darknet icon indicating copy to clipboard operation
darknet copied to clipboard

couldn't open file: train.txt

Open anandkoirala opened this issue 7 years ago • 19 comments

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.

anandkoirala avatar Feb 22 '18 09:02 anandkoirala

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

anandkoirala avatar Feb 23 '18 00:02 anandkoirala

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

TheMikeyR avatar Feb 23 '18 07:02 TheMikeyR

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

hust-lidelong avatar Jun 17 '18 07:06 hust-lidelong

AlexeyAB darknet is always maintained and works...

anandkoirala avatar Jun 17 '18 08:06 anandkoirala

@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.

snadgauda avatar Jul 02 '18 21:07 snadgauda

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!

AliRazaWrites avatar Dec 01 '18 14:12 AliRazaWrites

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 avatar May 27 '19 07:05 zhuchenxv

@zhuchenxv try to dos2unix your config file

anthonykluu avatar Oct 28 '19 16:10 anthonykluu

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

TanLocc avatar Nov 15 '19 03:11 TanLocc

@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.

SiBensberg avatar Nov 19 '19 14:11 SiBensberg

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

shouryasimha avatar Mar 19 '20 22:03 shouryasimha

same problem on macOS tried dos2unix

Hamid-Najafi avatar May 04 '20 15:05 Hamid-Najafi

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 [email protected] 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 .

shouryasimha avatar May 04 '20 15:05 shouryasimha

@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

doanthuan avatar May 11 '20 07:05 doanthuan

How do i fix this error...

prakashkumar52 avatar Jan 25 '21 09:01 prakashkumar52

when I run the command create_list_of_images.py after running there is not any data in the train.txt file

SaddamHosyn avatar Oct 12 '22 08:10 SaddamHosyn

Just give the proper location of obj.data, in my case "./darknet detector calc_anchors obj.data -num_of_clusters 9 -width 416 -height 416". I t works and anchors.txt and counters_per_class.txt will be saved.

athithya-raj avatar Feb 22 '23 06:02 athithya-raj

I fixed this error by looking here: https://github.com/pjreddie/darknet/issues/2437

Please check the type of Enter in".data","train.txt" files. If you also use VSCODE, you can find type is "UTF-8 LF" or "UTF-8 CRLF" on right bottom. I use Linux to train, but the ".data" file is generated by Windows and uploaded to linux. when i change ".data" file from "UTF-8 CRLF" to "UTF-8 LF" it works.

vinhmdev avatar May 10 '24 16:05 vinhmdev

已收到邮件,谢谢

hust-lidelong avatar May 10 '24 16:05 hust-lidelong