FastClassification is a tensorflow toolbox for class classification. It provides a training module with various backbones and training tricks towards state-of-the-art class classification.
features | |
---|---|
backbone | ResNet50,ResNet101,ResNet152, EfficientNetB0,EfficientNetB1,..., EfficientNetB7 |
augment |
|
tricks |
|
other |
|
[2021-06-26]
- Add classic models and training tricks.
git clone https://github.com/wangermeng2021/FastClassification.git
cd FastClassification
- Install tesnorflow (skip this step if it's already installed,test environment:tensorflow 2.4.0)
- Install dependencies:
pip install -r requirements.txt
- Set the learning rate manually:
python train.py --init-lr 1e-3 --progressive-resizing 224 224 --dataset-dir dataset/catdog --epochs 10 --batch-size 32 --augment cutmix --weights imagenet
- For training with Sharpness-Aware Minimization optimizer(support SAM-SGD,SAM-Adam):
python train.py --optimizer SAM-SGD --augment baseline --init-lr 1e-3 --progressive-resizing 224 224 --dataset-dir dataset/catdog --epochs 10 --batch-size 32 --weights imagenet
- For training with lr-finder:
python train.py --init-lr 0 --progressive-resizing 224 224 --dataset-dir dataset/catdog --epochs 10 --batch-size 32 --augment cutmix --weights imagenet
- For training with progressive-resizing:[(128,128),[224,224]]
python train.py --progressive-resizing 128 128 224 224 --dataset-dir dataset/catdog --epochs 10 --batch-size 32 --augment cutmix --weights imagenet
- For training with mixed-precision:
python train.py --mixed-precision True --init-lr 1e-3 --progressive-resizing 224 224 --dataset-dir dataset/catdog --epochs 10 --batch-size 32 --augment cutmix --weights imagenet
- For training with rand_augment:
python train.py --augment rand_augment --init-lr 1e-3 --progressive-resizing 224 224 --dataset-dir dataset/catdog --epochs 10 --batch-size 32 --weights imagenet
- Navigate to http://0.0.0.0:6006: you need to manually enable: "Setting"-->"Reload data" on tensorboard home page to automatically update data
model | val_acc |
---|---|
progressive-resizing(224x224)+SGD+baseline | 0.987 |
progressive-resizing(224x224)+SAM-SGD+baseline_augment | 0.990 |
progressive-resizing(224x224)+SAM-SGD+mixup | 0.947 |
progressive-resizing(224x224)+SAM-SGD+cutmix | 0.927 |
progressive-resizing(224x224)+SAM-SGD+auto_augment | 0.980 |
progressive-resizing(224x224)+SAM-SGD+rand_augment | 0.960 |
progressive-resizing(224x224)+SAM-SGD+baseline+mixed-precision | 0.980 |
progressive-resizing(224x224)+SAM-SGD+baseline+lr-finder | 0.907 |
progressive-resizing(128x128,224x224)+SAM-SGD+baseline | 0.963 |
progressive-resizing(128x128,224x224)+SAM-SGD+mixup | 0.936 |