lightly-ai / lightly

A python library for self-supervised learning on images.
https://docs.lightly.ai/self-supervised-learning/
MIT License
2.89k stars 249 forks source link

Fix masking ratio calculation #1585

Closed guarin closed 1 month ago

guarin commented 1 month ago

Changes

Closes #1583

Fixes an issue where too many tokens were masked because the class token was included in the calculation for the number of masked tokens.

The new behavior is:

The original MAE code also calculates the masking ratio without the class token, see: https://github.com/facebookresearch/mae/blob/efb2a8062c206524e35e47d04501ed4f544c0ae8/models_mae.py#L130

How was it tested?

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.77%. Comparing base (e0799ae) to head (843c250).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1585 +/- ## ======================================= Coverage 81.77% 81.77% ======================================= Files 144 144 Lines 6123 6124 +1 ======================================= + Hits 5007 5008 +1 Misses 1116 1116 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.