[Darknet-off topic] Cannot load image "-dont_show" despite patch of images and opencv OK [closed]
I'll like to know the explanation about the output error:
105 conv 18 1 x 1 / 1 76 x 76 x 256 -> 76 x 76 x 18 0.053 BFLOPs
106 yolo
Loading weights from backup/obj_100.weights...Done!
Cannot load image "-dont_show"
free(): invalid pointer
when a try to use the ./darknet detector test obj.data obj.cfg backup/obj_100.weights -dont_show -ext_output < data/train.txt > result.txt
command.
I check the train.txt and the image path is OK:
/home/fitlab1/Área de Trabalho/CNN4antsYOLO/darknet/sample_107.jpg
The opencv is OK too:
python3 -c "\
import cv2
print(cv2.__version__)"
4.2.0
and the prediction direct with the file image name using the command ./darknet detector train obj.data cfg/obj.cfg darknet53.conv.74 -map | tee log.txt
work very well:
105 conv 18 1 x 1 / 1 76 x 76 x 256 -> 76 x 76 x 18 0.053 BFLOPs
106 yolo
Loading weights from darknet53.conv.74...obj
Done!
Is there some explanation for this error?
This is very confusing to me. The "-dont_show" flag is a command line flag for the yolo/darknet executable. How is this related to opencv?
And your command does not contain the path to the image - please check the documentation on how to use command line correctly..
I would like to close this as offtopic - as this is really not an opencv issue. If you have question on how to do inference on a yolo model with opencv - come back later.
no proof, python uses a different package than darknet
Thank @holger, but in the code
-ext_output < data/train.txt >
my *txt file with the path of images is inside dedata
directory. I don't know what's wrong I check the darknet documentation in (https://github.com/pjreddie/darknet).Pardon me? The problem is in this line:
And the error is coming for the darknet/yolo executable. Python or opencv is not involved in this "problem". He should just pick the correct command line options. Yolo is not foolproof there(not best programmed imho).
And also
This does not do inference/predictions - it trains a model. If it output a prediction - then only because its luck or you using debug output - you shouldn't use training(back propagation) to make predictions(inference)
You base command should look like this:
it expected an image path where you gave it
-dont_show
.please lookup how cmdline args are handeled in
examples/darknet.c
@holger - beat me by a few seconds ;)
i would not say darknet is always off-topic (it's using opencv for gui and images)
but in this case - sure.
Berak you got the point :-) Just try out by adding flag one after the other to see where it breaks(i am not sure anymore - i do these things programatically). The command line handling is not intuitive/buggy/ not good documented imho.