Not All Models Are Equal: Predicting Model Transferability in a Self-challenging Fisher Space

July 20, 2022 ยท View on GitHub

This is the PyTorch implementation of the paper Not All Models Are Equal: Predicting Model Transferability in a Self-challenging Fisher Space

Self-challenging Fisher Discriminative Analysis (SFDA)

We design a novel model selection method, termed Self-challenging Fisher Discriminative Analysis (SFDA), which is efficient, effective, and robust when measuring the transferability of pre-trained models. Compared with the state-of-the-art method NLEEP, SFDA demonstrates an average of 59.1% gain while bringing 22.5x speedup in wall-clock time.

Comparisons of weighted Kendall's tau on 11 downstream classification datasets when selecting 11 pretrained supervised models.

MethodAircraftCaltech101CarsCIFAR10CIFAR100DTDFlowersFoodPetsSUN397VOC2007
LEEP-0.2340.6050.3670.8240.6770.486-0.2430.4910.3890.7010.446
LogME0.5060.4350.5760.8520.6920.6470.1110.3850.4110.5110.478
NLEEP0.4950.6610.2650.8060.8230.7770.2150.6240.5990.8070.654
PARC-0.1820.3740.5620.8450.6920.642-0.0820.7320.1380.6980.723
SFDA0.6150.7370.4870.9490.8660.5970.5420.8150.7340.7030.763

Getting Started

  • Install PyTorch
  • Clone the repo:
    git clone https://git.woa.com/wenqishao/SFDA.git
    

Requirements

  • Install PyTorch==1.7.1 and torchvision==0.8.2 with CUDA==10.1:
conda install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=10.1 -c pytorch
  • Install timm==0.4.9:
pip install timm==0.4.9

Data Preparation

  • Download the downstream datasets to ./data/*.

Pipeline of Model selection using transferability

  • Fine-tune pretrained models with hyper-paramters sweep to obtain ground-truth transferability score
python finetune_group1.py -m resnet50 -d cifar10
  • Extract features of target data using pretrained models
python forward_feature_group1.py -m resnet50 -d cifar10
  • Compute transferability scores using SFDA
python evaluate_metric_group1_cpu.py -me sfda -d cifar10
  • Assess the effectiveness of SFDA
python tw_group1_cpu.py -me sfda -d cifar10