vision: torchvision.io.read_image() fails to read image

🐛 Describe the bug

import torch
import torchvision.io as io
image = io.read_image('./1.png')

This minimal example does not work. I have tried many different versions of torch with different versions of python. It was working previously, and now it fails after doing the update.

Some of the errors that I got are: RuntimeError: No such operator image::read_file

I also tried the same in python3.7.11 and torchvision 0.8 and got RuntimeError: Non RGB images are not supported.

Versions

Collecting environment information… PyTorch version: 1.10.0 Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A

OS: macOS 11.6 (x86_64) GCC version: Could not collect Clang version: 13.0.0 (clang-1300.0.29.3) CMake version: Could not collect Libc version: N/A

Python version: 3.8.8 (default, Apr 13 2021, 12:59:45) [Clang 10.0.0 ] (64-bit runtime) Python platform: macOS-10.16-x86_64-i386-64bit Is CUDA available: False CUDA runtime version: No CUDA GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA HIP runtime version: N/A MIOpen runtime version: N/A

Versions of relevant libraries: [pip3] mypy-extensions==0.4.3 [pip3] numpy==1.20.1 [pip3] numpydoc==1.1.0 [pip3] torch==1.10.0 [pip3] torchaudio==0.10.0 [pip3] torchvision==0.11.1 [conda] blas 1.0 mkl
[conda] ffmpeg 4.3 h0a44026_0 pytorch [conda] mkl 2021.2.0 hecd8cb5_269
[conda] mkl-service 2.3.0 py38h9ed2024_1
[conda] mkl_fft 1.3.0 py38h4a7008c_2
[conda] mkl_random 1.2.1 py38hb2f4e1b_2
[conda] mypy_extensions 0.4.3 py38_0
[conda] numpy 1.20.1 py38hd6e1bb9_0
[conda] numpy-base 1.20.1 py38h585ceec_0
[conda] numpydoc 1.1.0 pyhd3eb1b0_1
[conda] pytorch 1.10.0 py3.8_0 pytorch [conda] torchaudio 0.10.0 py38_cpu pytorch [conda] torchvision 0.11.1 py38_cpu pytorch

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

you can use opencv to load your image .

  1. pip install opencv-python
  2. let cv.imread(img_path) instand of read_image(img_path)

@NicolasHug we don’t build publish M1 binaries to conda, although we probably should

Hi @NicolasHug , it will raise the same error of torchvision.io.read_image() on macOS Arm M1, and seems that there is only torchvision 0.10.0 released on M1, so I only test these on torchvision 0.10.0.

I think I should have mentioned that I am also having the problem in Mac M1. It may be the problem that lead to library dependency mismatches.

Using the collect_env.py does not show that it is a Mac with M1. Maybe that should be indicated if it is an important factor in debugging.

Hi @NicolasHug , it will raise the same error of torchvision.io.read_image() on macOS Arm M1, and seems that there is only torchvision 0.10.0 released on M1, so I only test these on torchvision 0.10.0.