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

Add openvino interpreter samples #159

Merged
merged 7 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
90 changes: 90 additions & 0 deletions datumaro/plugins/openvino/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# OpenVINO™ Inference Interpreter
Interpreter samples to parse OpenVINO™ inference outputs.

## Models supported from interpreter samples
There are detection and image classification examples.

- Detection (SSD-based)
- 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-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)
- [vehicle-detection-0200](https://docs.openvinotoolkit.org/latest/omz_models_intel_vehicle_detection_0200_description_vehicle_detection_0200.html)
- [vehicle-detection-0201](https://docs.openvinotoolkit.org/latest/omz_models_intel_vehicle_detection_0201_description_vehicle_detection_0201.html)
- [vehicle-detection-0202](https://docs.openvinotoolkit.org/latest/omz_models_intel_vehicle_detection_0202_description_vehicle_detection_0202.html)

- Public Pre-Trained Models(OMZ) > Object Detection
- [ssd_mobilenet_v1_coco](https://docs.openvinotoolkit.org/latest/omz_models_public_ssd_mobilenet_v1_coco_ssd_mobilenet_v1_coco.html)
- [ssd_mobilenet_v2_coco](https://docs.openvinotoolkit.org/latest/omz_models_public_ssd_mobilenet_v2_coco_ssd_mobilenet_v2_coco.html)

- Image Classification
- Public Pre-Trained Models(OMZ) > Classification
- [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).
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.

## Model download
- Prerequisites
- OpenVINO™ (To install OpenVINO™, please see the [OpenVINO™ Installation Instruction](https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html))
- 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))

```bash
# cd <openvino_dir>/deployment_tools/open_model_zoo/tools/downloader
# ./downloader.py --name <model_name>
#
# Examples
cd /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader
./downloader.py --name face-detection-0200
```

## Model inference
- 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
# source <openvino_dir>/bin/setupvars.sh
# datum create -o <proj_dir>
# datum model add -l <launcher> -p <proj_dir> --copy -- -d <path_to_xml> -w <path_to_bin> -i <path_to_interpreter_script>
# datum add path -p <proj_dir> -f <format> <path_to_dataset>
# datum model run -p <proj_dir> -m model-0
#
# Examples
# Detection> ssd_mobilenet_v2_coco
source /opt/intel/openvino/bin/setupvars.sh
cd datumaro/plugins/openvino
datum create -o proj_ssd_mobilenet_v2_coco_detection
datum model add -l openvino -p proj_ssd_mobilenet_v2_coco_detection --copy -- \
--output-layers=do_ExpandDims_conf/sigmoid \
-d model/ssd_mobilenet_v2_coco.xml \
-w model/ssd_mobilenet_v2_coco.bin \
-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
datum create -o proj_mobilenet_v2_classification
datum model add -l openvino -p proj_mobilenet_v2_classification --copy -- \
-d model/mobilenet-v2-pytorch.xml \
-w model/mobilenet-v2-pytorch.bin \
-i samples/mobilenet_v2_pytorch_interp.py
datum add path -p proj_mobilenet_v2_classification -f voc VOCdevkit/
datum model run -p proj_mobilenet_v2_classification -m model-0
```
Empty file.
91 changes: 91 additions & 0 deletions datumaro/plugins/openvino/samples/coco.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
person
bicycle
car
motorcycle
airplane
bus
train
truck
boat
trafficlight
firehydrant
streetsign
stopsign
parkingmeter
bench
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe
hat
backpack
umbrella
shoe
eyeglasses
handbag
tie
suitcase
frisbee
skis
snowboard
sportsball
kite
baseballbat
baseballglove
skateboard
surfboard
tennisracket
bottle
plate
wineglass
cup
fork
knife
spoon
bowl
banana
apple
sandwich
orange
broccoli
carrot
hotdog
pizza
donut
cake
chair
couch
pottedplant
bed
mirror
diningtable
window
desk
toilet
door
tv
laptop
mouse
remote
keyboard
cellphone
microwave
oven
toaster
sink
refrigerator
blender
book
clock
vase
scissors
teddybear
hairdrier
toothbrush
hairbrush
Loading