-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
🐛 Bug
AttributeError Traceback (most recent call last)
in ()
40
41 for epoch in range(num_epochs):
---> 42 train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq=10)
43 lr_scheduler.step()
44 # evaluate on the test dataset
5 frames
/usr/local/lib/python3.7/dist-packages/torch/_utils.py in reraise(self)
423 # have message field
424 raise self.exc_type(message=msg)
--> 425 raise self.exc_type(msg)
426
427
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 287, 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 "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataset.py", line 311, in getitem
return self.dataset[self.indices[idx]]
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataset.py", line 311, in getitem
return self.dataset[self.indices[idx]]
File "", line 83, in getitem
image, target = self._transforms(image, target)
File "/content/transforms.py", line 26, in call
image, target = t(image, target)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/content/transforms.py", line 36, in forward
width, _ = F.get_image_size(image)
AttributeError: module 'torchvision.transforms.functional' has no attribute 'get_image_size'
To Reproduce
Steps to reproduce the behavior:
- Follow tutorial as per https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html
- Error happening from the file - references/detection/transforms.py, line 36 (using an alias/local variable for
torchvision.transforms.functional is not allowing access to the public method in the same file)
Expected behavior
The public method "get_image_size" should be accessed normally (I had to remove the alias "F" and explicitly call the method).
Environment
Google Colab (libraries are up to date)