bennetthardwick / darknet.js

A NodeJS wrapper of pjreddie's darknet / yolo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Less accurate detection compare to darknet project

MaDumont opened this issue · comments

Hi,

I trained some darknet weights to detect a specific object. When I use the darknet project with my camera the detection is really great.

./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights

But when I use those same weights and config within my nodejs project, I have difficulty detecting the same object. It work if the object is close to the camera, but when it's a little bit far it doesn't detect anything. I use the node opencv4nodejs to capture the picture from my camera. I tested with the example with opencv4nodejs.

Do you have an idea of what could cause that issue?

The detection options in the demo.c file are nms = 0.4, thres = 0, hier = 0.5.

Can you try darknet.detect(frame, { nms: 0.4, thresh: 0 }). I'm not really sure what the options do (other than thresh), but it'll make it a lot more sensitive at least.

Other stuff that the demo.c file seems to do is remember the state of the previous frame before doing the next detection.

Decreasing the threshold help detecting better, but it also bring the problem of false detection.

But I'm not sure to know why I need a really low threshold. I use the same setup and with demo.c I get 80% detection and with this I get between 5% and 2%.

I'm a bit stumped on this. I think it's got something to do with the avg_detections method inside the demo.c file, but I don't have much capacity to look into it at the moment.

I am curious however, is it just your own weights that you have the problem with? Or does it happen with the example ones as well?

I just tested with my own weights. I will test it with the example weights and give you feed back.

I tested with yolov3-tiny weights and cfg because that's with those file I trained my own weights. I couldn't test with the normal yolov3 because of some issues with my computer. I didn't saw that much difference of accuracy of detection. So I feel it's related to my weights. I'm gonna try to figure it out what it could be.

I feel like there might be a small difference between the opencv that darknet uses and opencv4nodejs, which means the images aren't 100% identical. Maybe you can try retraining your weights and add random noise to the images?

Hummmm ok yeah I'm gonna try that.