def extract_and_process_tracks(self, tracks): boxes = tracks[0].boxes.xyxy.cpu() clss = tracks[0].boxes.cls.cpu().tolist() track_ids = tracks[0].boxes.id.int().cpu().tolist() self.annotator = Annotator(self.im0, self.tf, self.names) self.annotator.draw_region(reg_pts=self.reg_pts, color=(0, 255, 0)) for box, track_id, cls in zip(boxes, track_ids, clss): self.annotator.box_label(box, label=self.names[cls], color=colors(int(cls), True)) # Draw Tracks track_line = self.track_history[track_id] track_line.append((float((box[0] + box[2]) / 2), float((box[0] + box[2]) / 2)) track_line.pop(0) if len(track_line) > 30 else None if self.draw_tracks: self.annotator.draw_centroid_and_tracks(track_line, color=(0, 255, 0), track_thickness=self.track_thickness)
The object_counter.py
provided by ultralytics
can achieve the counting job, the track_line.append store the center of the
box(float((box[0] + box[2]) / 2), float((box[0] + box[2]) / 2)
,
but how to change the center into the keypoints
coordinate, e.g. I want to count the head keypoints
of animal cross a specified line.
How to get the keypoints
coordinate in yolo_pose
?