-
Notifications
You must be signed in to change notification settings - Fork 25k
Closed
Labels
module: third_partymodule: visiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Bug
Unable to perform torchvision transform on an image.
To Reproduce
Steps to reproduce the behavior:
import torch
import torchvision.transforms as T
from PIL import Image
transforms = T.Compose([
T.Resize(size=224),
T.ToTensor(),
T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
img = Image.open(path_to_image).convert('RGB')
data = transforms(img)
Expected behavior
The code should have successfully run and the image should've been transformed.
Environment
PyTorch version: 1.9.0+cu111
Is debug build: False
CUDA used to build PyTorch: 11.1
ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31
Python version: 3.8.10 (default, Jun 4 2021, 15:09:15) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.8.0-59-generic-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: GeForce RTX 3060
Nvidia driver version: 460.84
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.20.2
[pip3] torch==1.9.0+cu111
[pip3] torch-geometric==1.7.2
[pip3] torch-scatter==2.0.7
[pip3] torch-sparse==0.6.10
[pip3] torchaudio==0.9.0
[pip3] torchvision==0.10.0+cu111
[conda] numpy 1.20.2 pypi_0 pypi
[conda] torch 1.9.0+cu111 pypi_0 pypi
[conda] torch-geometric 1.7.2 pypi_0 pypi
[conda] torch-scatter 2.0.7 pypi_0 pypi
[conda] torch-sparse 0.6.10 pypi_0 pypi
[conda] torchaudio 0.9.0 pypi_0 pypi
[conda] torchvision 0.10.0+cu111 pypi_0 pypi
Additional context
Stack trace:
Traceback (most recent call last):
File "test.py", line 14, in <module>
data = transforms(img)
File "/home/snatarajan/anaconda3/envs/dl3d/lib/python3.8/site-packages/torchvision/transforms/transforms.py", line 60, in __call__
img = t(img)
File "/home/snatarajan/anaconda3/envs/dl3d/lib/python3.8/site-packages/torchvision/transforms/transforms.py", line 97, in __call__
return F.to_tensor(pic)
File "/home/snatarajan/anaconda3/envs/dl3d/lib/python3.8/site-packages/torchvision/transforms/functional.py", line 129, in to_tensor
np.array(pic, mode_to_nptype.get(pic.mode, np.uint8), copy=True)
TypeError: __array__() takes 1 positional argument but 2 were given
artemisart, xwang233, fritzo, fehiepsi, YuanTingHsieh and 1 more
Metadata
Metadata
Assignees
Labels
module: third_partymodule: visiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module