Skip to content

Commit efd238d

Browse files
author
Roman Donchenko
authored
Merge pull request openvinotoolkit#827 from IRDonch/release-2020.1
Merge OpenVINO toolkit 2020.1 content into master
2 parents e372d41 + 2e7d42a commit efd238d

File tree

856 files changed

+29503
-30590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

856 files changed

+29503
-30590
lines changed

.gitattributes

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,18 @@
77
/demos/build_demos_msvc.bat omz.package=w
88
/demos/tests/** -omz.package
99
/tools/downloader/tests/** -omz.package
10+
11+
/ci/requirements-ac.txt omz.ci.job-for-change.ac
12+
/ci/requirements-conversion.txt omz.ci.job-for-change.demos omz.ci.job-for-change.models
13+
/ci/requirements-demos.txt omz.ci.job-for-change.demos
14+
/ci/requirements-downloader.txt omz.ci.job-for-change.demos omz.ci.job-for-change.models
15+
16+
/demos/** omz.ci.job-for-change.demos
17+
/demos/**/*.md -omz.ci.job-for-change.demos
18+
19+
/models/** omz.ci.job-for-change.documentation
20+
/models/**/*.yml -omz.ci.job-for-change.documentation
21+
22+
/tools/accuracy_checker/** omz.ci.job-for-change.ac
23+
/tools/downloader/** omz.ci.job-for-change.downloader
24+
/tools/**/*.md -omz.ci.job-for-change.ac -omz.ci.job-for-change.downloader

CONTRIBUTING.md

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
# How to Contribute Models to Open Model Zoo
2+
3+
We appreciate your intention to contribute model to the OpenVINO™ Open Model Zoo (OMZ). OMZ is licensed under the Apache\* License, Version 2.0. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms. Note that we accept models under permissive licenses, such as **MIT**, **Apache 2.0**, and **BSD-3-Clause**. Otherwise, it might take longer time to get your model approved.
4+
5+
Frameworks supported by the Open Model Zoo:
6+
* Caffe\*
7+
* Caffe2\* (via conversion to ONNX\*)
8+
* TensorFlow\*
9+
* PyTorch\* (via conversion to ONNX\*)
10+
* MXNet\*
11+
12+
Open Model Zoo also supports models already in the ONNX format.
13+
14+
## Pull Request Requirements
15+
16+
To contribute to OMZ, create a pull request (PR) in this repository using the `develop` branch.
17+
Pull requests are strictly formalized and are reviewed by the OMZ maintainers for consistence and legal compliance.
18+
19+
Each PR contributing a model must contain:
20+
* [configuration file `model.yml`](#configuration-file)
21+
* [documentation of model in markdown format](#documentation)
22+
* [accuracy validation configuration file](#accuracy-validation)
23+
* (*optional*) [demo](#demo)
24+
25+
Follow the rules in the sections below before submitting a pull request.
26+
27+
### Model Name
28+
29+
Name your model in OMZ according to the following rules:
30+
- Use a name that is consistent with an original name, but complete match is not necessary
31+
- Use lowercase
32+
- Use `-`(preferable) or `_` as delimiters, for spaces are not allowed
33+
- Add a suffix according to framework identifier (see **`framework`** description in the [configuration file](#configuration-file) section for examples), if the model is a reimplementation of an existing model from another framework
34+
35+
This name will be used for downloading, converting, and other operations.
36+
Examples of model names:
37+
- `resnet-50-pytorch`
38+
- `mobilenet-v2-1.0-224`
39+
40+
### Files Location
41+
42+
Place your files as shown in the table below:
43+
44+
File | Destination
45+
---|---
46+
configuration file | `models/public/<model_name>/model.yml`
47+
documentation file | `models/public/<model_name>/<model_name>.md`
48+
validation configuration file|`tools/accuracy_checker/configs/<model_name>.yml`
49+
demo|`demos/<demo_name>`<br>or<br>`demos/python_demos/<demo_name>`
50+
51+
### Tests
52+
53+
Your PR must pass next tests:
54+
* Model is downloadable by the `tools/downloader/downloader.py` script. See [Configuration file](#configuration-file) for details.
55+
* Model is convertible by the `tools/downloader/converter.py` script. See [Model conversion](#model-conversion) for details.
56+
* Model is usable by demo or sample and provides adequate results. See [Demo](#demo) for details.
57+
* Model passes accuracy validation. See [Accuracy validation](#accuracy-validation) for details.
58+
59+
60+
### PR Rejection
61+
62+
Your PR may be rejected in some cases, for example:
63+
* If a license is inappropriate (such as GPL-like licenses).
64+
* If a dataset is inaccessible.
65+
* If the PR fails one of the tests above.
66+
67+
## Configuration File
68+
69+
The model configuration file contains information about model: what it is, how to download it, and how to convert it to the IR format. This information must be specified in the `model.yml` file that must be located in the model subfolder.
70+
71+
The detailed descriptions of file entries provided below.
72+
73+
**`description`**
74+
75+
Description of the model. Must match with the description from the model [documentation](#documentation).
76+
77+
**`task_type`**
78+
79+
[Model task type](tools/downloader/README.md#model-information-dumper-usage). If there is no task type of your model, add a new one to the list `KNOWN_TASK_TYPES` of the [tools/downloader/common.py](tools/downloader/common.py) file.
80+
81+
**`files`**
82+
83+
> **NOTE**: Before filling this section, make sure that the model can be downloaded either via a direct HTTP(S) link or from Google Drive\*.
84+
85+
Downloadable files. Each file is described by:
86+
87+
* `name` - sets a file name after downloading
88+
* `size` - sets a file size
89+
* `sha256` - sets a file hash sum
90+
* `source` - sets a direct link to a file *OR* describes a file access parameters
91+
92+
> **TIP**: You can obtain a hash sum using the `sha256sum <file_name>` command on Linux\*.
93+
94+
If file is located on Google Drive\*, the `source` section must contain:
95+
- `$type: google_drive`
96+
- `id` file ID on Google Drive\*
97+
98+
> **NOTE:** If file is on GitHub\*, use the specific file version.
99+
100+
**`postprocessing`** (*optional*)
101+
102+
Post processing of the downloaded files.
103+
104+
For unpacking archive:
105+
- `$type: unpack_archive`
106+
- `file` — Archive file name
107+
- `format` — Archive format (zip | tar | gztar | bztar | xztar)
108+
109+
For replacement operation:
110+
- `$type: regex_replace`
111+
- `file` — Name of file to run replacement in
112+
- `pattern`[Regular expression](https://docs.python.org/3/library/re.html)
113+
- `replacement` — Replacement string
114+
- `count` (*optional*) — Exact number of replacements (if number of `pattern` occurrences less then this number, downloading will be aborted)
115+
116+
**`conversion_to_onnx_args`** (*only for Caffe2\*, PyTorch\* models*)
117+
118+
List of ONNX\* conversion parameters, see `model_optimizer_args` for details.
119+
120+
**`model_optimizer_args`**
121+
122+
Conversion parameters (learn more in the [Model conversion](#model-conversion) section). For example:
123+
```
124+
- --input=data
125+
- --mean_values=data[127.5]
126+
- --scale_values=data[127.5]
127+
- --reverse_input_channels
128+
- --output=prob
129+
- --input_model=$conv_dir/googlenet-v3.onnx
130+
```
131+
132+
> **NOTE:** Do not specify `framework`, `data_type`, `model_name` and `output_dir`, since they are deduced automatically.
133+
134+
> **NOTE:** `$dl_dir` used to substitute subdirectory of downloaded model and `$conv_dir` used to substitute subdirectory of converted model.
135+
136+
**`framework`**
137+
138+
Framework of the original model (see [here](tools/downloader/README.md#model-information-dumper-usage) for details).
139+
140+
**`license`**
141+
142+
URL of the model license.
143+
144+
### Example
145+
146+
This example shows how to download the classification model [DenseNet-121*](models/public/densenet-121-tf/model.yml) pretrained in TensorFlow\* from Google Drive\* as an archive.
147+
148+
```
149+
description: >-
150+
This is a TensorFlow\* version of `densenet-121` model, one of the DenseNet
151+
group of models designed to perform image classification. The weights were converted
152+
from DenseNet-Keras Models. For details see repository <https://github.com/pudae/tensorflow-densenet/>,
153+
paper <https://arxiv.org/pdf/1608.06993.pdf>
154+
task_type: classification
155+
files:
156+
- name: tf-densenet121.tar.gz
157+
size: 30597420
158+
sha256: b31ec840358f1d20e1c6364d05ce463cb0bc0480042e663ad54547189501852d
159+
source:
160+
$type: google_drive
161+
id: 0B_fUSpodN0t0eW1sVk1aeWREaDA
162+
postprocessing:
163+
- $type: unpack_archive
164+
format: gztar
165+
file: tf-densenet121.tar.gz
166+
model_optimizer_args:
167+
- --reverse_input_channels
168+
- --input_shape=[1,224,224,3]
169+
- --input=Placeholder
170+
- --mean_values=Placeholder[123.68,116.78,103.94]
171+
- --scale_values=Placeholder[58.8235294117647]
172+
- --output=densenet121/predictions/Reshape_1
173+
- --input_meta_graph=$dl_dir/tf-densenet121.ckpt.meta
174+
framework: tf
175+
license: https://raw.githubusercontent.com/pudae/tensorflow-densenet/master/LICENSE
176+
```
177+
178+
## Model Conversion
179+
180+
Deep Learning Inference Engine (IE) supports models in the Intermediate Representation (IR) format. A model from any supported framework can be converted to IR using the Model Optimizer tool included in the OpenVINO&trade; toolkit. Find more information about conversion in the [Model Optimizer Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html). After a successful conversion you get a model in the IR format, with the `*.xml` file representing the net graph and the `*.bin` file containing the net parameters.
181+
182+
> **NOTE 1**: Image preprocessing parameters (mean and scale) must be built into a converted model to simplify model usage.
183+
184+
> **NOTE 2**: If a model input is a color image, color channel order should be `BGR`.
185+
186+
## Demo
187+
188+
A demo shows the main idea of how to infer a model using IE. If your model solves one of the tasks supported by the Open Model Zoo, try to find an appropriate option from [demos](demos/README.md) or [samples](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Samples_Overview.html). Otherwise, you must provide your own demo (C++ or Python).
189+
190+
The demo's name should end with `_demo` suffix to follow the convention of the project.
191+
192+
Demos are required to support the following keys:
193+
194+
- `-i "<input>"`: Required. Input to process.
195+
- `-m "<path>"`: Required. Path to an .xml file with a trained model. If the demo uses several models at the same time, use other keys prefixed with `-m_`.
196+
- `-d "<device>"`: Optional. Specifies a target device to infer on. CPU, GPU, FPGA, HDDL or MYRIAD is acceptable. Default must be CPU. If the demo uses several models at the same time, use keys prefixed with `d_` (just like keys `m_*` above) to specify device for each model.
197+
- `-no_show`: Optional. Do not visualize inference results.
198+
199+
> **TIP**: For Python, it is preferable to use `--` instead of `-` for long keys.
200+
201+
You can also add any other necessary parameters.
202+
203+
Add `README.md` file, which describes demo usage. Update [demos' README.md](demos/README.md) adding your demo to the list.
204+
205+
## Accuracy Validation
206+
207+
Accuracy validation can be performed by the [Accuracy Checker](./tools/accuracy_checker) tool. This tool can use either IE to run a converted model, or an original framework to run an original model. Accuracy Checker supports lots of datasets, metrics and preprocessing options, which simplifies validation if a task is supported by the tool. You only need to create a configuration file that contains necessary parameters for accuracy validation (specify a dataset and annotation, pre- and post-processing parameters, accuracy metrics to compute and so on) of converted model. For details, refer to [Testing new models](./tools/accuracy_checker#testing-new-models).
208+
209+
If a model uses a dataset which is not supported by the Accuracy Checker, you also must provide the license and the link to it and mention it in the PR description.
210+
211+
When the configuration file is ready, you must run the Accuracy Checker to obtain metric results. If they match your results, that means conversion was successful and the Accuracy Checker fully supports your model, metric and dataset. Otherwise, recheck the [conversion](#model-conversion) parameters or the validation configuration file.
212+
213+
### Example
214+
215+
This example uses one of the files from `tools/accuracy_checker/configs` — validation configuration file for [DenseNet-121](tools/accuracy_checker/configs/densenet-121-tf.yml)\* from TensorFlow\*:
216+
```
217+
models:
218+
- name: densenet-121-tf
219+
launchers:
220+
- framework: dlsdk
221+
tags:
222+
- FP32
223+
model: public/densenet-121-tf/FP32/densenet-121-tf.xml
224+
weights: public/densenet-121-tf/FP32/densenet-121-tf.bin
225+
adapter: classification
226+
227+
- framework: dlsdk
228+
tags:
229+
- FP16
230+
model: public/densenet-121-tf/FP16/densenet-121-tf.xml
231+
weights: public/densenet-121-tf/FP16/densenet-121-tf.bin
232+
adapter: classification
233+
234+
datasets:
235+
- name: imagenet_1000_classes
236+
preprocessing:
237+
- type: resize
238+
size: 256
239+
- type: crop
240+
size: 224
241+
```
242+
243+
244+
## Documentation
245+
246+
Documentation is a very important part of model contribution as it helps to better understand the possible usage of the model. Documentation must be named in accordance with the name of the model.
247+
The documentation should contain:
248+
* description of a model
249+
* main purpose
250+
* features
251+
* references to a paper or/and a source
252+
* model specification
253+
* type
254+
* framework
255+
* GFLOPs (*if available*)
256+
* number of parameters (*if available*)
257+
* validation dataset description and/or a link
258+
* main accuracy values (also description of a metric)
259+
* detailed description of input and output for original and converted models
260+
* the model's licensing terms
261+
262+
Learn the detailed structure and headers naming convention from any model documentation (for example, [alexnet](./models/public/alexnet/alexnet.md)).
263+
264+
## Legal Information
265+
266+
[\*] Other names and brands may be claimed as the property of others.
267+
268+
OpenVINO is a trademark of Intel Corporation or its subsidiaries in the U.S. and/or other countries.
269+
270+
Copyright &copy; 2018-2019 Intel Corporation
271+
272+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
273+
```
274+
http://www.apache.org/licenses/LICENSE-2.0
275+
```
276+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# [OpenVINO™ Toolkit](https://01.org/openvinotoolkit) - Open Model Zoo repository
2-
[![Build Status](http://134.191.240.124/buildStatus/icon?job=omz/2018/trigger)](http://134.191.240.124/job/omz/job/2018/job/trigger/)
3-
[![Stable release](https://img.shields.io/badge/version-2019_R3.1-green.svg)](https://github.com/opencv/open_model_zoo/releases/tag/2019_R3.1)
2+
[![Stable release](https://img.shields.io/badge/version-2020.1-green.svg)](https://github.com/opencv/open_model_zoo/releases/tag/2020.1)
43
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/open_model_zoo/community)
54
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
65

@@ -34,6 +33,8 @@ We welcome community contributions to the Open Model Zoo repository. If you have
3433
* In case of a larger feature, provide a relevant demo.
3534
* Submit a pull request at https://github.com/opencv/open_model_zoo/pulls
3635

36+
You can find additional information about model contribution [here](CONTRIBUTING.md).
37+
3738
We will review your contribution and, if any additional fixes or modifications are needed, may give you feedback to guide you. When accepted, your pull request will be merged into the GitHub* repositories.
3839

3940
Open Model Zoo is licensed under Apache License, Version 2.0. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.

ci/get-jobs-for-changes.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/python3
2+
3+
# Copyright (c) 2019 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
"""
18+
A script that prints a JSON description of the CI jobs necessary to validate
19+
the changes made between a base commit and the current commit.
20+
21+
The output format is a an object where each key is the identifier of the job
22+
and the corresponding value represents that job's parameters. The value
23+
is usually just "true" (which just means that the job should be run), but
24+
for the "models" job the value can be an array of names of models that should
25+
be validated.
26+
"""
27+
28+
import argparse
29+
import json
30+
import re
31+
import subprocess
32+
import sys
33+
34+
from pathlib import Path, PurePosixPath
35+
36+
RE_ATTRIB_NAME = re.compile(r"omz\.ci\.job-for-change\.(.+)")
37+
38+
def group_by_n(iterable, n):
39+
return zip(*[iter(iterable)] * n)
40+
41+
def main():
42+
parser = argparse.ArgumentParser()
43+
parser.add_argument('base_commit', metavar='COMMIT')
44+
args = parser.parse_args()
45+
46+
git_diff_output = subprocess.check_output(
47+
["git", "diff", "--name-only", "-z", args.base_commit + "...HEAD"])
48+
changed_files = list(map(PurePosixPath, git_diff_output.decode()[:-1].split("\0")))
49+
50+
models_dir = PurePosixPath("models")
51+
52+
jobs = {}
53+
54+
for changed_file in changed_files:
55+
if models_dir in changed_file.parents and changed_file.name == "model.yml":
56+
if Path(changed_file).exists(): # it might've been deleted in the branch
57+
jobs.setdefault("models", []).append(changed_file.parent.name)
58+
59+
git_check_attr_output = subprocess.run(
60+
["git", "check-attr", "--stdin", "-z", "--all"],
61+
input=git_diff_output, stdout=subprocess.PIPE, check=True).stdout
62+
63+
for path, attribute, value in group_by_n(git_check_attr_output.decode()[:-1].split("\0"), 3):
64+
attribute_match = RE_ATTRIB_NAME.fullmatch(attribute)
65+
if value != 'unset' and attribute_match:
66+
jobs[attribute_match.group(1)] = True
67+
68+
json.dump(jobs, sys.stdout)
69+
print()
70+
71+
if __name__ == "__main__":
72+
main()

0 commit comments

Comments
 (0)