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

Pictures in output are all black #6

Closed
summerrr opened this issue Sep 4, 2018 · 1 comment
Closed

Pictures in output are all black #6

summerrr opened this issue Sep 4, 2018 · 1 comment

Comments

@summerrr
Copy link

summerrr commented Sep 4, 2018

after training,model will save three ckpt files, .index .meta and .data, how can I run infer?I run the
python main.py --ckpt=models/model.ckpt-4
but the pictures in output are all black. And there is no errors and warnings.

@HasnainRaz
Copy link
Owner

The infer function is pretty basic, it was written for a binary class situation, you might have to modify it depending on the values your prediction contains.
The FC-DenseNet is also difficult to optimize for other datasets, see problems.

I have used this code to successfully train on a binary class situation, key things to keep in mind are that the model is sensitive to class imbalance, so if you have imbalanced classes (background dominates, then the model will tend to predict background), try the following:

  1. If you have only 2 classes, use --num_classes=1, and use sigmoid cross entropy instead of softmax.
  2. Try changing the loss function to dice coefficient, or weighted cross entropy, and weight the foreground class more.
  3. Try playing around with batch_norm, turning it on or off works sometimes (since segmentation mini-batches are very small, the learned statistics may or may not be a good reflection of the true statistics).
  4. Try using tensorboard logging to visualize the predictions during training and confirming that the network is not falling into a local minimum of predicting all black.

I am not aware of other settings of the problem you are trying to solve, so this is about as much help as I can give.

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

2 participants