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

train_step1 all pixels are classified as backgound(black) #12

Open
LigZhong opened this issue Nov 22, 2018 · 2 comments
Open

train_step1 all pixels are classified as backgound(black) #12

LigZhong opened this issue Nov 22, 2018 · 2 comments

Comments

@LigZhong
Copy link

LigZhong commented Nov 22, 2018

I did some small change and now the train step 1 can run but all pixels are classified as backgound(black).
Anyone has this same issue?

Initially the build_loss function is
def build_loss(self,seg_layer,lab_holder):
lab_reform = tf.expand_dims(lab_holder,-1)
lab_reform = tf.image.resize_images(seg_layer,tf.shape(lab_reform)[1:3])
lab_reform = tf.squeeze(lab_reform)
seg_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits=seg_layer,labels=lab_reform))

I changed it to
def build_loss(self,seg_layer,lab_holder):
# lab_reform = tf.expand_dims(lab_holder, -1)
# lab_reform = tf.image.resize_images(seg_layer, tf.shape(lab_reform)[1:3]) # z00445456
seg_reform = tf.image.resize_images(seg_layer, tf.shape(lab_holder)[1:3]) # z00445456
# lab_reform = tf.squeeze(lab_reform)
seg_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits=seg_reform,labels=lab_holder))

and it can run without error. But the result is weird. All pixels are classified as backgound.

@ridasalam
Copy link

Yes, I have the same issue

@kunkun007
Copy link

Why you change the loss part? I can run train_step1.py and has the same issue with yours.

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