Search code examples
pytorchconv-neural-networkimage-resizingtraining-data

Can someone explain how to scaling up small images for CNN training in pytorch?


I'm training CNN on ImageNet, this dataset contains images that are as small as 96 * 96 pixels, and others are as big as 1600 * 1200 pixels. However, I know about scaling down big images but I cannot understand scaling up small images, how is it done and how does it affect training?


Solution

  • If you want to stick to PyTorch:

    Follow the discussion and the link to the PyTorch tutorial.

    https://discuss.pytorch.org/t/how-do-i-resize-imagenet-image-to-224-x-224/66979

    Another option would be to use the ImUtils python package.

    frame_resized = imutils.resize(frame, width=new_width)

    The most popular option is to use OpenCV.

    frame_resized = cv2.resize(arr1,(new_width, new_height))