NVlabs / SCOPS

SCOPS: Self-Supervised Co-Part Segmentation (CVPR'19)
https://varunjampani.github.io/scops/
Other
217 stars 35 forks source link

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

Closed PierfrancescoArdino closed 5 years ago

PierfrancescoArdino commented 5 years ago

Running the code using the training guide in the readme

CUDA_VISIBLE_DEVICES={GPU} python train.py -f exps/SCOPS_K8_retrain.json

raise the following error after the download of the pretrained ResNet50

`original 161962 filtered 45609 Traceback (most recent call last): File "train.py", line 251, in main _, batch = trainloader_iter.next() File "/usr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 582, in next return self._process_next_batch(batch) File "/usr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch raise batch.exc_type(batch.exc_msg) AttributeError: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/usr/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/pierfrancesco/University/PhD/GAN/SCOPS/dataset/celeba_wild_dataset.py", line 117, in getitem label = cv2.resize(label, (image.shape[1], image.shape[0]), interpolation = cv2.INTER_LINEAR) AttributeError: 'NoneType' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 271, in main() File "train.py", line 254, in main _, batch = trainloader_iter.next() File "/usr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 582, in next return self._process_next_batch(batch) File "/usr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch raise batch.exc_type(batch.excmsg) AttributeError: Traceback (most recent call last): File "train.py", line 251, in main , batch = trainloader_iter.next() File "/usr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 582, in next return self._process_next_batch(batch) File "/usr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch raise batch.exc_type(batch.exc_msg) AttributeError: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/usr/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/pierfrancesco/University/PhD/GAN/SCOPS/dataset/celeba_wild_dataset.py", line 117, in getitem label = cv2.resize(label, (image.shape[1], image.shape[0]), interpolation = cv2.INTER_LINEAR) AttributeError: 'NoneType' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/usr/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/pierfrancesco/University/PhD/GAN/SCOPS/dataset/celeba_wild_dataset.py", line 117, in getitem label = cv2.resize(label, (image.shape[1], image.shape[0]), interpolation = cv2.INTER_LINEAR) AttributeError: 'NoneType' object has no attribute 'shape'`

How can I solve this?

hfslyc commented 5 years ago

Hi,

It looks like the dataloader couldn't read the images. Could you check whether you have the images ready?

PierfrancescoArdino commented 5 years ago

What do you mean with "have the images ready?" I've downloaded the dataset using the download_celeba script

PierfrancescoArdino commented 5 years ago

Ok my fault, I thought that I has the complete dataset but instead I have only the Saliency, labels and pretrained model. I'll close the issue

hfslyc commented 5 years ago

Thanks for double checking!