Open leishi2018 opened 5 years ago
ValueError Traceback (most recent call last)
Seem like your annotation image have depth of 4 and not 1, The Label should be 2d image where the value of each pixel is its class number.
Ok, thanks,I have solve this problem. but, my loss is always nan,and, my test photos are some flowers.
Possibly the number of classes you put in NUM_CLASSES is lower then the one actually appear in your annotations. Check the max number that appear in your annotation.
My annotation of photos are only white(object) and black(background).so, NUM_CLASSES is 2.
------------------ 原始邮件 ------------------ 发件人: "sagieppel"notifications@github.com; 发送时间: 2018年12月16日(星期天) 晚上6:33 收件人: "sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation"Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation@noreply.github.com; 抄送: "火焰舞者"523997174@qq.com; "Author"author@noreply.github.com; 主题: Re:[sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation]TRIAN.PY ISSUES (#10)
Possibly the number of classes you put in NUM_CLASSES is lower then the one actually appear in your annotations. Check the max number that appear in your annotation.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
NUM_CLASSES is 2 that is ok. when I change it the program will take an error.
Why do you use BGR substract pixels mean, that lead to the negative value of bgr. and the value of self.conv1_1 are all the zero. So, my Net.Prob is Nan
Is the value of the white region in label map 1 or 255? If its 255 that is the error. The highest value of the label map is the number of classes.
Substracting mean is standart normalization it cant lead to all zeros. Also having all zeros in first layer will not lead to nan results.
can you tell me how to set the number class.
------------------ 原始邮件 ------------------ 发件人: "sagieppel"notifications@github.com; 发送时间: 2018年12月18日(星期二) 上午6:35 收件人: "sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation"Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation@noreply.github.com; 抄送: "火焰舞者"523997174@qq.com; "Author"author@noreply.github.com; 主题: Re:[sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation]TRIAN.PY ISSUES (#10)
Is the value of the white region in label map 1 or 255? If its 255 that is the error. The highest value of the label map is the number of classes.
Substracting mean is standart normalization it cant lead to all zeros. Also having all zeros in first layer will not lead to nan results.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I have change white from 255 to 1 and black to 0. but my loss are always nan
The image above (the black one) has a maximum pixel value of 48 and depth of three. If you have two class the only allowed value are 0 and 1. And the image must be 2d (depth of 0) You can check it yourself by running:
import scipy.misc as misc Label=misc.imread(LabelFileName) print("Label Max Value "+str(Label.max())) print("Label shape "+str(Label.shape))
A simple way to convert your label map to 2d and remove values above 1 is: import numpy as np import scipy.misc as misc Label=misc.imread(LabelFileName) LabelFixed=(Label[:,:,0]==1).astype(np.uint8) print("Fixed Label Max Value "+str(Label.max())) print("Fixed Label shape "+str(LabelFixed.shape)) misc.imsave(LabelFileName,LabelFixed)
Thank you for your code, my data can be used,but some steps later it comes that
and my labels dont have this shape(327x383x3) of photo. my labels(60 photos) are all ok by use your code for checking.
------------------ 原始邮件 ------------------ 发件人: "sagieppel"notifications@github.com; 发送时间: 2018年12月19日(星期三) 凌晨5:22 收件人: "sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation"Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation@noreply.github.com; 抄送: "火焰舞者"523997174@qq.com; "Author"author@noreply.github.com; 主题: Re:[sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation]TRIAN.PY ISSUES (#10)
The image above (the black one) has a maximum pixel value of 48 and depth of three. If you have two class the only allowed value is 0 and 1. And the image must be 2d depth of 0 You can check it yourself by using:
import scipy.misc as misc Label=misc.imread(LabelFileName) misc.imshow((Label==1).astype(float)) print("Label Max Value "+str(Label.max())) print("Label shape "+str(Label.shape))
A simple way to convert your label to 2d and remove values above 1 is: import numpy as np import scipy.misc as misc Label=misc.imread(LabelFileName) LabelFixed=(Label[:,:,0]==1).astype(np.uint8) print("Fixed Label Max Value "+str(Label.max())) print("Fixed Label shape "+str(LabelFixed.shape)) misc.imsave(LabelFileName,LabelFixed)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hi, thank you. mine can work. because one Label is wrong.
------------------ 原始邮件 ------------------ 发件人: "sagieppel"notifications@github.com; 发送时间: 2018年12月19日(星期三) 凌晨5:22 收件人: "sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation"Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation@noreply.github.com; 抄送: "火焰舞者"523997174@qq.com; "Author"author@noreply.github.com; 主题: Re:[sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation]TRIAN.PY ISSUES (#10)
The image above (the black one) has a maximum pixel value of 48 and depth of three. If you have two class the only allowed value is 0 and 1. And the image must be 2d depth of 0 You can check it yourself by using:
import scipy.misc as misc Label=misc.imread(LabelFileName) misc.imshow((Label==1).astype(float)) print("Label Max Value "+str(Label.max())) print("Label shape "+str(Label.shape))
A simple way to convert your label to 2d and remove values above 1 is: import numpy as np import scipy.misc as misc Label=misc.imread(LabelFileName) LabelFixed=(Label[:,:,0]==1).astype(np.uint8) print("Fixed Label Max Value "+str(Label.max())) print("Fixed Label shape "+str(LabelFixed.shape)) misc.imsave(LabelFileName,LabelFixed)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hello, I have a problem about this. My test pictures is a RGB three chanels,and Labels is PNG .
ValueError: could not broadcast input array from shape (456,607,4) into shape (456,607)