AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.57k stars 7.95k forks source link

Trained model gives zero detections #243

Open bonzoq opened 6 years ago

bonzoq commented 6 years ago

I compiled your version of darknet on Amazon Linux (using Tesla K80 GPU) with the following settings:

GPU=1
CUDNN=1
OPENCV=1
DEBUG=0
OPENMP=0
LIBSO=0

...

ARCH=  -gencode arch=compute_37,code=sm_37

I trained Yolo for 300 iterations using the steps described in https://pjreddie.com/darknet/yolo/ .

When I try to perform detection on a single image:

./darknet detector test cfg/voc.data cfg/yolo-voc.cfg backupVOC/yolo-voc_300.weights VOCdevkit/VOC2007/JPEGImages/009460.jpg

I get no detections. I think I should get some (though not correct detections) even though the training was limited.

On another occasion I trained a classifier reproducing the steps from this tutorial https://timebutt.github.io/static/how-to-train-yolov2-to-detect-custom-objects/ . Training went on for a few thousand iterations with the average lost as low as 0.05 in the end and yet still I was unable to detect anything with that model.

What might I be doing wrong ?

TheMikeyR commented 6 years ago

You should recompile with OpenCV=0 then the result will be saved as an image in the root folder of darknet. The OpenCV is only used to show detections in a window and since you are using the AWS I assume you are doing it through an ssh connection.

AlexeyAB commented 6 years ago

@bonzoq Results of successfully training on Windows and Linux: https://github.com/AlexeyAB/darknet/issues/243#issuecomment-340908751

Can you get any bounded boxes using this command? ./darknet detector test cfg/voc.data cfg/yolo-voc.cfg backupVOC/yolo-voc_300.weights VOCdevkit/VOC2007/JPEGImages/009460.jpg -thresh 0.01

bonzoq commented 6 years ago

Thanks for your quick responses @TheMikeyR and @AlexeyAB.

I recompiled with OpenCV=0 and even with the threshold set to 0.01 I get no detections.

Threshold 0.00 also gives no detections. When I use the original yolo model I get plenty of detections.

sc1234qwer commented 6 years ago

I have the same problem. But training with tiny-yolo-voc.cfg is ok.

AlexeyAB commented 6 years ago

@bonzoq

When I use the original yolo model I get plenty of detections.

bonzoq commented 6 years ago

@AlexeyAB

Thanks, I will let you know!

AlexeyAB commented 6 years ago

@bonzoq

When I use your fork to perform detections on this one image I mentioned above (VOCdevkit/VOC2007/JPEGImages/009460.jpg) with the model https://pjreddie.com/media/files/yolo.weights I get plenty of detections.

bonzoq commented 6 years ago

@AlexeyAB thanks for pointing out I was using a COCO model with VOC config.

Also if you train your model on VOC-dataset, usually you can see any detections after >1000 iterations with low threshold -thresh 0.01

Does it mean that when training on VOC-dataset I won't get any detections with -thresh 0.01 and fewer than 1000 iterations?

phqmourao commented 6 years ago

Hi, I'm having the same problem. I think something is wrong with generated weights files after commit ae74d0ef31485f84e1856b4733135d2753dbb033. Weights files created before are ok.

I use VS 2017, Cuda 9.0, cuDNN 7, OpenCV 3.2.0 cfg: yolo-voc.2.0.cfg and resnet50_yolo.cfg

AlexeyAB commented 6 years ago

@phqmourao Thank you, I fixed it.

@bonzoq @TheMikeyR @sc1234qwer An error was added 5 days ago. Now I have fixed it.

bonzoq commented 6 years ago

So I compiled the code with the latest commit Fixed bug with: net->seen and trained the network with default parameters. After 1000 iterations I get zero detections even with threshold 0.001.

Maybe the problem lays somewhere else? How can I debug?

AlexeyAB commented 6 years ago

@bonzoq


This is strange, I just train my own model with 6 objects based on yolo-voc.2.0.cfg using 400 iterations on Windows 7x64 (CUDA 8.0, cuDNN 6.0, OpenCV 3.3.0), and it can detect objects.

bonzoq commented 6 years ago

@AlexeyAB I will reply tomorrow as I don't have access to the server right now. Thank you for your prompt reply. Greatly appreciated.

bonzoq commented 6 years ago

@AlexeyAB

./darknet detector test cfg/voc.data cfg/yolo-voc.cfg yolo-voc.weights VOCdevkit/VOC2007/JPEGImages/009460.jpg

gives me no detections whatsoever.

  1. I downloaded yolo-voc.weights from https://pjreddie.com/media/files/yolo-voc.weights
  2. VOC.data:
    train  = VOCdevkit/train.txt
    valid  = VOCdevkit/2007_test.txt
    names = data/voc.names
    backup = backupVOC2
  3. yolo-voc.cfg:
    
    [net]
    # Testing
    #batch=1
    #subdivisions=1
    # Training
    batch=64
    subdivisions=16
    height=416
    width=416
    channels=3
    momentum=0.9
    decay=0.0005
    angle=0
    saturation = 1.5
    exposure = 1.5
    hue=.1

learning_rate=0.001 burn_in=1000 max_batches = 80200 policy=steps steps=40000,60000 scales=.1,.1

[convolutional] batch_normalize=1 filters=32 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

#######

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[route] layers=-9

[convolutional] batch_normalize=1 size=1 stride=1 pad=1 filters=64 activation=leaky

[reorg] stride=2

[route] layers=-1,-4

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[convolutional] size=1 stride=1 pad=1 filters=125 activation=linear

[region] anchors = 1.3221, 1.73145, 3.19275, 4.00944, 5.05587, 8.09892, 9.47112, 4.84053, 11.2364, 10.0071 bias_match=1 classes=20 coords=4 num=5 softmax=1 jitter=.3 rescore=1

object_scale=5 noobject_scale=1 class_scale=1 coord_scale=1

absolute=1 thresh = .6 random=1


4. `VOCdevkit/VOC2007/JPEGImages/009460.jpg`

![009460](https://user-images.githubusercontent.com/2465884/32101377-3fd82452-bb18-11e7-8ee3-58b135a5bdc3.jpg)
AlexeyAB commented 6 years ago

@bonzoq Try to use this command with -i 0 at the end: ./darknet detector test cfg/voc.data cfg/yolo-voc.cfg yolo-voc.weights VOCdevkit/VOC2007/JPEGImages/009460.jpg -i 0

And if it doesn't work show screenshot of your console output.

Just now I try it on both Windows 7x64 and Linux x64 (Debian 8): predictions

bonzoq commented 6 years ago

@AlexeyAB sadly still no luck:

zrzut ekranu 2017-10-27 o 13 55 22

I updated the my previous comment to include the whole content of yolo-voc.cfg, which it didn't before.

AlexeyAB commented 6 years ago

@bonzoq I found the solution - set batch=1 subdivision=1 for detection.


In general

On Linux:

On Windows:

I'll look for a reason why we must set the values (batch=1 subdivision=1) for detection on Linux.

bonzoq commented 6 years ago

@AlexeyAB I set batch=1 and subdivision=1.

Sadly it didn't help. Can I debug this somehow?

AlexeyAB commented 6 years ago

@bonzoq

  1. Also try to build without CUDA, and do: ./darknet detector test cfg/voc.data cfg/yolo-voc.cfg yolo-voc.weights VOCdevkit/VOC2007/JPEGImages/009460.jpg -i 0
GPU=0
CUDNN=0
OPENCV=0
DEBUG=0
OPENMP=0
LIBSO=0

  1. Try to build with LIBSO=1, put yolo-voc.cfg and yolo-voc.weights near with compiled uselib file and do: ./uselib VOCdevkit/VOC2007/JPEGImages/009460.jpg
scamianbas commented 6 years ago

Hi all, I have sort of the same issue than @bonzoq here. The training looks ok, it converges to an avg 0.06, high IOU, Recall 1.0 almost everywhere, but on detection it always draws a box around the whole image even there's nothing to detect. :/

bonzoq commented 6 years ago

@AlexeyAB

  1. I built with those settings to no avail.
  2. I built with LIBSO=1 and tried but that did not work: zrzut ekranu 2017-10-27 o 14 59 40
zhang11wu4 commented 6 years ago

@AlexeyAB I encounter the same question in windows10, could you help to fix the bug? I downloaded the stop and yield JPEG format images from http://guanghan.info/blog/en/my-works/train-yolo/, Merged them together, the image number only is 554. I trained the images following the instruction “How to train (to detect your custom objects):”, cmd is “darknet.exe detector train data/obj.data yolo-obj.cfg darknet19_448.conv.23”,after 3000 iterations get the following result, Avg recall = 1.000, avg loss = 0.103, but I can’t detect any objects with cmd”arknet.exe detector test data/obj.data yolo-obj.cfg backup/yolo-obj_3000.weights”. Following is the training processing screenshot. image

Following is the obj.data file content: classes= 2 train = data/train.txt valid = data/train.txt names = data/obj.names backup = backup/ Following is the yolo-obj.cfg file content: _[net] batch=64 subdivisions=8 height=416 width=416 channels=3 momentum=0.9 decay=0.0005 angle=0 saturation = 1.5 exposure = 1.5 hue=.1

learning_rate=0.0001 max_batches = 45000 policy=steps steps=100,25000,35000 scales=10,.1,.1

[convolutional] batch_normalize=1 filters=32 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

#######

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[route] layers=-9

[reorg] stride=2

[route] layers=-1,-3

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[convolutional] size=1 stride=1 pad=1 filters=35 activation=linear

[region] anchors = 1.08,1.19, 3.42,4.41, 6.63,11.38, 9.42,5.11, 16.62,10.52 bias_match=1 classes=2 coords=4 num=5 softmax=1 jitter=.2 rescore=1

object_scale=5 noobject_scale=1 class_scale=1 coord_scale=1

absolute=1 thresh = .6 random=0_

Following is the detection cmd and result screenshot. image

AlexeyAB commented 6 years ago

@zhang11wu4 Can you detect anything using default trained model yolo-voc.cfg and yolo-voc.weights downloaded by the link? https://pjreddie.com/darknet/yolo/

zhang11wu4 commented 6 years ago

@AlexeyAB yes, I can detect objects correctly with "yolo-voc.cfg" and "yolo-voc.weights" downloaded from that website.

AlexeyAB commented 6 years ago

@zhang11wu4 Can you share your yolo-obj_3000.weights using GoogleDisk?

zhang11wu4 commented 6 years ago

@AlexeyAB https://drive.google.com/file/d/0Bw2dL4mXINuzMVBUaGFlamk0WUU/view?usp=sharing pls check, thanks!

AlexeyAB commented 6 years ago

@zhang11wu4 I can't detect anything too using this weights-file.

zhang11wu4 commented 6 years ago

@AlexeyAB

  1. Commit maybe b714004546b97e9a43fae3e385dbefb56cecafb6 [b714004], I just downloaded the zip file. 2.My operation system is Win10 with cuda8.0, cudnn5.1,opencv3.2,vs2015. 3.I have compress all project files(including train.txt, images and others) into a rar file to google disk: https://drive.google.com/open?id=0Bw2dL4mXINuzaVllaklkMHNDYzg Pls check, thanks a lot!
AlexeyAB commented 6 years ago

@zhang11wu4 I just trained model of 400 iterations using your dataset without any changes by using this command: darknet.exe detector train stopsign/obj.data stopsign/yolo-obj.cfg darknet19_448.conv.23

And I can detect stop sign by using this command: darknet.exe detector test stopsign/obj.data stopsign/yolo-obj.cfg backup/yolo-obj_400.weights stopsign/014.jpg -thresh 0.1

stop

AlexeyAB commented 6 years ago

@zhang11wu4

zhang11wu4 commented 6 years ago

@AlexeyAB 1.Yes, I use CUDA8.0 with cudnn5.1; 2.GPU is GForce 980M; 3.I tried commit 6ccb418, it works, I can detect objects successfully with 4000 iterations with original dataset including stop signs and yield signs.
Train cmd: darknet.exe detector train data/obj.data yolo-obj.cfg darknet19_448.conv.23 Test cmd: darknet.exe detector test data/obj.data yolo-obj.cfg backup/yolo-obj_4000.weights

scamianbas commented 6 years ago

Hi @AlexeyAB , @zhang11wu4 , @bonzoq here's my conf :

I used the tarball provided by @zhang11wu4 and enabled GPU, CUDNN, OPENCV and OPENMP in the Makefile then "make" it.

Then in "build/darknet/x64" I edited data/obj.data like this:

classes=2 train =data/train.txt valid =data/test.txt names=data/obj.names backup=backup/ because train.txt, test.txt and obj.names were located there. (there is no directory called stopsign)

I also had to rebuild train.txt and test.txt to have the paths in linux format and relative to current directory:

root@0e5c13ae42c1:~/WilliamZhang/build/darknet/x64# head data/train.txt data/obj/stopsign/001.JPEG data/obj/stopsign/002.JPEG data/obj/stopsign/003.JPEG

I did'nt change anything else.

Then I ran the following command: "/root/WilliamZhang/darknet detector train data/obj.data yolo-obj.cfg darknet19_448.conv.23" capture du 2017-10-31 09 58 11

After 400 iterations, I ran the following command: "/root/WilliamZhang/darknet detector test data/obj.data yolo-obj.cfg backup/yolo-obj_400.weights data/obj/stopsign/014.JPEG -thresh 0.1" capture du 2017-10-31 10 01 21

The result is no detections.

I also tried with smaller thresholds (down to zero!) and even by setting batch and subdivisions to 1 in yolo-obj.cfg , again no detections.

I really don't understand what's going on ...

Maybe it's a linux specific issue when generating weights because when I try weights from the official website for instance the detection works very well, the problem it's when try to generate it by myself, maybe you can share your "yolo-obj_4000.weights" so I can give it a try ?

Thank you very much for your help

Mirko

AlexeyAB commented 6 years ago

@scamianbas

  1. Try to update your code from the last commit.

  2. Check that you edit the same obj.data that used in training command line

Then in "build/darknet/x64" I edited data/obj.data like this:

Then I ran the following command: "/root/WilliamZhang/darknet detector train data/obj.data yolo-obj.cfg darknet19_448.conv.23"

  1. Later I'll check training using last commit on Linux, but earlier it worked fine.
zhang11wu4 commented 6 years ago

@scamianbas this the weight file https://drive.google.com/open?id=0Bw2dL4mXINuzS2hqOVRvaWZkMzA following is my cmd and detection result screenshot: image image

scamianbas commented 6 years ago

@AlexeyAB

  1. I used commit 6ccb418 (same as @zhang11wu4) which is the latest as far as I know
  2. I'm sure that I used the same obj.data, there's only one in my working directory (se below) capture du 2017-10-31 12 37 00
  3. cool, I can't wait ! :+1:

@zhang11wu4 Thanks for your weights file, the detection worked fine ! (with batch=1 subdivisions=1) capture du 2017-10-31 12 34 29

It really looks like the issue is linux related...

sc1234qwer commented 6 years ago

one class with 100 images and after about 400--800 iterations,the weights work well, i am doubtful, the train so fast ??

AlexeyAB commented 6 years ago

@scamianbas

  1. So I successfully trained model on Windows: https://github.com/AlexeyAB/darknet/issues/243#issuecomment-340512559
  2. And successfully trained model on Linux x64 Debian 8: source code, executable file darknet, training dataset /data/obj, two trained models in /backup folder - you can download all by the url: https://drive.google.com/open?id=0BwRgzHpNbsWBZi0xVENMbm1ZMVk
    • unpack darknet_port.zip
    • try to run img_sign.sh
    • if it doesn't work, then recompile executable file, do: make clean and make -j8 in folder with Makefile
    • run img_sign.sh to check detection work
    • run valid_sign.sh to check recall work
    • run train_sign.sh to check training, and after 100 iterations, cancel training CTRL+C and check detection - run img_sign.sh

linux_darknet

100 iterations too few for good prediction, but it enough to detect anything. For good prediction it should be trained ~4000 iterations for 2 classes (stop, yield) = 2000 per class

scamianbas commented 6 years ago

@AlexeyAB Yep it works ! Thank you very much ! Tomorrow I will analyze why and keep you informed. I had to recompile, dos2unix the .sh files and invoke bash to xecute them. Thanks a lot again !

scamianbas commented 6 years ago

@AlexeyAB please find below the src differences with @zhang11wu4 version, if you want analyze it:

root@0e5c13ae42c1:~/darknet_port# diff -rq src /root/WilliamZhang/src
Files src/demo.c and /root/WilliamZhang/src/demo.c differ
Files src/detector.c and /root/WilliamZhang/src/detector.c differ
Files src/image.c and /root/WilliamZhang/src/image.c differ
Files src/network.h and /root/WilliamZhang/src/network.h differ
Files src/parser.c and /root/WilliamZhang/src/parser.c differ
Files src/parser.h and /root/WilliamZhang/src/parser.h differ
Files src/yolo_console_dll.cpp and /root/WilliamZhang/src/yolo_console_dll.cpp differ
Files src/yolo_v2_class.cpp and /root/WilliamZhang/src/yolo_v2_class.cpp differ
root@0e5c13ae42c1:~/darknet_port# diff src/demo.c /root/WilliamZhang/src/demo.c
128c128
<     net = parse_network_cfg_custom(cfgfile, 1);
---
>     net = parse_network_cfg(cfgfile);
root@0e5c13ae42c1:~/darknet_port# diff src/detector.c /root/WilliamZhang/src/detector.c
14d13
< 
17,18c16
< #define OPENCV_VERSION CVAUX_STR(CV_VERSION_MAJOR)""CVAUX_STR(CV_VERSION_MINOR)""CVAUX_STR(CV_VERSION_REVISION)
< #pragma comment(lib, "opencv_world" OPENCV_VERSION ".lib")
---
> #pragma comment(lib, "opencv_world320.lib")  
20,23c18,20
< #define OPENCV_VERSION CVAUX_STR(CV_VERSION_EPOCH)""CVAUX_STR(CV_VERSION_MAJOR)""CVAUX_STR(CV_VERSION_MINOR)
< #pragma comment(lib, "opencv_core" OPENCV_VERSION ".lib")
< #pragma comment(lib, "opencv_imgproc" OPENCV_VERSION ".lib")
< #pragma comment(lib, "opencv_highgui" OPENCV_VERSION ".lib")
---
> #pragma comment(lib, "opencv_core2413.lib")  
> #pragma comment(lib, "opencv_imgproc2413.lib")  
> #pragma comment(lib, "opencv_highgui2413.lib") 
25d21
< 
27d22
< 
31a27
>   printf("detector.c train_detector()\n");
33a30
>   printf("detector.c train_images=%s\n", train_images);
35c32
< 
---
>   printf("detector.c backup_directory=%s\n", backup_directory);
37a35
>   printf("detector.c basefile=%s\n", base);
461a460,461
>   printf("detector.c test_detector() names0=%s\n", names[0]);
>   printf("detector.c test_detector() names1=%s\n", names[1]);
464c464
<     network net = parse_network_cfg_custom(cfgfile, 1);
---
>     network net = parse_network_cfg(cfgfile);
478d477
<           if (input[strlen(input) - 1] == 0x0d) input[strlen(input) - 1] = 0;
565d563
<       if (filename[strlen(filename) - 1] == 0x0d) filename[strlen(filename) - 1] = 0;
root@0e5c13ae42c1:~/darknet_port# diff src/image.c /root/WilliamZhang/src/image.c  
19d18
< #include "opencv2/imgcodecs/imgcodecs_c.h"
188c187
< 
---
>   //printf("draw_detections()_num=%d\n", num);
190a190
>       //printf("draw_detections()_class=%d\n", class);
191a192
>       //printf("draw_detections()_prob=%f\n", prob);
194,201d194
<           //// for comparison with OpenCV version of DNN Darknet Yolo v2
<           //printf("\n %f, %f, %f, %f, ", boxes[i].x, boxes[i].y, boxes[i].w, boxes[i].h);
<           // int k;
<           //for (k = 0; k < classes; ++k) {
<           //  printf("%f, ", probs[i][k]);
<           //}
<           //printf("\n");
< 
301c294
<           //printf("left=%d, right=%d, top=%d, bottom=%d, obj_id=%d, obj=%s \n", left, right, top, bot, class, names[class]);
---
> 
1368,1369c1361,1362
<   //image out = load_image_stb(filename, c);  // OpenCV 3.x
<   image out = load_image_cv(filename, c);
---
>   image out = load_image_stb(filename, c);    // OpenCV 3.x
>   //image out = load_image_cv(filename, c);
root@0e5c13ae42c1:~/darknet_port# diff src/network.h /root/WilliamZhang/src/network.h
24c24
<   int *seen;
---
>   uint64_t *seen;
root@0e5c13ae42c1:~/darknet_port# diff src/parser.c /root/WilliamZhang/src/parser.c
587,591d586
<   return parse_network_cfg_custom(filename, 0);
< }
< 
< network parse_network_cfg_custom(char *filename, int batch)
< {
608d602
<   if (batch > 0) net.batch = batch;
708,709d701
< 
< 
847c839
<     fwrite(net.seen, sizeof(int), 1, fp);
---
>     fwrite(net.seen, sizeof(uint64_t), 1, fp);
1036,1038c1028
<       uint64_t iseen = 0;
<       fread(&iseen, sizeof(uint64_t), 1, fp);
<       *net->seen = iseen;
---
>       fread(net->seen, sizeof(uint64_t), 1, fp);
1041c1031,1033
<       fread(net->seen, sizeof(int), 1, fp);
---
>       int iseen = 0;
>       fread(&iseen, sizeof(int), 1, fp);
>       *net->seen = iseen;
root@0e5c13ae42c1:~/darknet_port# diff src/parser.h /root/WilliamZhang/src/parser.h
6d5
< network parse_network_cfg_custom(char *filename, int batch);
root@0e5c13ae42c1:~/darknet_port# diff src/yolo_console_dll.cpp /root/WilliamZhang/src/yolo_console_dll.cpp
88c88
<   Detector detector("cfg/yolo-voc.cfg", "yolo-voc.weights");
---
>   Detector detector("yolo-voc.cfg", "yolo-voc.weights");
root@0e5c13ae42c1:~/darknet_port# diff src/yolo_v2_class.cpp /root/WilliamZhang/src/yolo_v2_class.cpp
57c57
<   net = parse_network_cfg_custom(cfgfile, 1);
---
>   net = parse_network_cfg(cfgfile);
Chanki8658 commented 6 years ago

@AlexeyAB @bonzoq @scamianbas hello , i am using windows 10 , cuda 9.0 and Cudacnn 7.0 . and i followed all the steps mentioned in the blog to train the model https://timebutt.github.io/static/how-to-train-yolov2-to-detect-custom-objects/ and successfully trained the model . but when i am predicting using cmd PS C:\darknet\darknet\build\darknet\x64> .\darknet.exe detector test cfg\obj.data cfg\yolo-obj.cfg backup\yolo-obj_1000.weights C:\darknet\darknet\build\darknet\x64\NFPAdatas et\pos-1.jpg i ma not getting any detection . even i tried with yolo-9000 weights and label still its not detecting anything .
capture

Chanki8658 commented 6 years ago

obj.zip @bonzoq @AlexeyAB @scamianbas my config file are attached in zip file

AlexeyAB commented 6 years ago
root@0e5c13ae42c1:~/darknet_port# diff src/network.h /root/WilliamZhang/src/network.h
24c24
<   int *seen;
---
>   uint64_t *seen;

@scamianbas Yes, definitely @zhang11wu4 code version without bug fixes, i.e. one of commit between these two:

@Chanki8658 Try to update your code from this repo.

Chanki8658 commented 6 years ago

@AlexeyAB changes of b714004#diff-3d6e69dd5b0d5232fc0779ad2cea1e00R24 commit with bug fix < used commit this branch is already in my code which i built . How can i debug this . when i debug the code everything seems to be fine and just that float *probs = calloc(l.wl.hl.n, sizeof(float )); probability is always coming zero . could you please suggest

Chanki8658 commented 6 years ago

@AlexeyAB parser.zip parser.c and network.c network.zip is attached

Chanki8658 commented 6 years ago

@AlexeyAB could you suggest the last correct branch which built and predict successfully on windows .

Chanki8658 commented 6 years ago

@AlexeyAB i also tried with pre-train weights . but still its not showing up anything https://drive.google.com/open?id=0B6yBEDUqsu7Ta1M1dE40OFV1Tms

AlexeyAB commented 6 years ago

@Chanki8658 You should do each step described here: https://github.com/AlexeyAB/darknet/issues/243#issuecomment-340908751

TheMikeyR commented 6 years ago

I saw the "help wanted"-label have been applied to this thread. I've completed the steps in https://github.com/AlexeyAB/darknet/issues/243#issuecomment-340908751 (had to make again for it to work) and I have no issues, detecting everything fine also after a new training.

./data/obj/stopsign/001.JPEG: Predicted in 0.067797 seconds.
: 73%
: 57%

System Info GPU: Quadro M1200 OS: Ubuntu 16.04 CUDA: 8.0 CUDNN: 5.1

scamianbas commented 6 years ago

Hi @AlexeyAB what is the "-i 0" option for ? Thanks

AlexeyAB commented 6 years ago

@scamianbas For using GPU number 0.