Skip to content

Commit 0844ae1

Browse files
committed
corner case supplement
1 parent 43b4a3b commit 0844ae1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

demos/smartlab_demo/python/evaluator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)