pythonmachine-learningdeep-learningyolodarknet

How to predict multi image txt in darknet?


In Yolov7, I use this code to test entire folder images:

python test.py --save-txt --data data/coco.yaml --save-conf --conf 0.1 --weights yolov7_20240316best.pt --task test --name 0316conf01

Now I need to predict test.txt (include all image path) in yolov4.

I tried this command but did not work:

darknet detector test data/obj.data cfg/yolo-obj.cfg backup/yolo-obj_best.weights -thresh 0.9 -dont_show data/test.txt result.txt

Solution

    1. Make sure you're using the most up-to-date repo for Darknet. The new repo is this one: https://github.com/hank-ai/darknet#table-of-contents

    2. The question you ask is addressed in the FAQ. See the question "How to run against multiple images" here: https://www.ccoderun.ca/programming/yolo_faq/#json_output The command that used to be recommended was:

    To process a list of images data/train.txt and save results of detection to result.json file use: darknet detector test coco.data yolov4.cfg yolov4.weights -ext_output -dont_show -out result.json < test.txt

    1. But personally, I prefer using the DarkHelp CLI. It is also open source, and provides a lot of functionality that doesn't exist in Darknet, as well as being much more robust. For example, this is how you'd do the equivalent in DarkHelp:

    DarkHelp --json --threshold 0.9 yolo-obj.cfg yolo-obj_best.weights yolo-obj.names --list test.txt

    1. Make sure you read the whole FAQ: https://www.ccoderun.ca/programming/yolo_faq/

    2. Join the Darknet/YOLO discord server if you have more questions: https://discord.gg/zSq8rtW