kriyeng / yolo-on-colab-notebook

How to train YOLOv3 using Darknet on Colab 12GB-RAM GPU notebook and optimize the VM runtime load times
49 stars 40 forks source link

Run Detector Test works on individual images, but cannot load multiple images from txt file #7

Open espenwiik91 opened 4 years ago

espenwiik91 commented 4 years ago

In short This doesn't work (trying to use detector test on multiple images in a folder: !./darknet detector test "/content/gdrive/My Drive/darknet/obj.data" "/content/gdrive/My Drive/darknet/cfg/yolov3.cfg" "/content/gdrive/My Drive/darknet/backup/yolov3_final.weights" -dont_show < "/content/gdrive/My Drive/darknet/test.txt"> "/content/gdrive/My Drive/darknet/result.txt"

Error messege is: Cannot load image /content/gdrive/My Drive/darknet/imgTest/test4.jpg Cannot load image /content/gdrive/My Drive/darknet/imgTest/test3.jpg

This does work (detect on one image, using direct path to said image): !./darknet detector test "/content/gdrive/My Drive/darknet/obj.data" "/content/gdrive/My Drive/darknet/cfg/yolov3.cfg" "/content/gdrive/My Drive/darknet/backup/yolov3_final.weights" -dont_show "/content/gdrive/My Drive/darknet/imgTest/test4.jpg" "/content/gdrive/My Drive/darknet/result.txt"

The test.txt file consist of the same path as given in working detector test i.e.: /content/gdrive/My Drive/darknet/imgTest/test4.jpg No spaces or blank lines in it apart from My Drive.

All help is very much appriciated test.txt file linked: test.txt

kriyeng commented 4 years ago

Hi espenwiik!

You need to use back slash before space in your paths in test.txt, like this:

/content/gdrive/My\ Drive/darknet/imgTest/test4.jpg

It will work only if you are using my darknet's cloned repo (The one used in the tutorial)

I hope this helps! Good luck! David

El jue., 2 abr. 2020 16:51, espenwiik91 notifications@github.com escribió:

In short This doesn't work (trying to use detector test on multiple images in a folder: !./darknet detector test "/content/gdrive/My Drive/darknet/obj.data" "/content/gdrive/My Drive/darknet/cfg/yolov3.cfg" "/content/gdrive/My Drive/darknet/backup/yolov3_final.weights" -dont_show < "/content/gdrive/My Drive/darknet/test.txt"> "/content/gdrive/My Drive/darknet/result.txt"

Error messege is: Cannot load image /content/gdrive/My Drive/darknet/imgTest/test4.jpg Cannot load image /content/gdrive/My Drive/darknet/imgTest/test3.jpg

This does work (detect on one image, using direct path to said image): !./darknet detector test "/content/gdrive/My Drive/darknet/obj.data" "/content/gdrive/My Drive/darknet/cfg/yolov3.cfg" "/content/gdrive/My Drive/darknet/backup/yolov3_final.weights" -dont_show "/content/gdrive/My Drive/darknet/imgTest/test4.jpg" "/content/gdrive/My Drive/darknet/result.txt"

The test.txt file consist of the same path as given in working detector test i.e.: /content/gdrive/My Drive/darknet/imgTest/test4.jpg No spaces or blank lines in it apart from My Drive.

All help is very much appriciated test.txt file linked: test.txt https://github.com/kriyeng/yolo-on-colab-notebook/files/4421765/test.txt

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriyeng/yolo-on-colab-notebook/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZUHL3PSLOFIWQHTQTSIFLRKSQ5TANCNFSM4L2Q5BIA .

espenwiik91 commented 4 years ago

Hi and thank you for answering. I have been following this guide and completed training of my model. Unfortunately, I get the same error; Cannot load image /content/gdrive/My\ Drive/darknet/imgTest/test4.jpg Cannot load image /content/gdrive/My\ Drive/darknet/imgTest/test3.jpg

Anything else you can think of? Also, this was not a problem during training, where I used a train.txt file for path to all training imges. Example: /content/gdrive/My Drive/darknet/img/005e4044be890b03.jpg

devb2020 commented 4 years ago

Hello David, I'm also encountering the same issue. I've metoculously followed all the steps mentioned in your "Tutorial DarknetToColab" Notebook.

Every thing runs smoothly until I attempt to train my custom dataset using the following command:

!./darknet detector train "/content/gdrive/My Drive/darknet/obj.data.txt" "/content/gdrive/My Drive/darknet/cfg/yolov3-tiny_obj.cfg" "/content/gdrive/My Drive/darknet/weights/yolov3-tiny.conv.15" -dont_show

My paths in obj.data look like (train = /content/gdrive/My\ Drive/darknet/train.txt) and Paths in train.txt (/content/gdrive/My\ Drive/darknet/img/CAX_Train1.png -- NO space between \ and Drive

The execution goes well showing conv layer etc and then starts throwing cannot load image (as below) and stops execution. ..... .... Total BFLOPS 5.680 Allocate additional workspace_size = 52.43 MB Loading weights from /content/gdrive/My Drive/darknet/weights/yolov3-tiny.conv.15... seen 64 Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Resizing 608 x 608 Very small path to the image:
Very small path to the image:
Cannot load image /content/gdrive/My\ Drive/darknet/img/CAX_Train100.png Cannot load image /content/gdrive/My\ Drive/darknet/img/CAX_Train10.png

I even changed my files from jpg to png but that didn't help... Any direction on resolving this will be highly appreciated..

espenwiik91 commented 4 years ago

Hi mister. I did not have the issue when doing training (only when running detection on multiple images) so maybe I can help. More than likely, this is a pathing problem. I've linked mine below so you can have a look, maybe that will help. As you can see, mine DOES have a space in between "My" and "Drive" and it worked fine for me during training train.txt

devb2020 commented 4 years ago

Didn't work. Not sure the root cause of the problem. It still throws the same error

devb2020 commented 4 years ago

I finally got it working.... Recreated train.txt and manually included the image file paths (though a weird workaround but it worked) I had earlier created using python and that seems to have done something wrong with the file..

kriyeng commented 4 years ago

Hi All,

Probably is because the end of line character. I can remember which one is the right one, but it works only using linux or windows style.

Good luck! David

TaskoudisDimi commented 4 years ago

Hi to everyone! When i try to train yolov3 in colab it appears to me this eror: "608 x 608 Create 6 permanent cpu-threads " Any soloutions??