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

Running SAM backbone on frontend #6019

Merged
merged 23 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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 @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- TDB

### Changed
- TDB
- Running SAM masks decoder on frontend (<https://github.com/opencv/cvat/pull/6019>)

### Deprecated
- TDB
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.4",
"version": "2.16.5",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions cvat-canvas/src/typescript/interactionHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -146,13 +147,13 @@ export class InteractionHandlerImpl implements InteractionHandler {
_e.stopPropagation();
self.remove();
this.shapesWereUpdated = true;
const shouldRaiseEvent = this.shouldRaiseEvent(_e.ctrlKey);
this.interactionShapes = this.interactionShapes.filter(
(shape: SVG.Shape): boolean => shape !== self,
);
if (this.interactionData.startWithBox && this.interactionShapes.length === 1) {
this.interactionShapes[0].style({ visibility: '' });
}
const shouldRaiseEvent = this.shouldRaiseEvent(_e.ctrlKey);
if (shouldRaiseEvent) {
this.onInteraction(this.prepareResult(), true, false);
}
Expand Down Expand Up @@ -314,7 +315,7 @@ export class InteractionHandlerImpl implements InteractionHandler {
'pointer-events': 'none',
opacity: 0.5,
}).addClass('cvat_canvas_interact_intermediate_shape');
image.move(this.geometry.offset, this.geometry.offset);
image.move(this.geometry.offset + left, this.geometry.offset + top);
this.drawnIntermediateShape = image;

imageDataToDataURL(
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": "9.0.1",
"version": "9.1.0",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "src/api.ts",
"scripts": {
Expand Down
22 changes: 19 additions & 3 deletions cvat-core/src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
// Copyright (C) 2019-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

import { PluginError } from './exceptions';

const plugins = [];

export interface APIWrapperEnterOptions {
preventMethodCall?: boolean;
}

export default class PluginRegistry {
static async apiWrapper(wrappedFunc, ...args) {
// I have to optimize the wrapper
const pluginList = await PluginRegistry.list();
const aggregatedOptions: APIWrapperEnterOptions = {
preventMethodCall: false,
};

for (const plugin of pluginList) {
const pluginDecorators = plugin.functions.filter((obj) => obj.callback === wrappedFunc)[0];
if (pluginDecorators && pluginDecorators.enter) {
try {
await pluginDecorators.enter.call(this, plugin, ...args);
const options: APIWrapperEnterOptions | undefined = await pluginDecorators
.enter.call(this, plugin, ...args);
if (options?.preventMethodCall) {
aggregatedOptions.preventMethodCall = true;
}
} catch (exception) {
if (exception instanceof PluginError) {
throw exception;
Expand All @@ -24,7 +37,10 @@ export default class PluginRegistry {
}
}

let result = await wrappedFunc.implementation.call(this, ...args);
let result = null;
if (!aggregatedOptions.preventMethodCall) {
result = await wrappedFunc.implementation.call(this, ...args);
}

for (const plugin of pluginList) {
const pluginDecorators = plugin.functions.filter((obj) => obj.callback === wrappedFunc)[0];
Expand Down
5 changes: 4 additions & 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.50.9",
"version": "1.51.0",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand All @@ -22,6 +22,7 @@
"dependencies": {
"@ant-design/icons": "^4.6.3",
"@types/lodash": "^4.14.172",
"@types/lru-cache": "^7.10.10",
"@types/platform": "^1.3.4",
"@types/react": "^16.14.15",
"@types/react-color": "^3.0.5",
Expand All @@ -41,8 +42,10 @@
"dotenv-webpack": "^8.0.1",
"error-stack-parser": "^2.0.6",
"lodash": "^4.17.21",
"lru-cache": "^9.1.1",
"moment": "^2.29.2",
"mousetrap": "^1.6.5",
"onnxruntime-web": "^1.14.0",
"platform": "^1.3.6",
"prop-types": "^15.7.2",
"react": "^16.14.0",
Expand Down
Loading