본문 바로가기
반응형
반응형

Python20

반응형
ModuleNotFoundError: No module named 'torchvision.models.mobilenetv2' 에러해결 개발환경 - ubuntu18.04 - python3.7 1. Problem model = torch.hub.load('pytorch/vision:v0.10.0', 'wide_resnet50_2', pretrained=True) wide_resnet을 학습시키려고 할 때 ModuleNotFoundError: No module named 'torchvision.models.mobilenetv2' 모듈을 찾을 수 없다는 error가 발생 2. Solution 정확한 이유는 알 수 없으나 stackoverflow의 해결방법은 pytorch/vision:v0.10.0 -> pytorch/vision:v0.8.0 2022. 4. 5.
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same 에러해결 개발환경 - ubuntu18.04 - python3.7 1. Problem RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same pytorch로 학습을 할 때 input type과 weight type이 같아야만 한다는 에러가 발생 2. Reason GPU로 학습을 할 때 model이나 dataset를 GPU에 설정하지 않았기 때문에 발생 3. Solution torch.tensor(..., device="cuda") torch.tensor(...).cuda() torch.tensor(...).to("cuda") model.to("cuda") dataset이나 model을.. 2022. 4. 5.
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' 에러 해결 개발환경 - ubuntu18.04 - python3.7 1. Problem ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' pillow를 설치했는데도 불구하고 import가 되지않는 error 발생 (9.0.1 버전이 설치 되어있었음) 2. Reason from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION pillow의 버전이 너무 높아서 발생하는 문제 3. Solution pillow version = (1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 2.0.0,.. 2022. 3. 31.
[Activation Function] Sigmoid 이란? 시그모이드(sigmoid)가 주로 사용되는곳은 마지막 출력 layer에서 class 0과 1을 예측할 때 이다. 예전에는 은닉 layer에서 자주 사용되었지만 gradient vanishing 이슈로 인해 최근에는 거의 사용되지 않는다. 1. Odds 오즈는 간단하게 말하면 확률을 계산하는 식이다. 특징으로는 0에서 ∞(무한대) 까지 발산한다. 우리에게 동전이 하나 있다. 해당 동전을 던져서 앞면이 0.3 뒷면이 0.7이라고 하면 앞면과 뒷면의 Odds는 앞면에 비해 뒷면이 몇배는 클것이다. 우리가 예측을 할 때에는 확률의 차이가 대칭적이여야 class마다 공평한 확률을 만들 수 있다. 2. Logit 해당 이슈를 해결하기 위해서 간단한 아이디어가 하나 있는데 바로 Odds에 log를 씌워주는 것이다. .. 2022. 3. 28.
반응형