Image Classification (UniCL)

UniCL: Unified Contrastive Learning in Image-Text-Label Space

Train an Image Classification Model From scratch

Compare to MMClassification

# Single GPU classification
python itra/training/main.py \
    --train-data 'CIFAR10' \
    --linear-frequency 20  --zeroshot-frequency 20 --datasets-dir '/data/Datasets' \
    --epochs 200 --save-frequency 0 --batch-size 128 --workers 4 \
    --opt 'sgd' --lr 0.1 --warmup 100 --weight_decay 0.0001 \
    --image-model 'resnet18' --image-model-builder 'torchvision' --image-resolution 32  --image-head-n-layers 1 \
    --pretrained-text-model \
    --text-model 'RN50' --text-model-builder 'openclip' --lock-text-model --text-head-n-layers 1  \
    --loss 'CrossEntropy' --joint-projection-dim 10 \
    --report-to tensorboard --logs 'logs/UniCL-Classification'  --name 'resnet18(scratch)-CIFAR10-200ep-CrossEntropy+linear_eval'
    
# Single GPU classification
python itra/training/main.py \
    --train-data 'CIFAR10' \
    --linear-frequency 5 --zeroshot-frequency 5 --datasets-dir '/data/Datasets' \
    --epochs 200 --save-frequency 0 --batch-size 128 --workers 4 \
    --opt 'sgd' --lr 0.1 --warmup 100 --weight_decay 0.0001 \
    --image-model 'resnet18' --image-model-builder 'torchvision' --image-resolution 32  --image-head-n-layers 1 \
    --pretrained-text-model \
    --text-model 'RN50' --text-model-builder 'openclip' --lock-text-model --text-head-n-layers 1  \
    --loss 'InfoNCE' --joint-projection-dim 1024 \
    --report-to tensorboard --logs 'logs/UniCL-Classification'  --name 'resnet18(scratch)-CIFAR10-200ep-InfoNCE+linear_eval'

Fine-tuning CLIP for ImageNet Classification

Re-implement this paper.

python itra/training/main.py –train-data ‘mscoco_captions’ –retrieval-data ‘mscoco_captions’ –dataset-size 1000 –retrieval-frequency 1 –datasets-dir ‘/data/Datasets’ –epochs 1 –save-frequency 1 –batch-size 32 –workers 2 –lr 1e-5 –warmup 100 –weight_decay 0.5 –max-grad-norm 5 –image-model ‘RN50’ –image-model-builder ‘openclip’ –text-model ‘RN50’ –text-model-builder ‘openclip’–pretrained-image-model –pretrained-text-model –loss ‘InfoNCE’ –report-to tensorboard –logs ‘logs/test’ –name ‘RN’