Keras-FCN icon indicating copy to clipboard operation
Keras-FCN copied to clipboard

Train my dataset [Value error] wrong input array

Open milumilule2 opened this issue 7 years ago • 5 comments

Thank you for your code! The label of VOC dataset is .mat file, but when I train my own dataset. My trained images are jpegs, and their labels are pngs. I meet the following error Value error: could not broadcast input array from shape(320,320,4) into shape(320,320,1).

I want to know, the dataset must be .mat format or not? Is the label format must be the same as the VOC dataset labels? Thank you very much!

milumilule2 avatar Nov 10 '17 09:11 milumilule2

I am still learning with the code of this implementation so my advice could not be right. As far as I know, if you are using the SegDataGenerator, the default way in this repo, for loading your images and labels, note that it is specified in the docstring of that class that the labels must be one channel with pixels specifying the class they belong to. This is in case that reshape error has to do with the label format.

dokutagero avatar Nov 16 '17 07:11 dokutagero

@dokutagero Thank you so much for your reply! In fact, I want to use this implementation to train my saliency detection dataset. In detail, the input images are RGB images(channel=3), but the output are grey images(channel=1). So the results are not classification for the objects in the image. The results are recognizing the saliency object in the image. After training, the saliency object should be white and the background should be black in the output map. Do you think this implementation can solve my task? Can I finish my task after modifying some parameters? Please give me some advice. Thank you again!

milumilule2 avatar Nov 17 '17 12:11 milumilule2

Hi,friends. @milumilule2 .I'm also trying to find suitful way to train my saliency detection dataset,but all the values in the final prediction are 255 which means the final map is a white picture.I guess that the loss function maybe the reason.However,I have no ideas to solve the problem.Can you give me some advice.Thank you!Happy to communicate with you.Best wishes!

JingangLang avatar Dec 28 '17 06:12 JingangLang

Hey @JingangLang check out #2

chinmayshah99 avatar Jun 05 '18 14:06 chinmayshah99

Hello, I also have this problem, I want to train my data set, but the picture of my data set is jpg, the label is png, can I use this data set for training, if I can, I need the program What changes have been made?thanks

watchmexiang avatar Dec 24 '18 05:12 watchmexiang