pjreddie / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
25.73k stars 21.33k forks source link

Cannot load image "data/labels/*.png" #955

Open idilalemdar opened 6 years ago

idilalemdar commented 6 years ago

Hello everyone, this is the first time I'm training YOLO. Currently I'm training YOLOv2 and at the same time while it is being trained, I test with backed up weights. When I run the test as:

./darkent detector test *.data *.cfg backup/*.weights *.jpg

I get Cannot load image "data/labels/*.png" error for all the files in data/labels/png. After the program finishes running, it outputs its predictions on the stdout, it draws predicted bounding boxes on the picture, but writes no labels on these boxes. I explicitly stated the full directory of .names file in my .data file, so why does YOLO look for data/labels directory for labels? What am I missing?

Here you can see the situation better: screenshot from 2018-07-09 10 03 57

(Currently it's not important whether it predicts correctly, I'm just interested in why no labels is shown on the image while something is predicted and bbox'ed.)

Victoria-Pinzhen-Liao commented 6 years ago

me too

GeorgUr commented 6 years ago

In the folder data/labels/are pictures of characters of the alphabet. YOLO uses them to draw the label in the picture. Probably you have deleted that folder, so Yolo can't find them and your label gets black in the picture. You can change the path of the directory, where the pictures of the characters are loacted. In src/image.c in function load_alphabet(), sprintf(buff, "data/labels/%d_%d.png", i, j);. In this case you need to rebuild darknet using make.

philippschw commented 5 years ago

Issue can also appear if you are trying to run the command not from the intended folder, e.g.:

./darknet/darknet detector test darknet/cfg/obj.data cfg/yolo-obj.cfg darknet/temp_models/yolo-obj_final.weights scan_classifier/Training_scan/4-28.png

Make sure you use something like this:

./darknet detector test cfg/obj.data cfg/yolo-obj.cfg temp_models/yolo-obj_final.weights ../scan_classifier/Training_scan/4-28.png

philipperemy commented 4 years ago

Probably you're using docker and your WORKDIR is wrong. You have to run the command from where darknet is.

yara-leodoro commented 2 years ago

You probably forgot to put the labels folder in darknet/data or removed it from location

AfiqHamdani commented 2 years ago

Hello there, I am a final year student and now doing my fyp about object detection using yolo. Currently, I face the same problem like this when I run the test where it showed "Cannot load image "data/labels/*.png". How do we solve this? Would you share the solution? I am looking forward to it.

MBouallegue commented 2 years ago

Hello there, I am a final year student and now doing my fyp about object detection using yolo. Currently, I face the same problem like this when I run the test where it showed "Cannot load image "data/labels/*.png". How do we solve this? Would you share the solution? I am looking forward to it.

I would like to start by saying the darknet_ros full package folder is composed like this

-Darknet_ros package ---Darknet_ros ---Darknet ---Darknet_ros_msgs

the problem is due to the "darknet/data" folder if you're trying to use it from catkin_make install that directory is not in the "install/share/" folder try to add this in CMakelist.txt by adding these lines in

install(DIRECTORY ${DARKNET_PATH}
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

this will put the darknet folder in the install folder of the darknet_ros, however, it won't solve the problem since the "YoloObjectDetector.cpp" depends on the DARKNET_FILE_PATH which is taken from the CMakelist ${CMAKE_CURRENT_SOURCE_DIR}/../darknet/ I tried to change it to ${CMAKE_CURRENT_SOURCE_DIR}/darknet/ and of course in the src I had to put the darknet inside darknet_ros it worked for me when I made the catkin_make install