Skip to content

Commit e15def2

Browse files
committed
update vision to only use green balloons
1 parent 430ee79 commit e15def2

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

python/src/blimp_vision/blimp_vision/camera_node.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,32 @@ def run_model(self, left_frame):
303303
:return: (inference_time, detection results)
304304
"""
305305
t_start = time.time()
306-
selected_model = self.ball_rknn if self.ball_search_mode else self.goal_rknn
307-
results = selected_model.track(left_frame, persist=True, tracker="bytetrack.yaml", verbose=False, conf=0.5)[0]
306+
307+
if self.ball_search_mode:
308+
selected_model = self.ball_rknn
309+
# Only detect class 0 for the ball model
310+
results = selected_model.track(
311+
left_frame,
312+
persist=True,
313+
tracker="bytetrack.yaml",
314+
verbose=False,
315+
conf=0.65,
316+
classes=[0] # Only class 0
317+
)[0]
318+
else:
319+
selected_model = self.goal_rknn
320+
# Detect all classes for the goal model (do not use 'classes' argument)
321+
results = selected_model.track(
322+
left_frame,
323+
persist=True,
324+
tracker="bytetrack.yaml",
325+
verbose=False,
326+
conf=0.65
327+
)[0]
328+
308329
return time.time() - t_start, results
309330

331+
310332
def compute_disparity(self, left_frame, right_frame):
311333
"""
312334
Compute disparity between two images using SGBM.
@@ -485,7 +507,8 @@ def camera_callback(self):
485507
if self.ball_search_mode:
486508
disp_depth = self.filter_disparity(disparity, detection_msg.bbox)
487509
regr_depth = self.mono_depth_estimator(detection_msg.bbox[2], detection_msg.bbox[3])
488-
detection_msg.depth = np.min([disp_depth, regr_depth]) if (np.square(np.max([detection_msg.bbox[2], detection_msg.bbox[3]])) > 50.0) else 100.0
510+
detection_msg.depth = np.min([disp_depth, regr_depth]) if (np.square(np.max([detection_msg.bbox[2], detection_msg.bbox[3]])) > 900.0) else 100.0
511+
489512
else:
490513
# Goal detection mode: use the calibrated vertical focal length and real goal height.
491514
# Assume detection_msg.obj_class contains a string like "circle", "square", or "triangle"

python/src/blimp_vision/calibration/undistorted.yaml

Whitespace-only changes.

0 commit comments

Comments
 (0)