본문 바로가기

파이썬10

[파이썬 오류]The following handlers are available to decode the pixel data however they are missing required dependencies: GDCM (req. GDCM), pylibjpeg (req. ) DICOM 파일을 python으로 열거나 저장할때 오류났을때, 해결방법입니다. pip install pylibjpeg pylibjpeg-libjpeg pydicom 출처 : stackoverflow https://stackoverflow.com/questions/62159709/pydicom-read-file-is-only-working-with-some-dicom-images 2023. 3. 9.
[Pytorch] resnet18 pretrained 저장 장소 from torchvision import models import torch resnet18_pretrained = models.resnet18(pretrained=True) window에서 만약 renset18 의 pretrained를 저장했다면 C:\Users\[사용자 이름]/.cache\torch\hub\checkpoints\resnet18-f37072fd.pth 에 저장되었습니다 2023. 1. 12.
[Pandas] Python excel 생성/쓰기 안녕하세요 :) ! 이번에는 Python에서 Pandas로 excel 생성 및 쓰는 법에 대해 알아보겠습니다. 우선 패키지 설치를 해야합니다. pip install pandas No module named 'openpyxl' 뜰때에는 pip install openpyxl 설치를 해줍니다. 이제 excel 만드는 것부터 시작하겠습니다. 1. 기본 액셀만들기 import pandas as pd table = pd.DataFrame( { 'name' : ['Kim','Lee','Oh','Lim','Choe'], 'age' : ['26','17','23','22','15'], '성별' : ['M','W','M','M','W'] } ) table.to_excel('./practice.xlsx') pd.DataFr.. 2022. 11. 30.
[Pytorch] 간단한 VGG16 코드 (수정중) 안녕하세요! 이번에는 VGG16 에 대해 공부한걸 작성해보겠습니다. 잘못된게 있다면 조언,충고 부탁합니다 :) import torch.nn as nn import torch x = torch.randn((1,3,256,256)).float() class VGG_A(nn.Module): def __init__(self, num_classes: int = 1000, init_weights: bool = True): super(VGG_A, self).__init__() self.convnet = nn.Sequential( # Input Channel (RGB: 3) nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, padding=1, stride=1), nn.. 2022. 11. 9.
[파이썬 오류] Expected object of scalar type Long but got scalar type Int for argument #2 'target' in call to _thnn_nll_loss_forward loss = criterion(model_pred, label) 에서 loss 계산할 때 "Expected object of scalar type Long but got scalar type Int for argument #2 'target' in call to _thnn_nll_loss_forward" 오류가 뜸 해석 : 스칼라 유형의 개체가 Long이어야 하지만 _thnn_nll_loss_forward에 호출된 #2 'target' 인수에 대한 스칼라 유형 Int가 있습니다. label의 값을 쳐보니 "int32"로 나옴. 해결방법 : label.to(device) => label.to(device).long() 2022. 10. 10.