새소식

반응형
IT skill/Python

AttributeError: module 'albumentations' has no attribute 'pytorch'

  • -
반응형

albumentations 라이브러리에서 ToTensor를 쓰려면 albumentations.pytorch를 따로 import 하여 사용해야 합니다.

 

 

이런식으로 ToTensor를 사용하면 오류가 나게 됩니다.

import albumentations as A
transform = A.Compose([A.pytorch.transforms.ToTensor()])

 

 

왜 그런진 모르겠는데 이렇게 import를 해줘야 AttributeError: module 'albumentations' has no attribute 'pytorch' 에러가 발생하지 않더군요.🤔🤔

import albumentations as A
import albumentations.pytorch as AP
transform = A.compose([AP.transforms.ToTensor()])

 

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감과 광고 클릭 부탁드립니다~