pjreddie / darknet

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

Cannot load image "./darknet/dataset/z1.jpg" STB Reason: can't fopen #1532

Open Mps24-7uk opened 5 years ago

Mps24-7uk commented 5 years ago

Cannot load image “./darknet/dataset/z115.jpg” STB Reason: can't fopen

The darknet directory contains the following:

When I am runing this command: ./darknet detector train obj.data yolov3-tiny.cfg darknet53.conv.74

The Error is generated: Cannot load image "./darknet/dataset/z115.jpg" STB Reason: can't fopen images cant load

The images are present in the dataset but not open.

Please me help with this @antnh6 @sachindesh @TheMikeyR @pjryan513 @BasketJace @jesuisthanos @futureZG @Fnajjar @kylynf @PeterQuinn925 @ahsan856jalal @romass12 @zboinek @BasketJace @Broham

koutini commented 5 years ago

do you use GPU=1 in your Makefile ?

sythanhho commented 5 years ago

You have to use exact path, for example /home/jesuisthanos/darknet/.... Relative paths like yours won't work. Change them

koutini commented 5 years ago

image @jesuisthanos i use the exact path and i get this error

sythanhho commented 5 years ago

Be careful when you save the file, it should be utf-8. It's really easy to face this problem on Windows due to file saving, unlike Linux

koutini commented 5 years ago

@jesuisthanos so what should I do ?

koutini commented 5 years ago

@jesuisthanos
image

sythanhho commented 5 years ago

Can you show me your Save As dialog box?

hakS07 commented 5 years ago

@jesuisthanos I'm also dealing the same problem (cannot load image "*****.txt") an mention it that we should save the file as UTF8 format, do you mean train.txt by that ??

Arktius commented 5 years ago

I had a similar problem: https://github.com/AlexeyAB/Yolo_mark/issues/132

shivu1998 commented 5 years ago

@jesuisthanos I am getting the following error.It was working well in a windows machine but when I tried to run on Google colab which is a linux machine I got errors.Any help???

shivu1998 commented 5 years ago

I solved this issue by converting the txt files which were created in windows to unix like using the following script which I found here https://stackoverflow.com/questions/36422107/how-to-convert-crlf-to-lf-on-a-windows-machine-in-python

Code:

WINDOWS_LINE_ENDING = b'\r\n' UNIX_LINE_ENDING = b'\n'

sou=r"/content/darknet/cfg/my-yolo2.cfg" file_path = sou

with open(file_path, 'rb') as open_file: content = open_file.read()

content = content.replace(WINDOWS_LINE_ENDING, UNIX_LINE_ENDING)

with open(file_path, 'wb') as open_file: open_file.write(content)

talhakabakus commented 5 years ago

Same here; the solution proposed by @shivu1998 did not work for me.

My Software Stack:

OS: Windows 10 Version 1809 (64-bit)
Python: 3.7.3
torch: 1.1.0
piyomatu commented 5 years ago

In google colab, PATH is different from PC environment, so PATH is required in your drive.

You can check with pwd. In train.txt and test.txt, (/ content / drive / [your PATH] ... / ~ .jpg or .png) and you need to rewrite.

ex) train.txt /content/drive/.../~0.jpg /content/drive/.../~1.jpg ...

aaron-wang-de commented 5 years ago

Can you show me your Save As dialog box?

thanks, simply by save as..., select unicode, and replace. then it works

kamat-roopesh commented 5 years ago

Below code worked for me, i have converted the windows train.txt file to Linux file format and i can run the model after that. Thanks to shivu1998

replacement strings

WINDOWS_LINE_ENDING = b'\r\n' UNIX_LINE_ENDING = b'\n'

relative or absolute file path, e.g.:

file_path = r"C:\Users\rkamat\Desktop\YOLO\2\yolo-custom-object-detector-master\python\train.txt"

with open(file_path, 'rb') as open_file: content = open_file.read()

content = content.replace(WINDOWS_LINE_ENDING, UNIX_LINE_ENDING)

with open(file_path, 'wb') as open_file: open_file.write(content)

postor commented 5 years ago

to linux format

dos2unix train.txt
dos2unix val.txt
arnabseacom commented 3 years ago

Hi, I don't think its with line endings only. I am using Ubuntu. I checked the encoding as UTF8. Still I get the same error. Most importantly not the same image file creating error everytime. Each time its a different image file being reported. Thanks

Maithilishetty commented 2 years ago

@arnabseacom I have the same issue, were you able to solve it?