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

版权声明:本文为CSDN博主「jack_201316888」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u010451780/article/details/109679951

jack_201316888

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

【经典论文解读】YOLO 目标检测

前言
YOLO是一种目标检测方法,它的输入是整张图片,当检测到目标物体时用边界框圈起来,同时给该目标物体一个类别;边界框由中心位置、宽、高等来表示的;它的输出是n个物体的检测信息,每个物体的信息包括:中心位置(x,y)、高(h)、宽(w)、类