From 3a291046ba9cf31cfabc0e633099a8cae3b593b9 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Thu, 24 Jun 2021 15:41:30 +0300 Subject: [PATCH 1/3] Fix whitespace errors As detected with `git diff --check`. --- .gitattributes | 1 - datumaro/components/__init__.py | 1 - datumaro/components/algorithms/__init__.py | 1 - .../accuracy_checker_plugin/__init__.py | 1 - .../details/representation.py | 4 -- datumaro/plugins/openvino_plugin/README.md | 18 ++++---- datumaro/plugins/openvino_plugin/launcher.py | 1 - .../samples/ssd_face_detection_interp.py | 4 +- .../samples/ssd_person_detection_interp.py | 4 +- ...sd_person_vehicle_bike_detection_interp.py | 4 +- .../samples/ssd_vehicle_detection_interp.py | 4 +- docs/formats/coco_user_manual.md | 2 +- docs/formats/mnist_user_manual.md | 8 ++-- tests/assets/lfw_dataset/test/pairs.txt | 1 - .../tf_detection_api_dataset/label_map.pbtxt | 41 +++++++++---------- .../wider_face_train_bbx_gt.txt | 6 +-- .../wider_face_val_bbx_gt.txt | 6 +-- 17 files changed, 48 insertions(+), 59 deletions(-) diff --git a/.gitattributes b/.gitattributes index 7c0b591b07..18929de21e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -26,4 +26,3 @@ LICENSE text *.gif binary *.ttf binary *.pdf binary - diff --git a/datumaro/components/__init__.py b/datumaro/components/__init__.py index 5a1ec10f3a..eb864e52b5 100644 --- a/datumaro/components/__init__.py +++ b/datumaro/components/__init__.py @@ -2,4 +2,3 @@ # Copyright (C) 2019-2020 Intel Corporation # # SPDX-License-Identifier: MIT - diff --git a/datumaro/components/algorithms/__init__.py b/datumaro/components/algorithms/__init__.py index 5a1ec10f3a..eb864e52b5 100644 --- a/datumaro/components/algorithms/__init__.py +++ b/datumaro/components/algorithms/__init__.py @@ -2,4 +2,3 @@ # Copyright (C) 2019-2020 Intel Corporation # # SPDX-License-Identifier: MIT - diff --git a/datumaro/plugins/accuracy_checker_plugin/__init__.py b/datumaro/plugins/accuracy_checker_plugin/__init__.py index fdd6d29179..f19d9bef37 100644 --- a/datumaro/plugins/accuracy_checker_plugin/__init__.py +++ b/datumaro/plugins/accuracy_checker_plugin/__init__.py @@ -1,4 +1,3 @@ # Copyright (C) 2020 Intel Corporation # # SPDX-License-Identifier: MIT - diff --git a/datumaro/plugins/accuracy_checker_plugin/details/representation.py b/datumaro/plugins/accuracy_checker_plugin/details/representation.py index 76da49ee0a..d502dd2b3a 100644 --- a/datumaro/plugins/accuracy_checker_plugin/details/representation.py +++ b/datumaro/plugins/accuracy_checker_plugin/details/representation.py @@ -56,7 +56,3 @@ def import_prediction(pred): # - else: raise NotImplementedError("Can't convert %s" % type(pred)) - - - - diff --git a/datumaro/plugins/openvino_plugin/README.md b/datumaro/plugins/openvino_plugin/README.md index fc0d904eb9..e676f96a83 100644 --- a/datumaro/plugins/openvino_plugin/README.md +++ b/datumaro/plugins/openvino_plugin/README.md @@ -1,17 +1,17 @@ -# OpenVINO™ Inference Interpreter +# OpenVINO™ Inference Interpreter Interpreter samples to parse OpenVINO™ inference outputs. ## Models supported from interpreter samples -There are detection and image classification examples. - +There are detection and image classification examples. + - Detection (SSD-based) - - Intel Pre-trained Models > Object Detection + - Intel Pre-trained Models > Object Detection - [face-detection-0200](https://docs.openvinotoolkit.org/latest/omz_models_intel_face_detection_0200_description_face_detection_0200.html) - [face-detection-0202](https://docs.openvinotoolkit.org/latest/omz_models_intel_face_detection_0202_description_face_detection_0202.html) - [face-detection-0204](https://docs.openvinotoolkit.org/latest/omz_models_intel_face_detection_0204_description_face_detection_0204.html) - [person-detection-0200](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_0200_description_person_detection_0200.html) - [person-detection-0201](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_0201_description_person_detection_0201.html) - - [person-detection-0202](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_0202_description_person_detection_0202.html) + - [person-detection-0202](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_0202_description_person_detection_0202.html) - [person-vehicle-bike-detection-2000](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_vehicle_bike_detection_2000_description_person_vehicle_bike_detection_2000.html) - [person-vehicle-bike-detection-2001](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_vehicle_bike_detection_2001_description_person_vehicle_bike_detection_2001.html) - [person-vehicle-bike-detection-2002](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_vehicle_bike_detection_2002_description_person_vehicle_bike_detection_2002.html) @@ -28,7 +28,7 @@ There are detection and image classification examples. - [mobilenet-v2-pytorch](https://docs.openvinotoolkit.org/latest/omz_models_public_mobilenet_v2_pytorch_mobilenet_v2_pytorch.html) You can find more OpenVINO™ Trained Models [here](https://docs.openvinotoolkit.org/latest/omz_models_intel_index.html) -To run the inference with OpenVINO™, the model format should be Intermediate Representation(IR). +To run the inference with OpenVINO™, the model format should be Intermediate Representation(IR). For the Caffe/TensorFlow/MXNet/Kaldi/ONNX models, please see the [Model Conversion Instruction](https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html) You need to implement your own interpreter samples to support the other OpenVINO™ Trained Models. @@ -49,12 +49,12 @@ You need to implement your own interpreter samples to support the other OpenVINO ``` ## Model inference -- Prerequisites: +- Prerequisites: - OpenVINO™ (To install OpenVINO™, please see the [OpenVINO™ Installation Instruction](https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html)) - Datumaro (To install Datumaro, please see the [User Manual](docs/user_manual.md)) - OpenVINO™ models (To download OpenVINO™ models, please see the [Model Downloader Instruction](https://docs.openvinotoolkit.org/latest/omz_tools_downloader_README.html)) - PASCAL VOC 2012 dataset (To download VOC 2012 dataset, please go [VOC2012 download](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit)) - + - To run the inference with OpenVINO™ models and the interpreter samples, please follow the instructions below. ```bash @@ -76,7 +76,7 @@ You need to implement your own interpreter samples to support the other OpenVINO -i samples/ssd_mobilenet_coco_detection_interp.py datum add path -p proj_ssd_mobilenet_v2_coco_detection -f voc VOCdevkit/ datum model run -p proj_ssd_mobilenet_v2_coco_detection -m model-0 - + # Classification> mobilenet-v2-pytorch source /opt/intel/openvino/bin/setupvars.sh cd datumaro/plugins/openvino_plugin diff --git a/datumaro/plugins/openvino_plugin/launcher.py b/datumaro/plugins/openvino_plugin/launcher.py index ef43d0fedc..9e6d9db3e0 100644 --- a/datumaro/plugins/openvino_plugin/launcher.py +++ b/datumaro/plugins/openvino_plugin/launcher.py @@ -195,4 +195,3 @@ def categories(self): def process_outputs(self, inputs, outputs): return self._interpreter.process_outputs(inputs, outputs) - diff --git a/datumaro/plugins/openvino_plugin/samples/ssd_face_detection_interp.py b/datumaro/plugins/openvino_plugin/samples/ssd_face_detection_interp.py index abb4604f8d..b079595caf 100644 --- a/datumaro/plugins/openvino_plugin/samples/ssd_face_detection_interp.py +++ b/datumaro/plugins/openvino_plugin/samples/ssd_face_detection_interp.py @@ -65,10 +65,10 @@ def process_outputs(inputs, outputs): w = min(int(det[5] * input_width - x), input_width) h = min(int(det[6] * input_height - y), input_height) - image_results.append(Bbox(x, y, w, h, label=label, + image_results.append(Bbox(x, y, w, h, label=label, attributes={ 'score': conf, 'scores': list(map(float, det_confs)) } )) - + results.append(image_results) return results diff --git a/datumaro/plugins/openvino_plugin/samples/ssd_person_detection_interp.py b/datumaro/plugins/openvino_plugin/samples/ssd_person_detection_interp.py index 3888944df4..2055979bd4 100644 --- a/datumaro/plugins/openvino_plugin/samples/ssd_person_detection_interp.py +++ b/datumaro/plugins/openvino_plugin/samples/ssd_person_detection_interp.py @@ -65,10 +65,10 @@ def process_outputs(inputs, outputs): w = min(int(det[5] * input_width - x), input_width) h = min(int(det[6] * input_height - y), input_height) - image_results.append(Bbox(x, y, w, h, label=label, + image_results.append(Bbox(x, y, w, h, label=label, attributes={ 'score': conf, 'scores': list(map(float, det_confs)) } )) - + results.append(image_results) return results diff --git a/datumaro/plugins/openvino_plugin/samples/ssd_person_vehicle_bike_detection_interp.py b/datumaro/plugins/openvino_plugin/samples/ssd_person_vehicle_bike_detection_interp.py index a2de43dd6d..23d92b7f1f 100644 --- a/datumaro/plugins/openvino_plugin/samples/ssd_person_vehicle_bike_detection_interp.py +++ b/datumaro/plugins/openvino_plugin/samples/ssd_person_vehicle_bike_detection_interp.py @@ -65,10 +65,10 @@ def process_outputs(inputs, outputs): w = min(int(det[5] * input_width - x), input_width) h = min(int(det[6] * input_height - y), input_height) - image_results.append(Bbox(x, y, w, h, label=label, + image_results.append(Bbox(x, y, w, h, label=label, attributes={ 'score': conf, 'scores': list(map(float, det_confs)) } )) - + results.append(image_results) return results diff --git a/datumaro/plugins/openvino_plugin/samples/ssd_vehicle_detection_interp.py b/datumaro/plugins/openvino_plugin/samples/ssd_vehicle_detection_interp.py index 2866133542..28d343f122 100644 --- a/datumaro/plugins/openvino_plugin/samples/ssd_vehicle_detection_interp.py +++ b/datumaro/plugins/openvino_plugin/samples/ssd_vehicle_detection_interp.py @@ -65,10 +65,10 @@ def process_outputs(inputs, outputs): w = min(int(det[5] * input_width - x), input_width) h = min(int(det[6] * input_height - y), input_height) - image_results.append(Bbox(x, y, w, h, label=label, + image_results.append(Bbox(x, y, w, h, label=label, attributes={ 'score': conf, 'scores': list(map(float, det_confs)) } )) - + results.append(image_results) return results diff --git a/docs/formats/coco_user_manual.md b/docs/formats/coco_user_manual.md index 5b2d379016..b9714fc6ef 100644 --- a/docs/formats/coco_user_manual.md +++ b/docs/formats/coco_user_manual.md @@ -103,7 +103,7 @@ datum import --format coco_stuff --input-path Datumaro supports the following COCO tasks: - [Image Captioning](https://cocodataset.org/#captions-2015) (`coco_caption`) - [Object Detection](https://cocodataset.org/#detection-2020) (`coco_instances`) -- Image classification (our extension) (`coco_labels`) - a format like Object Detection, which uses +- Image classification (our extension) (`coco_labels`) - a format like Object Detection, which uses only `category_id` and `score` annotation fields - [Panoptic Segmentation](https://cocodataset.org/#panoptic-2020) (`coco_panoptic`) - [Keypoint Detection](https://cocodataset.org/#keypoints-2020) (`coco_person_keypoints`) diff --git a/docs/formats/mnist_user_manual.md b/docs/formats/mnist_user_manual.md index 01645e2827..fba64b2fd1 100644 --- a/docs/formats/mnist_user_manual.md +++ b/docs/formats/mnist_user_manual.md @@ -64,9 +64,9 @@ MNIST dataset directory should have the following structure: ``` └─ Dataset/ ├── labels.txt # list of non-digit labels (optional) - ├── t10k-images-idx3-ubyte.gz - ├── t10k-labels-idx1-ubyte.gz - ├── train-images-idx3-ubyte.gz + ├── t10k-images-idx3-ubyte.gz + ├── t10k-labels-idx1-ubyte.gz + ├── train-images-idx3-ubyte.gz └── train-labels-idx1-ubyte.gz ``` MNIST in CSV dataset directory should have the following structure: @@ -75,7 +75,7 @@ MNIST in CSV dataset directory should have the following structure: ``` └─ Dataset/ ├── labels.txt # list of non-digit labels (optional) - ├── mnist_test.csv + ├── mnist_test.csv └── mnist_train.csv ``` If the dataset needs non-digit labels, you need to add the labels.txt diff --git a/tests/assets/lfw_dataset/test/pairs.txt b/tests/assets/lfw_dataset/test/pairs.txt index 401afe36b3..16907857a0 100644 --- a/tests/assets/lfw_dataset/test/pairs.txt +++ b/tests/assets/lfw_dataset/test/pairs.txt @@ -2,4 +2,3 @@ name1 1 2 name0 1 name1 1 name0 1 name1 2 - \ No newline at end of file diff --git a/tests/assets/tf_detection_api_dataset/label_map.pbtxt b/tests/assets/tf_detection_api_dataset/label_map.pbtxt index dbf2b339b7..de7fbb9ec4 100644 --- a/tests/assets/tf_detection_api_dataset/label_map.pbtxt +++ b/tests/assets/tf_detection_api_dataset/label_map.pbtxt @@ -1,50 +1,49 @@ item { - id: 1 - name: 'label_0' + id: 1 + name: 'label_0' } item { - id: 2 - name: 'label_1' + id: 2 + name: 'label_1' } item { - id: 3 - name: 'label_2' + id: 3 + name: 'label_2' } item { - id: 4 - name: 'label_3' + id: 4 + name: 'label_3' } item { - id: 5 - name: 'label_4' + id: 5 + name: 'label_4' } item { - id: 6 - name: 'label_5' + id: 6 + name: 'label_5' } item { - id: 7 - name: 'label_6' + id: 7 + name: 'label_6' } item { - id: 8 - name: 'label_7' + id: 8 + name: 'label_7' } item { - id: 9 - name: 'label_8' + id: 9 + name: 'label_8' } item { - id: 10 - name: 'label_9' + id: 10 + name: 'label_9' } - diff --git a/tests/assets/widerface_dataset/wider_face_split/wider_face_train_bbx_gt.txt b/tests/assets/widerface_dataset/wider_face_split/wider_face_train_bbx_gt.txt index 09109f7010..813e43b117 100644 --- a/tests/assets/widerface_dataset/wider_face_split/wider_face_train_bbx_gt.txt +++ b/tests/assets/widerface_dataset/wider_face_split/wider_face_train_bbx_gt.txt @@ -1,7 +1,7 @@ 0--Parade/0_Parade_image_01.jpg 1 -1 2 2 2 0 0 0 0 0 0 +1 2 2 2 0 0 0 0 0 0 1--Handshaking/1_Handshaking_image_02.jpg 2 -1 1 2 2 0 0 1 0 0 0 -5 1 2 2 0 0 1 0 0 0 \ No newline at end of file +1 1 2 2 0 0 1 0 0 0 +5 1 2 2 0 0 1 0 0 0 diff --git a/tests/assets/widerface_dataset/wider_face_split/wider_face_val_bbx_gt.txt b/tests/assets/widerface_dataset/wider_face_split/wider_face_val_bbx_gt.txt index 04573e8268..095b845257 100644 --- a/tests/assets/widerface_dataset/wider_face_split/wider_face_val_bbx_gt.txt +++ b/tests/assets/widerface_dataset/wider_face_split/wider_face_val_bbx_gt.txt @@ -1,5 +1,5 @@ 0--Parade/0_Parade_image_03.jpg 3 -0 0 1 1 2 0 0 0 2 0 -3 2 1 2 0 0 0 1 0 0 -5 6 1 1 2 0 0 0 2 0 \ No newline at end of file +0 0 1 1 2 0 0 0 2 0 +3 2 1 2 0 0 0 1 0 0 +5 6 1 1 2 0 0 0 2 0 From fbd902217ed3d7654d24025851e92c40c2927fee Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Thu, 24 Jun 2021 16:01:31 +0300 Subject: [PATCH 2/3] Add a job to check for whitespace errors I called it "lint" so that other checks could be added to it later. --- .github/workflows/pr_checks.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 0201fb6f69..5c4bdb499e 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -27,3 +27,11 @@ jobs: run: | pytest -v datum -h + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Checking whitespace + run: | + empty_tree="$(git hash-object -t tree --stdin < /dev/null)" + git diff --check "$empty_tree" From 371416274f68a28abcb29040e602814baf59b802 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Thu, 24 Jun 2021 16:07:14 +0300 Subject: [PATCH 3/3] Bump copyright years in changed files --- datumaro/components/__init__.py | 2 +- datumaro/components/algorithms/__init__.py | 2 +- datumaro/plugins/accuracy_checker_plugin/__init__.py | 2 +- datumaro/plugins/openvino_plugin/launcher.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datumaro/components/__init__.py b/datumaro/components/__init__.py index eb864e52b5..6ea3037239 100644 --- a/datumaro/components/__init__.py +++ b/datumaro/components/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2020 Intel Corporation +# Copyright (C) 2019-2021 Intel Corporation # # SPDX-License-Identifier: MIT diff --git a/datumaro/components/algorithms/__init__.py b/datumaro/components/algorithms/__init__.py index eb864e52b5..6ea3037239 100644 --- a/datumaro/components/algorithms/__init__.py +++ b/datumaro/components/algorithms/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2020 Intel Corporation +# Copyright (C) 2019-2021 Intel Corporation # # SPDX-License-Identifier: MIT diff --git a/datumaro/plugins/accuracy_checker_plugin/__init__.py b/datumaro/plugins/accuracy_checker_plugin/__init__.py index f19d9bef37..dc281deb65 100644 --- a/datumaro/plugins/accuracy_checker_plugin/__init__.py +++ b/datumaro/plugins/accuracy_checker_plugin/__init__.py @@ -1,3 +1,3 @@ -# Copyright (C) 2020 Intel Corporation +# Copyright (C) 2020-2021 Intel Corporation # # SPDX-License-Identifier: MIT diff --git a/datumaro/plugins/openvino_plugin/launcher.py b/datumaro/plugins/openvino_plugin/launcher.py index 9e6d9db3e0..4de5cedbc0 100644 --- a/datumaro/plugins/openvino_plugin/launcher.py +++ b/datumaro/plugins/openvino_plugin/launcher.py @@ -1,5 +1,5 @@ -# Copyright (C) 2019-2020 Intel Corporation +# Copyright (C) 2019-2021 Intel Corporation # # SPDX-License-Identifier: MIT