From 29c833d346bf7483f4b438883ab3b63c8fe63bd2 Mon Sep 17 00:00:00 2001 From: NicikD Date: Fri, 9 Aug 2024 18:04:12 +0200 Subject: [PATCH] Bugfix: Added timestamps to outcoming messages --- depthai_nodes/ml/parsers/image_output.py | 1 + depthai_nodes/ml/parsers/keypoints.py | 1 + depthai_nodes/ml/parsers/mediapipe_hand_landmarker.py | 1 + depthai_nodes/ml/parsers/mediapipe_palm_detection.py | 1 + depthai_nodes/ml/parsers/mlsd.py | 1 + depthai_nodes/ml/parsers/monocular_depth.py | 1 + depthai_nodes/ml/parsers/scrfd.py | 1 + depthai_nodes/ml/parsers/segmentation.py | 1 + depthai_nodes/ml/parsers/superanimal_landmarker.py | 1 + depthai_nodes/ml/parsers/thermal_image.py | 1 + depthai_nodes/ml/parsers/xfeat.py | 1 + depthai_nodes/ml/parsers/yunet.py | 1 + 12 files changed, 12 insertions(+) diff --git a/depthai_nodes/ml/parsers/image_output.py b/depthai_nodes/ml/parsers/image_output.py index 534db76b..e60bb09a 100644 --- a/depthai_nodes/ml/parsers/image_output.py +++ b/depthai_nodes/ml/parsers/image_output.py @@ -75,5 +75,6 @@ def run(self): image=image, is_bgr=self.output_is_bgr, ) + image_message.setTimestamp(output.getTimestamp()) self.out.send(image_message) diff --git a/depthai_nodes/ml/parsers/keypoints.py b/depthai_nodes/ml/parsers/keypoints.py index 4f9f8ce7..a501ba1f 100644 --- a/depthai_nodes/ml/parsers/keypoints.py +++ b/depthai_nodes/ml/parsers/keypoints.py @@ -100,5 +100,6 @@ def run(self): keypoints /= self.scale_factor msg = create_keypoints_message(keypoints) + msg.setTimestamp(output.getTimestamp()) self.out.send(msg) diff --git a/depthai_nodes/ml/parsers/mediapipe_hand_landmarker.py b/depthai_nodes/ml/parsers/mediapipe_hand_landmarker.py index f358c602..effbc0f5 100644 --- a/depthai_nodes/ml/parsers/mediapipe_hand_landmarker.py +++ b/depthai_nodes/ml/parsers/mediapipe_hand_landmarker.py @@ -83,4 +83,5 @@ def run(self): hand_landmarks_msg = create_hand_keypoints_message( landmarks, float(handedness), float(hand_score), self.score_threshold ) + hand_landmarks_msg.setTimestamp(output.getTimestamp()) self.out.send(hand_landmarks_msg) diff --git a/depthai_nodes/ml/parsers/mediapipe_palm_detection.py b/depthai_nodes/ml/parsers/mediapipe_palm_detection.py index 0c992ec5..aeacd17f 100644 --- a/depthai_nodes/ml/parsers/mediapipe_palm_detection.py +++ b/depthai_nodes/ml/parsers/mediapipe_palm_detection.py @@ -116,4 +116,5 @@ def run(self): scores = np.array(scores)[indices] detections_msg = create_detection_message(bboxes, scores, labels=None) + detections_msg.setTimestamp(output.getTimestamp()) self.out.send(detections_msg) diff --git a/depthai_nodes/ml/parsers/mlsd.py b/depthai_nodes/ml/parsers/mlsd.py index e13dadf7..128e9905 100644 --- a/depthai_nodes/ml/parsers/mlsd.py +++ b/depthai_nodes/ml/parsers/mlsd.py @@ -97,4 +97,5 @@ def run(self): ) message = create_line_detection_message(lines, np.array(scores)) + message.setTimestamp(output.getTimestamp()) self.out.send(message) diff --git a/depthai_nodes/ml/parsers/monocular_depth.py b/depthai_nodes/ml/parsers/monocular_depth.py index 21e48d42..b21c36f5 100644 --- a/depthai_nodes/ml/parsers/monocular_depth.py +++ b/depthai_nodes/ml/parsers/monocular_depth.py @@ -66,4 +66,5 @@ def run(self): depth_map=depth_map, depth_type=self.depth_type, ) + depth_message.setTimestamp(output.getTimestamp()) self.out.send(depth_message) diff --git a/depthai_nodes/ml/parsers/scrfd.py b/depthai_nodes/ml/parsers/scrfd.py index b2f24115..40c88cc9 100644 --- a/depthai_nodes/ml/parsers/scrfd.py +++ b/depthai_nodes/ml/parsers/scrfd.py @@ -173,4 +173,5 @@ def run(self): scores = scores[indices] detection_msg = create_detection_message(bboxes, scores, None, None) + detection_msg.setTimestamp(output.getTimestamp()) self.out.send(detection_msg) diff --git a/depthai_nodes/ml/parsers/segmentation.py b/depthai_nodes/ml/parsers/segmentation.py index 2f2fc2d3..d4f9e0b5 100644 --- a/depthai_nodes/ml/parsers/segmentation.py +++ b/depthai_nodes/ml/parsers/segmentation.py @@ -89,4 +89,5 @@ def run(self): ) imgFrame = create_segmentation_message(class_map) + imgFrame.setTimestamp(output.getTimestamp()) self.out.send(imgFrame) diff --git a/depthai_nodes/ml/parsers/superanimal_landmarker.py b/depthai_nodes/ml/parsers/superanimal_landmarker.py index 48fd4007..9b0bdeeb 100644 --- a/depthai_nodes/ml/parsers/superanimal_landmarker.py +++ b/depthai_nodes/ml/parsers/superanimal_landmarker.py @@ -80,5 +80,6 @@ def run(self): keypoints = keypoints[:, :2] / self.scale_factor msg = create_keypoints_message(keypoints, scores, self.score_threshold) + msg.setTimestamp(output.getTimestamp()) self.out.send(msg) diff --git a/depthai_nodes/ml/parsers/thermal_image.py b/depthai_nodes/ml/parsers/thermal_image.py index 44ed9555..bc090ef6 100644 --- a/depthai_nodes/ml/parsers/thermal_image.py +++ b/depthai_nodes/ml/parsers/thermal_image.py @@ -44,4 +44,5 @@ def run(self): thermal_map = output[0] thermal_message = create_thermal_message(thermal_map=thermal_map) + thermal_message.setTimestamp(output.getTimestamp()) self.out.send(thermal_message) diff --git a/depthai_nodes/ml/parsers/xfeat.py b/depthai_nodes/ml/parsers/xfeat.py index 2065cddc..f7ecf633 100644 --- a/depthai_nodes/ml/parsers/xfeat.py +++ b/depthai_nodes/ml/parsers/xfeat.py @@ -92,6 +92,7 @@ def run(self): if self.previous_results is not None: mkpts0, mkpts1 = match(self.previous_results, result) matched_points = create_tracked_features_message(mkpts0, mkpts1) + matched_points.setTimestamp(output.getTimestamp()) self.out.send(matched_points) else: # save the result from first frame diff --git a/depthai_nodes/ml/parsers/yunet.py b/depthai_nodes/ml/parsers/yunet.py index a2d1a4ad..c229c995 100644 --- a/depthai_nodes/ml/parsers/yunet.py +++ b/depthai_nodes/ml/parsers/yunet.py @@ -146,5 +146,6 @@ def run(self): labels, keypoints, ) + detections_message.setTimestamp(output.getTimestamp()) self.out.send(detections_message)