-1

I am trying to segment 4 lesions with semantic segmentation. I follow this this great post

My training folder has only 2 subfolders with patches: masks and images. Inside the folder with masks, ALL the classes are mixed. The other folder has the corresponding images. So, when I train the model ,it appears: ONE CLASS FOUND, just following the abovementioned post. The results are disappointing and I am wondering if I have to split the classes in the folders, and thus the model recognizes 4 classes instead of the one.

Nick ODell
  • 15,465
  • 3
  • 32
  • 66

1 Answers1

1

What your really need to be attentive at is the way in which the masks are created.

It is possible that by default the ImageDataGenerator in Keras to output the number of folders, regardless of how you manually build and adapt the ImageDataGenerator for image segmentation instead of image classification.

My suggestion is to follow the entire post along and change nothing in the first instance. If you pay attention the final results obtained are quite good; this means that the dataset preparation process (mask creation) is correct.

Timbus Calin
  • 13,809
  • 5
  • 41
  • 59
  • thanks for the reply. Could you please explain this: "and adapt the ImageDataGenerator for image segmentation instead of image classification."..I do segmentation and not classification. – THEODOROPOULOS DIMITRIS Apr 30 '20 at 07:40
  • 1
    The ImageDataGenerator looks for a couple of folders and considers the number of folders equal to the number of classes. However, this is not the case for image segmentation, since you have two main folders such as images and masks, where the mask can correspond to a various number of classes, for example. The dataset preparation has been taken care of in the example you provided , you do not need to manually do the preparation. – Timbus Calin Apr 30 '20 at 07:43
  • 1
    However, if you look at the code that you provided, in TrainAugmentGenerator and ValAugmentGenerator, the logic is overriden and they are adapted for the image segmentation task and not the image classification one. You do not need to concern with dataset creation anymore, unless you want to train for 2 classes for example instead of all the classes for CamVid. If my explanations helped you understand/solve your problem, kindly accept the answer, thank you. – Timbus Calin Apr 30 '20 at 07:47
  • Under the triangle of downvote there is a tick, you should click the tick in order to do so. – Timbus Calin Apr 30 '20 at 12:55