I am trying to use the xception model for a transfer learning task. I understand that it needs the minimum input shape of image to be (71, 71, 3) when downloading it with option include_top=False.
The issues I am facing is that when I try to reshape my data from (48,48,3) to (71,71,3) I am going in to RAM issues and my system gets restarted. Instead of reshaping the data outside I think of reshaping it within the network architecture. When I try to do that I have the follow error..
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-44-a448922440e7> in <module>()
1 model = Sequential()
2 #model.add(Input(shape=(48,48,3)))
----> 3 model.add(tf.keras.layers.Reshape((71,71,3), input_shape=(48,48,3)))
4 #model.add(ReformatImage(71,71))
5 model.add(conv_base)
8 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/layers/core.py in _fix_unknown_dimension(self, input_shape, output_shape)
534 output_shape[unknown] = original // known
535 elif original != known:
--> 536 raise ValueError(msg)
537 return output_shape
538
ValueError: total size of new array must be unchanged, input_shape = [48, 48, 3], output_shape = [71, 71, 3]
my code is as below
from tensorflow.keras.applications import Xception
conv_base = Xception(weights='imagenet',include_top=False,input_shape=(71,71,3))
conv_base.trainable = False
model = Sequential()
#model.add(Input(shape=(48,48,3)))
model.add(tf.keras.layers.Reshape((71,71,3), input_shape=(48,48,3)))
#model.add(ReformatImage(71,71))
model.add(conv_base)
model.add(Flatten())
model.add(Dense(1024, activation='relu'))
model.add(Dense(1024, activation='relu'))
model.add(BatchNormalization())
model.add(Dense(10, activation='softmax'))
model.summary()
can someone please point me to right direction so that I can resolve this issue?