experiencor / keras-yolo3

Training and Detecting Objects with YOLO3
MIT License
1.6k stars 861 forks source link

Cannot find image #207

Open kaushil24 opened 5 years ago

kaushil24 commented 5 years ago

While using the train.py on my own dataset, it prompts 'Cannot find imageName' multiple times.

However those images do exist in my specified folder. Why is it so and how can I remove it ?

Below I have given the message proceeding with an error caused by the mentioned issue.

`Epoch 1/103 resizing: 416 416 Cannot find Cannot find /Dataset/images/newfoundland_106.jpg Cannot find /Dataset/images/leonberger_184.jpg Cannot find /Dataset/images/leonberger_127.jpg/Dataset/images/Egyptian_Mau_127.jpg

Cannot find Cannot find /Dataset/images/staffordshire_bull_terrier_165.jpg /Dataset/images/Bombay_116.jpg Cannot find /Dataset/images/keeshond_179.jpg Cannot find /Dataset/images/english_cocker_spaniel_107.jpg

TypeError Traceback (most recent call last)

in () 279 280 # args = argparser.parse_args() --> 281 _main_(config) 11 frames /content/gdrive/My Drive/ML Projects/Object Detection/YOLO/keras-yolo3-master-v2/keras-yolo3/generator.py in _aug_image(self, instance, net_h, net_w) 161 162 if image is None: print('Cannot find ', image_name) --> 163 image = image[:,:,::-1] # RGB image 164 165 image_h, image_w, _ = image.shape TypeError: 'NoneType' object is not subscriptable` Edit: I tried removing the pickle file and starting from scratch, but the same issue prompts out.
andreasmarxer commented 5 years ago

I do have the same issue. Did you find a solution yet?

Socret360 commented 4 years ago

@andreasmarxer , the above error occurs because the code in generator.py cannot find the image file from the path you've added in config.json. I ran into the same issue. It turns out, when I changed the train_image_folder and train_annot_folder as well as their valid counterparts, i need to remove the cache (.pkl) files in order for those changes to be reflected during the training process as well. Hope this helps!

SteveIb commented 4 years ago

Write a small python script to make sure that you can read the image using cv2.imread(). I had issue reading the image since it was a bmp file, and there are sometimes issues with opencv reading bmp files. divide and concure your problem, start with making sure that opencv works! then check the paths, and remove cache pkl or pyc files, reopen your python terminal and run the code again.

SteveIb commented 4 years ago

So I had to convert all bmp files to jpg. then readim() file could work!