Using hinge loss for binary semantic segmentation

Issue

I am exploring the idea of the ensemble technique for the semantic segmentation model. I initially wanted to use a support vector machine combined with UNet/ResNet/DeepLabV3 for the last layer. I found that I could use ‘hinge loss’ as a loss function and it works the same as a support vector machine. But I’m a bit not clear how this will work and if this is the right way I’m trying to implement it. Since I do not have extensive knowledge in computer vision I might be completely wrong and digging the wrong hole. If that’s the case please let me know.

What I was thinking is the outcome of Unet layer will be imagesize*imagesize with probabilities of class for either 0 or 1(before applying activation) and I wanted to apply a support vector machine with this all pixel vectors and then classify with the result.

my question will be

  1. I feel like using sigmoid as activation of last layer and selecting hinge loss for loss function is a little different to what I wanted to do. Is this correct?
  2. Can I use hinge loss for semantic segmentation(binary class) as well?
  3. If the aforementioned methods are all wrong and If I wanted to implement the ensemble technique(semantic segmentation model+SVM) how can I implement?

Solution

I feel like using sigmoid as activation of last layer and selecting
hinge loss for loss function is a little different to what I wanted to
do. Is this correct?

Sigmoid makes sense as your last layer as you are working with a binary classification problem and this activation will squeeze the values between 0 and 1. For binary classification problems the default loss functions is binary cross entropy (BCE). Hinge is a possible alternative, but for the problems I have been working with it has very seldomly led to better results.

Can I use hinge loss for semantic segmentation(binary class) as well?

To be completely sure which loss function you should use for your specific problem you should train both with BCE and Hinge. However, I would start by BCE.

If the aforementioned methods are all wrong and If I wanted to
implement the ensemble technique(semantic segmentation model+SVM) how
can I implement?

Go for a pure neural network approach. You will get much better results

Answered By – Mikel B

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published