Darknet: No Detection!!!

Created on 1 Dec 2017  ·  16Comments  ·  Source: pjreddie/darknet

I Can't get any prediction after running detector using pre trained weights in darknet.
prediction.png is created but with no labels neither the shell shows any prediction as was expected
Any help would be very appreciated!!

*running detector
$ ./darknet detect cfg/yolo.cfg yolo.weights data/dog.jpg
layer filters size input output
0 conv 32 3 x 3 / 1 608 x 608 x 3 -> 608 x 608 x 32
1 max 2 x 2 / 2 608 x 608 x 32 -> 304 x 304 x 32
.
.
.
30 conv 425 1 x 1 / 1 19 x 19 x1024 -> 19 x 19 x 425
31 detection
mask_scale: Using default '1.000000'
Loading weights from yolo.weights...Done!
data/dog.jpg: Predicted in 0.008077 seconds.

  • My system
    Ubuntu 14.04
    CUDA 8.0.61
    Cudnn 5.1
    Nvidia Titan Xp

  • driver version
    $ nvidia-smi
    Fri Dec 1 21:02:14 2017
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 384.90 Driver Version: 384.90 |
    |-------------------------------+----------------------+----------------------+
    | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
    | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
    |===============================+======================+======================|
    | 0 TITAN Xp Off | 00000000:02:00.0 On | N/A |
    | 23% 39C P8 18W / 250W | 204MiB / 12186MiB | 0% Default |

  • Makefile setting
    GPU=1
    CUDNN=1
    OPENCV=1
    OPENMP=0
    DEBUG=0
    ARCH= -gencode arch=compute_61,code=[sm_61,compute_61]
    CC=gcc
    NVCC=nvcc
    NVCC += -D_FORCE_INLINES

Most helpful comment

opencv=1
cuda=1
cudnn=1

same error, please modify cfg/yolov3.cfg,

# Testing
batch=1
subdivisions=1
# Training
#batch=256
#subdivisions=64

then, detector result display ok.

All 16 comments

Try lowering the threshold to a very low number to see if you get any different results (i.e 0.001).

Thank you for your response.
I tried to test with low number as your comment, and I can see different result as below.

./darknet detect cfg/yolo.cfg yolo.weights data/dog.jpg -thresh 0.01
...
person: 0%
chair: 0%
diningtable: 0%
person: 0%
chair: 0%
diningtable: 0%
person: 0%
chair: 0%
diningtable: 0%
person: 0%
chair: 0%
diningtable: 0%
person: 0%
chair: 0%
diningtable: 0%
person: 0%
chair: 0%
diningtable: 0%

created too many predition....
I think, It is not correct prediction.

are you sure that cudnn5.1 match with arch compute_61?

set cudnn=0 and recompile.
I do not know why.

that doesn't help I think. I tried other compiling options too(like opencv/cuda off). but prediction/detection_boxes!
Does it has something to do with mask scale??
If cudnn=0 compiled it fine, how is it possible? cudnn is the cuda compiler right?

cuda compiler is nvcc not cudnn.......

download the pretrained weights and try again.

the pretrained weights maybe old but you git pull the code often, I think.

if the detection with pretrained weights works (as suggested by Jiewen2017), try training for more iterations

@blue2314 Hi, have you solved the problem? I met the same problem but cannot find the solution.

@wsyzzz Just replace CUDNN=1 to CUDNN=0.

I feel a little late to the party. I also encountered this issue while working with the YOLT fork (https://github.com/CosmiQ/yolt). In my case, it was not an issue with CUDNN, but a combination of issues with my training data pipeline.

  • Ensure your training data follows the YOLO format. Folder structure should have images and labels sub-directories in them with matching names (e.g. images/my_image1.png and labels/my_image1.txt).
  • Make sure all of the images you're training on are the dimensions of the network (e.g. 416px by 416px). If you have larger images, darknet will scale it down and attempt to try, but likely won't perform as you expect. Personally, I followed the YOLT approach and made a new set of training images/labels by slicing the original images into 416px by 416px with 20% overlap between slices (make sure your label files match the name of the sliced images if you do this).
  • Major: Delete any images from your training directory for which you don't have any labels. darknet, by default, will initialize a label for every image with ID, x, y, w, h all equal to 0 and it will train on that if you don't have any labels specified.
  • Major: Make sure your label files use numeric IDs. I started with the COWC dataset and tried car 0.5 0.5 0.5 0.5. C will try to parse car as the object ID and likely cause the remaining values to become 0, resulting in predictions all becoming 0% probability.
  • Major: Make sure all of your x, y, w, h values are normalized! The only integer in your labels file should be the object ID; everything else should be a floating point value between 0 and 1. Forgetting to do this can also cause predictions to become 0% probability.

opencv=1
cuda=1
cudnn=1

same error, please modify cfg/yolov3.cfg,

# Testing
batch=1
subdivisions=1
# Training
#batch=256
#subdivisions=64

then, detector result display ok.

same issue

same issue

Plz check the .cfg file.

I feel a little late to the party. I also encountered this issue while working with the YOLT fork (https://github.com/CosmiQ/yolt). In my case, it was not an issue with CUDNN, but a combination of issues with my training data pipeline.

  • Ensure your training data follows the YOLO format. Folder structure should have images and labels sub-directories in them with matching names (e.g. images/my_image1.png and labels/my_image1.txt).
  • Make sure all of the images you're training on are the dimensions of the network (e.g. 416px by 416px). If you have larger images, darknet will scale it down and attempt to try, but likely won't perform as you expect. Personally, I followed the YOLT approach and made a new set of training images/labels by slicing the original images into 416px by 416px with 20% overlap between slices (make sure your label files match the name of the sliced images if you do this).
  • Major: Delete any images from your training directory for which you don't have any labels. darknet, by default, will initialize a label for every image with ID, x, y, w, h all equal to 0 and it will train on that if you don't have any labels specified.
  • Major: Make sure your label files use numeric IDs. I started with the COWC dataset and tried car 0.5 0.5 0.5 0.5. C will try to parse car as the object ID and likely cause the remaining values to become 0, resulting in predictions all becoming 0% probability.
  • Major: Make sure all of your x, y, w, h values are normalized! The only integer in your labels file should be the object ID; everything else should be a floating point value between 0 and 1. Forgetting to do this can also cause predictions to become 0% probability.

As far as i know there must be empty .txt files for negative pictures.

I got no detection when I run the demo sample "./darknet yolo test cfg/yolo.cfg /yolo.weights ".
The yolo.weights was downloaded by the link given in the page https://github.com/pjreddie/darknet/wiki/YOLO:-Real-Time-Object-Detection saying "You already have the config file for YOLO in the cfg/ subdirectory. You will have to download the pre-trained weight file here (1.0 GB)." However the file downloaded was just 203.9 MB.
I finally solved it by downloading a different weight file from https://pjreddie.com/darknet/yolo/ using "wget https://pjreddie.com/media/files/yolov1.weights". Afterwards, I got all the detection as I want.
Hope it helps!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndyZX picture AndyZX  ·  3Comments

sayanmutd picture sayanmutd  ·  3Comments

ryuzakinho picture ryuzakinho  ·  4Comments

MaverickLoneshark picture MaverickLoneshark  ·  3Comments

cadip92 picture cadip92  ·  3Comments