使用yolov4检测识别自定义类别

1>下载darknet源码

2>使用make进行编译

3>找到src下的image.c文件

4>修改draw_detections_v3函数,在const int best_class = selected_detections[i].best_class;下面加上         if(selected_detections[i].best_class!=8)

                   {

                            continue;

                   }

在            if (width < 1)

                width = 1;

下面加上

                            if(selected_detections[i].best_class!=8)

                            {

                                     continue;

                            }

我使用的是coco.names,只是识别里面的第9类boat,所以有如上操作。

5>然后make clean ,重新编译make -j4,

6> darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights data/test6.jpg

接着就可以看到输出结果。

使用yolov4检测识别自定义类别