Skip to content

Commit 3386309

Browse files
author
Roman Donchenko
authored
Merge pull request #1924 from openvinotoolkit/release
Merge OpenVINO toolkit 2021.2 content into master
2 parents 75ec8ad + d70fd4e commit 3386309

File tree

1,002 files changed

+90206
-10054
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,002 files changed

+90206
-10054
lines changed

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
* text=auto
22

3+
/demos/thirdparty/** -whitespace
4+
5+
# In patches, a context line is prefixed by a space, and if it's empty,
6+
# that space becomes a trailing space. That's a valid use for trailing spaces,
7+
# so allow it.
8+
*.patch whitespace=-blank-at-eol
9+
310
.git* -omz.package
411
.editorconfig -omz.package
12+
.yamllint -omz.package
513
/ci/** -omz.package
614
/demos/build_demos.sh omz.package=l,m
715
/demos/build_demos_msvc.bat omz.package=w

.yamllint

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
yaml-files:
2+
- '*.yaml'
3+
- '*.yml'
4+
- '.yamllint'
5+
6+
# The tools/accuracy_checker/ ignores are there because those files
7+
# are all symlinks, and:
8+
# a) it's pointless to check symlinks if we check the real files too;
9+
# b) on Windows, Git turns links into regular files containing the target name,
10+
# which yamllint complains about.
11+
12+
ignore: |
13+
demos/thirdparty/
14+
tools/accuracy_checker/.yamllint
15+
tools/accuracy_checker/configs/
16+
17+
rules:
18+
line-length: disable
19+
braces: enable
20+
brackets: enable
21+
colons: disable
22+
commas: enable
23+
comments:
24+
level: warning
25+
comments-indentation:
26+
level: warning
27+
document-end: disable
28+
document-start: disable
29+
empty-lines: enable
30+
empty-values: enable
31+
hyphens: enable
32+
indentation: enable
33+
key-duplicates: enable
34+
key-ordering: disable
35+
new-line-at-end-of-file: enable
36+
new-lines: disable
37+
octal-values: disable
38+
quoted-strings: disable
39+
trailing-spaces: enable
40+
truthy: disable

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# [OpenVINO™ Toolkit](https://01.org/openvinotoolkit) - Open Model Zoo repository
2-
[![Stable release](https://img.shields.io/badge/version-2021.1-green.svg)](https://github.com/opencv/open_model_zoo/releases/tag/2021.1)
2+
[![Stable release](https://img.shields.io/badge/version-2021.2-green.svg)](https://github.com/openvinotoolkit/open_model_zoo/releases/tag/2021.2)
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

@@ -31,7 +31,7 @@ Open Model Zoo is licensed under [Apache License Version 2.0](LICENSE).
3131
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:
3232
* Make sure you can build the product and run all the demos with your patch.
3333
* In case of a larger feature, provide a relevant demo.
34-
* Submit a pull request at https://github.com/opencv/open_model_zoo/pulls
34+
* Submit a pull request at https://github.com/openvinotoolkit/open_model_zoo/pulls
3535

3636
You can find additional information about model contribution [here](CONTRIBUTING.md).
3737

@@ -42,7 +42,7 @@ Open Model Zoo is licensed under Apache License, Version 2.0. By contributing to
4242
## Support
4343
Please report questions, issues and suggestions using:
4444
* [\#open_model_zoo](https://stackoverflow.com/search?q=%23open_model_zoo) tag on StackOverflow*
45-
* [GitHub* Issues](https://github.com/opencv/open_model_zoo/issues)
45+
* [GitHub* Issues](https://github.com/openvinotoolkit/open_model_zoo/issues)
4646
* [Forum](https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit)
4747
* [Gitter](https://gitter.im/open_model_zoo/community)
4848

ci/check-basics.py

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright (c) 2020 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+
This script performs various checks on the source code that can be run quickly.
19+
The idea is that these are the kind of checks that can be run on every pull
20+
request without substantially impacting build time.
21+
"""
22+
23+
import re
24+
import subprocess
25+
import sys
26+
27+
from pathlib import Path
28+
29+
30+
OMZ_ROOT = Path(__file__).resolve().parents[1]
31+
32+
RE_SHEBANG_LINE = re.compile(r'\#! \s* (\S+) (?: \s+ (\S+))? \s*', re.VERBOSE)
33+
34+
def main():
35+
all_passed = True
36+
37+
def complain(message):
38+
nonlocal all_passed
39+
all_passed = False
40+
print(message, file=sys.stderr)
41+
42+
# get the Git magic empty tree hash
43+
empty_tree_hash = subprocess.run(
44+
['git', 'hash-object', '-t', 'tree', '--stdin'],
45+
stdin=subprocess.DEVNULL,
46+
stdout=subprocess.PIPE,
47+
check=True,
48+
universal_newlines=True,
49+
cwd=OMZ_ROOT,
50+
).stdout.strip()
51+
52+
if subprocess.run(['git', '--no-pager', 'diff', '--check', empty_tree_hash, '--'],
53+
cwd=OMZ_ROOT).returncode != 0:
54+
all_passed = False
55+
56+
raw_diff_lines = subprocess.run(
57+
['git', 'diff', '--raw', '-z', empty_tree_hash, '--'],
58+
check=True,
59+
stdout=subprocess.PIPE,
60+
cwd=OMZ_ROOT,
61+
).stdout.decode()[:-1].split('\0')
62+
63+
numstat_lines = subprocess.run(
64+
['git', 'diff', '--numstat', '-z', empty_tree_hash, '--'],
65+
check=True,
66+
stdout=subprocess.PIPE,
67+
cwd=OMZ_ROOT,
68+
).stdout.decode()[:-1].split('\0')
69+
70+
for raw_diff, path, numstat_line in zip(*[iter(raw_diff_lines)] * 2, numstat_lines):
71+
num_added_lines, num_removed_lines, numstat_path = numstat_line.split('\t', 2)
72+
assert path == numstat_path, "git diff --raw and --numstat list different files"
73+
74+
# Overly long paths cause problems in internal infrastructure due to Windows's
75+
# 259 character path length limit. Cap the repo path lengths at a known safe value.
76+
PATH_LENGTH_LIMIT = 135
77+
if len(path) > PATH_LENGTH_LIMIT:
78+
complain(f"{path}: path length ({len(path)}) over limit ({PATH_LENGTH_LIMIT})")
79+
80+
mode = raw_diff.split()[1]
81+
82+
absolute_path = OMZ_ROOT / path
83+
84+
if path.startswith('tools/accuracy_checker/configs/') and path.endswith('.yml'):
85+
if mode == '120000':
86+
try:
87+
if absolute_path.is_symlink():
88+
real_path = absolute_path.resolve(strict=True)
89+
else:
90+
with open(absolute_path, 'r', newline='') as file:
91+
link_target = file.read()
92+
real_path = (absolute_path.parent / link_target).resolve(strict=True)
93+
except FileNotFoundError:
94+
complain(f"{path}: should be a symbolic link to existing accuracy-check.yml from models directory")
95+
else:
96+
model_name = absolute_path.stem
97+
if real_path.name != 'accuracy-check.yml' or real_path.parent.name != model_name:
98+
complain(f"{path}: should be a symbolic link to accuracy-check.yml from {model_name} model "
99+
"directory")
100+
else:
101+
complain(f"{path}: isn't a symbolic link but it should be a symbolic link to accuracy-check.yml "
102+
"from models directory")
103+
104+
if mode not in {'100644', '100755'}: # not a regular or executable file
105+
continue
106+
107+
if num_added_lines == '-': # binary file
108+
continue
109+
110+
if path.startswith('demos/thirdparty/'):
111+
continue
112+
113+
with open(absolute_path, encoding='UTF-8') as f:
114+
lines = list(f)
115+
116+
if lines and not lines[-1].endswith('\n'):
117+
complain(f"{path}:{len(lines)}: last line doesn't end with a newline character")
118+
119+
has_shebang = lines and lines[0].startswith('#!')
120+
is_executable = mode == '100755'
121+
122+
if is_executable and not has_shebang:
123+
complain(f"{path}: is executable, but doesn't have a shebang line")
124+
125+
if has_shebang:
126+
if not is_executable:
127+
complain(f"{path}: has a shebang line, but isn't executable")
128+
129+
shebang_program, shebang_args = \
130+
RE_SHEBANG_LINE.fullmatch(lines[0].rstrip('\n')).groups()
131+
132+
# Python 2 is EOL and OpenVINO doesn't support it anymore. If someone
133+
# uses `#!/usr/bin/python` or something similar, it's likely a mistake.
134+
if shebang_program.endswith('/python') or (
135+
shebang_program.endswith('/env') and shebang_args == 'python'):
136+
complain(f"{path}:1: use 'python3', not 'python'")
137+
138+
if subprocess.run([sys.executable, '-m', 'yamllint', '-s', '.'], cwd=OMZ_ROOT).returncode != 0:
139+
all_passed = False
140+
141+
sys.exit(0 if all_passed else 1)
142+
143+
144+
if __name__ == '__main__':
145+
main()

ci/check-release-readiness.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ def complain(format, *args):
4545

4646
for models_lst_path in OMZ_ROOT.glob('demos/**/models.lst'):
4747
with models_lst_path.open() as models_lst:
48-
for line in models_lst:
48+
for line_num, line in enumerate(models_lst):
4949
if RE_TODO_COMMENT.search(line):
50-
complain('{} has a TODO comment', models_lst_path.relative_to(OMZ_ROOT))
50+
complain('{}:{}: line contains TODO comment',
51+
models_lst_path.relative_to(OMZ_ROOT), line_num + 1)
5152

5253
sys.exit(0 if all_passed else 1)
5354

ci/get-jobs-for-changes.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
from pathlib import Path, PurePosixPath
3535

36+
OMZ_ROOT = Path(__file__).resolve().parents[1]
37+
3638
RE_ATTRIB_NAME = re.compile(r"omz\.ci\.job-for-change\.(.+)")
3739

3840
def group_by_n(iterable, n):
@@ -44,24 +46,34 @@ def main():
4446
args = parser.parse_args()
4547

4648
git_diff_output = subprocess.check_output(
47-
["git", "diff", "--name-only", "--no-renames", "-z", args.base_commit + "...HEAD"])
49+
["git", "diff", "--name-only", "--no-renames", "-z", args.base_commit + "...HEAD"],
50+
cwd=OMZ_ROOT)
4851
changed_files = list(map(PurePosixPath, git_diff_output.decode()[:-1].split("\0")))
4952

5053
models_dir = PurePosixPath("models")
5154

5255
jobs = {}
5356

5457
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-
else:
59-
# make sure no models.lst files reference the deleted model
60-
jobs["models_lst"] = True
58+
if models_dir in changed_file.parents:
59+
if changed_file.name == "model.yml":
60+
if (OMZ_ROOT / changed_file).exists(): # it might've been deleted in the branch
61+
jobs.setdefault("models", set()).add(changed_file.parent.name)
62+
else:
63+
# make sure no models.lst files reference the deleted model
64+
jobs["models_lst"] = True
65+
66+
if changed_file.suffix == ".py":
67+
for parent in changed_file.parents:
68+
if (OMZ_ROOT / parent / "model.yml").exists():
69+
jobs.setdefault("models", set()).add(parent.name)
70+
71+
if "models" in jobs:
72+
jobs["models"] = sorted(jobs["models"]) # JSON can't work with a set
6173

6274
git_check_attr_output = subprocess.run(
6375
["git", "check-attr", "--stdin", "-z", "--all"],
64-
input=git_diff_output, stdout=subprocess.PIPE, check=True).stdout
76+
input=git_diff_output, stdout=subprocess.PIPE, check=True, cwd=OMZ_ROOT).stdout
6577

6678
for path, attribute, value in group_by_n(git_check_attr_output.decode()[:-1].split("\0"), 3):
6779
attribute_match = RE_ATTRIB_NAME.fullmatch(attribute)

ci/requirements-ac-test.txt

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
11
# use update-requirements.py to update this file
22

33
atomicwrites==1.4.0 # via -r tools/accuracy_checker/requirements-test.in
4-
attrs==19.3.0 # via pytest
4+
attrs==20.2.0 # via pytest
5+
certifi==2020.6.20 # via matplotlib
6+
click==7.1.2 # via nltk
57
cycler==0.10.0 # via matplotlib
68
decorator==4.4.2 # via networkx
79
editdistance==0.5.3 # via -r tools/accuracy_checker/requirements.in
10+
fast-ctc-decode==0.2.5 # via -r tools/accuracy_checker/requirements.in
811
imageio==2.9.0 # via scikit-image
9-
importlib-metadata==1.7.0 # via pluggy, pytest
10-
joblib==0.14.1 # via scikit-learn
11-
kiwisolver==1.1.0 # via matplotlib
12-
matplotlib==3.0.3 # via scikit-image
13-
more-itertools==8.4.0 # via pytest
14-
networkx==2.4 # via scikit-image
15-
nibabel==3.0.2 # via -r tools/accuracy_checker/requirements.in
16-
numpy==1.17.5 # via -r tools/accuracy_checker/requirements-core.in, imageio, matplotlib, nibabel, pywavelets, scikit-learn, scipy
17-
packaging==20.4 # via pytest
18-
pathlib2==2.3.5 # via pytest
19-
pillow==7.2.0 # via -r tools/accuracy_checker/requirements.in, imageio, scikit-image
12+
importlib-metadata==2.0.0 # via pluggy, pytest
13+
joblib==0.17.0 # via nltk, scikit-learn
14+
kiwisolver==1.2.0 # via matplotlib
15+
matplotlib==3.3.2 # via scikit-image
16+
more-itertools==8.5.0 # via pytest
17+
networkx==2.5 # via scikit-image
18+
nibabel==3.1.1 # via -r tools/accuracy_checker/requirements.in
19+
nltk==3.5 # via -r tools/accuracy_checker/requirements.in
20+
numpy==1.17.5 # via -r tools/accuracy_checker/requirements-core.in, imageio, matplotlib, nibabel, parasail, pywavelets, scikit-image, scikit-learn, scipy, tifffile
21+
packaging==20.4 # via nibabel, pytest
22+
parasail==1.2 # via -r tools/accuracy_checker/requirements.in
23+
pillow==8.0.0 # via -r tools/accuracy_checker/requirements-core.in, imageio, matplotlib, scikit-image
2024
pluggy==0.13.1 # via pytest
21-
py-cpuinfo==4.0.0 # via -r tools/accuracy_checker/requirements.in
25+
py-cpuinfo==7.0.0 # via -r tools/accuracy_checker/requirements.in
2226
py==1.9.0 # via pytest
2327
pydicom==2.0.0 # via -r tools/accuracy_checker/requirements.in
2428
pyparsing==2.4.7 # via matplotlib, packaging
29+
pypi-kenlm==0.1.20190403 # via -r tools/accuracy_checker/requirements.in
2530
pytest-mock==2.0.0 # via -r tools/accuracy_checker/requirements-test.in
2631
pytest==5.4.3 # via -r tools/accuracy_checker/requirements-test.in, pytest-mock
2732
python-dateutil==2.8.1 # via matplotlib
2833
pywavelets==1.1.1 # via scikit-image
2934
pyyaml==5.3.1 # via -r tools/accuracy_checker/requirements-core.in
30-
scikit-image==0.15.0 # via -r tools/accuracy_checker/requirements.in
31-
scikit-learn==0.22.2.post1 # via -r tools/accuracy_checker/requirements.in
32-
scipy==1.4.1 # via -r tools/accuracy_checker/requirements.in, scikit-image, scikit-learn
35+
regex==2020.10.15 # via nltk
36+
scikit-image==0.17.2 # via -r tools/accuracy_checker/requirements.in
37+
scikit-learn==0.23.2 # via -r tools/accuracy_checker/requirements.in
38+
scipy==1.5.2 # via -r tools/accuracy_checker/requirements.in, scikit-image, scikit-learn
3339
sentencepiece==0.1.91 # via -r tools/accuracy_checker/requirements.in
34-
shapely==1.7.0 # via -r tools/accuracy_checker/requirements.in
35-
six==1.15.0 # via packaging, pathlib2, python-dateutil
36-
tokenizers==0.8.0 # via -r tools/accuracy_checker/requirements.in
37-
tqdm==4.47.0 # via -r tools/accuracy_checker/requirements.in
40+
shapely==1.7.1 # via -r tools/accuracy_checker/requirements.in
41+
six==1.15.0 # via packaging, python-dateutil
42+
threadpoolctl==2.1.0 # via scikit-learn
43+
tifffile==2020.9.3 # via scikit-image
44+
tokenizers==0.9.1 # via -r tools/accuracy_checker/requirements.in
45+
tqdm==4.50.2 # via -r tools/accuracy_checker/requirements.in, nltk
3846
wcwidth==0.2.5 # via pytest
39-
zipp==1.2.0 # via importlib-metadata
40-
41-
# The following packages are considered to be unsafe in a requirements file:
42-
# setuptools
47+
wheel==0.35.1 # via parasail
48+
zipp==3.3.0 # via importlib-metadata

0 commit comments

Comments
 (0)