Skip to content

Commit

Permalink
UI Tracking with serverless functions (#2136)
Browse files Browse the repository at this point in the history
* tmp

* Refactored

* Refactoring & added button to context menu

* Updated changelog, updated versions

* Improved styles

* Removed outdated code

* Updated icon
  • Loading branch information
bsekachev authored Sep 8, 2020
1 parent a5b63a4 commit 4e21929
Show file tree
Hide file tree
Showing 19 changed files with 431 additions and 61 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ability to work with data on the fly (https://github.com/opencv/cvat/pull/2007)
- Annotation in process outline color wheel (<https://github.com/opencv/cvat/pull/2084>)
- On the fly annotation using DL detectors (<https://github.com/opencv/cvat/pull/2102>)
- Automatic tracking of bounding boxes using serverless functions (<https://github.com/opencv/cvat/pull/2136>)
- [Datumaro] CLI command for dataset equality comparison (<https://github.com/opencv/cvat/pull/1989>)
- [Datumaro] Merging of datasets with different labels (<https://github.com/opencv/cvat/pull/2098>)

Expand Down
4 changes: 0 additions & 4 deletions cvat-canvas/src/typescript/interactionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ export class InteractionHandlerImpl implements InteractionHandler {
this.shapesWereUpdated = true;

this.canvas.off('mousedown.interaction', eventListener);
if (this.shouldRaiseEvent(false)) {
this.onInteraction(this.prepareResult(), true, false);
}

this.interact({ enabled: false });
}).addClass('cvat_canvas_shape_drawing').attr({
'stroke-width': consts.BASE_STROKE_WIDTH / this.geometry.scale,
Expand Down
2 changes: 1 addition & 1 deletion 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": "3.6.0",
"version": "3.6.1",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/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-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.9.2",
"version": "1.9.3",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
33 changes: 27 additions & 6 deletions cvat-ui/src/actions/annotation-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import getCore from 'cvat-core-wrapper';
import logger, { LogType } from 'cvat-logger';
import { RectDrawingMethod } from 'cvat-canvas-wrapper';
import { getCVATStore } from 'cvat-store';
import { MutableRefObject } from 'react';

interface AnnotationsParameters {
filters: string[];
Expand Down Expand Up @@ -189,6 +190,7 @@ export enum AnnotationActionTypes {
SAVE_LOGS_SUCCESS = 'SAVE_LOGS_SUCCESS',
SAVE_LOGS_FAILED = 'SAVE_LOGS_FAILED',
INTERACT_WITH_CANVAS = 'INTERACT_WITH_CANVAS',
SET_AI_TOOLS_REF = 'SET_AI_TOOLS_REF',
}

export function saveLogsAsync(): ThunkAction {
Expand Down Expand Up @@ -1397,6 +1399,16 @@ export function interactWithCanvas(activeInteractor: Model, activeLabelID: numbe
};
}

export function setAIToolsRef(ref: MutableRefObject<any>): AnyAction {
return {
type: AnnotationActionTypes.SET_AI_TOOLS_REF,
payload: {
aiToolsRef: ref,
},
};
}


export function repeatDrawShapeAsync(): ThunkAction {
return async (dispatch: ActionCreator<Dispatch>): Promise<void> => {
const {
Expand Down Expand Up @@ -1424,12 +1436,21 @@ export function repeatDrawShapeAsync(): ThunkAction {

let activeControl = ActiveControl.CURSOR;
if (activeInteractor) {
canvasInstance.interact({
enabled: true,
shapeType: 'points',
minPosVertices: 4, // TODO: Add parameter to interactor
});
dispatch(interactWithCanvas(activeInteractor, activeLabelID));
if (activeInteractor.type === 'tracker') {
canvasInstance.interact({
enabled: true,
shapeType: 'rectangle',
});
dispatch(interactWithCanvas(activeInteractor, activeLabelID));
} else {
canvasInstance.interact({
enabled: true,
shapeType: 'points',
minPosVertices: 4, // TODO: Add parameter to interactor
});
dispatch(interactWithCanvas(activeInteractor, activeLabelID));
}

return;
}

Expand Down
5 changes: 1 addition & 4 deletions cvat-ui/src/actions/plugins-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,16 @@ export function checkPluginsAsync(): ThunkAction {
const plugins: PluginObjects = {
ANALYTICS: false,
GIT_INTEGRATION: false,
DEXTR_SEGMENTATION: false,
};

const promises: Promise<boolean>[] = [
// check must return true/false with no exceptions
PluginChecker.check(SupportedPlugins.ANALYTICS),
PluginChecker.check(SupportedPlugins.GIT_INTEGRATION),
PluginChecker.check(SupportedPlugins.DEXTR_SEGMENTATION),
];

const values = await Promise.all(promises);
[plugins.ANALYTICS, plugins.GIT_INTEGRATION,
plugins.DEXTR_SEGMENTATION] = values;
[plugins.ANALYTICS, plugins.GIT_INTEGRATION] = values;
dispatch(pluginActions.checkedAllPlugins(plugins));
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function ControlsSideBarComponent(props: Props): JSX.Element {
preventDefault(event);
const drawing = [ActiveControl.DRAW_POINTS, ActiveControl.DRAW_POLYGON,
ActiveControl.DRAW_POLYLINE, ActiveControl.DRAW_RECTANGLE,
ActiveControl.DRAW_CUBOID, ActiveControl.INTERACTION].includes(activeControl);
ActiveControl.DRAW_CUBOID, ActiveControl.AI_TOOLS].includes(activeControl);

if (!drawing) {
canvasInstance.cancel();
Expand All @@ -98,7 +98,7 @@ export default function ControlsSideBarComponent(props: Props): JSX.Element {
repeatDrawShape();
}
} else {
if (activeControl === ActiveControl.INTERACTION) {
if (activeControl === ActiveControl.AI_TOOLS) {
// separated API method
canvasInstance.interact({ enabled: false });
return;
Expand Down
Loading

0 comments on commit 4e21929

Please sign in to comment.