Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guarin lig 3056 add mae imagenet benchmark #1263

Closed
wants to merge 22 commits into from

Conversation

guarin
Copy link
Contributor

@guarin guarin commented May 31, 2023

Closes #1255

Reference values from paper:
Screen Shot 2023-06-15 at 08 50 01

Screen Shot 2023-06-15 at 09 03 04

The paper uses ViT-L with 1600 epoch pretraining by default while we use only ViT-B with 100 epoch pretraining. So I would expect finetune performance to be <82.3% following Figure 7. solo-learn reports 81.6% finetune top1 for ViT-B after 100 epochs. The paper reports ViT-B finetune performance of 83.6% after 1600 epoch pretraining.

From Figure 7 it looks like linear eval should be <57.3 as we use ViT-B instead of ViT-L. ViT-B linear eval after 1600 epoch pretraining is reported as 68% in Table 12.

First Results

Imagenet
    max val_online_cls_top1: 0.17285999655723572                                                                                                                                                                                                                    
    max val_online_cls_top5: 0.36941999197006226 
    knn val_top1: 0.13728000223636627                                                                                                                                                                                                                               
    knn val_top5: 0.2959200143814087 
    max linear val_top1: 0.4907799959182739                                   
    max linear val_top5: 0.728380024433136
    max finetune val_top1: 0.7822399735450745                                 
    max finetune val_top5: 0.9412800073623657

Results are a bit worse than expected. We should get ~82% finetune top1 but got 78.2%. Similarly for linear top1 we should get something a bit below 57% but we only got 49%.

Interestingly, knn top1 is really bad. Could be a sign that pretraining doesn't work properly or that (linear) finetuning is very important.

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (889825a) 85.25% compared to head (e27946e) 85.79%.

Files Patch % Lines
lightly/models/utils.py 83.78% 6 Missing ⚠️
lightly/models/modules/masked_autoencoder.py 84.84% 5 Missing ⚠️
lightly/utils/benchmarking/metric_callback.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1263      +/-   ##
==========================================
+ Coverage   85.25%   85.79%   +0.54%     
==========================================
  Files         130      130              
  Lines        5519     5547      +28     
==========================================
+ Hits         4705     4759      +54     
+ Misses        814      788      -26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

guarin added 13 commits June 5, 2023 14:44
* This is required as torch.no_grad doesn't change the model configuration
  while manual gradient deactivation/activation can have unintended
  consequences. For example, MAE ViT positional embeddings are parameters
  with requires_grad=False that should never receive an update. But if
  we use activate_requires_grad for finetuning we break those
  parameters.
@guarin
Copy link
Contributor Author

guarin commented Jan 24, 2024

Closing in favor of: #1468

@guarin guarin closed this Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MAE
1 participant