Skip to content

Commit e37a163

Browse files
authored
Merge pull request #2557 from openvinotoolkit/release
Merge OpenVINO toolkit 2021.4 content into master
2 parents 9ca5dbe + 57909c1 commit e37a163

File tree

1,600 files changed

+68908
-42985
lines changed

Some content is hidden

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

1,600 files changed

+68908
-42985
lines changed

.flake8

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ exclude=
33
# generic excludes
44
.git,__pycache__,
55
# generated files
6-
demos/speech_recognition_demo/python/ctcdecode-numpy/ctcdecode_numpy/impl.py,
6+
demos/speech_recognition_deepspeech_demo/python/ctcdecode-numpy/ctcdecode_numpy/impl.py,
77
models/public/mozilla-deepspeech-0.8.2/mds_convert_utils/memmapped_file_system_pb2.py,
88

99
select=
10+
# flake8-comprehensions issues
11+
C4,
1012
# indentation problems
1113
E10,E11,
1214
# closing bracket does not match indentation of opening brackets line

.gitattributes

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
/demos/tests/** -omz.package
1818
/tools/downloader/tests/** -omz.package
1919

20+
* omz.package.component=dev
21+
/LICENSE omz.package.component=tools
22+
/data/dataset_definitions.yml omz.package.component=tools
23+
/models/**/*.py omz.package.component=tools
24+
/models/**/*.yml omz.package.component=tools
25+
/tools/**/* omz.package.component=tools
26+
27+
/ci/dependencies.yml omz.ci.job-for-change.ac omz.ci.job-for-change.demos omz.ci.job-for-change.models
28+
2029
/ci/requirements-ac.txt omz.ci.job-for-change.ac
2130
/ci/requirements-ac-test.txt omz.ci.job-for-change.ac
2231
/ci/requirements-conversion.txt omz.ci.job-for-change.demos omz.ci.job-for-change.models
@@ -25,11 +34,9 @@
2534
/ci/requirements-quantization.txt omz.ci.job-for-change.downloader
2635

2736
/demos/** omz.ci.job-for-change.demos
28-
/demos/**/*.md -omz.ci.job-for-change.demos
29-
30-
/models/** omz.ci.job-for-change.documentation
31-
/models/**/*.yml -omz.ci.job-for-change.documentation
3237

3338
/tools/accuracy_checker/** omz.ci.job-for-change.ac
39+
/tools/accuracy_checker/configs/*.yml -omz.ci.job-for-change.ac
3440
/tools/downloader/** omz.ci.job-for-change.downloader
35-
/tools/**/*.md -omz.ci.job-for-change.ac -omz.ci.job-for-change.downloader
41+
42+
*.md omz.ci.job-for-change.documentation -omz.ci.job-for-change.ac -omz.ci.job-for-change.demos -omz.ci.job-for-change.downloader

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Place your files as shown in the table below:
4444
File | Destination
4545
---|---
4646
configuration file | `models/public/<model_name>/model.yml`
47-
documentation file | `models/public/<model_name>/<model_name>.md`
47+
documentation file | `models/public/<model_name>/README.md`
4848
validation configuration file|`models/public/<model_name>/accuracy-check.yml`
4949
demo|`demos/<demo_name>`<br>or<br>`demos/python_demos/<demo_name>`
5050

@@ -76,7 +76,7 @@ Description of the model. Must match with the description from the model [docume
7676

7777
**`task_type`**
7878

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.
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 [`open_model_zoo.model_tools._common`](tools/downloader/src/open_model_zoo/model_tools/_common.py) module.
8080

8181
**`files`**
8282

@@ -193,7 +193,7 @@ Demos are required to support the following keys:
193193

194194
- `-i "<input>"`: Required. An input to process. The input can usually be a single image, a folder of images or anything that OpenCV's `VideoCapture` can process.
195195
- `-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.
196+
- `-d "<device>"`: Optional. Specifies a target device to infer on. CPU, GPU, 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.
197197
- `-no_show`: Optional. Do not visualize inference results.
198198

199199
> **TIP**: For Python, it is preferable to use `--` instead of `-` for long keys.
@@ -204,7 +204,7 @@ Add `README.md` file, which describes demo usage. Update [demos' README.md](demo
204204

205205
## Accuracy Validation
206206

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).
207+
Accuracy validation can be performed by the [Accuracy Checker](./tools/accuracy_checker/README.md) 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/README.md#testing-new-models).
208208

209209
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.
210210

@@ -232,7 +232,7 @@ models:
232232

233233
## Documentation
234234

235-
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.
235+
Documentation is a very important part of model contribution as it helps to better understand the possible usage of the model. It must be located in a `README.md` file in the model subdirectory.
236236
The documentation should contain:
237237
* description of a model
238238
* main purpose
@@ -248,7 +248,7 @@ The documentation should contain:
248248
* detailed description of input and output for original and converted models
249249
* the model's licensing terms
250250

251-
Learn the detailed structure and headers naming convention from any model documentation (for example, [alexnet](./models/public/alexnet/alexnet.md)).
251+
Learn the detailed structure and headers naming convention from any model documentation (for example, [alexnet](./models/public/alexnet/README.md)).
252252

253253
## Legal Information
254254

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
# [OpenVINO™ Toolkit](https://01.org/openvinotoolkit) - Open Model Zoo repository
2-
[![Stable release](https://img.shields.io/badge/version-2021.3-green.svg)](https://github.com/openvinotoolkit/open_model_zoo/releases/tag/2021.3)
2+
[![Stable release](https://img.shields.io/badge/version-2021.4-green.svg)](https://github.com/openvinotoolkit/open_model_zoo/releases/tag/2021.4)
33
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/open_model_zoo/community)
44
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
55

66
This repository includes optimized deep learning models and a set of demos to expedite development of high-performance deep learning inference applications. Use these free pre-trained models instead of training your own models to speed-up the development and production deployment process.
77

8+
Intel is committed to the respect of human rights and avoiding complicity in human rights abuses, a policy reflected in the [Intel Global Human Rights Principles](https://www.intel.com/content/www/us/en/policy/policy-human-rights.html). Accordingly, by accessing the Intel material on this platform you agree that you will not use the material in a product or application that causes or contributes to a violation of an internationally recognized human right.
9+
810
## Repository Components:
9-
* [Pre-Trained Models](models/intel/index.md)
10-
* [Public Models Description](models/public/index.md)
11+
* [Intel Pre-Trained Models](models/intel/index.md)
12+
* [Public Pre-Trained Models](models/public/index.md)
1113
* [Model Downloader](tools/downloader/README.md) and other automation tools
1214
* [Demos](demos/README.md) that demonstrate models usage with Deep Learning Deployment Toolkit
1315
* [Accuracy Checker](tools/accuracy_checker/README.md) tool for models accuracy validation
1416

1517
## License
1618
Open Model Zoo is licensed under [Apache License Version 2.0](LICENSE).
1719

18-
## Documentation
20+
## Online Documentation
1921
* [OpenVINO™ Release Notes](https://software.intel.com/en-us/articles/OpenVINO-RelNotes)
20-
* [Pre-Trained Models](https://software.intel.com/en-us/openvino-toolkit/documentation/pretrained-models)
21-
* [Demos and samples](https://software.intel.com/en-us/articles/OpenVINO-IE-Samples)
22+
* [Pre-Trained Models](https://docs.openvinotoolkit.org/latest/trained_models.html)
23+
* [Demos and Samples](https://docs.openvinotoolkit.org/latest/omz_demos.html)
2224

23-
## Other usage examples
25+
## Other Usage Examples
2426
* [Open Visual Cloud](https://01.org/openvisualcloud)
2527
* [Tutorial: Build and Run the AD Insertion Sample on public cloud or local machine](https://01.org/openvisualcloud/documents/tutorial-build-and-run-ad-insertion-sample-public-cloud-or-local-machine)
2628
* [GitHub Repo for Ad Insertion Sample](https://github.com/OpenVisualCloud/Ad-Insertion-Sample)
2729
* [OpenVINO for Smart City](https://github.com/incluit/OpenVino-For-SmartCity)
2830
* [OpenVINO Driver Behavior](https://github.com/incluit/OpenVino-Driver-Behaviour)
31+
* [OpenVINO Python\* Notebooks](https://github.com/openvinotoolkit/openvino_notebooks/blob/main/README.md)
2932

3033
## How to Contribute
3134
We welcome community contributions to the Open Model Zoo repository. If you have an idea how to improve the product, please share it with us doing the following steps:
35+
3236
* Make sure you can build the product and run all the demos with your patch.
3337
* In case of a larger feature, provide a relevant demo.
3438
* Submit a pull request at https://github.com/openvinotoolkit/open_model_zoo/pulls

ci/check-basics.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def complain(message):
4949
cwd=OMZ_ROOT,
5050
).stdout.strip()
5151

52-
print('running text checks...', flush=True)
52+
print('running miscellaneous checks...', flush=True)
5353

5454
if subprocess.run(['git', '--no-pager', 'diff', '--check', empty_tree_hash, '--'],
5555
cwd=OMZ_ROOT).returncode != 0:
@@ -103,6 +103,10 @@ def complain(message):
103103
complain(f"{path}: isn't a symbolic link but it should be a symbolic link to accuracy-check.yml "
104104
"from models directory")
105105

106+
if path.startswith('models/') and '/description/' in path:
107+
complain(f"{path}: the model documentation convention has changed;"
108+
" put the text in README.md and the images under /assets/")
109+
106110
if mode not in {'100644', '100755'}: # not a regular or executable file
107111
continue
108112

@@ -145,6 +149,10 @@ def complain(message):
145149
if subprocess.run([sys.executable, '-m', 'flake8', '--config=.flake8'], cwd=OMZ_ROOT).returncode != 0:
146150
all_passed = False
147151

152+
print('running documentation checks...', flush=True)
153+
if subprocess.run([sys.executable, '--', str(OMZ_ROOT / 'ci/check-documentation.py')]).returncode != 0:
154+
all_passed = False
155+
148156
sys.exit(0 if all_passed else 1)
149157

150158

ci/check-documentation.py

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
This script is like check-basics.py, but specific to the documentation.
5+
It's split off into a separate script, so that it can be easily run on its own.
6+
"""
7+
8+
import re
9+
import sys
10+
import urllib.parse
11+
import urllib.request
12+
13+
from pathlib import Path
14+
15+
OMZ_ROOT = Path(__file__).resolve().parents[1]
16+
17+
sys.path.append(str(OMZ_ROOT / 'ci/lib'))
18+
19+
import omzdocs
20+
21+
HTML_FRAGMENT_RE = re.compile(r'</?([^>\s]+)', re.IGNORECASE)
22+
23+
# taken from https://www.doxygen.nl/manual/htmlcmds.html
24+
ALLOWED_HTML_ELEMENTS = frozenset([
25+
'a', 'b', 'blockquote', 'br', 'caption', 'center', 'code', 'dd', 'del',
26+
'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
27+
'hr', 'i', 'img', 'ins', 'kbd', 'li', 'ol', 'p', 'pre', 's', 'small',
28+
'span', 'strike', 'strong', 'sub', 'sup', 'table', 'td', 'th', 'tr',
29+
'tt', 'u', 'ul', 'var',
30+
])
31+
32+
def find_md_files():
33+
thirdparty_dir = OMZ_ROOT / 'demos' / 'thirdparty'
34+
35+
for path in OMZ_ROOT.glob('**/*.md'):
36+
if thirdparty_dir in path.parents: continue
37+
yield path
38+
39+
def main():
40+
all_passed = True
41+
42+
index_file_paths = (
43+
OMZ_ROOT / 'models/intel/index.md',
44+
OMZ_ROOT / 'models/public/index.md',
45+
OMZ_ROOT / 'demos/README.md',
46+
)
47+
48+
all_md_files = tuple(find_md_files())
49+
50+
def complain(message):
51+
nonlocal all_passed
52+
all_passed = False
53+
print(message, file=sys.stderr)
54+
55+
index_child_md_links = {}
56+
for index_file_path in index_file_paths:
57+
if not index_file_path.exists():
58+
complain(f'{index_file_path}: file not found')
59+
continue
60+
61+
required_md_links = []
62+
for md_file in all_md_files:
63+
if md_file.name == "README.md" and md_file.parent != index_file_path.parent:
64+
try:
65+
md_rel_path = md_file.relative_to(index_file_path.parent)
66+
except ValueError:
67+
continue
68+
69+
md_intermediate_parents = list(md_rel_path.parents)[1:-1] # removed root and first parent dirs
70+
71+
if not any((index_file_path.parent / parent_dir / 'README.md').exists()
72+
for parent_dir in md_intermediate_parents):
73+
required_md_links.append(md_file)
74+
75+
index_child_md_links[index_file_path] = sorted(required_md_links)
76+
77+
omz_reference_prefix = '<omz_dir>/'
78+
79+
for md_path in sorted(all_md_files):
80+
referenced_md_files = set()
81+
82+
md_path_rel = md_path.relative_to(OMZ_ROOT)
83+
84+
doc_page = omzdocs.DocumentationPage(md_path.read_text(encoding='UTF-8'))
85+
86+
# check local link validity
87+
88+
for url in sorted([ref.url for ref in doc_page.external_references()]):
89+
try:
90+
components = urllib.parse.urlparse(url)
91+
except ValueError:
92+
complain(f'{md_path_rel}: invalid URL reference {url!r}')
93+
continue
94+
95+
if components.scheme: # non-local URLs
96+
continue
97+
98+
if components.netloc or components.path.startswith('/'):
99+
complain(f'{md_path_rel}: non-relative local URL reference "{url}"')
100+
continue
101+
102+
if not components.path: # self-link
103+
continue
104+
105+
target_path = (md_path.parent / urllib.request.url2pathname(components.path)).resolve()
106+
107+
if OMZ_ROOT not in target_path.parents:
108+
complain(f'{md_path_rel}: URL reference "{url}" points outside the OMZ directory')
109+
continue
110+
111+
if not target_path.is_file():
112+
complain(f'{md_path_rel}: URL reference "{url}" target'
113+
' does not exist or is not a file')
114+
continue
115+
116+
if md_path in index_child_md_links:
117+
referenced_md_files.add(target_path)
118+
119+
# check <omz_dir> reference validity
120+
121+
for code_span in doc_page.code_spans():
122+
if code_span.startswith(omz_reference_prefix):
123+
target_path_rel = Path(code_span[len(omz_reference_prefix):])
124+
target_path = OMZ_ROOT / target_path_rel
125+
126+
if ".." in target_path_rel.parts:
127+
complain(f'{md_path_rel}: OMZ reference "{code_span}"'
128+
' contains a ".." component.')
129+
continue
130+
131+
if not target_path.exists():
132+
complain(f'{md_path_rel}: OMZ reference "{code_span}" target'
133+
' does not exist')
134+
135+
# check for existence of links to README.md files of models and demos
136+
137+
if md_path in index_child_md_links:
138+
for md_file in index_child_md_links[md_path]:
139+
if md_file not in referenced_md_files:
140+
complain(f"{md_path_rel}: {md_file.relative_to(OMZ_ROOT)} is not referenced")
141+
142+
# check for HTML fragments that are unsupported by Doxygen
143+
144+
for html_fragment in doc_page.html_fragments():
145+
match = HTML_FRAGMENT_RE.match(html_fragment)
146+
if not match:
147+
complain(f'{md_path_rel}: cannot parse HTML fragment {html_fragment!r}')
148+
continue
149+
150+
if match.group(1).lower() not in ALLOWED_HTML_ELEMENTS:
151+
complain(f'{md_path_rel}: unknown/disallowed HTML element in {html_fragment!r}')
152+
continue
153+
154+
sys.exit(0 if all_passed else 1)
155+
156+
if __name__ == '__main__':
157+
main()

ci/check-release-readiness.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,23 @@ def complain(format, *args):
3232
all_passed = False
3333

3434
for model_dir in OMZ_ROOT.glob('models/*/*/'):
35-
# searching recursively, because this could be a composite model
36-
has_config = bool(list(model_dir.glob('**/model.yml')))
35+
has_model_yml = (model_dir / 'model.yml').is_file()
36+
has_composite_model_yml = (model_dir / 'composite-model.yml').is_file()
3737

38-
has_doc = bool(list(model_dir.glob('**/*.md')))
38+
has_config = has_model_yml or has_composite_model_yml
39+
40+
has_doc = (model_dir / 'README.md').is_file()
3941

4042
if has_config and not has_doc:
4143
complain('model {} has no documentation', model_dir.name)
4244

4345
if has_doc and not has_config:
4446
complain('model {} has no config file', model_dir.name)
4547

48+
if has_composite_model_yml:
49+
if not list(model_dir.glob('*/model.yml')):
50+
complain('composite model {} has no components', model_dir.name)
51+
4652
for models_lst_path in OMZ_ROOT.glob('demos/**/models.lst'):
4753
with models_lst_path.open() as models_lst:
4854
for line_num, line in enumerate(models_lst):

ci/dependencies.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
openvino_linux: '2021.4.563'
2+
openvino_windows: '2021.4.562'

ci/documentation_updater/documentation_updater.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ def parse():
5656
return args
5757

5858

59-
def collect_readme(directory, ignored_files):
60-
files = {file.stem: file for file in directory.glob('**/*.md') if file.name not in ignored_files}
59+
def collect_readme(directory):
60+
files = {file.parent.name: file for file in directory.glob('**/README.md')}
6161
logging.info('Collected {} description files'.format(len(files)))
6262
if not files:
63-
logging.error("No markdown file found in {}. Exceptions - {}. Ensure, that you set right directory."
64-
.format(directory, ignored_files))
63+
logging.error("No markdown file found in {}. Ensure, that you set right directory."
64+
.format(directory))
6565
exit(1)
6666
return files
6767

@@ -174,8 +174,7 @@ def main():
174174
args = parse()
175175
logging.basicConfig(level=getattr(logging, args.log_level.upper()), format='%(levelname)s: %(message)s')
176176

177-
ignored_files = ('index.md',)
178-
descriptions = collect_descriptions(collect_readme(args.model_dir, ignored_files))
177+
descriptions = collect_descriptions(collect_readme(args.model_dir))
179178
models = get_models_from_configs(args.model_dir)
180179
update_model_configs(models, descriptions, args.mode)
181180

0 commit comments

Comments
 (0)