Comments (6)
Make sure your class labels are 0 and 1. I'm guessing the reason 151 works is because your label values fit within that range. The model afaik is trying to allocate a position in a one hot vector for each pixel, so if your label is outside the range of that vector then it will go nan.
from fcn.tensorflow.
It's funny. And I also train the code on my dataset. When the NUM_OF_CLASSES is less than 60, the loss is Nan. And when I change the NUM_OF_CLASSES to 61, it works.
After some experiments, I found some results:
First, the direct reason is because the values of conv1_1 is Nan when the NUM_OF_CLASSES is less than 60. But the input image is not Nan. Second, what really matters is the NUM_OF_CLASSES in the third transpose convolution. That's saying it's no matter how you change the NUM_OF_CLASSES in the first transpose convolution.
But unfortunatly, I didn't find the reson and don't know how to fix it.
Do you fix it ?
Thanks,
from fcn.tensorflow.
Agree with @Exuro889 . Just double check you label.
from fcn.tensorflow.
@xtudbxk I have found the problem.I checked my dataset and surprisingly the max value of my label is 2.No wonder that 2 classes didn't work.I strongly suggest you checking your label again to make sure the num of labels is 60.
Meanwhile,thanks you @rayhou0710 @Exuro889
from fcn.tensorflow.
@abc8350712 @Exuro889
Thanks for your help, I just get the loss which is not nan through your ways.
from fcn.tensorflow.
Sorry for the late response. The above comment by @Exuro889 does solve the problem.
Just fyi in the documentation for tf.nn.sparse_softmax_cross_entropy_with_logits you will notice the labels are to be in range [0, num_classes). This is the same conclusion made in the above comments. This is just how the function is implemented.
from fcn.tensorflow.
Related Issues (20)
- Why not implement batch normalization?
- Questions about training
- Expected string passed to parameter 'tag' of op 'ImageSummary', got 'input_image_1' of type 'str' instead. HOT 1
- run FCN.py , path wrong HOT 1
- is fusion operation the same as the paper?
- 为什么没有把pool5的结果和最后结果上采样做差值,我看代码只做了pool4和pool3的结果 HOT 1
- 论文中是说最后输入1000张特征图,取1000张特征图中的各像素最大值,为啥这个代码要用3通道呢 HOT 2
- KeyError: 'normalization' HOT 1
- Train the model for face parsing problem HOT 2
- how to train my own dataset?
- Training problem HOT 1
- What is output node's name? HOT 1
- Is anyone could share the trained ckpt???thanks!!!!
- ValueError: Cannot feed value of shape (2, 227, 227, 1, 4) for Tensor 'annotation:0', which has shape '(?, 227, 227, 1)' HOT 2
- Can I use FCN on Windows 10?
- 'NoneType' object is not subscriptable
- i made a reimplement with tensorflow2 HOT 3
- ValueError: Unknown mat file type, version 110, 116 HOT 2
- Logging and Visualizing Training Metrics on Tensorboard
- Implementing GradCam HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fcn.tensorflow.