-1
$\begingroup$

In this example:

https://github.com/qubvel/segmentation_models.pytorch/blob/dcd19d676bdfbf73fc140d5b98d780f449b0a2f8/segmentation_models_pytorch/base/initialization.py

It only initializes the decoder and header, but not the encoder. More strangely, it initializes convolutional layers in decoder with nn.init.kaiming_uniform_, but initializes fully connected layers, as well as convolutional layers in header with nn.init.xavier_uniform_. Is there a specific reason for doing so?

$\endgroup$

1 Answer 1

2
$\begingroup$

The encoder is a feature extractor. For this reason, we use an encoder trained on millions of different images (ImageNet). No matter whether your task is tumor segmentation or car segmentation, a pretrained feature extractor will improve the results. Using a pretrained encoder is always better than a randomly initialized one.

The decoder only upsamples the image. While there are convolutional layers between the upsampling layers, they are highly specific to the task. For this reason, you would randomly initialize the decoder. It would make no sense to use a pretrained decoder when it is not exactly the same task.

Depending on the activation function, some initializations are better. For example, the output layer is for segmentation either a softmax or sigmoid activation. Then a Xavier initialization might work better. This can be empirically determined.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.