'expected conv2d_input to have shape [null,200,200,3] but got array with shape [1,220,220,3]
I've created a model:
model = Sequential([
Conv2D(32, (3, 3), activation='relu', input_shape=(200, 200, 3)),
MaxPooling2D((2, 2)),
Conv2D(64, (3, 3), activation='relu'),
MaxPooling2D((2, 2)),
Conv2D(64, (3, 3), activation='relu'),
Flatten(),
Dense(256, activation='relu'),
Dense(1, activation='sigmoid')
])
I'm working with tensorflow.js, I've created a medical website, model.json and I want to check if it works fine, so I've picked some picture from validation folder and tried to predict if the patient is healthy or not.
<script>
async function LoadModels(){
model = undefined;
model = await tf.loadLayersModel("http://127.0.0.1:5500/model.json");
const pr = document.getElementById('photo');
const image = tf.browser.fromPixels(pr);
const prediction = model.predict(tf.expandDims(image, 0));
alert(prediction);
}
LoadModels();
</script>
Of course it gives me [1, 200, 200, 3] when I need [null, 200, 200, 3]. I tried to reshape it, but no luck.
Could you please help?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
