How can I add a resizing layer to
model = Sequential()
using
model.add(...)
To resize an image from sha
Normally you would use the Reshape layer for this:
model.add(Reshape((224,224,3), input_shape=(160,320,3))
but since your target dimensions don't allow to hold all the data from the input dimensions (224*224 != 160*320), this won't work. You can only use Reshape if the number of elements does not change.
If you are fine with losing some data in your image, you can specify your own lossy reshape:
model.add(Reshape(-1,3), input_shape=(160,320,3))
model.add(Lambda(lambda x: x[:50176])) # throw away some, so that #data = 224^2
model.add(Reshape(224,224,3))
That said, often these transforms are done before applying the data to the model because this is essentially wasted computation time if done in every training step.