Can't import ToTensorV2 in Colab

Viewed 8106
from albumentations.pytorch.transforms import ToTensorV2

I used the above code, and it doesn't work.

3 Answers

Just add a code block with the line

! pip install albumentations==0.4.6

above the block where you do the import. I tried installing it without the specific version and it failed.

When i did not specify the version number in pip install, version 0.1.12 was installed which does not contain ToTensorV2.

Ensure that you have the latest version

!pip install --upgrade --force-reinstall --no-deps albumentations

Get albumentations from Github. Usage on Colab Example

!pip install -U git+https://github.com/albu/albumentations > /dev/null 
Related