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

Add openvino interpreter samples #159

merged 7 commits into from
Mar 17, 2021

Conversation

chuneuny-emily
Copy link
Contributor

Summary

This PR includes ,

  • README.md, which explains what models are supported in the samples, and how to download OpenVINO models.
  • Keyword in sampler was modified to match the format of the interpreter. ('score' -> 'confidences')
  • Modified the words of test_sampler.py accordingly.
  • The example of the user manual has been modified to fit the refactored sampler(Refactor sampler #149).

How to test

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT

@zhiltsov-max
Copy link
Contributor

I suggest moving openvino_interpreter_samples into openvino/samples and renaming openvino_launcher.py into openvino/launcher.py.

…openvino_launcher.py into openvino/launcher.py.
@chuneuny-emily
Copy link
Contributor Author

I updated the requested changes. Can you review it again?

@zhiltsov-max
Copy link
Contributor

We've discussed the problem with importing openvino launcher after these changes, but I don't see any changes here regarding this. Have you tested the patch?

@chuneuny-emily
Copy link
Contributor Author

Yes. I tested. It works well. The reason previously openvino was not found, was because I had used python datum.py in repo instead of datum installed(v0.1.6.1)

datumaro/plugins/openvino/README.md Outdated Show resolved Hide resolved
- vehicle-detection-0202 (https://docs.openvinotoolkit.org/latest/omz_models_intel_vehicle_detection_0202_description_vehicle_detection_0202.html)

- Public Pre-Trained Models(OMZ)
- Classification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, it would be great, if you gave a notion about classes of supported models, instead of specific models. This would also cover custom, manually-converted models.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you give an example? The model link contains model input/output info. Do you want to change,
before

to

Copy link
Contributor

@zhiltsov-max zhiltsov-max Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'm speaking about a line "or any other model with the last layer of type DetectionOutput" or any other similar kind of advice for searching other classes of models, which can be supported, but not tested (including custom user models). Or any instruction on how to get a (potentially, custom) model to work.

datumaro/plugins/openvino/README.md Outdated Show resolved Hide resolved
datumaro/plugins/openvino/README.md Outdated Show resolved Hide resolved

## Model inference
- Prerequisites:
- Put the models downloaded in <datumaro_root_dir>/datumaro/plugins/openvino/models
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach doesn't look right. Do your examples only work with manually downloaded Datumaro repository? For a typical user, <datumaro_root_dir> is somewhere in the python libraries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only the part that performs inference under the premise that the Datumaro repo is received. Do yo want to insert Datumaro ?

datumaro/plugins/openvino/README.md Outdated Show resolved Hide resolved
@zhiltsov-max
Copy link
Contributor

Add a link to the plugin docs in the user manual.

@chuneuny-emily
Copy link
Contributor Author

I uploaded PR again based on your comments. Please review it.

- OpenVINO models (To download OpenVINO models, please go https://docs.openvinotoolkit.org/latest/omz_tools_downloader_README.html)
- VOCdevkit dataset (To download VOC2012 dataset, please go http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit)
- 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)
Copy link
Contributor

@zhiltsov-max zhiltsov-max Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing )

Suggested change
- OpenVINO™ models (To download OpenVINO™ models, please see the [Model Downloader Instruction] https://docs.openvinotoolkit.org/latest/omz_tools_downloader_README.html)
- OpenVINO™ models (To download OpenVINO™ models, please see the [Model Downloader Instruction] https://docs.openvinotoolkit.org/latest/omz_tools_downloader_README.html))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- VOCdevkit dataset (To download VOC2012 dataset, please go http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit)
- 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)
Copy link
Contributor

@zhiltsov-max zhiltsov-max Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing )

Suggested change
- PASCAL VOC 2012 dataset (To download VOC 2012 dataset, please go [VOC2012 download](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit)
- PASCAL VOC 2012 dataset (To download VOC 2012 dataset, please go [VOC2012 download](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -43,30 +50,31 @@ Interpreter samples to parse OpenVINO inference outputs.

## Model inference
- Prerequisites:
- Put the models downloaded in <datumaro_root_dir>/datumaro/plugins/openvino/models
- Put the VOCdevkit dataset downloaded in <datumaro_root_dir>
- OpenVINO™ (To install OpenVINO™, please see the [OpenVINO™ Installation Instruction](https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html)
Copy link
Contributor

@zhiltsov-max zhiltsov-max Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ) (+3 next)

Suggested change
- OpenVINO™ (To install OpenVINO™, please see the [OpenVINO™ Installation Instruction](https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html)
- OpenVINO™ (To install OpenVINO™, please see the [OpenVINO™ Installation Instruction](https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# 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
. /opt/intel/openvino_2021/bin/setupvars.sh
/opt/intel/openvino_2021/bin/setupvars.sh
Copy link
Contributor

@zhiltsov-max zhiltsov-max Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

. or source in the beginning is required

Suggested change
/opt/intel/openvino_2021/bin/setupvars.sh
. /opt/intel/openvino/bin/setupvars.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we install openvino 2021.r1, the default path is /opt/intel/openvino_2021, not /opt/intel/openvino. The default path like openvino_2021 had been using since openvino 2021.r1. Do you still want me to change it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to openvino because we don't know user which Openvino version will install. openvino is more general. So I changed it.

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, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image_results.append(Bbox(x, y, w, h, label=label, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
image_results.append(Bbox(x, y, w, h, label=label,
attributes={ 'score': conf, 'scores': list(map(float, det_confs)) }
))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image_results.append(Bbox(x, y, w, h, label=label, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
image_results.append(Bbox(x, y, w, h, label=label,
attributes={ 'score': conf, 'scores': list(map(float, det_confs)) }
))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image_results.append(Bbox(x, y, w, h, label=label, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
image_results.append(Bbox(x, y, w, h, label=label,
attributes={ 'score': conf, 'scores': list(map(float, det_confs)) }
))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image_results.append(Bbox(x, y, w, h, label=label, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
image_results.append(Bbox(x, y, w, h, label=label,
attributes={ 'score': conf, 'scores': list(map(float, det_confs)) }
))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image_results.append(Bbox(x, y, w, h, label=label, attributes={"score": conf, "scores": list(map(float, det_confs)),},))
image_results.append(Bbox(x, y, w, h, label=label,
attributes={ 'score': conf, 'scores': list(map(float, det_confs)) }
))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# Examples
# Detection> ssd_mobilenet_v2_coco
/opt/intel/openvino_2021/bin/setupvars.sh
cd /home/cvalgo/workspace/datumaro/datumaro/plugins/openvino/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cd /home/cvalgo/workspace/datumaro/datumaro/plugins/openvino/
cd datumaro/plugins/openvino/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 71 to 74
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 /home/cvalgo/workspace/datumaro/VOCdevkit
datum model run -p proj_ssd_mobilenet_v2_coco_detection -m model-0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 /home/cvalgo/workspace/datumaro/VOCdevkit
datum model run -p proj_ssd_mobilenet_v2_coco_detection -m model-0
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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- PASCAL VOC 2012 dataset (To download VOC 2012 dataset, please go [VOC2012 download](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit)
- PASCAL VOC 2012 dataset (To download VOC 2012 dataset, please go [VOC2012 download](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- OpenVINO™ models (To download OpenVINO™ models, please see the [Model Downloader Instruction] https://docs.openvinotoolkit.org/latest/omz_tools_downloader_README.html)
- OpenVINO™ models (To download OpenVINO™ models, please see the [Model Downloader Instruction] (https://docs.openvinotoolkit.org/latest/omz_tools_downloader_README.html))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

## 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Datumaro (To install Datumaro, please see the [User Manual](docs/user_manual.md)
- Datumaro (To install Datumaro, please see the [User Manual](docs/user_manual.md))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


## 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- OpenVINO™ (To install OpenVINO™, please see the [OpenVINO™ Installation Instruction](https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html)
- OpenVINO™ (To install OpenVINO™, please see the [OpenVINO™ Installation Instruction](https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Interpreter samples to parse OpenVINO™ inference outputs.

## Models supported from interpreter samples
There are 5 SSD and 1 image classification interpreter samples.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There are 5 SSD and 1 image classification interpreter samples.
There are detection and image classification examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

## Models supported from interpreter samples
There are 5 SSD and 1 image classification interpreter samples.

- 5 SSD interpreter samples support the following models.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 5 SSD interpreter samples support the following models.
- Detection (SSD-based)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@chuneuny-emily
Copy link
Contributor Author

I uploaded PR again based on your comments. Can you review it?

@zhiltsov-max zhiltsov-max merged commit a698cac into openvinotoolkit:develop Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants