Bad prediction even with high training and validation accuracy
See original GitHub issuehey guys,
i am using this code for image segmentation:
`from keras_segmentation.models.unet import unet
model = unet(n_classes=3) model.train(n_classes=3, train_images = “/content/Training/images”, train_annotations = “/content/Training/labels”, checkpoints_path = “/content/checkpoints” , epochs=1,validate=True,val_images=“/content/Test/images”,val_annotations=“/content/Test/labels”) ` Epoch 1/1 512/512 [==============================] - 252s 492ms/step - loss: 0.1199 - accuracy: 0.9728 - val_loss: 7.3933e-05 - val_accuracy: 1.0000 saved /content/checkpoints.model.0 Finished Epoch 0
I have high accuracies but bad prediction. I tried different models. All give me the same result.
Image Label Prediction
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
keras - Very good validation accuracy but bad predictions
I'm building a keras model to classify cats and dogs. I used transfer learning with bottleneck features and fine tuning with vgg model....
Read more >Why the predictions using keras saved models are bad when ...
Because it did overfitting, training accuracy will be very good. And since the model though giving very good accuracy on training set, doesn't...
Read more >Keras model has a good validation accuracy but makes bad ...
This is the model I made but somehow the predictions are really bad even if the validation accuracy is really high (99%).
Read more >Good accuracy but really bad predictions · Issue #8411 - GitHub
Good accuracy but really bad predictions #8411 ... The problem is that prediction on the training images(those 3 images) are not correct.
Read more >Use of Bad Training Data for Better Predictions - NIPS papers
acheive high training set accuracy, cause poor predictions for new data. When using neural networks, this problem has two basic aspects.
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
I had the same issue and I solved it as follows: First of all, the labeled image generated from labelme tool has several channels. While the labeled image used in image-segmentation-keras has one channel. You can check that using Matlab. So, to convert all the labeled images from multiple channels to a single channel, create a small script in Matlab to read the png labeled images and save it again as png. It will directly save it as one channel image. Use these images for training. The generated images will look like black images. just try in a small dataset to make sure that it works.
It worked with me.
Best Regards,
@TharinduMoraDs
Hey can you please share the python code for the same. I am unfortunately not able to get grayscale image( image of single channel) and with values as 0 or 1.