AlexeyAB / darknet

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

Real-time predictions with darknet, extracting live bbox info #7662

Closed pabsan-0 closed 2 years ago

pabsan-0 commented 3 years ago

Hello! I am using the following command to stream an IP camera, perform live inference, and also cast results to a local server.

./darknet detector demo \
    ~/YOLOv4/darknet/cfg/coco.data \
    ~/YOLOv4/darknet/cfg/yolov4-tiny.cfg  \
    ~/YOLOv4/darknet/cfg/yolov4-tiny.weights \
    http://192.168.0.101:8085/video?dummy=param.mjpg -i 0 \
    -thresh 0.5 \
    -json_port 8070 -mjpeg_port 8090 -ext_output -dont_show

I can stream the results on the output ports 8070 and 8090 just fine. However, now I want to get the live bounding box information and pass it to another program (want to use those coordinates for item localization), but I don't know how. It seems that the .json is appending bboxes each iteration and I can stream that on my web browser, but when I try reaching it with Python's requests module, for instance, I can't get the content.

Is there any clean way of obtaining the live bounding box classes and coordinates, whether using this approach or any other?

Thanks a lot!

iraadit commented 3 years ago

Hi @solder-fumes-asthma ,

I'm encountering the same problem, did you find a solution?

Thanks

pabsan-0 commented 3 years ago

Hey, yes!

Maybe there is a better way, but the easiest I found is to use the Python bindings in darknet.py

That way you boot the network beforehand and can work in real time smoothly.

Hope it helps, cheers!