Skip to content

Latest commit

 

History

History

token_labeling

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Image classification with UniFormer

We follow LV-ViT to train our models with Token Labeling.

Model Zoo

ImageNet-1K pretrained with Token Labeling (224x224)

The followed models and logs can be downloaded on Google Drive: total_models, total_logs.

We also release the models on Baidu Cloud: total_models (p05h), total_logs (wsvi).

We follow LV-ViT to train our models with Token Labeling. Please see token_labeling for more details.

Model Top-1 #Param. FLOPs Model Log Shell
UniFormer-S 83.4 (+0.5) 22M 3.6G google google run.sh
UniFormer-S† 83.9 (+0.5) 24M 4.2G google google run.sh
UniFormer-B 85.1 (+1.3) 50M 8.3G google google run.sh
UniFormer-L+Layer Scale 85.6 100M 12.6G google google run.sh

Due to the models UniFormer-S/S†/B use head_dim=32, which cause much memory cost for downstream tasks. We re-train these models with head_dim=64. All models are trained with 224x224 resolution.

Model Top-1 #Param. FLOPs Model Log Shell
UniFormer-S 83.4 (+0.5) 22M 3.6G google google run.sh
UniFormer-S† 83.6 (+0.2) 24M 4.2G google google run.sh
UniFormer-B 84.8 (+1.0) 50M 8.3G google google run.sh

Large resolution fine-tuning (384x384)

The followed models and logs can be downloaded on Google Drive: total_models, total_logs.

We also release the models on Baidu Cloud: total_models (p05h), total_logs (wsvi).

We fine-tune the above models with Token Labeling on resolution of 384x384. Please see token_labeling for more details.

Model Top-1 #Param. FLOPs Model Log Shell
UniFormer-S 84.6 22M 11.9G google google run.sh
UniFormer-S† 84.9 24M 13.7G google google run.sh
UniFormer-B 86.0 50M 27.2G google google run.sh
UniFormer-L+Layer Scale 86.3 100M 39.2G google google run.sh

Usage

Our repository is built base on the TokenLabeling repository.

Installation

  • Clone this repo:

    git clone https://github.com/Sense-X/UniFormer.git
    cd UniFormer
  • Install PyTorch 1.7.0+ and torchvision 0.8.1+

    conda install -c pytorch pytorch torchvision
  • Install other packages

    pip install timm

Download label data

For Token Labeling, we need to download the dense label map.

We provide NFNet-F6 generated dense label map in Google Drive and BaiDu Yun (password: y6j2). As NFNet-F6 are based on pure ImageNet data, no extra training data is involved.

Training

Simply run the training scripts in exp as followed:

bash ./exp/uniformer_small_tl_224/run.sh

You should set the dense label data path via --token-label-data.

Evaluation

Simply run the evaluating scripts in exp as followed:

bash ./exp/uniformer_small_tl_224/test.sh

You should set the checkpoint file path via --checkpoint.

Fine-tuning

Simply run the training scripts in exp as followed:

bash ./exp/uniformer_small_tl_384/run.sh

You should set the pretrained model file path via --finetune.

Acknowledgement

This repository is built using the timm library and the TokenLabeling repository.