Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shubham12tomar opened this issue Jun 11, 2021 · 1 comment
Open

Comments

@shubham12tomar
Copy link

Number of GPU's available: 1
Pytorch version: 1.8.1+cu101
mean_bgr: [103.939, 116.779, 123.68]
/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py:477: UserWarning: This DataLoader will create 8 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
cpuset_checked))
output_dir: result/BIPED2CLASSIC
Restoring weights from: checkpoints/BIPED/14/14_model.pth
actual size: (205, 119, 3), target size: (512, 512)
actual size: (427, 640, 3), target size: (512, 512)
actual size: (764, 1200, 3), target size: (512, 512)
input tensor shape: torch.Size([1, 3, 512, 512])
input tensor shape: torch.Size([1, 3, 512, 512])
Traceback (most recent call last):
File "main.py", line 441, in
main(args)
File "main.py", line 390, in main
test(checkpoint_path, dataloader_val, model, device, output_dir, args)
File "main.py", line 125, in test
for batch_id, sample_batched in enumerate(dataloader):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 517, in next
data = self._next_data()
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1179, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
data.reraise()
File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 429, in reraise
raise self.exc_type(msg)
AttributeError: Caught AttributeError in DataLoader worker process 2.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/DexiNed/datasets.py", line 233, in getitem
im_shape = [image.shape[0], image.shape[1]]
AttributeError: 'NoneType' object has no attribute 'shape'

@xavysp
Copy link
Owner

xavysp commented Jun 22, 2021

Number of GPU's available: 1
Pytorch version: 1.8.1+cu101
mean_bgr: [103.939, 116.779, 123.68]
/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py:477: UserWarning: This DataLoader will create 8 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
cpuset_checked))
output_dir: result/BIPED2CLASSIC
Restoring weights from: checkpoints/BIPED/14/14_model.pth
actual size: (205, 119, 3), target size: (512, 512)
actual size: (427, 640, 3), target size: (512, 512)
actual size: (764, 1200, 3), target size: (512, 512)
input tensor shape: torch.Size([1, 3, 512, 512])
input tensor shape: torch.Size([1, 3, 512, 512])
Traceback (most recent call last):
File "main.py", line 441, in
main(args)
File "main.py", line 390, in main
test(checkpoint_path, dataloader_val, model, device, output_dir, args)
File "main.py", line 125, in test
for batch_id, sample_batched in enumerate(dataloader):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 517, in next
data = self._next_data()
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1179, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
data.reraise()
File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 429, in reraise
raise self.exc_type(msg)
AttributeError: Caught AttributeError in DataLoader worker process 2.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/DexiNed/datasets.py", line 233, in getitem
im_shape = [image.shape[0], image.shape[1]]
AttributeError: 'NoneType' object has no attribute 'shape'

Hi, sorry for my late response, did you solve your problem? I think, somehow you are not reading your test images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants