2

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?

Antonino
  • 3,178
  • 3
  • 24
  • 39
Uwe Clement
  • 21
  • 1
  • 5

2 Answers2

2

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

can
  • 309
  • 1
  • 4
  • 13
  • This was a perfect hint! Can i ask u a further question? Do you know how i can change the .c sourcefiles, that the image is loaded from a IP-camera (http://192.168.178.47/tmpfs/auto.jpg?usr=admin&pwd=none1) instead of the given file typed in the console? – Uwe Clement Aug 17 '20 at 20:23
  • I don't know that much about it, but you can use a python script to call the command with different images. if you are saving images on a temp file you can check the existance of the image and run the command. code looks bad here I added the example as a second answer. – can Aug 18 '20 at 15:34
-1
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))
can
  • 309
  • 1
  • 4
  • 13