purnasai / Dino_V2

Dino V2 for Classification, PCA Visualization, Instance Retrival: https://arxiv.org/abs/2304.07193

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about transformer.norm

Myungbin opened this issue · comments

Hello! Thank you for sharing the great code. I have a question. Could you please explain why you applied 'transformer.norm' in the 'forward' function of 'DinoVisionTransformerClassifier'?

def forward(self, x):
    x = self.transformer(x)
    x = self.transformer.norm(x)
    x = self.classifier(x)
    return x

Hi @Myungbin, Thanks for finding the repo useful. I am not externally applying "Normalization" to the features. I am using the "Normalization" layer that is inbuilt in the model architecture to "Normalize" the features.

This step adds stabilization/scales the values to be in a range. It might work even without this step, but this step has improved the Overall results. hence added.

Thank you

@purnasai Thank you very much! It was very helpful!