AlexeyAB / darknet

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

any solution to save video detection annotation logs in text #4872

Open qwertyuiop-123456789 opened 4 years ago

qwertyuiop-123456789 commented 4 years ago

Hi. i want to get output text of video detection's annotation list in each video frame or image from Darknet. Is there any solution to this problem inside Darknet?

stephanecharette commented 4 years ago

In DarkHelp (a C++ wrapper for libdarknet.so) I have a --json or -j switch that makes it output a JSON structure. It contains everything there is to know about what has been detected. Maybe this would be useful to you? See here: https://www.ccoderun.ca/DarkHelp/api/ShellScripting.html

Output looks like this for every image:

{
    "image": [
        {
            "count": 1,
            "duration": "178 milliseconds",
            "filename": "cujo.jpg",
            "original_height": 293,
            "original_width": 269,
            "prediction": [
                {
                   "all_probabilities": [
                        {
                            "class": 0,
                            "name": "dog",
                            "probability": 0.9390020966529846
                        }
                    ],
                    "best_class": 0,
                    "best_probability": 0.9390020966529846,
                    "name": "dog 94%",
                    "original_point": {
                        "x": 0.4825710654258728,
                        "y": 0.33033615350723267
                    },
                    "original_size": {
                        "height": 0.48039382696151733,
                        "width": 0.6355597376823425
                    },
                    "rect": {
                        "height": 141,
                        "width": 171,
                        "x": 44,
                        "y": 26
                    }
                }
            ],
            "resized_height": 293,
            "resized_width": 269
        }
    ],
...
qillbel commented 4 years ago

I've got them saved in txt file through this command. Is that what you need?

!./darknet detector demo obj.data yolov3-tiny-costum.cfg yolov3-tiny_last.weights -dont_show -ext_output video.mp4 -out_filename video.avi >video.txt