AlexeyAB / darknet

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

Images detected in 4k #1852

Open saulibanez opened 5 years ago

saulibanez commented 5 years ago

Hi @AlexeyAB,

First I want to tell you that I find your work unbelievable. Having said that, I would like to ask you a series of questions:

I'm theoretically saving the detected image in 4k, the problem is that it doesn't save exactly the correct image, I mean, when I run the neural network with a test video, in the X-frame it tells me that I have some predictions, I save that frame, then I run the neural network against that image and different predictions appear to me to what was seen in the video, does this problem have a solution? I've also tried to save the image before the new thread starts, but it doesn't work either, I don't know if it will be a problem of the 4k that takes to save the image.

The other thing I wanted to ask you are a few lines of code that I can not understand why. in demo.c from line 254 you have:

fetch_in_thread(0);
detect_in_thread(0);
det_img = in_img;
det_s = in_s;

for(j = 0; j < FRAMES/2; ++j){
    fetch_in_thread(0);
    detect_in_thread(0);
    det_img = in_img;
    det_s = in_s;
}

Why do you make the loop? and the variable FRAMES, what is it used for in this case?

Thank you Greetings.

Saul.

AlexeyAB commented 5 years ago

@saulibanez Hi,

Why do you make the loop? and the variable FRAMES, what is it used for in this case?

It averages detection over 3 frames for more stable detection.

To disable it - set #define FRAMES 1 here and recompile: https://github.com/AlexeyAB/darknet/blob/08e8e0c8c2d3cddfb6ee065e813ae5023f9568d2/src/demo.c#L18 so you will get the same predictions for ./darknet detecto demo and ./darknet detecto test

saulibanez commented 5 years ago

Hi @AlexeyAB

I tried what you told me, but it doesn't work, the results are still the same. I mean, when I launch the neural network with a video, in frame 4, there is a probability of 86% and 70%, that image is saved (regardless of FRAMES = 1 or FRAMES = 3) when I launch the neural network on the image that has been saved (the frame 4, I understand that I should get the same probabilities and detections, but not so, the prediction of that frame is 53%, 27% and 31%, I check the saved previously and later and none looks like the original result. There are other images that have been saved that launching ./darknet detector test does not detect anything.

Do you know what might be due?

Thank you, Greetings, Saul.