Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training Accuracy is always 1.00 and the Minibatch error is always 0.0% #292

Open
ChristmasLatte opened this issue Apr 16, 2020 · 3 comments

Comments

@ChristmasLatte
Copy link

Hi, I have a trouble when i was training model.The minibatch loss seems normal, but the training accuracy is always 1 and minibatch error is always 0.0%.
图片
And I just want extract buildings from image, and my mask label channels is 3,should i set n_class=3 ?

Here is my code:

from tf_unet import unet, util, image_util

data_provider = image_util.ImageDataProvider("data/train/*.tif")
net = unet.Unet(layers=3, features_root=64, channels=3, n_class=3)
trainer = unet.Trainer(net)
path = trainer.train(data_provider, "./data/unet_trained_bgs_example_data", training_iters=32, epochs=100, dropout=0.5)

verification

...
data_provider = image_util.ImageDataProvider("data/test/*.tif")
x_test, y_test = data_provider(1)
prediction = net.predict("./data/unet_trained_bgs_example_data/model.ckpt", x_test)
unet.error_rate(prediction, util.crop_to_shape(y_test, prediction.shape))
img = util.combine_img_prediction(x_test, y_test, prediction)
util.save_image(img, "prediction.jpg")

@jakeret
Copy link
Owner

jakeret commented Apr 17, 2020

Hi @ChristmasLatte , hard to tell whats going on from what I see here.

I'm currently working on a re-implementation of tf_unet that is based on tensorflow 2 & keras and addressing some of the issues tf_unet had.
Maybe this could help you:
https://github.com/jakeret/unet

@ChristmasLatte
Copy link
Author

Okay, thanks for your answer @jakeret .I will refre another projected.
Sorry i am a beginner in u-net, I also have a little question that if i want to class an image into foreground and background, should i set n_class 1?
I would appreciate it if you have time to reply.

@AzizahMasturina
Copy link

Hi @ChristmasLatte, I am experiencing the same problem and was wondering if you managed to solve it? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants