Why yolo can't detect all objects in image?

旧城冷巷雨未停 提交于 2020-03-25 18:04:59

问题


I am trying to detect objects in image using AlexeyAB darknet.But it is detecting only 2 or 3 object.It can't detect small objects(for example hat).I am using this command:

./darknet detector test ./cfg/coco.data ./cfg/yolov3.cfg /weight_path/ /image_path/

How can I do it?


回答1:


According to the AlexeyAB page for small objects you can do this:

for training for small objects (smaller than 16x16 after the image is resized to 416x416) - set layers = -1, 11 instead of https://github.com/AlexeyAB/darknet/blob/6390a5a2ab61a0bdf6f1a9a6b4a739c16b36e0d7/cfg/yolov3.cfg#L720 and set stride=4 instead of https://github.com/AlexeyAB/darknet/blob/6390a5a2ab61a0bdf6f1a9a6b4a739c16b36e0d7/cfg/yolov3.cfg#L717

For training small and large objects you can use modified models:

  • Full-model: 5 yolo layers: https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov3_5l.cfg
  • Tiny-model: 3 yolo layers: https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov3-tiny_3l.cfg
  • Spatial-full-model: 3 yolo layers: https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov3-spp.cfg

Also after training is done, in the detection phase, you may do the following:

Increase network-resolution by set in your .cfg-file (height=608 and width=608) or (height=832 and width=832) or (any value multiple of 32) - this increases the precision and makes it possible to detect small objects: link

  • it is not necessary to train the network again, just use .weights-file already trained for 416x416 resolution

  • but to get even greater accuracy you should train with higher resolution 608x608 or 832x832, note: if error Out of memory occurs
    then in .cfg-file you should increase subdivisions=16, 32 or 64: link



来源:https://stackoverflow.com/questions/58317943/why-yolo-cant-detect-all-objects-in-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!