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

Deleted frames #4194

Closed
wants to merge 88 commits into from
Closed
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
3e43e97
Init server implementation
ActiveChooN Dec 16, 2021
69eb17a
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Dec 27, 2021
d81a51e
Deleted frames UI implementation
ActiveChooN Jan 18, 2022
e68e549
Merge develop
ActiveChooN Jan 18, 2022
90bf274
Added icon fixed issues
ActiveChooN Jan 31, 2022
b5a15ad
Fixed headers
ActiveChooN Jan 31, 2022
e069b9a
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Jan 31, 2022
1de4271
Fixed linter issues
ActiveChooN Jan 31, 2022
f562aa2
Added CHANGELOG, updated versions
ActiveChooN Jan 31, 2022
5461d1c
Fixed tests
ActiveChooN Jan 31, 2022
28e25a0
Adjusted test assets
ActiveChooN Jan 31, 2022
4f9bf51
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Jan 31, 2022
93f374e
Adjusted package versions
ActiveChooN Jan 31, 2022
d918ef8
Fixed assets
ActiveChooN Feb 1, 2022
68a1cd2
Added tests
ActiveChooN Feb 2, 2022
3439c24
Addedd iam rules
ActiveChooN Feb 2, 2022
8d525a2
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 2, 2022
863b39b
Fixed tests assets
ActiveChooN Feb 3, 2022
f274c0b
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 3, 2022
8290398
Fixed migrations
ActiveChooN Feb 3, 2022
6fc3dc0
Fixed package-lock for cvat-ui
ActiveChooN Feb 3, 2022
354c32a
Rewrite PR with only job data usage
ActiveChooN Feb 4, 2022
707babd
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 4, 2022
8dfd46a
Adjusted tests assests
ActiveChooN Feb 4, 2022
b14c18e
Updated iam tests
ActiveChooN Feb 7, 2022
982cde6
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 7, 2022
29515e9
Fixed styles
ActiveChooN Feb 7, 2022
baa4d72
Fixed getting frame meta
ActiveChooN Feb 8, 2022
43b7ffa
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 8, 2022
db9f5e6
Fixed API in tests
ActiveChooN Feb 8, 2022
8d4cbef
Fixed frame meta filtering
ActiveChooN Feb 8, 2022
806912c
Fixed getting frame meta
ActiveChooN Feb 8, 2022
26dc701
Fixed getting context image
ActiveChooN Feb 8, 2022
a39f28e
Fixed backups
ActiveChooN Feb 9, 2022
0eec5d8
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 9, 2022
f1d3504
Added cypress tests
ActiveChooN Feb 11, 2022
9bafb3d
Fixed comments
ActiveChooN Feb 14, 2022
ac0787a
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 14, 2022
89bb864
Fixed tests
ActiveChooN Feb 15, 2022
1293148
Simplified tests
ActiveChooN Feb 15, 2022
34f58a1
Update CHANGELOG.md
ActiveChooN Feb 15, 2022
a369965
Fixed comments
ActiveChooN Feb 16, 2022
c104535
Merge branch 'dk/deleted-frames' of https://github.com/openvinotoolki…
ActiveChooN Feb 16, 2022
c23634d
Renamed search
ActiveChooN Feb 16, 2022
c073708
Fixed types annotation
ActiveChooN Feb 17, 2022
707c465
Added propper shapes filtration
ActiveChooN Feb 17, 2022
f8ae123
Fixed export and navigation
ActiveChooN Feb 22, 2022
30f228b
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 22, 2022
0201565
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Feb 24, 2022
1f23dea
Fixed navigation
ActiveChooN Mar 4, 2022
700d462
Moved to locked deleted frames
ActiveChooN Mar 9, 2022
e687a9f
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Mar 10, 2022
801d9ca
Fixed migration
ActiveChooN Mar 10, 2022
e8a6633
Fixed db dump
ActiveChooN Mar 10, 2022
366a33e
Fixed import
ActiveChooN Mar 10, 2022
18ac993
Added documentation
ActiveChooN Mar 10, 2022
65f77af
Fixed remark issues
ActiveChooN Mar 10, 2022
d27454b
Fixed remark issues
ActiveChooN Mar 10, 2022
df40abb
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Mar 12, 2022
e84cea5
Fixed remark issues
ActiveChooN Mar 12, 2022
5655bb2
Merge remote-tracking branch 'origin/develop' into dk/deleted-frames
Mar 14, 2022
452201f
Fixed docker-compose file
ActiveChooN Mar 14, 2022
918f683
Fixed docker-compose.dev
ActiveChooN Mar 14, 2022
05c5a26
Merge branch 'develop' into dk/deleted-frames
Mar 14, 2022
d8e6b31
Merge remote-tracking branch 'origin/develop' into dk/deleted-frames
Mar 16, 2022
655b2bc
Fix a problem with tests
Mar 16, 2022
49844b1
Regenerated cvat_db/data.json
Mar 16, 2022
39ee972
Fix tests for REST API
Mar 16, 2022
1bbe6c7
Fixed comments
ActiveChooN Mar 17, 2022
fa10f73
Fixed docs
ActiveChooN Mar 17, 2022
1f668c7
Deleted unused files
ActiveChooN Mar 17, 2022
9faf557
Fixed rego file
ActiveChooN Mar 17, 2022
0786100
FIxed models
ActiveChooN Mar 18, 2022
c797a2b
Fixed view names
ActiveChooN Mar 18, 2022
2193450
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Mar 18, 2022
3c7b9a8
Changed view name
ActiveChooN Mar 18, 2022
a941024
Merge branch 'develop' into dk/deleted-frames
Mar 21, 2022
4773973
Fixed permissions check for metadata requests
ActiveChooN Mar 21, 2022
d013e8f
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Mar 23, 2022
2c5da81
Moved to icon instead of pattern
ActiveChooN Mar 23, 2022
5540727
Fixed overflow
ActiveChooN Mar 24, 2022
3acbb7c
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Mar 24, 2022
b668760
Fixed frames order
ActiveChooN Mar 29, 2022
0bb20e6
Made saving annotation optional
ActiveChooN Mar 30, 2022
a04367f
Added workaround for detectors
ActiveChooN Apr 5, 2022
0790359
Fixed icon
ActiveChooN Apr 5, 2022
1eceb05
Merge branch 'develop' into dk/deleted-frames
ActiveChooN Jul 21, 2022
03e3c02
Changes from cvat-ai fork
ActiveChooN Jul 22, 2022
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Basic page with jobs list, basic filtration to this list (<https://github.com/openvinotoolkit/cvat/pull/4258>)
- Added OpenCV.js TrackerMIL as tracking tool (<https://github.com/openvinotoolkit/cvat/pull/4200>)
- Ability to continue working from the latest frame where an annotator was before (<https://github.com/openvinotoolkit/cvat/pull/4297>)

- Added ability to delete frames from a job (<https://github.com/openvinotoolkit/cvat/pull/4194>)

### Changed
- Users don't have access to a task object anymore if they are assigneed only on some jobs of the task (<https://github.com/openvinotoolkit/cvat/pull/3788>)
Expand Down
15 changes: 13 additions & 2 deletions cvat-canvas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,19 @@ Canvas itself handles:
}

interface Configuration {
displayAllText?: boolean;
undefinedAttrValue?: string;
smoothImage?: boolean;
autoborders?: boolean;
displayAllText?: boolean;
textFontSize?: number;
textPosition?: 'auto' | 'center';
textContent?: string;
undefinedAttrValue?: string;
showProjections?: boolean;
forceDisableEditing?: boolean;
intelligentPolygonCrop?: boolean;
forceFrameUpdate?: boolean;
creationOpacity?: number;
canvasFilters?: string;
}

interface DrawData {
Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.13.1",
"version": "2.14.0",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts",
"scripts": {
Expand Down
26 changes: 19 additions & 7 deletions cvat-canvas/src/scss/canvas.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -248,7 +248,7 @@ polyline.cvat_canvas_shape_splitting {
}

#cvat_canvas_loading_animation {
z-index: 1;
z-index: 2;
position: absolute;
width: 100%;
height: 100%;
Expand All @@ -265,7 +265,7 @@ polyline.cvat_canvas_shape_splitting {
#cvat_canvas_text_content {
text-rendering: optimizeSpeed;
position: absolute;
z-index: 3;
z-index: 4;
pointer-events: none;
width: 100%;
height: 100%;
Expand All @@ -285,7 +285,7 @@ polyline.cvat_canvas_shape_splitting {

pointer-events: none;
position: absolute;
z-index: 4;
z-index: 5;
background: black;
width: 100%;
height: 100%;
Expand All @@ -294,7 +294,7 @@ polyline.cvat_canvas_shape_splitting {

#cvat_canvas_grid {
position: absolute;
z-index: 2;
z-index: 3;
pointer-events: none;
width: 100%;
height: 100%;
Expand All @@ -305,18 +305,30 @@ polyline.cvat_canvas_shape_splitting {
stroke: white;
}

#cvat_canvas_deleted_frame_overlay {
position: absolute;
z-index: 2;
pointer-events: none;
width: 100%;
height: 100%;
}

#cvat_canvas_deleted_frame_overlay_pattern {
stroke: gray;
}

#cvat_canvas_content {
filter: contrast(120%) saturate(150%);
position: absolute;
z-index: 2;
z-index: 3;
outline: 10px solid black;
width: 100%;
height: 100%;
}

#cvat_canvas_attachment_board {
position: absolute;
z-index: 4;
z-index: 5;
pointer-events: none;
width: 100%;
height: 100%;
Expand Down
18 changes: 17 additions & 1 deletion cvat-canvas/src/typescript/canvasModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export interface Configuration {
intelligentPolygonCrop?: boolean;
forceFrameUpdate?: boolean;
creationOpacity?: number;
canvasFilters?: string;
}

export interface DrawData {
Expand Down Expand Up @@ -171,6 +172,7 @@ export enum Mode {

export interface CanvasModel {
readonly imageBitmap: boolean;
readonly imageDeleted: boolean;
readonly image: Image | null;
readonly issueRegions: Record<number, { hidden: boolean; points: number[] }>;
readonly objects: any[];
Expand Down Expand Up @@ -230,6 +232,7 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
imageID: number | null;
imageOffset: number;
imageSize: Size;
imageDeleted: boolean;
focusData: FocusData;
gridSize: Size;
left: number;
Expand Down Expand Up @@ -277,6 +280,7 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
height: 0,
width: 0,
},
imageDeleted: false,
focusData: {
clientID: 0,
padding: 0,
Expand Down Expand Up @@ -406,14 +410,18 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
throw Error(`Canvas is busy. Action: ${this.data.mode}`);
}
}
if (frameData.number === this.data.imageID && !this.data.configuration.forceFrameUpdate) {
if (frameData.number === this.data.imageID &&
this.data.imageDeleted === frameData.deleted &&
!this.data.configuration.forceFrameUpdate
) {
this.data.zLayer = zLayer;
this.data.objects = objectStates;
this.notify(UpdateReasons.OBJECTS_UPDATED);
return;
}

this.data.imageID = frameData.number;
this.data.imageDeleted = frameData.deleted;
frameData
.data((): void => {
this.data.image = null;
Expand Down Expand Up @@ -695,6 +703,10 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
this.data.configuration.creationOpacity = configuration.creationOpacity;
}

if (typeof configuration.canvasFilters === 'string') {
this.data.configuration.canvasFilters = configuration.canvasFilters;
}

this.notify(UpdateReasons.CONFIG_UPDATED);
}

Expand Down Expand Up @@ -753,6 +765,10 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
return this.data.imageBitmap;
}

public get imageDeleted(): boolean {
return this.data.imageDeleted;
}

public get image(): Image | null {
return this.data.image;
}
Expand Down
60 changes: 57 additions & 3 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export class CanvasViewImpl implements CanvasView, Listener {
private canvas: HTMLDivElement;
private gridPath: SVGPathElement;
private gridPattern: SVGPatternElement;
private deletedImageOverlay: SVGSVGElement;
private deletedImageOverlayPath: SVGPathElement;
private deletedImageOverlayPattern: SVGPatternElement;
private controller: CanvasController;
private svgShapes: Record<number, SVG.Shape>;
private svgTexts: Record<number, SVG.Text>;
Expand All @@ -93,6 +96,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
private innerObjectsFlags: {
drawHidden: Record<number, boolean>;
};
private canvasFilters: string;

private set mode(value: Mode) {
this.controller.mode = value;
Expand Down Expand Up @@ -494,7 +498,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
}

private moveCanvas(): void {
for (const obj of [this.background, this.grid, this.bitmap]) {
for (const obj of [this.background, this.grid, this.deletedImageOverlay, this.bitmap]) {
obj.style.top = `${this.geometry.top}px`;
obj.style.left = `${this.geometry.left}px`;
}
Expand All @@ -515,7 +519,9 @@ export class CanvasViewImpl implements CanvasView, Listener {

private transformCanvas(): void {
// Transform canvas
for (const obj of [this.background, this.grid, this.content, this.bitmap, this.attachmentBoard]) {
for (const obj of [
this.background, this.grid, this.deletedImageOverlay, this.content, this.bitmap, this.attachmentBoard,
]) {
obj.style.transform = `scale(${this.geometry.scale}) rotate(${this.geometry.angle}deg)`;
}

Expand Down Expand Up @@ -595,7 +601,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
}

private resizeCanvas(): void {
for (const obj of [this.background, this.grid, this.bitmap]) {
for (const obj of [this.background, this.grid, this.deletedImageOverlay, this.bitmap]) {
obj.style.width = `${this.geometry.image.width}px`;
obj.style.height = `${this.geometry.image.height}px`;
}
Expand Down Expand Up @@ -979,6 +985,10 @@ export class CanvasViewImpl implements CanvasView, Listener {
this.gridPath = window.document.createElementNS('http://www.w3.org/2000/svg', 'path');
this.gridPattern = window.document.createElementNS('http://www.w3.org/2000/svg', 'pattern');

this.deletedImageOverlay = window.document.createElementNS('http://www.w3.org/2000/svg', 'svg');
this.deletedImageOverlayPath = window.document.createElementNS('http://www.w3.org/2000/svg', 'path');
this.deletedImageOverlayPattern = window.document.createElementNS('http://www.w3.org/2000/svg', 'pattern');

this.content = window.document.createElementNS('http://www.w3.org/2000/svg', 'svg');
this.adoptedContent = SVG.adopt((this.content as any) as HTMLElement) as SVG.Container;

Expand All @@ -987,11 +997,15 @@ 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');
const deletedImageOverlayDefs: SVGDefsElement = window.document.createElementNS('http://www.w3.org/2000/svg', 'defs');
const deletedImageOverlayRect: SVGRectElement = window.document.createElementNS('http://www.w3.org/2000/svg', 'rect');

// Setup defs
const contentDefs = this.adoptedContent.defs();

this.issueRegionPattern_1 = contentDefs
.pattern(consts.BASE_PATTERN_SIZE, consts.BASE_PATTERN_SIZE, (add): void => {
add.line(0, 0, 0, 10).stroke('red');
Expand Down Expand Up @@ -1034,6 +1048,22 @@ export class CanvasViewImpl implements CanvasView, Listener {
gridRect.setAttribute('height', '100%');
gridRect.setAttribute('fill', 'url(#cvat_canvas_grid_pattern)');

// Setup deleted frame overlay
this.deletedImageOverlay.setAttribute('id', 'cvat_canvas_deleted_frame_overlay');
this.deletedImageOverlay.setAttribute('version', '2');
this.deletedImageOverlayPath.setAttribute('d', 'M 1000 0 L 0 0 1000 0');
this.deletedImageOverlayPath.setAttribute('fill', 'none');
this.deletedImageOverlayPath.setAttribute('stroke-width', `${consts.BASE_DELETED_PATTERN_WIDTH}`);
this.deletedImageOverlayPath.setAttribute('opacity', '0.6');
this.deletedImageOverlayPattern.setAttribute('id', 'cvat_canvas_deleted_frame_overlay_pattern');
this.deletedImageOverlayPattern.setAttribute('width', '100');
this.deletedImageOverlayPattern.setAttribute('height', '100');
this.deletedImageOverlayPattern.setAttribute('patternUnits', 'userSpaceOnUse');
this.deletedImageOverlayPattern.setAttribute('patternTransform', 'rotate(45)');
deletedImageOverlayRect.setAttribute('width', '100%');
deletedImageOverlayRect.setAttribute('height', '100%');
deletedImageOverlayRect.setAttribute('fill', 'url(#cvat_canvas_deleted_frame_overlay_pattern)');

// Setup content
this.text.setAttribute('id', 'cvat_canvas_text_content');
this.background.setAttribute('id', 'cvat_canvas_background');
Expand All @@ -1055,10 +1085,17 @@ export class CanvasViewImpl implements CanvasView, Listener {
gridDefs.appendChild(this.gridPattern);
this.gridPattern.appendChild(this.gridPath);

this.deletedImageOverlay.appendChild(deletedImageOverlayDefs);
this.deletedImageOverlay.appendChild(deletedImageOverlayRect);

deletedImageOverlayDefs.appendChild(this.deletedImageOverlayPattern);
this.deletedImageOverlayPattern.appendChild(this.deletedImageOverlayPath);

this.canvas.appendChild(this.loadingAnimation);
this.canvas.appendChild(this.text);
this.canvas.appendChild(this.background);
this.canvas.appendChild(this.bitmap);
this.canvas.appendChild(this.deletedImageOverlay);
this.canvas.appendChild(this.grid);
this.canvas.appendChild(this.content);
this.canvas.appendChild(this.attachmentBoard);
Expand Down Expand Up @@ -1219,6 +1256,14 @@ export class CanvasViewImpl implements CanvasView, Listener {
}
}

if (typeof configuration.canvasFilters === 'string') {
this.canvasFilters = configuration.canvasFilters;

if (!model.imageDeleted) {
this.background.style.filter = this.canvasFilters;
}
}

this.activate(activeElement);
this.editHandler.configurate(this.configuration);
this.drawHandler.configurate(this.configuration);
Expand Down Expand Up @@ -1260,6 +1305,15 @@ export class CanvasViewImpl implements CanvasView, Listener {
ctx.drawImage(image.imageData, 0, 0);
}
}

if (model.imageDeleted) {
this.deletedImageOverlay.style.display = null;
this.background.style.filter = 'saturate(0)';
} else {
this.background.style.filter = this.canvasFilters;
this.deletedImageOverlay.style.display = 'none';
}

this.moveCanvas();
this.resizeCanvas();
this.transformCanvas();
Expand Down
4 changes: 3 additions & 1 deletion cvat-canvas/src/typescript/consts.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright (C) 2019-2021 Intel Corporation
// Copyright (C) 2019-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

const BASE_STROKE_WIDTH = 1.25;
const BASE_GRID_WIDTH = 2;
const BASE_DELETED_PATTERN_WIDTH = 50;
const BASE_POINT_SIZE = 5;
const TEXT_MARGIN = 10;
const AREA_THRESHOLD = 9;
Expand All @@ -25,6 +26,7 @@ const MINIMUM_TEXT_FONT_SIZE = 8;
export default {
BASE_STROKE_WIDTH,
BASE_GRID_WIDTH,
BASE_DELETED_PATTERN_WIDTH,
BASE_POINT_SIZE,
TEXT_MARGIN,
AREA_THRESHOLD,
Expand Down
4 changes: 2 additions & 2 deletions cvat-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "4.2.0",
"version": "4.3.0",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions cvat-core/src/cloud-storage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -54,7 +54,7 @@
Object.freeze({
/**
* @name id
* @type {integer}
* @type {number}
* @memberof module:API.cvat.classes.CloudStorage
* @readonly
* @instance
Expand Down
Loading