pjreddie / darknet

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

Open file with white spaces #1672

Open fabioaraujopt opened 5 years ago

fabioaraujopt commented 5 years ago

I'm trying to open the train.txt and test.txt files with the following config file:

classes= 1  
train  = /content/gdrive/My Drive/mrcnn_fire/yolo_files/yolo_first_example/data/nfpa/train.txt  
valid  = /content/gdrive/My Drive/mrcnn_fire/yolo_files/yolo_first_example/data/nfpa/test.txt  
names = /content/gdrive/My Drive/mrcnn_fire/yolo_files/yolo_first_example/obj.names  
backup = /content/gdrive/My Drive/mrcnn_fire/yolo_files/yolo_first_example/backup/

The console show me the folowing error:

Couldn't open file: /content/gdrive/MyDrive/mrcnn_fire/yolo_files/yolo_first_example/data/nfpa/train.txt

I think the problem is related with the white space. I'm using google colab with the google drive mount and I can't change that path.

Is that any way of fix this?

Salamendrine commented 5 years ago

Yes, I encountered a similar problem. I tried to change the paths to /content/gdrive/My\ Drive/...... However, it still gives report saying Couldn't open file: /content/gdrive/My\Drive/......

Have you solved this problem?

Salamendrine commented 5 years ago

I found two ways to go around this problem. The first is to change Google Drive's default name "My Drive" to something without space. Another is to use shell command in Colab to copy training samples to /content/ folder. To save backup to drive, use another Colab notebook to run the following command. while true; do cp -r /content/<path to backup>/. /content/gdrive/My\ Drive/<path to desired destination> ;date ; sleep 1800; done

tanluren commented 5 years ago

I found two ways to go around this problem. The first is to change Google Drive's default name "My Drive" to something without space. Another is to use shell command in Colab to copy training samples to /content/ folder. To save backup to drive, use another Colab notebook to run the following command. while true; do cp -r /content/<path to backup>/. /content/gdrive/My\ Drive/<path to desired destination> ;date ; sleep 1800; done

great idea! could you tell me how to change the default name ?I tried ,but not got the way

Salamendrine commented 5 years ago

Actually I used the second method because otherwise I would need to change the path in .cfg file and .txt file. But I found (I did not really try) this website has a way to do this.

tanluren commented 5 years ago

thanks Salamendrine

Shruthi-Sampathkumar commented 5 years ago

Did you solve this issue? @tanluren @fabioaraujopt

iibrahimli commented 5 years ago

I encountered this issue too, could get it to work with Google Colab by creating a symlink to the desired folder(s). For example, to create a symlink named drive_yolo_files that links to /content/gdrive/My Drive/mrcnn_fire/yolo_files/yolo_first_example/ you can do this in a cell:

!ln -s "/content/gdrive/My Drive/mrcnn_fire/yolo_files/yolo_first_example/" "/content/drive_yolo_files"

and then specify the paths as /content/drive_yolo_files/backup etc.

Hope this is helpful.

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

koojoi 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

I encountered the same problem and I tried this:

!ln -s "/content/drive/My\ Drive/darknet" ./darknet detector train custom/darknet.data custom/yolov3.cfg darknet53.conv.74

How ever, I get this error now: ln: target 'darknet53.conv.74' is not a directory

I have tried an option from https://stackoverflow.com/questions/56640534/cannot-open-train-txt-with-white-space-my-drivehe, but still, the problem persists. I'll be glad to receive your guidance

iibrahimli commented 4 years ago

I encountered the same problem and I tried this:

!ln -s "/content/drive/My\ Drive/darknet" ./darknet detector train custom/darknet.data custom/yolov3.cfg darknet53.conv.74

How ever, I get this error now: ln: target 'darknet53.conv.74' is not a directory

I have tried an option from https://stackoverflow.com/questions/56640534/cannot-open-train-txt-with-white-space-my-drivehe, but still, the problem persists. I'll be glad to receive your guidance

@koojoi, if I understand it correctly, in the example that you bring there is no need to create a symlink since your files are already in a folder whose name does not contain spaces (custom/*). Is the darknet executable in your current directory? Please provide your directory structure so that we can help.

develoboi commented 4 years ago

hey, do u get the solution ? @iibrahimli @koojoi

Kathy-Peng commented 9 months ago

It might be a late solution, but one easy way to do it is mount it to "/content/drive" first where there is no space, then %cd /content/drive/My Drive/Colab Notebooks.