dinov2 icon indicating copy to clipboard operation
dinov2 copied to clipboard

potential type mismatch in eval mode?

Open khalilsarwari opened this issue 1 year ago • 1 comments

1.) vision_transformer forward does self.head(ret["x_norm_clstoken"]) in eval, where ret is the result of forward_features

https://github.com/facebookresearch/dinov2/blob/ea5276ec8c27d7db59632cf75870cb3c1037de1f/dinov2/models/vision_transformer.py#L290

2.) the value of forward_features can be the result of forward_features_list https://github.com/facebookresearch/dinov2/blob/ea5276ec8c27d7db59632cf75870cb3c1037de1f/dinov2/models/vision_transformer.py#L223

3.) forward_features_list returns a list of dictionaries

https://github.com/facebookresearch/dinov2/blob/ea5276ec8c27d7db59632cf75870cb3c1037de1f/dinov2/models/vision_transformer.py#L211

So, ret["x_norm_clstoken"] cannot work since ret is a list of outputs, not an individual output.

khalilsarwari avatar Apr 19 '23 10:04 khalilsarwari