YOLO (Darknet): How to change the output file directory of a detection (predictions.jpg)?

Viewed 2514

The Darknet guide to detect objects in images using pre-trained weights is here

The command to run is:

./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg

The result of the detection is currently saved in the current directory. How can i change this directory where the output file predictions.jpg is saved?

2 Answers

it is under detector.c there is a function like this save_image(im, "predictions");

import subprocess

comand = "/darknet detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights {0} -dont_show"

def __run_shell_command(command):    
    output = subprocess.check_output(command, shell=True).decode("ascii")
    return output

images = ["a.jpg","b.jpg"]

for image in images:
    __run_shell_command(command.format(image))
Related