Cannot fix ImportError: cannot import name 'ToTensorV2' from 'albumentations.pytorch' on Colab
Cannot fix ImportError: cannot import name 'ToTensorV2' from 'albumentations.pytorch' on Colab
我尝试了中的所有三个解决方案来解决问题,但仍然收到错误消息:
ImportError: cannot import name 'ToTensorV2' from 'albumentations.pytorch' (/usr/local/lib/python3.7/dist-packages/albumentations/pytorch/__init__.py)
我当前的代码:
!pip install -U albumentations
import albumentations
from albumentations.pytorch import ToTensorV2
您是否尝试过将运行时恢复出厂设置?如果没有,可能 python 仍在加载早期版本。我刚刚在一个新的 colab 实例上测试了链接问题中接受的解决方案,它运行良好:
!pip install albumentations==0.4.6
import albumentations
from albumentations.pytorch import ToTensorV2
这对我有用。从 github 导入没有任何问题。
!pip install -U git+https://github.com/albu/albumentations > /dev/null && echo import albumentations from albumentations.pytorch import ToTensorV2
我尝试了
ImportError: cannot import name 'ToTensorV2' from 'albumentations.pytorch' (/usr/local/lib/python3.7/dist-packages/albumentations/pytorch/__init__.py)
我当前的代码:
!pip install -U albumentations
import albumentations
from albumentations.pytorch import ToTensorV2
您是否尝试过将运行时恢复出厂设置?如果没有,可能 python 仍在加载早期版本。我刚刚在一个新的 colab 实例上测试了链接问题中接受的解决方案,它运行良好:
!pip install albumentations==0.4.6
import albumentations
from albumentations.pytorch import ToTensorV2
这对我有用。从 github 导入没有任何问题。
!pip install -U git+https://github.com/albu/albumentations > /dev/null && echo import albumentations from albumentations.pytorch import ToTensorV2