Skip to content

Commit 3805e3f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ak/yolo_models
2 parents ae9a659 + 0b1d3ec commit 3805e3f

File tree

4 files changed

+23
-28
lines changed

4 files changed

+23
-28
lines changed

demos/smartlab_demo/python/evaluator.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self):
3131
self.rider_portion = 6 # [IS_rider & MS_rider] divide the distance between 2 roundscrew1 into rider_portion portion, if rider falls in the first portion mean rider at zeroth position
3232
self.rider_move_threshold = 20 # [MS_rider_tweezers] if rider moves more than this value, check if tweezers or hand is used to move rider
3333
self.buffer_rider_size_limit = 30 # [MS_rider_tweezers]
34-
self.use_tweezers_threshold = 100 # [MS_rider_tweezers & MS_weights_tweezers] if tweezer and rider/weight distance more than tweezer treshold, consider use hand instead of use tweezer
34+
self.use_tweezers_threshold = 99 # [MS_rider_tweezers & MS_weights_tweezers] if tweezer and rider/weight distance more than tweezer treshold, consider use hand instead of use tweezer
3535
self.tweezers_warning_duration = 60 # [MS_rider_tweezers & MS_weights_tweezers] if score related to tweezers is 0 more than this duration/frames, score is 0 and unrevertible; else still revertible
3636
self.battery_aspect_ratio = 1.9
3737
self.reset()
@@ -424,7 +424,7 @@ def get_center_coordinate(self, coor):
424424
def is_inside(self, small_item_center_coor, big_item_coor):
425425
[big_x_min, big_y_min, big_x_max, big_y_max] = big_item_coor
426426
[small_center_x, small_center_y] = small_item_center_coor
427-
if small_center_x >= big_x_min and small_center_x <= big_x_max and small_center_y > big_y_min and small_center_y < big_y_max:
427+
if big_x_min <= small_center_x <= big_x_max and big_y_min < small_center_y < big_y_max:
428428
return True
429429
else:
430430
return False
@@ -574,12 +574,15 @@ def evaluate_rider_tweezers(self):
574574
elif np.linalg.norm(rider_min_coordinate - tweezers_min_coordinate) > self.use_tweezers_threshold:
575575
self.scoring['measuring_score_rider_tweezers'] = 0
576576
self.keyframe['measuring_score_rider_tweezers'] = self.frame_counter
577-
self.rider_tweezers_lock_mark = True # once detected not using tweezers, will lose mark and not able to gain back this mark again
578-
# corner case: rider and tweezer can't found correctly at the same time. we only detect tweezer_coor whether under balance
577+
# once detected not using tweezers, will lose mark and not able to gain back this mark again
578+
self.rider_tweezers_lock_mark = True
579+
# corner case: rider and tweezer can't found correctly at the same time.
580+
# we only detect tweezer_coor whether under balance
579581
elif len(tweezers_coor) == 1 and len(self.side_object_dict['balance']) == 1:
580582
tweezers_coor = self.side_object_dict['tweezers'][0]
581583
balance_coor = self.side_object_dict['balance'][0]
582-
if self.is_behind(tweezers_coor, balance_coor):
584+
if self.is_behind(tweezers_coor, balance_coor) and self.is_inside(self.get_center_coordinate(tweezers_coor),
585+
balance_coor):
583586
self.scoring['measuring_score_rider_tweezers'] = 1
584587
self.keyframe['measuring_score_rider_tweezers'] = self.frame_counter
585588

@@ -789,7 +792,7 @@ def evaluate_weights_tweezers(self, weight_inside_tray):
789792
if not self.tweezers_warning \
790793
or self.frame_counter - self.tweezers_warning < self.tweezers_warning_duration:
791794
self.tweezers_warning = None
792-
if all(use_tweezers_bool):
795+
if all(use_tweezers_bool) and len(use_tweezers_bool) > 0:
793796
self.scoring['measuring_score_weights_tweezers'] = 1
794797
self.keyframe['measuring_score_weights_tweezers'] = self.frame_counter
795798
else:

tools/accuracy_checker/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,13 @@ You can use any of them or several at a time. For correct work, Accuracy Checker
9292
If all prerequisite are installed, then you are ready to install **Accuracy Checker**:
9393

9494
```bash
95-
python3 setup.py install
95+
python3 -m pip install .
9696
```
9797

98-
Accuracy Checker is a modular tool and have some task-specific dependencies, all specific required modules can be found in `requirements.in` file.
99-
Instead of the standard installation, you can install only the core part of the tool without additional dependencies and manage them by yourself using the following command:
100-
98+
Accuracy Checker is a modular tool and have some task-specific dependencies, all specific required modules can be found in `requirements-extra.in` file.
99+
Standard installation procedure includes only basic part, in order to obtain extra modules you can execute following command:
101100
```bash
102-
python setup.py install_core
101+
python3 -m pip install .[extra]
103102
```
104103

105104
#### Installation Troubleshooting
@@ -108,7 +107,7 @@ python setup.py install_core
108107
If you get a directory/file not found error, try manually removing the previous tool version from your environment or install the tool using following command in Accuracy Checker directory instead of setup.py install:
109108

110109
```bash
111-
pip install --upgrade --force-reinstall .
110+
python3 -m pip install --upgrade --force-reinstall .
112111
```
113112
2. If `accuracy_check` command failed with following error:
114113
```

tools/accuracy_checker/setup.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ def check_and_update_numpy(min_acceptable='1.15'):
6262
subprocess.call([sys.executable, '-m', 'pip', 'install', 'numpy>={}'.format(min_acceptable)])
6363

6464

65-
def install_dependencies_with_pip(dependencies):
66-
for dep in dependencies:
67-
if dep.startswith('#'):
68-
continue
69-
subprocess.call([sys.executable, '-m', 'pip', 'install', str(dep)])
70-
71-
7265
class CoreInstall(install_command):
7366
pass
7467

@@ -81,20 +74,22 @@ def find_version(*path):
8174

8275
raise RuntimeError("Unable to find version string.")
8376

84-
is_arm = platform.processor() == 'aarch64'
8577
long_description = read("README.md")
8678
version = find_version("openvino/tools/accuracy_checker", "__init__.py")
8779

8880

8981
def prepare_requirements():
9082
requirements_core = read('requirements-core.in').split('\n')
9183
if 'install_core' in sys.argv:
92-
return requirements_core
93-
requirements = read("requirements.in").split('\n')
94-
return requirements_core + requirements
84+
warnings.warn(
85+
'"install_core" command is deprecated and will be removed in 2023.1 release, please use "install" instead',
86+
DeprecationWarning
87+
)
88+
requirements = read("requirements-extra.in").split('\n')
89+
return requirements_core, requirements
9590

9691

97-
_requirements = prepare_requirements()
92+
_requirements, _extras = prepare_requirements()
9893

9994
try:
10095
importlib.import_module('cv2')
@@ -110,8 +105,6 @@ def prepare_requirements():
110105
+ "\n Probably due to unsuitable numpy version, will be updated")
111106
check_and_update_numpy()
112107

113-
if is_arm:
114-
install_dependencies_with_pip(_requirements)
115108

116109
setup(
117110
name="accuracy_checker",
@@ -125,9 +118,9 @@ def prepare_requirements():
125118
"convert_annotation=openvino.tools.accuracy_checker.annotation_converters.convert:main"]},
126119
zip_safe=False,
127120
python_requires='>=3.5',
128-
install_requires=_requirements if not is_arm else '',
121+
install_requires=_requirements,
129122
tests_require=[read("requirements-test.in")],
130123
cmdclass={'test': PyTest, 'install_core': CoreInstall},
131-
extras_require={'extra': ['pycocotools>=2.0.2', 'crf_beam;platform_system=="Linux"', 'torch>=0.4.0', 'torchvision>=0.2.1', 'lpips', 'soundfile',
124+
extras_require={'extra': _extras + ['pycocotools>=2.0.2', 'crf_beam;platform_system=="Linux"', 'torch>=0.4.0', 'torchvision>=0.2.1', 'lpips', 'soundfile',
132125
'kenlm @ git+https://github.com/kpu/kenlm.git@f01e12d83c7fd03ebe6656e0ad6d73a3e022bd50#egg=kenlm']}
133126
)

0 commit comments

Comments
 (0)