-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Robust-detections #217
Robust-detections #217
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work! Looks good to me. Some minor refactoring suggestions, but feel free to ignore!
for det in detections: | ||
x, y, _, _ = det.xywh[0], det.xywh[1], det.xywh[2], det.xywh[3] | ||
det_center_x = x | ||
det_center_y = y | ||
det_dist = np.sqrt( | ||
(x_to_compare - det_center_x) ** 2 + (y_to_compare - det_center_y) ** 2 | ||
) | ||
if det_dist < dist: | ||
dist = det_dist | ||
detection = det | ||
|
||
if detection is None: | ||
raise ValueError("No detections found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for det in detections: | |
x, y, _, _ = det.xywh[0], det.xywh[1], det.xywh[2], det.xywh[3] | |
det_center_x = x | |
det_center_y = y | |
det_dist = np.sqrt( | |
(x_to_compare - det_center_x) ** 2 + (y_to_compare - det_center_y) ** 2 | |
) | |
if det_dist < dist: | |
dist = det_dist | |
detection = det | |
if detection is None: | |
raise ValueError("No detections found") | |
if not detections: | |
raise ValueError("No detections found") | |
detection = min(detections, key = lambda det : np.sqrt(x_to_compare - det.xywh[0]) ** 2 + (y_to_compare - det.xywh[1]) ** 2)) |
if self._crop_method in self._valid_2d_methods: | ||
img_msg = rospy.wait_for_message(self._rgb_topic, Image) | ||
detections = self._yolo_2d( | ||
img_msg, "yolov8x.pt", 0.5, 0.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the model, confidence and nms threshold should be given in the constructor?
Co-authored-by: Jared Swift <[email protected]>
Co-authored-by: Jared Swift <[email protected]>
Co-authored-by: Jared Swift <[email protected]>
Co-authored-by: Jared Swift <[email protected]>
Co-authored-by: Jared Swift <[email protected]>
No description provided.