I have a CNN architecture that works well on 32x32x3 images. Can I use that same architecture for a data set made up of 28x28x1 images? (Both data sets have 10 classes). If this is possible, what changes would I need to make to the architecture I have?
One way is to redesign your CNN architecture to fit your new data input. However, if you want to use the current model you have, you should:
(1) Retraining: Re-train the model with new data set images
(2) Reshape new images: You should add a pre-processing layer to convert 28x28x1 images to 32x32x3 images. This could be done by replicating a single channel in other two channels and adding boundaries to your images. This deformation process should be the same on all new input images.
If that is the case, you probably shouldn't try to adapt the CIFAR model for MNIST. There are a few reasons not to do this, but the main ones are:
- the features are probably going to be dramatically different
- the colorspaces are different, which makes the features even less relevant
As suggested by @aminrd, you could reshape your 28x28x1 to 32x32x3 to force a correct input shape, but you'd probably get better results with just training a new network. Forcefully retraining in this manner would effectively be throwing excess data at your final layer while likely ignoring data that would have been extracted had you trained from scratch.
If you don't mind training the model, you need to change the input layer of the model to be 28x28x1 and the first convolution layers num_input_channels to be 1 instead of 3. Also, you will need to remove the 3rd and 4th pooling layers if there are and the shape of the upper reshaping layer where you connect to a final fully connected neural network.