YOLOV5 计数某类目标的方法

https://github.com/ultralytics/yolov5/issues/242

比如计数人的个数。counting

How to write the detected number of people in the video

At this line, you can find the class and the bounding boxes coordinates.

yolov5/detect.py

Line 97 in 0a08375

  for *xyxy, conf, cls in det:

 

If you just want to count the num of classes per frame, this line would do as well.

yolov5/detect.py

Line 93 in 0a08375

  n = (det[:, -1] == c).sum() # detections per class

 

glenn-jocher commented on 5 Oct • 

edited 

@swethabethireddy see python code in detect.py:

                # Print results
                for c in det[:, -1].unique():
                    n = (det[:, -1] == c).sum()  # detections per class
                    s += '%g %ss, ' % (n, names[int(c)])  # add to string

你可能感兴趣的:(YOLO,AI)