2
$\begingroup$

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?

$\endgroup$
0
$\begingroup$

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.

| improve this answer | |
$\endgroup$
  • $\begingroup$ If I were to retrain the model with the new data set images I would have some tensor dimension errors right? $\endgroup$ – brubrudsi Nov 14 '19 at 2:24
  • $\begingroup$ That actually depends what all layers you have and how you have connected them as well imo. $\endgroup$ – Aditya Nov 14 '19 at 4:22
  • $\begingroup$ @brubrudsi If you retrained the model you need to change the input shape in the first layer to avoid such errors. $\endgroup$ – serali Nov 14 '19 at 8:59
0
$\begingroup$

I'm assuming your 32x32x3 CNN was trained on CIFAR and you are looking to apply it to MNIST (correct me if I'm wrong).

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:

  1. the features are probably going to be dramatically different
  2. 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.

| improve this answer | |
$\endgroup$
0
$\begingroup$

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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.