Official PyTorch code for the paper: TransFG: A Transformer Architecture for Fine-grained Recognition (AAAI2022)
- Python 3.7.3
- PyTorch 1.5.1
- torchvision 1.8.2+cu111
- ml_collections
Install dependencies with the following command:
pip3 install -r requirements.txt
To train TransFG on custom dataset with 1 gpus in FP-16 mode for 10000 steps run:
CUDA_VISIBLE_DEVICES=0 python3 -m torch.distributed.launch --nproc_per_node=1 train.py --dataset custum --split overlap --num_steps 10000 --fp16 --name sample_run
To train TransFG on custom dataset with 4 gpus in FP-16 mode for 10000 steps run:
CUDA_VISIBLE_DEVICES=0,1,2,3 python3 -m torch.distributed.launch --nproc_per_node=4 train.py --dataset custum --split overlap --num_steps 10000 --fp16 --name sample_run