diff --git a/CHANGELOG.md b/CHANGELOG.md index 272b3c3f8ea..999ab1d976a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,13 +44,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Task/Job buttons has no "Open in new tab" option () - Delete point context menu option has no shortcut hint () - Fixed issue with unnecessary tag activation in cvat-canvas () -- Fixed an issue with large number of instances in instance mask (https://github.com/opencv/cvat/issues/1539) -- Fixed full COCO dataset import error with conflicting labels in keypoints and detection (https://github.com/opencv/cvat/pull/1548) -- Fixed COCO keypoints skeleton parsing and saving (https://github.com/opencv/cvat/issues/1539) -- Fixed an error when exporting a task with cuboids to any format except CVAT (https://github.com/opencv/cvat/pull/1577) -- `tf.placeholder() is not compatible with eager execution` exception for auto_segmentation (https://github.com/opencv/cvat/pull/1562) -- Synchronization with remote git repo (https://github.com/opencv/cvat/pull/1582) -- A problem with mask to polygons conversion when polygons are too small (https://github.com/opencv/cvat/pull/1581) +- Fixed an issue with large number of instances in instance mask () +- Fixed full COCO dataset import error with conflicting labels in keypoints and detection () +- Fixed COCO keypoints skeleton parsing and saving () +- `tf.placeholder() is not compatible with eager execution` exception for auto_segmentation () +- Canvas cannot be moved with move functionality on left mouse key () +- Deep extreme cut request is sent when draw any shape with Make AI polygon option enabled () +- Fixed an error when exporting a task with cuboids to any format except CVAT () +- Synchronization with remote git repo () +- A problem with mask to polygons conversion when polygons are too small () ### Security - diff --git a/cvat-canvas/package-lock.json b/cvat-canvas/package-lock.json index b05d8126033..50645fbd1a3 100644 --- a/cvat-canvas/package-lock.json +++ b/cvat-canvas/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-canvas/package.json b/cvat-canvas/package.json index 7fafda292a8..73a7c98a391 100644 --- a/cvat-canvas/package.json +++ b/cvat-canvas/package.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "1.1.0", + "version": "1.1.1", "description": "Part of Computer Vision Annotation Tool which presents its canvas library", "main": "src/canvas.ts", "scripts": { diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index 71f6b05d900..002b4f093cf 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -451,7 +451,7 @@ export class CanvasViewImpl implements CanvasView, Listener { self.onEditDone( state, points, - ) + ); e.preventDefault(); return; } @@ -687,7 +687,7 @@ export class CanvasViewImpl implements CanvasView, Listener { this.content.addEventListener('mousedown', (event): void => { if ([0, 1].includes(event.button)) { - if ([Mode.IDLE, Mode.DRAG, Mode.MERGE, Mode.SPLIT].includes(this.mode) + if ([Mode.IDLE, Mode.DRAG_CANVAS, Mode.MERGE, Mode.SPLIT].includes(this.mode) || event.button === 1 || event.altKey ) { self.controller.enableDrag(event.clientX, event.clientY); diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx index ac012adef72..1c61ed9fdd0 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx @@ -51,7 +51,8 @@ function DrawShapePopoverComponent(props: Props): JSX.Element { onChangeCuboidDrawingMethod, } = props; - const trackDisabled = shapeType === ShapeType.POLYGON || shapeType === ShapeType.POLYLINE + const trackDisabled = shapeType === ShapeType.POLYGON + || shapeType === ShapeType.POLYLINE || (shapeType === ShapeType.POINTS && numberOfPoints !== 1); return ( @@ -85,9 +86,7 @@ function DrawShapePopoverComponent(props: Props): JSX.Element { - { - shapeType === ShapeType.POLYGON && - } + { shapeType === ShapeType.POLYGON && } { shapeType === ShapeType.RECTANGLE && ( <> @@ -183,19 +182,14 @@ function DrawShapePopoverComponent(props: Props): JSX.Element { - - diff --git a/cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx b/cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx index ba10cf17359..1d9a09340cd 100644 --- a/cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx +++ b/cvat-ui/src/containers/annotation-page/standard-workspace/controls-side-bar/draw-shape-popover.tsx @@ -107,11 +107,7 @@ class DrawShapePopoverContainer extends React.PureComponent { } private onDraw(objectType: ObjectType): void { - const { - canvasInstance, - shapeType, - onDrawStart, - } = this.props; + const { canvasInstance, shapeType, onDrawStart } = this.props; const { rectDrawingMethod, @@ -143,8 +139,8 @@ class DrawShapePopoverContainer extends React.PureComponent { private onChangeCuboidDrawingMethod = (event: RadioChangeEvent): void => { this.setState({ cuboidDrawingMethod: event.target.value, - }) - } + }); + }; private onDrawShape = (): void => { this.onDraw(ObjectType.SHAPE); diff --git a/cvat-ui/src/cvat-store.ts b/cvat-ui/src/cvat-store.ts index 1c528c4ec92..ee48f363401 100644 --- a/cvat-ui/src/cvat-store.ts +++ b/cvat-ui/src/cvat-store.ts @@ -10,7 +10,7 @@ import { Reducer, } from 'redux'; import { createLogger } from 'redux-logger'; -import {isDev} from 'utils/enviroment'; +import { isDev } from 'utils/enviroment'; const logger = createLogger({ diff --git a/cvat-ui/src/utils/dextr-utils.ts b/cvat-ui/src/utils/dextr-utils.ts index a884d586549..03280cface5 100644 --- a/cvat-ui/src/utils/dextr-utils.ts +++ b/cvat-ui/src/utils/dextr-utils.ts @@ -4,7 +4,8 @@ import getCore from 'cvat-core-wrapper'; import { Canvas } from 'cvat-canvas-wrapper'; -import { ShapeType, RQStatus } from 'reducers/interfaces'; +import { ShapeType, RQStatus, CombinedState } from 'reducers/interfaces'; +import { getCVATStore } from 'cvat-store'; const core = getCore(); const baseURL = core.config.backendAPI.slice(0, -7); @@ -145,6 +146,60 @@ function serverRequest( }); } +async function enter(this: any, self: DEXTRPlugin, objects: any[]): Promise { + try { + if (self.data.enabled && objects.length === 1) { + const state = (getCVATStore().getState() as CombinedState); + const isPolygon = state.annotation + .drawing.activeShapeType === ShapeType.POLYGON; + if (!isPolygon) return; + + document.body.append(antModalRoot); + const promises: Record> = {}; + for (let i = 0; i < objects.length; i++) { + if (objects[i].points.length >= 8) { + promises[i] = serverRequest( + self, + this.id, + objects[i].frame, + objects[i].points, + ); + } else { + promises[i] = new Promise((resolve) => { + resolve(objects[i].points); + }); + } + } + + const transformed = await Promise + .all(Object.values(promises)); + for (let i = 0; i < objects.length; i++) { + // eslint-disable-next-line no-param-reassign + objects[i] = new core.classes.ObjectState({ + frame: objects[i].frame, + objectType: objects[i].objectType, + label: objects[i].label, + shapeType: ShapeType.POLYGON, + points: transformed[i], + occluded: objects[i].occluded, + zOrder: objects[i].zOrder, + }); + } + } + + return; + } catch (error) { + throw new core.exceptions.PluginError(error.toString()); + } finally { + // eslint-disable-next-line no-param-reassign + self.data.canceled = false; + antModalButton.disabled = true; + if (antModalRoot.parentElement === document.body) { + document.body.removeChild(antModalRoot); + } + } +} + const plugin: DEXTRPlugin = { name: 'Deep extreme cut', description: 'Plugin allows to get a polygon from extreme points using AI', @@ -154,54 +209,7 @@ const plugin: DEXTRPlugin = { prototype: { annotations: { put: { - async enter(self: DEXTRPlugin, objects: any[]): Promise { - try { - if (self.data.enabled) { - document.body.append(antModalRoot); - const promises: Record> = {}; - for (let i = 0; i < objects.length; i++) { - if (objects[i].points.length >= 8) { - promises[i] = serverRequest( - self, - (this as any).id, - objects[i].frame, - objects[i].points, - ); - } else { - promises[i] = new Promise((resolve) => { - resolve(objects[i].points); - }); - } - } - - const transformed = await Promise - .all(Object.values(promises)); - for (let i = 0; i < objects.length; i++) { - // eslint-disable-next-line no-param-reassign - objects[i] = new core.classes.ObjectState({ - frame: objects[i].frame, - objectType: objects[i].objectType, - label: objects[i].label, - shapeType: ShapeType.POLYGON, - points: transformed[i], - occluded: objects[i].occluded, - zOrder: objects[i].zOrder, - }); - } - } - - return; - } catch (error) { - throw new core.exceptions.PluginError(error.toString()); - } finally { - // eslint-disable-next-line no-param-reassign - self.data.canceled = false; - antModalButton.disabled = true; - if (antModalRoot.parentElement === document.body) { - document.body.removeChild(antModalRoot); - } - } - }, + enter, }, }, },