pjreddie / darknet

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

Couldn't open file: train.txt #1277

Open ihafsa opened 5 years ago

ihafsa commented 5 years ago

I am working on image classification using darknet and YOLO. While training it is giving me the following error: 30 detection mask_scale: Using default '1.000000' Loading weights from darknet19_448.conv.23...Done! Learning Rate: 0.0001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: train.txt i have searched alot and try all the suggestion but failed. anyone please help me out to resolve this issue.

PeterQuinn925 commented 5 years ago

Do you have train.txt where your .data file says to find it?

ihafsa commented 5 years ago

Do you have train.txt where your .data file says to find it?

yes the path is correct.

ihafsa commented 5 years ago

yes the path is correct and train.txt and .data file are in same folder

PeterQuinn925 commented 5 years ago

check the path. Make sure it's got the right / or \ for the path in windows or unix. Try using a full path for it.

ihafsa commented 5 years ago

it works. thankyou

xueyingliu commented 5 years ago

@ihafsa can you tell me how you solved this error?

ihafsa commented 5 years ago

@ihafsa can you tell me how you solved this error?

YES i simply copied the path of train.text file and paste it in .data file

zoranl commented 5 years ago

try: dos2unix data/train.txt if you were using files created in windows

ihafsa commented 5 years ago

@zoranl the issue has been solved by giving the full path. and i am working on linux not windows.

zoranl commented 5 years ago

@ihafsa well, I am working on both, windows and linux machines. In both machines there is no need for a full path, it works fine with relative paths. But when copying windows edited files to linux, there was an exactly same issue as this one. So, its good that people that have same problem, could check both solutions.

fatanifh commented 5 years ago

I have tried all the above suggested solutions but i am still facing the same issue. I did try to convert the file to unix format using dos2unix like @zoranl suggested but i am still struggling with this problem. Please help~

gnaytx commented 5 years ago

i had sove this problem : one: make sure you use abs path two: cat -v train.txt --> check each line endswith, if you found ^M in your line end , use dos2unix train.txt to transform

Wanke15 commented 5 years ago

tried abs path and relative path, still not solved :(

Tehara-Fonseka commented 5 years ago

Hi, I created obj.data file in my windows machine then copied it to linux VM to run darknet on google colab. Firstly, I had a similar issue and this is how I solved it. I simply replaced new lines from '\n' as follows and it worked for me.

content of obj.data classes= 4'\n'train = /content/drive/My\ Drive/darknet/train.txt'\n'valid = /content/drive/My\ Drive/darknet/test.txt'\n'names = /content/drive/My\ Drive/darknet/obj.names'\n'backup = /content/drive/My\ Drive/darknet/backup

FerneyCordoba commented 5 years ago

Hi, I solved the problem by rearranging the .data file as follows

`classes= 4

valid = custom/test.txt

names = custom/objects.names

backup = /ExternalData/BackupFerney

train = custom/train.txt`

I wrote the train path line at the end

TanLocc commented 4 years ago

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

WozLai commented 4 years ago

@TanLocc would you solve that?! I also have the same problem.

Fvegini commented 4 years ago

I was facing the same problem used the "dos2unix" train and test and didn't work!

Then used the "dos2unix" in the other files (obj.data, obj.names, yolov3.cfg) and it worked:

Dung28mta commented 4 years ago

help me! How to use "dos2unix"? i don't convert train.txt error: Loading weights from darknet53.conv.74...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: train.txt

Fvegini commented 4 years ago

help me! How to use "dos2unix"? i don't convert train.txt error: Loading weights from darknet53.conv.74...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: train.txt

In my case I'm using Windows Subsystem Linux - Ubuntu, so you just need to install and use it:

sudo apt-get update sudo apt-get install dos2unix dos2unix /path/to/file

yashrathore750 commented 4 years ago

Just check your .data file and train.txt file are in same directory. worked for me

jhonjam commented 4 years ago

mask_scale: Using default '1.000000' Loading weights from darknet19_448.conv.23...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: /content/darknet/data/train.txt I am working in google colab. help me

shouryasimha commented 4 years ago

Hi, I created obj.data file in my windows machine then copied it to linux VM to run darknet on google colab. Firstly, I had a similar issue and this is how I solved it. I simply replaced new lines from '\n' as follows and it worked for me.

content of obj.data classes= 4'\n'train = /content/drive/My\ Drive/darknet/train.txt'\n'valid = /content/drive/My\ Drive/darknet/test.txt'\n'names = /content/drive/My\ Drive/darknet/obj.names'\n'backup = /content/drive/My\ Drive/darknet/backup

hey , I'm trying to run my model on colab by but i'm unable to do so.Can you please help me out, i'm facing this error when i try put train on top but if I move to the bottom like @FerneyCordoba my backup files are not created.

jhonjam commented 4 years ago

@shouryasimha yo solucione el problema descargando nuevamente los archivos desde !git clone https://github.com/AlexeyAB/darknet, inicialmete estaba descargando los archivo desde !git clone https://github.com/pjreddie/darknet lo cual me generaba ese error.

hustzlb commented 4 years ago

mask_scale: Using default '1.000000' Loading weights from darknet19_448.conv.23...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: /content/darknet/data/train.txt I am working in google colab. help me

do u solve the issue? me too

shouryasimha commented 4 years ago

This isssue is because colab is built with Linux I guess , just try

!Sudo apt install dos2unix !dos2unix (address of train.txt)

On Fri, Apr 24, 2020 at 9:50 PM hustzlb notifications@github.com wrote:

mask_scale: Using default '1.000000' Loading weights from darknet19_448.conv.23...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: /content/darknet/data/train.txt I am working in google colab. help me

do u solve the issue? me too

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/1277#issuecomment-619300982, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKV2FZWDP2L2MOR5T3XY6DROI6VPANCNFSM4GGHA72Q .

hustzlb commented 4 years ago

still not work

发自我的 iPhone

在 2020年4月25日,上午10:16,shouryasimha addepalli notifications@github.com 写道:

This isssue is because colab is built with Linux I guess , just try

!Sudo apt install dos2unix !dos2unix (address of train.txt)

On Fri, Apr 24, 2020 at 9:50 PM hustzlb notifications@github.com wrote:

mask_scale: Using default '1.000000' Loading weights from darknet19_448.conv.23...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: /content/darknet/data/train.txt I am working in google colab. help me

do u solve the issue? me too

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/1277#issuecomment-619300982, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKV2FZWDP2L2MOR5T3XY6DROI6VPANCNFSM4GGHA72Q .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

shouryasimha commented 4 years ago

Try by Applying dos2unix to all your files , I.e. the .txt,.names and .data files . This should do the trick and again please check your path and see if there spaces in your.data file after the address.

On Fri, Apr 24, 2020 at 11:33 PM hustzlb notifications@github.com wrote:

still not work

发自我的 iPhone

在 2020年4月25日,上午10:16,shouryasimha addepalli notifications@github.com 写道:

This isssue is because colab is built with Linux I guess , just try

!Sudo apt install dos2unix !dos2unix (address of train.txt)

On Fri, Apr 24, 2020 at 9:50 PM hustzlb notifications@github.com wrote:

mask_scale: Using default '1.000000' Loading weights from darknet19_448.conv.23...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: /content/darknet/data/train.txt I am working in google colab. help me

do u solve the issue? me too

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/pjreddie/darknet/issues/1277#issuecomment-619300982>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ALKV2FZWDP2L2MOR5T3XY6DROI6VPANCNFSM4GGHA72Q

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/1277#issuecomment-619313140, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKV2F66T6WT64Q6UIG2KSTROJKXNANCNFSM4GGHA72Q .

hustzlb commented 4 years ago

the train.txt was generated by Colab ,i try to dos2unix trains.txt, but failed.

在 2020年4月25日,下午1:28,shouryasimha addepalli notifications@github.com 写道:

Try by Applying dos2unix to all your files , I.e. the .txt,.names and .data files . This should do the trick and again please check your path and see if there spaces in your.data file after the address.

On Fri, Apr 24, 2020 at 11:33 PM hustzlb notifications@github.com wrote:

still not work

发自我的 iPhone

在 2020年4月25日,上午10:16,shouryasimha addepalli notifications@github.com 写道:

This isssue is because colab is built with Linux I guess , just try

!Sudo apt install dos2unix !dos2unix (address of train.txt)

On Fri, Apr 24, 2020 at 9:50 PM hustzlb notifications@github.com wrote:

mask_scale: Using default '1.000000' Loading weights from darknet19_448.conv.23...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: /content/darknet/data/train.txt I am working in google colab. help me

do u solve the issue? me too

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/pjreddie/darknet/issues/1277#issuecomment-619300982>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ALKV2FZWDP2L2MOR5T3XY6DROI6VPANCNFSM4GGHA72Q

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/1277#issuecomment-619313140, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKV2F66T6WT64Q6UIG2KSTROJKXNANCNFSM4GGHA72Q .

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

shouryasimha commented 4 years ago

Did you check my repo : https://github.com/Shouryasimha

On Sat, Apr 25, 2020 at 4:31 AM hustzlb notifications@github.com wrote:

the train.txt was generated by Colab ,i try to dos2unix trains.txt, but failed.

在 2020年4月25日,下午1:28,shouryasimha addepalli notifications@github.com 写道:

Try by Applying dos2unix to all your files , I.e. the .txt,.names and .data files . This should do the trick and again please check your path and see if there spaces in your.data file after the address.

On Fri, Apr 24, 2020 at 11:33 PM hustzlb notifications@github.com wrote:

still not work

发自我的 iPhone

在 2020年4月25日,上午10:16,shouryasimha addepalli < notifications@github.com> 写道:

This isssue is because colab is built with Linux I guess , just try

!Sudo apt install dos2unix !dos2unix (address of train.txt)

On Fri, Apr 24, 2020 at 9:50 PM hustzlb notifications@github.com wrote:

mask_scale: Using default '1.000000' Loading weights from darknet19_448.conv.23...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Couldn't open file: /content/darknet/data/train.txt I am working in google colab. help me

do u solve the issue? me too

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/pjreddie/darknet/issues/1277#issuecomment-619300982 , or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALKV2FZWDP2L2MOR5T3XY6DROI6VPANCNFSM4GGHA72Q

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/pjreddie/darknet/issues/1277#issuecomment-619313140>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ALKV2F66T6WT64Q6UIG2KSTROJKXNANCNFSM4GGHA72Q

.

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/1277#issuecomment-619342746, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKV2F3UZJKKWPUYJ52LLLTROKNUPANCNFSM4GGHA72Q .

jhonjam commented 4 years ago

mask_scale: Uso predeterminado '1.000000' Cargando pesos desde darknet19_448.conv.23 ... ¡Listo! Tasa de aprendizaje: 0.001, Momentum: 0.9, Decadencia: 0.0005 No se pudo abrir el archivo: /content/darknet/data/train.txt Estoy trabajando en Google Colab. ayuadame

¿resuelves el problema? yo también

Hi, I solved the problem by downloading the repository from the main darknet page, I was trying to train YOLOV2 from this repository https://github.com/pjreddie/darknet, but it generated an error. then try to train YOLOV2 from this repository https://github.com/AlexeyAB/darknet, and everything works fine ..

KishoreKonakanti commented 4 years ago

I had this problem: train="abs_path_in_quotes" Worked with the following change : train=abs_path_without_quotes

hanifjunos commented 4 years ago

@shouryasimha Its working. Thanks for the solution.

Try by Applying dos2unix to all your files , I.e. the .txt,.names and .data files . This should do the trick and again please check your path and see if there spaces in your.data file after the address.

cocoleep commented 4 years ago

check your file is train.txt or train.txt.txt just rename the file to "train"

hkr007 commented 3 years ago

Hi, I created obj.data file in my windows machine then copied it to linux VM to run darknet on google colab. Firstly, I had a similar issue and this is how I solved it. I simply replaced new lines from '\n' as follows and it worked for me.

content of obj.data classes= 4'\n'train = /content/drive/My\ Drive/darknet/train.txt'\n'valid = /content/drive/My\ Drive/darknet/test.txt'\n'names = /content/drive/My\ Drive/darknet/obj.names'\n'backup = /content/drive/My\ Drive/darknet/backup

its works for me

hkr007 commented 3 years ago

thank you very much

kushagra-singhh commented 3 years ago

while using this command :

!./darknet detector test data/obj.data cfg/yolov3_custom_test.cfg backup/yolov3_custom_train_final.weights testing.jpg -thresh 0.3

I am getting error :

CUDA-version: 11000 (11020), cuDNN: 7.6.5, GPU count: 1
OpenCV version: 3.2.0 Couldn't open file: classes.names

Do anyone have any clue how to solve this please ?

shouryasimha commented 3 years ago

Please check the permissions on the file classes.names Try using chmod-777 . If this helps drop a star on my profile :)

On Wed, Sep 8, 2021 at 7:34 AM Kushagra Singh @.***> wrote:

while using this command :

!./darknet detector test data/obj.data cfg/yolov3_custom_test.cfg backup/yolov3_custom_train_final.weights testing.jpg -thresh 0.3

I am getting error :

CUDA-version: 11000 (11020), cuDNN: 7.6.5, GPU count: 1 OpenCV version: 3.2.0 Couldn't open file: classes.names

Do anyone have any clue how to solve this please ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/1277#issuecomment-915294231, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKV2F232KFME7HKUDMN4K3UA5YA3ANCNFSM4GGHA72Q .

deepali0162 commented 2 years ago

@shouryasimha I followed your steps to fix error related to train.txt file. Now the cmd runs without any error but it stops after

Loading weights from /content/drive/MyDrive/Decarbonisation/Decarb_ObjectDetection/yolov3/custom_weight/darknet53.conv.74...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005

and there is no weight file generated in the backup folder.

halfwayman001 commented 2 years ago

I have the same problem. How did you guys solved it?

hustzlb commented 2 years ago

sorry,i forgot

发自我的iPhone

在 2022年9月9日,04:07,Lubban Jihad @.***> 写道:

 I have the same problem. How did you guys solved it?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

ghost commented 2 years ago

!./darknet detector train data/Dataset/image_data.data cfg/yolov4_new.cfg yolov4.conv.137

same problem here, i dont know what i did wrong? please help me