Search code examples
machine-learningimage-processingobject-detectionyolodarknet

Why yolo can't detect all objects in image?


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?


Solution

  • 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:

    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