AlexeyAB / darknet

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

Saving video file results in .json format #7890

Open seabass1217 opened 3 years ago

seabass1217 commented 3 years ago

Hi All,

I would like to save detection results from video file in .json format, so I can get the frame number where the detection occurs. Is this possible?

Sample commands I have tried:

  1. darknet detector demo data/obj.data cft/yolov4.cfg video.mp4 -out result.json
  2. darknet detector demo data/obj.data cft/yolov4.cfg video.mp4 -ext_output -out result.json
  3. darknet detector demo data/obj.data cft/yolov4.cfg video.mp4 -ext_output result.json

Thanks!

folkien commented 3 years ago

I don't know darknet command to do it but if you know python you can use darknet.py library wrapper and write own code. It shouldn't be hard. You can use this example as solid basis for this task https://github.com/AlexeyAB/darknet/blob/master/darknet_video.py In python it's easy to store each detections in dictionary object and then save dictionary to json thanks to json python module.