AlexeyAB / darknet

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

-ext_output for video to .txt file #6486

Closed fostjms closed 4 years ago

fostjms commented 4 years ago

Hey,

is there a way to save the output of the detection command on video to a .txt just like I can with images?

If I run !./darknet detector demo data/obj.data cfg/yolov4-obj.cfg /mydrive/yolov4/backup/yolov4-obj_last.weights -dont_show /mydrive/yolov4/funny.mp4 -ext_output -i 0 -out_filename results.mp4 the output is shown (FPS, object, bb coordinates, etc...).

How can I modify that command so that it behaves just like this one (images) !./darknet detector test data/obj.data cfg/yolov4-obj.cfg /mydrive/yolov4/backup/yolov4-obj_last.weights -ext_output < /mydrive/yolov4/percorsi.txt > result.txt -thresh 0.3 so the output is written to the result.txt file?

I tried to add the -ext_output < /mydrive/yolov4/percorsi.txt > result.txt part but it doesn't seem to work and creates a heavy .txt file (gigabytes).

edit: I could get the .txt file result and it's giving me this: image

fostjms commented 4 years ago

Ok, the -out flag doesn't work for demo. Regardless, I found a way to solve my problem.

I'll close this issue.

RobinV760 commented 4 years ago

Hi @fostjms how did you solve the issue? I'm trying to do the same thing here.

fostjms commented 4 years ago

Hello @RobinV760 just get frames from your video, save them somewhere (in my case I saved them to Google Drive), then create a txt file where each line contains the path to a frame, and then just run the command: !./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights -dont_show -ext_output < /mydrive/yolov4/frame/paths.txt > result.txt where paths.txt is the txt file I just told you about, and result.txt is the txt file that contains the results of the detection. Let me know if you got it!