jakeret / tf_unet

Generic U-Net Tensorflow implementation for image segmentation
GNU General Public License v3.0
1.9k stars 748 forks source link

All Black Mask predictions on example code #244

Closed I-CANT-CODE closed 5 years ago

I-CANT-CODE commented 5 years ago

Hello,

I used the example code

https://tf-unet.readthedocs.io/en/latest/usage.html

`from tf_unet import unet, util, image_util

preparing data loading

data_provider = image_util.ImageDataProvider("train/*.png")

setup & training

net = unet.Unet(layers=3, features_root=64, channels=1, n_class=2) trainer = unet.Trainer(net) path = trainer.train(data_provider, "checkpoints", training_iters=32, epochs=100)

verification

...

prediction = net.predict(path, data)

unet.error_rate(prediction, util.crop_to_shape(label, prediction.shape))

img = util.combine_img_prediction(data, label, prediction) util.save_image(img, "prediction.jpg")`

The prediction files in the "prediction" folder look like they are predicting all black images as the output, and I am not sure how I can fix it. Any advice?

Also I know that to change the optimizer I simply don Unet.trainer(net, optimizer = "Adam")

but how can I change the learning rate? I was a little confused about this part.

I-CANT-CODE commented 5 years ago

edit: fixed by switching to Adam!