You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nikita Manovich e7585b8ce9
DL models as serverless functions (#1767)
* Initial experiments with nuclio

* Update nuclio prototype

* Improve nuclio prototype for dextr.

* Dummy lambda manager

* OpenFaaS prototype (dextr.bin and dextr.xml are empty).

* Moved openfaas prototype.

* Add comments

* Add serializers and HLD for lambda_manager

* Initial version of Mask RCNN (without debugging)

* Initial version for faster_rcnn_inception_v2_coco

* Fix faster_rcnn_inception_v2_coco

* Implemented mask_rcnn_inception_resnet_v2_atrous_coco

* Implemented yolo detector as a lambda function

* Removed dextr app.

* Added types for each function (detector and interactor)

* Initial version of lambda_manager.

* Implement a couple of methods for lambda:

GET /api/v1/lambda/functions
GET /api/v1/lambda/functions/public.dextr

* First working version of dextr serverless function

* First version of dextr which works in UI.

* Modify omz.public.faster_rcnn_inception_v2_coco

- image decoding
- restart policy always for the function

* Improve omz.public.mask_rcnn_inception_resnet_v2_atrous_coco

* Improve omz.public.yolo-v3-tf function

* Implemented the initial version of requests for lambda manager.

* First working version of POST /api/v1/lambda/requests

* Updated specification of function.yaml (added labels and used annotations section).

* Added health check for containers (nuclio dashboard feature)

* Read labels spec from function.yaml.

* Added settings for NUCLIO

* Fixed a couple of typos. Now it works in most cases.

* Remove Plugin REST API

* Remove tf_annotation app (it will be replaced by serverless function)

* Remove tf_annotation and cuda components

* Cleanup docs and Dockerfile from CUDA component.

* Just renamed directories inside serverless

* Remove redundant files and code

* Remove redundant files.

* Remove outdated files

* Remove outdated code

* Delete reid app and add draft of serverless function for reid.

* Model list in UI.

* Fixed the framework name (got it from lambda function).

* Add maxRequestBodySize for functions, remove redundant code from UI for auto_annotation.

* Update view of models page.

* Unblock mapping for "primary" models.

* Implement cleanup flag for lambda/requests and labeling mapping for functions.

* Implement protection from running multiple jobs for the same task.

* Fix invocation of functions in docker container.

* Fix Dockerfile.ci

* Remove unused files from lambda_manager

* Fix codacy warnings

* Fix codacy issues.

* Fix codacy warnings

* Implement progress and cancel (aka delete) operation.

* Send annotations in batch.

* Fix UI. Now it can retrieve information about inference requests in progress.

* Update CHANGELOG.md

* Update cvat-ui version.

* Update nuclio version.

* Implement serverless/tensorflow/faster_rcnn_inception_v2_coco

* Add information how to install nuclio platform and run serverless functions.

* Add installation instructions for serverless functions.

* Update OpenVINO files which are responsible for loading network

* relocated functions

* Update dextr function.

* Update faster_rcnn function from omz

* Fix OpenVINO Mask-RCNN

* Fix YOLO v3 serverless function.

* Dummy serverless functions for a couple of more OpenVINO models.

* Protected lambda manager views by correct permissions.

* Fix name of Faster RCNN from Tensorflow.

* Implement Mask RCNN via Tensorflow serverless function.

* Minor client changes (#1847)

* Minor client changes

* Removed extra code

* Add reid serverless function (no support in lambda manager).

* Fix contribution guide.

* Fix person-reidentification-retail-300 and implement text-detection-0004

* Add semantic-segmentation-adas-0001

* Moving model management to cvat-core (#1905)

* Squached changes

* Removed extra line

* Remove duplicated files for OpenVINO serverless functions.

* Updated CHANGELOG.md

* Remove outdated code.

* Running dextr via lambda manager (#1912)

* Deleted outdated migration.

* Add name for DEXTR function.

* Fix restart policy for serverless functions.

* Fix openvino serverless functions for images with alpha channel

* Add more tensorflow serverless functions into deploy.sh

* Use ID instead of name for DEXTR (#1926)

* Update DEXTR function

* Added source "auto" inside lambda manager for automatic annotation.

* Customize payload (depends on type of lambda function).

* First working version of REID (Server only).

* Fix codacy warnings

* Avoid exception during migration (workaround)

File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: table "engine_pluginoption" does not exist

* Add siammask serverless function (it doesn't work, need to serialize state)

* Run ReID from UI (#1949)

* Removed reid route in installation.md

* Fix a command to get lena image in CONTRIBUTION guide.

* Fix typo and crash in case a polygon is a line.

Co-authored-by: Boris Sekachev <40690378+bsekachev@users.noreply.github.com>
6 years ago
..
datumaro Fix convert command (#1943) 6 years ago
docs [Datumaro] Plugins and transforms (#1126) 6 years ago
tests [Datumaro] Reducing nesting of tests (#1875) 6 years ago
.gitignore DL models as serverless functions (#1767) 6 years ago
CONTRIBUTING.md Add plugin system documentation (#1131) 6 years ago
README.md [Datumaro] Convert command (#1837) 6 years ago
datum.py [Datumaro] CLI updates + better documentation (#1057) 6 years ago
requirements.txt Fixed security issues in Datumaro (#1244) 6 years ago
setup.py Fixed security issues in Datumaro (#1244) 6 years ago

README.md

Dataset Framework (Datumaro)

A framework to build, transform, and analyze datasets.

CVAT annotations  --                              ---> Annotation tool
...                  \                          /
COCO-like dataset -----> Datumaro ---> dataset ------> Model training
...                  /                          \
VOC-like dataset  --                              ---> Publication etc.

Contents

Documentation

Features

Check the design document for a full list of features

Installation

Optionally, create a virtual environment:

python -m pip install virtualenv
python -m virtualenv venv
. venv/bin/activate

Install Datumaro package:

pip install 'git+https://github.com/opencv/cvat#egg=datumaro&subdirectory=datumaro'

Usage

There are several options available:

Standalone tool

    User
        |
        v
+------------------+
|       CVAT       |
+--------v---------+       +------------------+       +--------------+
| Datumaro module  | ----> | Datumaro project | <---> | Datumaro CLI | <--- User
+------------------+       +------------------+       +--------------+
datum --help
python -m datumaro --help

Python module

Datumaro can be used in custom scripts as a library in the following way:

from datumaro.components.project import Project # project-related things
import datumaro.components.extractor # annotations and high-level interfaces
# etc.
project = Project.load('directory')

Examples

  • Convert PASCAL VOC to COCO, keep only images with cat class presented:

    # Download VOC dataset:
    # http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
    datum convert --input-format voc --input-path <path/to/voc> \
                  --output-format coco --filter '/item[annotation/label="cat"]'
    
  • Convert only non-occluded annotations from a CVAT-annotated project to TFrecord:

    # export Datumaro dataset in CVAT UI, extract somewhere, go to the project dir
    datum project extract --filter '/item/annotation[occluded="False"]' \
      --mode items+anno --output-dir not_occluded
    datum project export --project not_occluded \
      --format tf_detection_api -- --save-images
    
  • Annotate COCO, extract image subset, re-annotate it in CVAT, update old dataset:

    # Download COCO dataset http://cocodataset.org/#download
    # Put images to coco/images/ and annotations to coco/annotations/
    datum project import --format coco --input-path <path/to/coco>
    datum project export --filter '/image[images_I_dont_like]' --format cvat \
      --output-dir reannotation
    # import dataset and images to CVAT, re-annotate
    # export Datumaro project, extract to 'reannotation-upd'
    datum project project merge reannotation-upd
    datum project export --format coco
    
  • Annotate instance polygons in CVAT, export as masks in COCO:

    datum convert --input-format cvat --input-path <path/to/cvat.xml> \
                  --output-format coco -- --segmentation-mode masks
    
  • Apply an OpenVINO detection model to some COCO-like dataset, then compare annotations with ground truth and visualize in TensorBoard:

    datum project import --format coco --input-path <path/to/coco>
    # create model results interpretation script
    datum model add mymodel openvino \
      --weights model.bin --description model.xml \
      --interpretation-script parse_results.py
    datum model run --model mymodel --output-dir mymodel_inference/
    datum project diff mymodel_inference/ --format tensorboard --output-dir diff
    
  • Change colors in PASCAL VOC-like .png masks:

    datum project import --format voc --input-path <path/to/voc/dataset>
    
    # Create a color map file with desired colors:
    #
    # label : color_rgb : parts : actions
    # cat:0,0,255::
    # dog:255,0,0::
    #
    # Save as mycolormap.txt
    
    datum project export --format voc_segmentation -- --label-map mycolormap.txt
    # add "--apply-colormap=0" to save grayscale (indexed) masks
    # check "--help" option for more info
    # use "datum --loglevel debug" for extra conversion info
    

Contributing

Feel free to open an Issue if you think something needs to be changed. You are welcome to participate in development, development instructions are available in our developer manual.