Input 0 is incompatible with layer model
See original GitHub issueI’m trying the default training (satellite unet) and train went good but when I’m trying to test the model I got the error
ValueError: Input 0 is incompatible with layer model: expected shape=(None, 384, 384, 3), found shape=(None, 348, 3)
Here is my test code
model_file = 'model_satellite.h5'
input_shape = (384, 384, 3)
model = satellite_unet(
input_shape
)
model.load_weights(model_file)
image = np.array(Image.open("test.jpg").resize((348, 348)))
print("shape: ", image.shape)
shape: (348, 348, 3)
pr_mask = model.predict(image).round()
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Input 0 is incompatible with layer lstm_13: expected ndim=3 ...
I solved the problem by making. input size: (95000,360,1) and output size: (95000,22). and changed the input shape to (360,1) in the code ......
Read more >ValueError:Input 0 of layer sequential is incompatible with the ...
You are getting the error because you are missing the fourth dimension indicating the number of samples. You can use -1 for this...
Read more >Input 0 is incompatible with layer conv1_1: expected ndim=4 ...
i want train my model with gray levels images but when i want define network this error occur : ValueError: Input 0 is...
Read more >ValueError: Input 0 of layer sequential is ... - TensorFlow Forum
I am working with the LSTM model and getting this error. ValueError: Input 0 of layer sequential is incompatible with the layer: expected...
Read more >ValueError: Input 0 of layer sequential_3 is incompatible with ...
ValueError : Input 0 of layer sequential_3 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 180)
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I see your problem. When providing inputs for prediction you need to serve images in batches - if you want to fit just a single image you need to reshape it from
(384, 384, 3)
to(1, 384, 384, 3)
Indeed it was the problem. Here is the new working code
also I’m saving the image to the disk
the model needs more training but it’s a good start
Thanks @karolzak for your time