本文主要是介绍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 resultsfor c in det[:, -1].unique():n = (det[:, -1] == c).sum() # detections per classs += '%g %ss, ' % (n, names[int(c)]) # add to string |
这篇关于YOLOV5 计数某类目标的方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!