From a267e0aa069cdd663e11e6adf76bc70697d92275 Mon Sep 17 00:00:00 2001 From: fcakyon Date: Tue, 30 Jul 2024 22:47:12 +0300 Subject: [PATCH] Refactor ActionRecognition class to remove unused method and update box plotting --- ultralytics/solutions/action_recognition.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/ultralytics/solutions/action_recognition.py b/ultralytics/solutions/action_recognition.py index 0f4747aff3..24ac3cdda2 100644 --- a/ultralytics/solutions/action_recognition.py +++ b/ultralytics/solutions/action_recognition.py @@ -91,15 +91,6 @@ class ActionRecognition: if len(self.track_history[track_id]) > self.num_video_sequence_samples: self.track_history[track_id].pop(0) - def plot_box_and_action(self, box: List[float], label_text: str): - """ - Plots track and bounding box with action label. - - Args: - box (list): Object bounding box data. - label_text (str): Text to display on the image. - """ - self.annotator.box_label(box, label_text, color=(0, 0, 255)) def display_frames(self): """Displays the current frame.""" @@ -188,7 +179,7 @@ class ActionRecognition: for box, track_id, pred_label, pred_conf in zip(self.boxes, track_ids_to_infer, pred_labels, pred_confs): top2_preds = sorted(zip(pred_label, pred_conf), key=lambda x: x[1], reverse=True) label_text = " | ".join([f"{label} ({conf:.2f})" for label, conf in top2_preds]) - self.plot_box_and_action(box, label_text) + self.annotator.box_label(box, label_text, color=(0, 0, 255)) return im0