thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

AttributeError: 'NoneType' object has no attribute 'shape' #1094

Open GoyalAnkit16 opened 4 years ago

GoyalAnkit16 commented 4 years ago
issue

While trying to train the model with my custom dataset and annotations, it shows this error AttributeError: 'NoneType' object has no attribute 'shape' I suppose this error occurs when an invalid image path is passed to cv2.imread If that's correct, in which file should I correct the path i.e. In which line of the code darkflow is reading the images using cv2.imread?

SW0BBR commented 4 years ago

Check if your path to the images are correct and if the xml's link correctly to the images. A correct path could be "data/images". I had the same error because my paths were formatted like "/data/images" which indicates the root folder.

Anubhav007 commented 4 years ago
issue

While trying to train the model with my custom dataset and annotations, it shows this error AttributeError: 'NoneType' object has no attribute 'shape' I suppose this error occurs when an invalid image path is passed to cv2.imread If that's correct, in which file should I correct the path i.e. In which line of the code darkflow is reading the images using cv2.imread?

Check the path and name of the image. Remember that the path is taken from the command line argument "dataset" and the name is read from the corresponding annotation xml file (in pascal voc format)

phatsp commented 4 years ago

@SW0BBR could you show me the xml format for your case. I have the same problem when I use the available dataset at https://github.com/datitran/raccoon_dataset Screenshot from 2019-12-31 16-03-19

GoyalAnkit16 commented 4 years ago

image @phatsp you can have a look at my xml format

I'm still unable to get rid of the error.

k66inthesky commented 4 years ago

@GoyalAnkit16 Hi your 9.xml shows < filename >Capture< filename > in the third line. In your case, it should be < filename >9.jpg< filename >.