sagieppel / Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation

68 stars 40 forks source link

ValueError: could not broadcast input array from shape (277,261,3) into shape (277,261) #3

Open HetSP07 opened 6 years ago

HetSP07 commented 6 years ago

Thanks for your code!

But when i'm trying to run TRAIN.py I'm having this error ReadAndAugmentNextBatch Labels[f, :, :,0]=Label ValueError: could not broadcast input array from shape (277,261,3) into shape (277,261) Can you help me please! Thanks

sagieppel commented 6 years ago

The label map you read seem to have depth of 3 while it should have no depth (one label per pixel). Checkout the which of the 3 channel of the Label matrix contain the label map and replace Label with Label[:,:,C] where C is the channel where the label map is.

HetSP07 commented 6 years ago

Sorryy I did not understand, The Label [:,:,C] that I will change is it in Data_Reader.py ?

sagieppel commented 6 years ago

The Label matrix should contain one label per pixel (one int number per pixel) as ground truth for training. It seems from the error message that the label you read have three channels hence 3 numbers per pixel. At least I assume this is the error.

RaphF3rr commented 6 years ago

Dude, how did you create your Label files? I'm having this trouble and could'nt fix it.

Btw, thanks for your code.

sagieppel commented 6 years ago

Label file is just an image in the size of the input image but with one channel (kind of greyscale). The value of each pixel in the label image is the class number of the corresponding pixel in the input image. There are many annotation tools that can be used for this.

RaphF3rr commented 6 years ago

Thanks for answer. Can u pls link me to one of those? I'm already like 3 hours already just looking for one.

sagieppel commented 6 years ago

Try labelme: https://github.com/wkentaro/labelme