Skip to content

Commit

Permalink
IOG serverless function + some fixes (#2578)
Browse files Browse the repository at this point in the history
* Initial version of Inside Outside Guidance serverless function
* Support neg_points in interactors
* Improved deployment process of serverless functions
* Improve installation.md for serverless functions.
* Update CHANGELOG, use NUCLIO_DASHBOARD_DEFAULT_FUNCTION_MOUNT_MODE as
recommended by nuclio developers.
* Disable warning from markdown linter about max line length for a table.
* Fix IOG function with conda environment
* Fix tensorflow matterport/mask_rcnn

Co-authored-by: Boris Sekachev <[email protected]>
  • Loading branch information
Nikita Manovich and Boris Sekachev authored Feb 10, 2021
1 parent 51c3dd8 commit 97cb892
Show file tree
Hide file tree
Showing 42 changed files with 387 additions and 136 deletions.
17 changes: 10 additions & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
"request": "launch",
"stopOnEntry": false,
"justMyCode": false,
"pythonPath": "${command:python.interpreterPath}",
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/manage.py",
"env": {
"CVAT_SERVERLESS": "1",
},
"args": [
"runserver",
"--noreload",
Expand Down Expand Up @@ -73,7 +76,7 @@
"request": "launch",
"stopOnEntry": false,
"justMyCode": false,
"pythonPath": "${command:python.interpreterPath}",
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"rqworker",
Expand All @@ -92,7 +95,7 @@
"request": "launch",
"stopOnEntry": false,
"justMyCode": false,
"pythonPath": "${command:python.interpreterPath}",
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"rqscheduler",
Expand All @@ -108,7 +111,7 @@
"request": "launch",
"justMyCode": false,
"stopOnEntry": false,
"pythonPath":"${command:python.interpreterPath}",
"python":"${command:python.interpreterPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"rqworker",
Expand All @@ -127,7 +130,7 @@
"request": "launch",
"justMyCode": false,
"stopOnEntry": false,
"pythonPath": "${command:python.interpreterPath}",
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"update_git_states"
Expand All @@ -143,7 +146,7 @@
"request": "launch",
"justMyCode": false,
"stopOnEntry": false,
"pythonPath": "${command:python.interpreterPath}",
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"migrate"
Expand All @@ -159,7 +162,7 @@
"request": "launch",
"justMyCode": false,
"stopOnEntry": false,
"pythonPath": "${command:python.interpreterPath}",
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"test",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- CVAT-3D: Load all frames corresponding to the job instance
(<https://github.com/openvinotoolkit/cvat/pull/2645>)
- Intelligent scissors with OpenCV javascript (<https://github.com/openvinotoolkit/cvat/pull/2689>)
- [Inside Outside Guidence](https://github.com/shiyinzhang/Inside-Outside-Guidance) serverless
function for interative segmentation

### Changed

- Updated HTTPS install README section (cleanup and described more robust deploy)
- Logstash is improved for using with configurable elasticsearch outputs (<https://github.com/openvinotoolkit/cvat/pull/2531>)
- Bumped nuclio version to 1.5.16
- All methods for interative segmentation accept negative points as well

### Deprecated

Expand Down
37 changes: 24 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,26 @@ For more information about supported formats look at the
| [ImageNet](http://www.image-net.org) | X | X |
| [CamVid](http://mi.eng.cam.ac.uk/research/projects/VideoRec/CamVid/) | X | X |

## Deep learning models for automatic labeling
## Deep learning serverless functions for automatic labeling

<!--lint disable maximum-line-length-->

| Name | Type | Framework | CPU | GPU |
| ------------------------------------------------------------------------------------------------------- | ---------- | ---------- | --- | --- |
| [Deep Extreme Cut](/serverless/openvino/dextr/nuclio) | interactor | OpenVINO | X |
| [Deep Extreme Cut](/serverless/openvino/dextr/nuclio) | interactor | OpenVINO | X | |
| [Faster RCNN](/serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio) | detector | OpenVINO | X | |
| [Mask RCNN](/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio) | detector | OpenVINO | X | |
| [YOLO v3](/serverless/openvino/omz/public/yolo-v3-tf/nuclio) | detector | OpenVINO | X | |
| [Object reidentification](/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio) | reid | OpenVINO | X | |
| [Semantic segmentation for ADAS](/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio) | detector | OpenVINO | X | |
| [Text detection v4](/serverless/openvino/omz/intel/text-detection-0004/nuclio) | detector | OpenVINO | X | |
| [SiamMask](/serverless/pytorch/foolwood/siammask/nuclio) | tracker | PyTorch | X | |
| [f-BRS](/serverless/pytorch/saic-vul/fbrs/nuclio) | interactor | PyTorch | X | |
| [Inside-Outside Guidance](/serverless/pytorch/shiyinzhang/iog/nuclio) | interactor | PyTorch | X | |
| [Faster RCNN](/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio) | detector | TensorFlow | X | X |
| [Mask RCNN](/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio) | detector | OpenVINO | X |
| [YOLO v3](/serverless/openvino/omz/public/yolo-v3-tf/nuclio) | detector | OpenVINO | X |
| [Text detection v4](/serverless/openvino/omz/intel/text-detection-0004/nuclio) | detector | OpenVINO | X |
| [Semantic segmentation for ADAS](/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio) | detector | OpenVINO | X |
| [Mask RCNN](/serverless/tensorflow/matterport/mask_rcnn/nuclio) | detector | TensorFlow | X |
| [Object reidentification](/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio) | reid | OpenVINO | X |
| [Mask RCNN](/serverless/tensorflow/matterport/mask_rcnn/nuclio) | detector | TensorFlow | X | |

<!--lint enable maximum-line-length-->

## Online demo: [cvat.org](https://cvat.org)

Expand All @@ -93,11 +101,12 @@ Limitations:

## REST API

Automatically generated Swagger documentation for Django REST API is
available on `<cvat_origin>/api/swagger`
(default: `localhost:8080/api/swagger`).
Automatically generated Swagger documentation for Django REST API is available
on `<cvat_origin>/api/swagger`(default: `localhost:8080/api/swagger`).

Swagger documentation is visiable on allowed hostes, Update environement variable in docker-compose.yml file with cvat hosted machine IP or domain name. Example - `ALLOWED_HOSTS: 'localhost, 127.0.0.1'`)
Swagger documentation is visiable on allowed hostes, Update environement
variable in docker-compose.yml file with cvat hosted machine IP or domain
name. Example - `ALLOWED_HOSTS: 'localhost, 127.0.0.1'`.

## LICENSE

Expand Down Expand Up @@ -129,4 +138,6 @@ Other ways to ask questions and get our support:

## Projects using CVAT

- [Onepanel](https://github.com/onepanelio/core) - Onepanel is an open source vision AI platform that fully integrates CVAT with scalable data processing and parallelized training pipelines.
- [Onepanel](https://github.com/onepanelio/core) - Onepanel is an open source
vision AI platform that fully integrates CVAT with scalable data processing
and parallelized training pipelines.
3 changes: 2 additions & 1 deletion components/serverless/docker-compose.serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.3'
services:
serverless:
container_name: nuclio
image: quay.io/nuclio/dashboard:1.5.8-amd64
image: quay.io/nuclio/dashboard:1.5.16-amd64
restart: always
networks:
default:
Expand All @@ -16,6 +16,7 @@ services:
https_proxy:
no_proxy: 172.28.0.1,${no_proxy}
NUCLIO_CHECK_FUNCTION_CONTAINERS_HEALTHINESS: 'true'
NUCLIO_DASHBOARD_DEFAULT_FUNCTION_MOUNT_MODE: 'volume'
ports:
- '8070:8070'

Expand Down
2 changes: 1 addition & 1 deletion cvat-core/src/server-proxy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2020 Intel Corporation
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down
2 changes: 1 addition & 1 deletion cvat-core/src/session.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2020 Intel Corporation
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down
6 changes: 4 additions & 2 deletions cvat-data/src/js/unzip_imgs.worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -7,7 +7,9 @@ const JSZip = require('jszip');
onmessage = (e) => {
const zip = new JSZip();
if (e.data) {
const { start, end, block, dimension, dimension2D } = e.data;
const {
start, end, block, dimension, dimension2D,
} = e.data;

zip.loadAsync(block).then((_zip) => {
let index = start;
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.14.1",
"version": "1.14.2",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
5 changes: 1 addition & 4 deletions cvat-ui/src/actions/annotation-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1362,10 +1362,7 @@ export function pasteShapeAsync(): ThunkAction {
};
}

export function interactWithCanvas(
activeInteractor: Model | OpenCVTool,
activeLabelID: number,
): AnyAction {
export function interactWithCanvas(activeInteractor: Model | OpenCVTool, activeLabelID: number): AnyAction {
return {
type: AnnotationActionTypes.INTERACT_WITH_CANVAS,
payload: {
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/annotation-page/annotation-page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class OpenCVControlComponent extends React.PureComponent<Props & DispatchToProps
const {
shapesUpdated, isDone, threshold, shapes,
} = (e as CustomEvent).detail;
const pressedPoints = convertShapesForInteractor(shapes).flat();
const pressedPoints = convertShapesForInteractor(shapes, 0).flat();
this.interactionIsDone = isDone;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
try {
result = await core.lambda.call(jobInstance.task, interactor, {
frame,
points: convertShapesForInteractor((e as CustomEvent).detail.shapes),
pos_points: convertShapesForInteractor((e as CustomEvent).detail.shapes, 0),
neg_points: convertShapesForInteractor((e as CustomEvent).detail.shapes, 2),
});

if (this.interactionIsAborted) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/annotation-page/top-bar/top-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down
16 changes: 8 additions & 8 deletions cvat-ui/src/components/labels-editor/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ function validateParsedAttribute(attr: Attribute): void {

if (!['number', 'undefined'].includes(typeof attr.id)) {
throw new Error(
`Attribute: "${attr.name}". ` + `Type of attribute id must be a number or undefined. Got value ${attr.id}`,
`Attribute: "${attr.name}". Type of attribute id must be a number or undefined. Got value ${attr.id}`,
);
}

if (!['checkbox', 'number', 'text', 'radio', 'select'].includes((attr.input_type || '').toLowerCase())) {
throw new Error(`Attribute: "${attr.name}". ` + `Unknown input type: ${attr.input_type}`);
throw new Error(`Attribute: "${attr.name}". Unknown input type: ${attr.input_type}`);
}

if (typeof attr.mutable !== 'boolean') {
throw new Error(
`Attribute: "${attr.name}". ` + `Mutable flag must be a boolean value. Got value ${attr.mutable}`,
`Attribute: "${attr.name}". Mutable flag must be a boolean value. Got value ${attr.mutable}`,
);
}

if (!Array.isArray(attr.values)) {
throw new Error(
`Attribute: "${attr.name}". ` + `Attribute values must be an array. Got type ${typeof attr.values}`,
`Attribute: "${attr.name}". Attribute values must be an array. Got type ${typeof attr.values}`,
);
}

Expand All @@ -52,7 +52,7 @@ function validateParsedAttribute(attr: Attribute): void {

for (const value of attr.values) {
if (typeof value !== 'string') {
throw new Error(`Attribute: "${attr.name}". ` + `Each value must be a string. Got value ${value}`);
throw new Error(`Attribute: "${attr.name}". Each value must be a string. Got value ${value}`);
}
}
}
Expand All @@ -64,12 +64,12 @@ export function validateParsedLabel(label: Label): void {

if (!['number', 'undefined'].includes(typeof label.id)) {
throw new Error(
`Label "${label.name}". ` + `Type of label id must be only a number or undefined. Got value ${label.id}`,
`Label "${label.name}". Type of label id must be only a number or undefined. Got value ${label.id}`,
);
}

if (typeof label.color !== 'string') {
throw new Error(`Label "${label.name}". ` + `Label color must be a string. Got ${typeof label.color}`);
throw new Error(`Label "${label.name}". Label color must be a string. Got ${typeof label.color}`);
}

if (!label.color.match(/^#[0-9a-fA-F]{6}$|^$/)) {
Expand All @@ -80,7 +80,7 @@ export function validateParsedLabel(label: Label): void {
}

if (!Array.isArray(label.attributes)) {
throw new Error(`Label "${label.name}". ` + `attributes must be an array. Got type ${typeof label.attributes}`);
throw new Error(`Label "${label.name}". Attributes must be an array. Got type ${typeof label.attributes}`);
}

for (const attr of label.attributes) {
Expand Down
4 changes: 3 additions & 1 deletion cvat-ui/src/containers/actions-menu/actions-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import ActionsMenuComponent, { Actions } from 'components/actions-menu/actions-m
import { CombinedState } from 'reducers/interfaces';

import { modelsActions } from 'actions/models-actions';
import { dumpAnnotationsAsync, loadAnnotationsAsync, exportDatasetAsync, deleteTaskAsync } from 'actions/tasks-actions';
import {
dumpAnnotationsAsync, loadAnnotationsAsync, exportDatasetAsync, deleteTaskAsync,
} from 'actions/tasks-actions';
// eslint-disable-next-line import/no-extraneous-dependencies
import { MenuInfo } from 'rc-menu/lib/interface';

Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/containers/annotation-page/top-bar/top-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down
18 changes: 9 additions & 9 deletions cvat-ui/src/cvat-canvas-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -12,20 +12,20 @@ import {
InteractionResult as _InteractionResult,
} from 'cvat-canvas/src/typescript/canvas';

export function convertShapesForInteractor(shapes: InteractionResult[]): number[][] {
export function convertShapesForInteractor(shapes: InteractionResult[], button: number): number[][] {
const reducer = (acc: number[][], _: number, index: number, array: number[]): number[][] => {
if (!(index % 2)) { // 0, 2, 4
acc.push([
array[index],
array[index + 1],
]);
if (!(index % 2)) {
// 0, 2, 4
acc.push([array[index], array[index + 1]]);
}
return acc;
};

return shapes.filter((shape: InteractionResult): boolean => shape.shapeType === 'points' && shape.button === 0)
return shapes
.filter((shape: InteractionResult): boolean => shape.shapeType === 'points' && shape.button === button)
.map((shape: InteractionResult): number[] => shape.points)
.flat().reduce(reducer, []);
.flat()
.reduce(reducer, []);
}

export type InteractionData = _InteractionData;
Expand Down
5 changes: 3 additions & 2 deletions cvat-ui/src/reducers/annotation-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,9 @@ export default (state = defaultState, action: AnyAction): AnnotationState => {
},
canvas: {
...state.canvas,
activeControl: activeInteractor
.type.startsWith('opencv') ? ActiveControl.OPENCV_TOOLS : ActiveControl.AI_TOOLS,
activeControl: activeInteractor.type.startsWith('opencv') ?
ActiveControl.OPENCV_TOOLS :
ActiveControl.AI_TOOLS,
},
};
}
Expand Down
3 changes: 2 additions & 1 deletion cvat/apps/documentation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ Please see the [Docker documentation](https://docs.docker.com/network/proxy/) fo

```bash
# Build and run containers with Analytics component support:
docker-compose -f docker-compose.yml -f components/analytics/docker-compose.analytics.yml up -d --build
docker-compose -f docker-compose.yml \
-f components/analytics/docker-compose.analytics.yml up -d --build
```

### Semi-automatic and automatic annotation
Expand Down
Loading

0 comments on commit 97cb892

Please sign in to comment.