Anam Zahra
Anam Zahra

Reputation: 21

How to write Yolov4 detection results of VIDEOS in .txt format?

I'm trying the code from https://github.com/AlexeyAB for object detection on videos. I want to save my results in .txt or .json form rather than .avi form, I tried this solution Save prediction to json or txt file and also save output video file in yolov3 object detection - Google colab but didn't work. Just wondering if someone can suggest something.

Upvotes: 2

Views: 3271

Answers (1)

Addie Ira B. Parico
Addie Ira B. Parico

Reputation: 617

If you are using Linux, try this command:

./darknet detector demo data/coco.data yolov3.cfg yolov3.weights -i 0 -ext_output > result.txt

The result will be saved in result.txt file in this case. It would look like this:

Demo
net.optimized_memory = 0 
mini_batch = 1, batch = 16, time_steps = 1, train = 0 
nms_kind: greedynms (1), beta = 0.600000 
nms_kind: greedynms (1), beta = 0.600000 

 seen 64, trained: 371 K-images (5 Kilo-batches_64) 
video file: /.../test.mp4
Video stream: 1920 x 1080 
FPS:57.9     AVG_FPS:52.9
Objects:

person: 99%     (left_x:    0   top_y:  645   width:  364   height:  465)

FPS:58.4     AVG_FPS:52.9
Objects:

person: 99%     (left_x:    8   top_y:  664   width:  340   height:  424)

FPS:56.9     AVG_FPS:52.9
Stream closed.
input video stream closed. 

If you want to see the video with the detections while writing the txt file:

./darknet detector demo data/coco.data yolov3.cfg yolov3.weights -i 0 -ext_output | tee result.txt

For Windows you should install: https://code.google.com/archive/p/wintee/downloads

Reference for this answer: https://github.com/AlexeyAB/darknet/issues/868

Upvotes: 1

Related Questions