Open kmsravindra opened 6 years ago
i guess you are interested in this: https://github.com/AlexeyAB/darknet/blob/6390a5a2ab61a0bdf6f1a9a6b4a739c16b36e0d7/src/image.c#L536-L548
if you use yolo as .dll, look at this function: https://github.com/AlexeyAB/darknet/blob/6390a5a2ab61a0bdf6f1a9a6b4a739c16b36e0d7/src/yolo_console_dll.cpp#L181-L204
Hi @AlexeyAB
I thought it might be easier to just ask here since my question is similar. Is there a way to retrieve the bounding box for a specific video? when I run my model with a video with the command, I can see the box in the video displayed, but I would like to retrieve the points either through python or saved in a text file. I tried the following command: darknet.exe detector valid data/obj.data yolo-obj.cfg yolo-obj_4700.weights Prince_1_1.mp4 -i 0 but it seems like it only works on the testing data set I put before and I don't understand what the results in the text file refer to (They also don't seem to be normalized like the label format used by YOLO).
Thanks a lot !!
@Osumann Try to use
darknet.exe detector demo data/coco.data yolov3.cfg yolov3.weights -thresh 0.25 test.mp4 -ext_output > result.txt
Then you can look at the file result.txt
@AlexeyAB I tried the command and all I get is the percentage of the object and fps in thefile. What I am trying to retrieve is the detected spatial boundary for every frame. Maybe the xmin, y min, height and width or just like the format used for training: center point and height and width. Is there any way to get it?
@Osumann Update your code from this GitHub repo.
What can I get using this command:
darknet.exe detector demo data/coco.data yolov3.cfg yolov3.weights -i 0 -thresh 0.25 -ext_output test.mp4 > result.txt
and result.txt
:
Demo
Total BFLOPS 65.864
seen 64
video file: test.mp4
Video stream: 1280 x 720
[2J[1;1H
FPS:0.0
Objects:
[2J[1;1H
FPS:0.0
Objects:
person: 84% (left: 1067 top: 1242 w: 175 h: 81)
person: 72% (left: 0 top: 1139 w: 1154 h: 138)
person: 71% (left: 828 top: 926 w: 98 h: 97)
person: 62% (left: 465 top: 557 w: 91 h: 85)
person: 62% (left: 281 top: 474 w: 193 h: 135)
person: 60% (left: 530 top: 617 w: 87 h: 82)
person: 58% (left: 927 top: 1020 w: 93 h: 75)
person: 55% (left: 33 top: 124 w: 91 h: 73)
person: 52% (left: 692 top: 824 w: 131 h: 121)
person: 43% (left: 0 top: 60 w: 61 h: 69)
person: 34% (left: 627 top: 704 w: 76 h: 82)
person: 26% (left: 1177 top: 1247 w: 70 h: 105)
person: 26% (left: 603 top: 647 w: 44 h: 65)
[2J[1;1H
FPS:0.0
Objects:
...
@AlexeyAB Thank you !! I'll get the new commit and try again !
@AlexeyAB Using the new code, I got the result you showed !! thank you so~ much !! Can you please point me to the lines of code that print the other information (the one below this text) so that I can comment them out and only save the bounding box. I looked in image.c and I tried commenting out all the other printf() but I still can't get it done.
Demo
Total BFLOPS 65.864
seen 64
video file: test.mp4
Video stream: 1280 x 720
�[2J�[1;1H
FPS:0.0
Objects:
�[2J�[1;1H
FPS:0.0
Objects:
@AlexeyAB that worked like a charm !! Thank you again. One more (hopefully last) question. I tried to figure it out, but it seems like something is strange with the y-max (top) value I get in the results. The value of x (left) seems correct, so do the values of width and height, but the y-max (top) is way too high. I use a video with dimension: 1920*1080 and the first frame (for example) is supposed to have a top value of around 950 but I get 1600. When I test using darknet, I get good results and the box keeps following my target. Any idea ?
@Osumann Thanks. This was a bug, I fixed it.
@AlexeyAB I encountered the same bug as @Osumann could you point where the bug was so I can fix it, without updating all the repo, I locally have?
Thank you very much!
Just found it on the image.c commit 1b7a1a0
@AlexeyAB I figured while using this command `darknet.exe detector demo data/coco.data yolov3.cfg yolov3.weights -i 0 -thresh 0.25 -ext_output test.mp4 > result.txt
` to save output in result.txt it somehow encodes the files in UTF-8. Since i want to parse that txt file and compare the output but due to encoded in UTF-8 it doesnt process that well, and i have to remove few keyword from txt file in starting (which actually makes it encoded in UTF-8) manually to do parsing. the keyword i specifically have to remove is <84> and other THTH unused keywords
Can you please point out where it converts the file in UTF-8 ? or Can you please point out how can i save this output file in csv ?
@Eyshika
There is not implemented any special convertion to the UTF-8 in the Darknet. Check settings of you OS.
To disable showing THTH... just comment these lines: https://github.com/AlexeyAB/darknet/blob/b3b78afb8f313231ab771367af3a60cfedd98c11/src/convolutional_layer.c#L252-L253
Also you can save predictions in the Yolo-training format, just use flag -save_labels
./darknet.exe detector test cfg/coco.data yolov3.cfg yolov3.weights -dont_show -ext_output -save_labels < data/test.txt
and you will see near with jpg-files also txt-files with the same names.
@AlexeyAB, I am looking for the code to change the format and style of the bounding box. It would be very helpful if you could point me to where this code is present and how I can change it ? thanks!