Pytorch

ResNet Image Feature Extraction

술임 2023. 9. 4. 14:47

ref : https://github.com/josharnoldjosh/Resnet-Extract-Image-Feature-Pytorch-Python/blob/master/extract_image_feature.py

 

 

RuntimeError : The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

 

def get_vector(image_name):
    # 1. Load the image with Pillow library
    img = Image.open(image_name).convert('RGB')

코드를 .convert('RGB')로 수정하면 작동

'Pytorch' 카테고리의 다른 글

torch.cat과 torch.stack  (1) 2023.11.27
torch.nn과 torch.nn.functional  (0) 2023.09.11
파이토치 모델 정의  (0) 2022.04.30
파이토치 기초 문법  (0) 2022.04.28
파이토치 기초  (0) 2022.04.27