Skip to content

Commit 336bae9

Browse files
authored
Fix some errors (#3661)
1 parent 2a5292c commit 336bae9

File tree

11 files changed

+35
-46
lines changed

11 files changed

+35
-46
lines changed

data/dataset_definitions.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,16 +1472,16 @@ datasets:
14721472
input_suffix: in
14731473
reference_suffix: out
14741474

1475-
- name: online_mstcn_plus_encoder_dataset
1476-
data_source: annotation
1477-
reader: numpy_reader
1478-
annotation_conversion:
1479-
converter: feature_regression
1480-
reference_dir: image
1481-
input_dir: image
1482-
input_suffix: in
1483-
reference_suffix: out
1484-
use_bin_data: True
1475+
- name: online_mstcn_plus_encoder_dataset
1476+
data_source: annotation
1477+
reader: numpy_reader
1478+
annotation_conversion:
1479+
converter: feature_regression
1480+
reference_dir: image
1481+
input_dir: image
1482+
input_suffix: in
1483+
reference_suffix: out
1484+
use_bin_data: True
14851485

14861486
- name: smartlab_detection_10cl_top
14871487
data_source: object_detection/streams_1/top/images

demos/3d_segmentation_demo/python/3d_segmentation_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def normalize(image, mask, full_intensities_range):
173173

174174

175175
def resample_np(data, output_shape, order):
176-
assert(len(data.shape) == len(output_shape))
176+
assert len(data.shape) == len(output_shape)
177177
factor = [float(o) / i for i, o in zip(data.shape, output_shape)]
178178
return interpolation.zoom(data, zoom=factor, order=order)
179179

demos/mri_reconstruction_demo/python/mri_reconstruction_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
logger = logging.getLogger('mri_reconstruction_demo')
1515

1616
def kspace_to_image(kspace):
17-
assert(len(kspace.shape) == 3 and kspace.shape[-1] == 2)
17+
assert len(kspace.shape) == 3 and kspace.shape[-1] == 2
1818
fft = cv.idft(kspace, flags=cv.DFT_SCALE)
1919
img = cv.magnitude(fft[:, :, 0], fft[:, :, 1])
2020
return cv.normalize(img, dst=None, alpha=255, beta=0, norm_type=cv.NORM_MINMAX, dtype=cv.CV_8U)

demos/smartlab_demo/python/display.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def draw_text_without_background(self, img, text,
9090
cv2.putText(img, text, (x, y + text_h + font_scale - 1), font, font_scale, text_color, font_thickness)
9191
return text_size
9292

93-
def display_result(self, frame_top, frame_side, side_seg_results, top_seg_results, \
93+
def display_result(self, frame_top, frame_side, side_seg_results, top_seg_results,
9494
top_det_results, side_det_results, scoring, state, keyframe, frame_counter, fps):
9595

9696
if state == 'Initial':
@@ -167,16 +167,6 @@ def display_result(self, frame_top, frame_side, side_seg_results, top_seg_result
167167
m_weights_tweezers = scoring['measuring_score_weights_tweezers']
168168
e_tidy = scoring['end_score_tidy']
169169

170-
# display keyframe
171-
i_rider_k = keyframe['initial_score_rider']
172-
i_balance_k = keyframe['initial_score_balance']
173-
m_rider_tweezers_k = keyframe['measuring_score_rider_tweezers']
174-
m_balance_k = keyframe['measuring_score_balance']
175-
m_object_left_k = keyframe['measuring_score_object_left']
176-
m_weights_right_k = keyframe['measuring_score_weights_right']
177-
m_weights_tweezers_k = keyframe['measuring_score_weights_tweezers']
178-
e_tidy_k = keyframe['end_score_tidy']
179-
180170
w, h = self.draw_text_without_background(self.score_board, f"SCORE - {display_status}",
181171
pos=(self.w1, 60), text_color_bg=initial_text_color_bg)
182172
w, h = self.draw_text(self.score_board, f"INITIALISE RIDER[{i_rider}]",

demos/smartlab_demo/python/evaluator.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def evaluate_rider_tweezers(self):
567567
# if rider move, check tweezers and rider distance
568568
# if tweezers and rider are apart more than use_tweezers_threshold pixels (based on euclidean distance), consider not using tweezers
569569
if np.linalg.norm(
570-
rider_min_coordinate - tweezers_min_coordinate) <= self.use_tweezers_threshold and self.rider_tweezers_lock_mark == False:
570+
rider_min_coordinate - tweezers_min_coordinate) <= self.use_tweezers_threshold and not self.rider_tweezers_lock_mark:
571571
self.scoring['measuring_score_rider_tweezers'] = 1
572572
self.keyframe['measuring_score_rider_tweezers'] = self.frame_counter
573573

@@ -655,7 +655,7 @@ def evaluate_object_left_from_view(self, view):
655655
else: # if object put happens on the right, then give zero score mark
656656
self.object_direction = 'right'
657657
self.object_is_in_tray_now = True
658-
if self.is_object_put == False or self.is_change_object_direction:
658+
if not self.is_object_put or self.is_change_object_direction:
659659
self.is_object_put = True
660660
self.is_change_object_direction = False
661661
object_left_score = 0
@@ -688,7 +688,7 @@ def evaluate_object_left_from_view(self, view):
688688
self.object_is_in_tray_now = True
689689
# give mark when object is put first time,
690690
# change mark only if student change direction afterward
691-
if self.is_object_put == False or self.is_change_object_direction:
691+
if not self.is_object_put or self.is_change_object_direction:
692692
self.is_change_object_direction = False
693693
object_left_score = 1
694694
object_left_keyframe = self.frame_counter
@@ -698,7 +698,7 @@ def evaluate_object_left_from_view(self, view):
698698
else:
699699
self.object_direction = 'right'
700700
self.object_is_in_tray_now = True
701-
if self.is_object_put == False or self.is_change_object_direction:
701+
if not self.is_object_put or self.is_change_object_direction:
702702
self.is_object_put = True
703703
self.is_change_object_direction = False
704704
object_left_score = 0
@@ -831,7 +831,7 @@ def evaluate_end_tidy(self):
831831
self.keyframe["end_score_tidy"] = self.frame_counter
832832
else:
833833
self.evaluate_rider()
834-
if self.rider_zero == True:
834+
if self.rider_zero:
835835
self.scoring["end_score_tidy"] = 1
836836
self.keyframe["end_score_tidy"] = self.frame_counter
837837
else:
@@ -853,7 +853,7 @@ def evaluate_end_tidy(self):
853853
self.keyframe["end_score_tidy"] = self.frame_counter
854854
else:
855855
self.evaluate_rider()
856-
if self.rider_zero == True:
856+
if self.rider_zero:
857857
self.scoring["end_score_tidy"] = 1
858858
self.keyframe["end_score_tidy"] = self.frame_counter
859859
else:
@@ -889,7 +889,7 @@ def lose_balance_mark(self):
889889
self.keyframe['initial_score_balance'] = self.frame_counter
890890
elif self.state == "Measuring":
891891
self.balance_persist_duration = 0
892-
if self.measuring_state_balance_lock_mark == False:
892+
if not self.measuring_state_balance_lock_mark:
893893
self.scoring['measuring_score_balance'] = 0
894894
self.keyframe['measuring_score_balance'] = self.frame_counter
895895

@@ -932,11 +932,11 @@ def evaluate_scale_balance(self):
932932
right_roundscrew2_coor = roundscrew2_coor[0]
933933

934934
# find center coordinate of roundscrew2 and pointerhead
935-
left_roundscrew2_center_coor = [(left_roundscrew2_coor[0] + left_roundscrew2_coor[2]) / 2, \
935+
left_roundscrew2_center_coor = [(left_roundscrew2_coor[0] + left_roundscrew2_coor[2]) / 2,
936936
(left_roundscrew2_coor[1] + left_roundscrew2_coor[3]) / 2]
937-
right_roundscrew2_center_coor = [(right_roundscrew2_coor[0] + right_roundscrew2_coor[2]) / 2, \
937+
right_roundscrew2_center_coor = [(right_roundscrew2_coor[0] + right_roundscrew2_coor[2]) / 2,
938938
(right_roundscrew2_coor[1] + right_roundscrew2_coor[3]) / 2]
939-
pointerhead_center_coor = [(pointerhead_coor[0][0] + pointerhead_coor[0][2]) / 2, \
939+
pointerhead_center_coor = [(pointerhead_coor[0][0] + pointerhead_coor[0][2]) / 2,
940940
(pointerhead_coor[0][1] + pointerhead_coor[0][3]) / 2]
941941

942942
# rotate to make two roundscrew1 in a horizontal line
@@ -955,7 +955,7 @@ def evaluate_scale_balance(self):
955955
self.lose_balance_mark()
956956

957957
elif len(scale_coor) == 1 and len(pointerhead_coor) == 1:
958-
pointerhead_center_coor = [(pointerhead_coor[0][0] + pointerhead_coor[0][2]) / 2, \
958+
pointerhead_center_coor = [(pointerhead_coor[0][0] + pointerhead_coor[0][2]) / 2,
959959
(pointerhead_coor[0][1] + pointerhead_coor[0][3]) / 2]
960960
lower_limit = (scale_coor[0][0] + scale_coor[0][2]) / 2 - self.balance_threshold
961961
upper_limit = (scale_coor[0][0] + scale_coor[0][2]) / 2 + self.balance_threshold

demos/smartlab_demo/python/object_detection/detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self,
105105
self.all_classes += list(self.top_loc_exp.mw_classes)
106106
self.all_classes += list(self.side_glb_exp.mw_classes)
107107
self.all_classes += list(self.side_loc_exp.mw_classes)
108-
self.all_classes = sorted(list(set(self.all_classes)))
108+
self.all_classes = sorted(set(self.all_classes))
109109

110110
# max-number constraints:
111111
self.max_nums = {

demos/smartlab_demo/python/segmentor.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,12 @@ def inference_async(self, frame_top, frame_side, frame_index):
118118
frame_side = frame_side[np.newaxis, :, :, :].transpose((0, 3, 1, 2)).astype(np.float32)
119119
frame_top = frame_top[np.newaxis, :, :, :].transpose((0, 3, 1, 2)).astype(np.float32)
120120

121-
self.infer_encoder_side_request.start_async(inputs={ \
121+
self.infer_encoder_side_request.start_async(inputs={
122122
self.encoder_side_input_keys['input_image']: frame_side,
123123
self.encoder_side_input_keys['shifted_input']: self.shifted_tesor_side})
124124

125-
self.infer_encoder_top_request.start_async(inputs= \
126-
{self.encoder_top_input_keys['input_image']: frame_top,
127-
self.encoder_top_input_keys[
128-
'shifted_input']: self.shifted_tesor_top})
125+
self.infer_encoder_top_request.start_async(inputs={self.encoder_top_input_keys['input_image']: frame_top,
126+
self.encoder_top_input_keys['shifted_input']: self.shifted_tesor_top})
129127

130128
while True:
131129
if self.infer_encoder_side_request.wait_for(0) and self.infer_encoder_top_request.wait_for(0):

demos/smartlab_demo/python/smartlab_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ def video_loop(args, cap_top, cap_side, detector, segmentor, evaluator, display)
7474
# multithread setup
7575
executor = concurrent.futures.ThreadPoolExecutor()
7676
future_detector = None
77-
future_segmentor = None
7877
buffer_display = None
78+
scoring = None
79+
keyframe = None
7980

8081
while cap_top.isOpened() and cap_side.isOpened():
8182
ret_top, frame_top = cap_top.read()

models/intel/smartlab-action-recognition-0001/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Use Case and High-Level Description
44

5-
There are 3 models for smartlab action recogntion including two encoder models and one decoder model.
5+
There are 3 models for smartlab action recogntion including two encoder models and one decoder model.
66

77
These models are fine-tuned with smartlab dataset to predict actions and can classfy 3 types of action including "noise_action", "put_take" and "adjust_rider".
88

@@ -20,7 +20,7 @@ Output `put_take` action
2020

2121
## Encoder models specification
2222

23-
The smartlab-action-recognition-0001-encoder-* have Mobilenet-V2 like backbone with convolutional encoder part of the action recognition.
23+
The smartlab-action-recognition-0001-encoder-* have Mobilenet-V2 like backbone with convolutional encoder part of the action recognition.
2424

2525
There are two models called: `smartlab-action-recognition-0001-encoder-side` and `smartlab-action-recognition-0001-encoder-top`, which have the same strcuture but different weights.
2626

models/public/erfnet/accuracy-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ models:
1010
preprocessing:
1111
- type: resize
1212
dst_width: 976
13-
dst_height: 208
13+
dst_height: 208
1414
postprocessing:
1515
- type: resize_segmentation_mask
1616
dst_width: 1640
@@ -44,4 +44,4 @@ models:
4444
- type: mean_iou
4545
use_argmax: false
4646
presenter: print_scalar
47-
reference: 0.7647
47+
reference: 0.7647

0 commit comments

Comments
 (0)