Hello! I am a newbie and would like to adjust a pretrained VGG19 model to accept MNIST data. How should I do this?

One approach would be to resize your input images to 224x224 using torchvision.transforms.Resize and then inside the loop expand the channels to 3 using data = data.expand(-1, 3, -1, -1).

Alternative approaches would be:

  • changing the vgg19 architecture to take smaller input images (e.g. by removing certain layers and/or changing the input features of the first linear layer)
  • resizing the input images to 224x224 and adding a conv layer before the actual model, which results in 3 output channels

Let me know, if one of these approaches would work for you.