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')로 수정하면 작동