AlexeyAB / darknet

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

How to store yolo predictions into seperate files during testing ? #998

Open BornInWater opened 6 years ago

BornInWater commented 6 years ago

During inference on yolov3, i am currently parsing the bounding box co-ordinates displayed on the terminal by storing the entire thing into one file for all the images. This is very slow as i can process only one image at a time and hence takes a lot of time. Is there a way where i could test on multiple images at a time[in a batch] while being able to store predictions into different [mat/pkl] files?

AlexeyAB commented 6 years ago

Is there a way where i could test on multiple images at a time[in a batch]

You should implement it by yourself: https://github.com/AlexeyAB/darknet/issues/878#issuecomment-391926257

while being able to store predictions into different [mat/pkl] files?

It isn't implemented.

BornInWater commented 6 years ago

An unrelated question, after how many iterations is testing on validation done during the training process ? If thats configurable, where do i need to look for that? Also, is the validation accuracy at different snapshots stored in some file so as to pick the best snapshot?

Thank you for the help.

AlexeyAB commented 6 years ago

It isn't done automatically yet. You should do ./darknet detector map... manually for each 2000 iterations after ~2000 x classes iterations

BornInWater commented 6 years ago

Which code amongst those in "src" directory should i change in order to do this automatically?

ritwikdubey commented 6 years ago

while being able to store predictions into different [mat/pkl] files?

I intend to achieve something similar within the scope of darknet code.

Say, I have two set of weights, one for character segmentation and other for character recognition. Character segmentation returns following image (disregard the incorrect label names). I want to extract the image in the bounding box and run character recognition on it.

image

One way could be to write a wrapper script which does something like

Perform character segmentation using darknet.exe with flag -ext_output
extract sections from `predictions.png` based on output from darknet.exe
for each extracted image:
    run darknet.exe with character recognition weights
end

But I wish there's a way to perform bounding box extraction in darknet which would be more robust than my hacked up code.

AlexeyAB commented 6 years ago

@ritwikdubey Why you don't want to Detect characters as different objects (i.e. do Detection and Classification by using one Yolo v3 network)?

ritwikdubey commented 6 years ago

@AlexeyAB, interesting idea. I get a feeling that I might lose the sequence information of the characters. If A gets detected before K then the sequence might be read as AK.

Guess I can answer it myself, I could get the coordinates of center of each bounding box and sort them by their x-coordinates. This approach might be quite faster in detection as well, one call to detector will get me the characters by this approach compared to (num_of_characters+1) call to detector in my earlier idea.

Let me see how I can get it to work.