Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13921

Yolo v8 can help to detect keypoints, but how to count the number of the keypoints that cross a specified line

$
0
0
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?


Viewing all articles
Browse latest Browse all 13921

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>