Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Darknet detector test interprets flags as image argument #62

Open
StijnPruijssers opened this issue May 7, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@StijnPruijssers
Copy link

I have successfully trained a test model with the repo. However, I want to evaluate my test set with the 'darknet detector test' command on a batch of images from the file test.txt.

Previously on a earlier version of the AlexeyAB fork I used a command like this which worked fine:
darknet detector test obj.data cfg\detector_test.cfg modelWeights\detector_test_best.weights -ext_output -dont_show -out result.json < test.txt

However, now this results in the following error:

Error location: C:\src\darknet\src-lib\image_opencv.cpp, load_image_mat_cv(), line #72
Error message: failed to load image file "result.json"
Thread #62760: main darknet thread
Version v2.0-190-g3c9722d5 built on May 1 2024 16:56:45

Funnily enough, if I use the command that writes to a text version it does work. The working command looks like this:
darknet detector test obj.data cfg\detector_test.cfg modelWeights\detector_test_best.weights -dont_show -ext_output < test.txt > result.txt

The results show up in results.txt but the same problem with the .json comes up when I try to add the -thresh or -iou_thresh flag to test performance with different values. If I use this command:

darknet detector test obj.data cfg\detector_test.cfg modelWeights\detector_test_best.weights -thresh 0.75 -dont_show -ext_output < test.txt > result.txt

It does not work and gives the same type of error as with the .json command:

Errno 2: No such file or directory
Error location: C:\src\darknet\src-lib\image_opencv.cpp, load_image_mat_cv(), line #72
Error message: failed to load image file "0.75"

I have tried all commands with absolute paths and relative paths and flags in different order but functionality remains the same. At this moment I'm not sure why the .json or the threshold flags are interpreted as the image argument in the command.

I am running darknet on windows 11. With the following output of the darknet --version command:

Darknet v2.0-190-g3c9722d5
CUDA runtime version 11080 (v11.8), driver version 12000 (v12.0)
cuDNN version 11080 (v8.9.6), use of half-size floats is ENABLED
=> 0: NVIDIA RTX 2000 Ada Generation Laptop GPU [#8.9], 8.0 GiB
OpenCV v4.8.0

@StijnPruijssers StijnPruijssers added the bug Something isn't working label May 7, 2024
@pete-machine
Copy link

pete-machine commented May 29, 2024

First, thank you Hank-ai for the great work your are doing!

I want to add a +1 on this issue. I noticed the same issue on linux/ubuntu when saving results to json.

The issue is reproducible with the default yolo4 model and weights:

wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights
./build/src-cli/darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights -ext_output -dont_show -out result.json artwork/dog.jpg

I have checked and can confirmed that the same command works on the "AlexeyAB" version of darknet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants