Darknet: couldn't open file: train.txt

Created on 22 Feb 2018  Â·  14Comments  Â·  Source: pjreddie/darknet

although the absolute and relative locations for train.txt file was defined in obj.data the darknet detector train command couldn't open it.
if obj.data is not provided as argument it looks for the /data/train.list as default.
if i save my train.txt into /data as train.list the training starts and wants to save to default folder /backup//yolo.backup
if i create a backup folder manually but it didn't work..

Can someone help me what the problem is ? re-build make clean did not work
i am on linux. But everything works in Windows os.

Most helpful comment

@anandkoirala

The first thing you should check is that you have permission to edit/read the files necessary.

Changing the files to include the absolute path worked on for me on a Mac. However, it did not solve the issue on Windows.

On Windows, I was running into the same error and the issue turned out to be the end of line sequences. Make sure that the end of line sequences are "/n" and not "/r/n". In a text editor (like visual studio code) make sure you have LF and not CRLF and also that the file format is UTF8.

Side Note: I also switched to this version of dark net https://github.com/pengdada/darknet-win-linux as it worked better on Linux.

All 14 comments

Ok build this and it runs good..... cheers
https://github.com/pengdada/darknet-win-linux

If you want a more updated / optimised darknet go for https://github.com/AlexeyAB/darknet/

I met the same problem.too
Can you tell more details about how to solve this problem ? Thanks @anandkoirala @TheMikeyR

AlexeyAB darknet is always maintained and works...

@anandkoirala

The first thing you should check is that you have permission to edit/read the files necessary.

Changing the files to include the absolute path worked on for me on a Mac. However, it did not solve the issue on Windows.

On Windows, I was running into the same error and the issue turned out to be the end of line sequences. Make sure that the end of line sequences are "/n" and not "/r/n". In a text editor (like visual studio code) make sure you have LF and not CRLF and also that the file format is UTF8.

Side Note: I also switched to this version of dark net https://github.com/pengdada/darknet-win-linux as it worked better on Linux.

I also face the same problem and get solved after making efforts for two hours. You can follow the following steps to resolve this issue.
01-Open the "train.txt" file and note the directory assigned to each image.
01

02-Open the " obj.txt" file and assign the same directory as you noted above to "train", "Valid", and names.
02

03-The "train.txt", "test.txt" and "obj.txt" should be in the same directory as assigned above.

Stay Blessed!

I am working on Unbuntu and I also got this problem.
I've use dos2unix to change me .txt and also use abs path for this files. Also I move these files all to dir /data/. But it still gives me "Couldn't open file: /xxx/xxx/train.txt/"
TAT

@zhuchenxv try to dos2unix your config file

Loading weights from darknet53.conv.74...Done!
Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005
Couldn't open file: /content/darknet/train.txt
plesea, help me, I spent a lot of time for it

@zhuchenxv try to dos2unix your config file

that worked thank you very much.
I just dos2unix'ed the "X.names" and "X.data" file and it worked.

Loading weights from darknet53.conv.74...Done!
Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005
Couldn't open file: /content/darknet/train.txt
plesea, help me, I spent a lot of time for it

@snadgauda

same problem on macOS
tried dos2unix

It’s not required for macOS since it’s already built on Linux. Check for
your path and any extra spaces . Names the files .data and .names .
That solved the problem for friend using macOS.
On Mon, May 4, 2020 at 11:31 AM Hamid notifications@github.com wrote:

same problem on macOS
tried dos2unix

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/pjreddie/darknet/issues/484#issuecomment-623534256,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ALKV2FY343EYUC7XANG2BALRP3NTNANCNFSM4ER32RNA
.

@zhuchenxv try to dos2unix your config file

that worked thank you very much.
I just dos2unix'ed the "X.names" and "X.data" file and it worked.

that helps, thanks alot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

groot-1313 picture groot-1313  Â·  4Comments

gpsmit picture gpsmit  Â·  3Comments

ryuzakinho picture ryuzakinho  Â·  4Comments

sujithm picture sujithm  Â·  3Comments

arianaa30 picture arianaa30  Â·  3Comments