bonlime / keras-deeplab-v3-plus

Keras implementation of Deeplab v3+ with pretrained weights
MIT License
1.36k stars 428 forks source link

Model not learning anything #152

Open anmol4210 opened 3 years ago

anmol4210 commented 3 years ago

Hi I'm training DeepLabV3+ Mobilenet backbone on my custom dataset. My Dataset has 1 class. My Model architecture looks like:

deeplab_model = Deeplabv3(input_shape=(512, 512, 3), classes=2,activation='softmax') deeplab_model.compile(optimizer='adam', loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),metrics='accuracy']) deeplab_model.fit(...)

My Loss is not reducing and the output is all black. My mask is of the shape (512,512) Someone, please guide me what to do? Any help would be great.

YuriyKortev commented 3 years ago

Hello, try to use classes argument equal to 1 and activation argument equal to 'sigmoid', then use np.reshape on your mask with shape argument equal to (512, 512, 1). Also try to use some loss functions useful for semantic segmentation, dice loss for example