yingxin-jia / SuperGlue-pytorch

[SuperGlue: Learning Feature Matching with Graph Neural Networks] This repo includes PyTorch code for training the SuperGlue matching network on top of SIFT keypoints and descriptors.
Other
545 stars 126 forks source link

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

Open Shuhul24 opened 1 year ago

Shuhul24 commented 1 year ago

I am training the model on my dataset instead of what is mentioned on the github repository (COCO, etc.). While training following error occured:

Traceback (most recent call last):
  File "/home/shuhulh/superglue_train/train.py", line 164, in <module>
    for i, pred in enumerate(train_loader):
  File "/opt/conda/envs/animal-reid/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 628, in __next__
    data = self._next_data()
  File "/opt/conda/envs/animal-reid/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 671, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/opt/conda/envs/animal-reid/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/opt/conda/envs/animal-reid/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 58, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/shuhulh/superglue_train/load_data.py", line 30, in __getitem__
    width, height = image.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'

I don't understand why does it happen while training. Can you help me out what am I supposed to do here? Do I need to change the name of files (the images) in the image directory (they are usually numerical values).