Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid view and multiple context images supported #5542

Merged
merged 57 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
618739a
Number of context images
bsekachev Dec 23, 2022
44ae262
Added grid view
bsekachev Jan 1, 2023
445534d
Updated yarn lock
bsekachev Jan 1, 2023
3b4c601
Some project restructurization
bsekachev Jan 2, 2023
14be381
Added context headers
bsekachev Jan 2, 2023
a1eccd7
Merge branch 'develop' into bs/multiple_context_images
nmanovic Jan 2, 2023
8e0b1a3
Updated license headers
bsekachev Jan 3, 2023
cfae70f
Merge branch 'bs/multiple_context_images' of github.com:opencv/cvat i…
bsekachev Jan 3, 2023
6a12162
Fixed stylelint issues
bsekachev Jan 3, 2023
270fe3d
Refactored cvat-data
bsekachev Jan 3, 2023
83f71fe
Fixed positioning issue
bsekachev Jan 3, 2023
64f202e
Fixed several test cases
bsekachev Jan 3, 2023
fde56e6
A couple more fixed tests
bsekachev Jan 3, 2023
0fd047e
Updated license headers, aborted extra changes
bsekachev Jan 3, 2023
4b3668c
Updated versions
bsekachev Jan 3, 2023
1d7d713
Updated changelog, fixed several tests
bsekachev Jan 3, 2023
1c4fdb4
Fixed eslint issue
bsekachev Jan 4, 2023
36b3fca
Fixed tests
bsekachev Jan 4, 2023
5ddfbe2
Merge branch 'develop' into bs/multiple_context_images
nmanovic Jan 4, 2023
a567d9b
Updated license headers
bsekachev Jan 4, 2023
6428ba3
Merge branch 'bs/multiple_context_images' of github.com:opencv/cvat i…
bsekachev Jan 4, 2023
248d4e3
Resizing raw height after resizing the browser window
bsekachev Jan 5, 2023
d6eb4e5
Fix one corner case
bsekachev Jan 5, 2023
fd10e12
Added header & button
bsekachev Jan 5, 2023
a848737
Tried to fix two tests
bsekachev Jan 5, 2023
3b0ac10
Reworked screenshot command
bsekachev Jan 5, 2023
1adb3ec
Removed extra commands
bsekachev Jan 5, 2023
e55bf56
Added context images names
bsekachev Jan 6, 2023
fc38ebb
Go to/from fullscreen
bsekachev Jan 6, 2023
0a523f9
Adjusted transition events
bsekachev Jan 6, 2023
5743c7e
Bugfixes and improvements
bsekachev Jan 6, 2023
d3c932c
Merge branch 'develop' into bs/multiple_context_images
nmanovic Jan 6, 2023
72a45b7
reset views, add/remove context images runtime
bsekachev Jan 10, 2023
207fe05
Merge branch 'bs/multiple_context_images' of github.com:opencv/cvat i…
bsekachev Jan 10, 2023
ff5f8ae
Fixed two issues
bsekachev Jan 10, 2023
8835df0
Tried to fix several tests
bsekachev Jan 10, 2023
7a620d7
Fixed wrong test 111
bsekachev Jan 10, 2023
7e641b9
Fixed hardcoded values in tests
bsekachev Jan 10, 2023
ab16089
Increased timeout
bsekachev Jan 10, 2023
4cc0f45
Fix one issue
bsekachev Jan 10, 2023
90890c6
.
bsekachev Jan 10, 2023
015c888
Totally reworked 3d test case_82
bsekachev Jan 10, 2023
999c626
Advanced fit function to support more context images
bsekachev Jan 10, 2023
f9d7ce3
Flickering fixed
bsekachev Jan 10, 2023
db2b620
Improved resize
bsekachev Jan 10, 2023
eabd20a
Tests
bsekachev Jan 10, 2023
403ca0d
Aborted test changes
bsekachev Jan 10, 2023
18d65c8
Adjusted text, moved close button
bsekachev Jan 11, 2023
d360627
Code improvements
bsekachev Jan 11, 2023
b6be3f8
Returned one test
bsekachev Jan 11, 2023
ee55e11
Use commonpath
bsekachev Jan 11, 2023
b2fe63b
Merge branch 'develop' into bs/multiple_context_images
bsekachev Jan 12, 2023
b31b31b
Resolved conflicts
bsekachev Jan 12, 2023
1e7aa72
Merge branch 'develop' into bs/multiple_context_images
bsekachev Jan 12, 2023
31ddd8f
Merge branch 'develop' into bs/multiple_context_images
nmanovic Jan 13, 2023
0ef5d1f
using MediaCache
bsekachev Jan 16, 2023
f44870e
Fixed zoom behaviour
bsekachev Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(<https://github.com/opencv/cvat/pull/5535>)
- \[SDK\] Class to represent a project as a PyTorch dataset
(<https://github.com/opencv/cvat/pull/5523>)
- Grid view and multiple context images supported (<https://github.com/opencv/cvat/pull/5542>)
- Support for custom file to job splits in tasks (server API & SDK only)
(<https://github.com/opencv/cvat/pull/5536>)
- \[SDK\] A PyTorch adapter setting to disable cache updates
Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-canvas",
"version": "2.16.1",
"version": "2.16.2",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts",
"scripts": {
Expand Down
17 changes: 1 addition & 16 deletions cvat-canvas/src/scss/canvas.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
// Copyright (C) 2022-2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -290,21 +290,6 @@ g.cvat_canvas_shape_occluded {
position: relative;
}

#cvat_canvas_loading_animation {
z-index: 1;
position: absolute;
width: 100%;
height: 100%;
}

#cvat_canvas_loading_circle {
fill-opacity: 0;
stroke: #09c;
stroke-width: 3px;
stroke-dasharray: 50;
animation: loadingAnimation 1s linear infinite;
}

#cvat_canvas_text_content {
text-rendering: optimizeSpeed;
position: absolute;
Expand Down
1 change: 0 additions & 1 deletion cvat-canvas/src/typescript/canvasModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
if (typeof exception !== 'number' || exception === this.data.imageID) {
this.notify(UpdateReasons.DATA_FAILED);
}
throw exception;
});
}

Expand Down
20 changes: 2 additions & 18 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2019-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
// Copyright (C) 2022-2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -66,7 +66,6 @@ export interface CanvasView {
}

export class CanvasViewImpl implements CanvasView, Listener {
private loadingAnimation: SVGSVGElement;
private text: SVGSVGElement;
private adoptedText: SVG.Container;
private background: HTMLCanvasElement;
Expand Down Expand Up @@ -1082,7 +1081,6 @@ export class CanvasViewImpl implements CanvasView, Listener {
};

// Create HTML elements
this.loadingAnimation = window.document.createElementNS('http://www.w3.org/2000/svg', 'svg');
this.text = window.document.createElementNS('http://www.w3.org/2000/svg', 'svg');
this.adoptedText = SVG.adopt((this.text as any) as HTMLElement) as SVG.Container;
this.background = window.document.createElement('canvas');
Expand All @@ -1101,8 +1099,6 @@ export class CanvasViewImpl implements CanvasView, Listener {

this.canvas = window.document.createElement('div');

const loadingCircle: SVGCircleElement = window.document.createElementNS('http://www.w3.org/2000/svg', 'circle');

const gridDefs: SVGDefsElement = window.document.createElementNS('http://www.w3.org/2000/svg', 'defs');
const gridRect: SVGRectElement = window.document.createElementNS('http://www.w3.org/2000/svg', 'rect');

Expand All @@ -1129,13 +1125,6 @@ export class CanvasViewImpl implements CanvasView, Listener {
patternUnits: 'userSpaceOnUse',
});

// Setup loading animation
this.loadingAnimation.setAttribute('id', 'cvat_canvas_loading_animation');
loadingCircle.setAttribute('id', 'cvat_canvas_loading_circle');
loadingCircle.setAttribute('r', '30');
loadingCircle.setAttribute('cx', '50%');
loadingCircle.setAttribute('cy', '50%');

// Setup grid
this.grid.setAttribute('id', 'cvat_canvas_grid');
this.grid.setAttribute('version', '2');
Expand Down Expand Up @@ -1166,14 +1155,12 @@ export class CanvasViewImpl implements CanvasView, Listener {
this.canvas.setAttribute('id', 'cvat_canvas_wrapper');

// Unite created HTML elements together
this.loadingAnimation.appendChild(loadingCircle);
this.grid.appendChild(gridDefs);
this.grid.appendChild(gridRect);

gridDefs.appendChild(this.gridPattern);
this.gridPattern.appendChild(this.gridPath);

this.canvas.appendChild(this.loadingAnimation);
this.canvas.appendChild(this.text);
this.canvas.appendChild(this.background);
this.canvas.appendChild(this.masksContent);
Expand Down Expand Up @@ -1412,10 +1399,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
}
} else if (reason === UpdateReasons.IMAGE_CHANGED) {
const { image } = model;
if (!image) {
this.loadingAnimation.classList.remove('cvat_canvas_hidden');
} else {
this.loadingAnimation.classList.add('cvat_canvas_hidden');
if (image) {
const ctx = this.background.getContext('2d');
this.background.setAttribute('width', `${image.renderWidth}px`);
this.background.setAttribute('height', `${image.renderHeight}px`);
Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas3d/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-canvas3d",
"version": "0.0.6",
"version": "0.0.7",
"description": "Part of Computer Vision Annotation Tool which presents its canvas3D library",
"main": "src/canvas3d.ts",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion cvat-canvas3d/src/typescript/canvas3dModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ export class Canvas3dModelImpl extends MasterImpl implements Canvas3dModel {
})
.catch((exception: any): void => {
this.data.isFrameUpdating = false;
throw exception;
// don't notify when the frame is no longer needed
if (typeof exception !== 'number' || exception === this.data.imageID) {
throw exception;
}
});
}

Expand Down
35 changes: 28 additions & 7 deletions cvat-canvas3d/src/typescript/canvas3dView.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
// Copyright (C) 2022-2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -107,6 +107,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
private cube: CuboidModel;
private isPerspectiveBeingDragged: boolean;
private activatedElementID: number | null;
private isCtrlDown: boolean;
private drawnObjects: Record<number, {
data: DrawnObjectData;
cuboid: CuboidModel;
Expand Down Expand Up @@ -184,6 +185,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
},
};

this.isCtrlDown = false;
this.action = {
scan: null,
frameCoordinates: {
Expand Down Expand Up @@ -263,6 +265,20 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
const canvasSideView = this.views.side.renderer.domElement;
const canvasFrontView = this.views.front.renderer.domElement;

[
[canvasPerspectiveView, this.views.perspective.scene],
[canvasTopView, this.views.top.scene],
[canvasSideView, this.views.side.scene],
[canvasFrontView, this.views.front.scene],
].forEach(([view, scene]) => {
Object.defineProperty(view, 'scene', {
value: scene,
enumerable: false,
configurable: false,
writable: false,
});
});

canvasPerspectiveView.addEventListener('contextmenu', (e: MouseEvent): void => {
if (this.model.data.activeElement.clientID !== null) {
this.dispatchEvent(
Expand Down Expand Up @@ -330,6 +346,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {

canvasPerspectiveView.addEventListener('mousemove', (event: MouseEvent): void => {
event.preventDefault();
this.isCtrlDown = event.ctrlKey;
if (this.mode === Mode.DRAG_CANVAS) return;
const canvas = this.views.perspective.renderer.domElement;
const rect = canvas.getBoundingClientRect();
Expand Down Expand Up @@ -539,7 +556,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
}

private setDefaultZoom(): void {
if (this.model.data.activeElement === null) {
if (this.model.data.activeElement.clientID === null) {
Object.keys(this.views).forEach((view: string): void => {
const viewType = this.views[view as keyof Views];
if (view !== ViewType.PERSPECTIVE) {
Expand All @@ -554,7 +571,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
canvasTop.offsetWidth / (bboxtop.max.x - bboxtop.min.x),
canvasTop.offsetHeight / (bboxtop.max.y - bboxtop.min.y),
) * 0.4;
this.views.top.camera.zoom = x1 / 100;
this.views.top.camera.zoom = x1 / 50;
this.views.top.camera.updateProjectionMatrix();
this.views.top.camera.updateMatrix();
this.updateHelperPointsSize(ViewType.TOP);
Expand All @@ -565,7 +582,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
canvasFront.offsetWidth / (bboxfront.max.y - bboxfront.min.y),
canvasFront.offsetHeight / (bboxfront.max.z - bboxfront.min.z),
) * 0.4;
this.views.front.camera.zoom = x2 / 100;
this.views.front.camera.zoom = x2 / 50;
this.views.front.camera.updateProjectionMatrix();
this.views.front.camera.updateMatrix();
this.updateHelperPointsSize(ViewType.FRONT);
Expand All @@ -576,7 +593,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
canvasSide.offsetWidth / (bboxside.max.x - bboxside.min.x),
canvasSide.offsetHeight / (bboxside.max.z - bboxside.min.z),
) * 0.4;
this.views.side.camera.zoom = x3 / 100;
this.views.side.camera.zoom = x3 / 50;
this.views.side.camera.updateProjectionMatrix();
this.views.side.camera.updateMatrix();
this.updateHelperPointsSize(ViewType.SIDE);
Expand Down Expand Up @@ -842,7 +859,8 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
this.activatedElementID = +clientID;
this.rotatePlane(null, null);
this.detachCamera(null);
this.setDefaultZoom();
[ViewType.TOP, ViewType.SIDE, ViewType.FRONT]
.forEach((type) => this.updateHelperPointsSize(type));
}
}

Expand Down Expand Up @@ -1030,6 +1048,9 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
} else if (reason === UpdateReasons.SHAPE_ACTIVATED) {
this.deactivateObject();
this.activateObject();
if (this.activatedElementID) {
this.setDefaultZoom();
}
} else if (reason === UpdateReasons.DRAW) {
const data: DrawData = this.controller.drawData;
if (Number.isInteger(data.redraw)) {
Expand Down Expand Up @@ -1385,7 +1406,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
const { x, y, z } = intersection.point;
object.position.set(x, y, z);
}
} else if (this.mode === Mode.IDLE && !this.isPerspectiveBeingDragged) {
} else if (this.mode === Mode.IDLE && !this.isPerspectiveBeingDragged && !this.isCtrlDown) {
const { renderer } = this.views.perspective.rayCaster;
const intersects = renderer.intersectObjects(this.getAllVisibleCuboids(), false);
if (intersects.length !== 0) {
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-core",
"version": "7.5.0",
"version": "8.0.0",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "src/api.ts",
"scripts": {
Expand Down
Loading