Skip to content

Training classification model for generating backbone

Notifications You must be signed in to change notification settings

pjh5672/Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Classification


[Content]

  1. Description
  2. Usage
    2-1. Model Training
    2-2. Detection Evaluation
  3. Contact

[Description]

This is a repository for PyTorch training implementation of general purposed classifier. With the training code, various feature extractor backbones such as Resnet, Darknet, CSP-Darknet53, Mobilenet series can be created. It can provide 6x faster dataloader rather than torchvision.datasets.ImageFolder.

result

  • 224 x 224 Model Performance Table
Model Dataset Train Valid Size
(pixel)
Accuracy
(Top-1)
Params
(M)
FLOPs
(G)
Darknet19 ImageNet train2012 val2012 224 73.50 20.84 5.62
Darknet53 ImageNet train2012 val2012 224 77.67 41.61 14.29
Darknet53-tiny ImageNet train2012 val2012 224 52.75 2.09 0.64
CSP-Darknet53 ImageNet train2012 val2012 224 77.83 21.74 6.72
Mobilenet-v1 ImageNet train2012 val2012 224 71.49 4.23 1.18
Mobilenet-v2 ImageNet train2012 val2012 224 66.61 3.50 0.66
Mobilenet-v3-small ImageNet train2012 val2012 224 - - -
Mobilenet-v3-large ImageNet train2012 val2012 224 69.93 5.48 0.47
Pretrained Model Weights Download

  • 448 x 448 Model Performance Table
Model Dataset Train Valid Size
(pixel)
Accuracy
(Top-1)
Params
(M)
FLOPs
(G)
Darknet19 ImageNet train2012 val2012 448 76.22 20.84 22.47
Darknet53 ImageNet train2012 val2012 448 79.77 41.61 57.17
Darknet53-tiny ImageNet train2012 val2012 448 - - -
CSP-Darknet53 ImageNet train2012 val2012 448 79.33 21.74 26.86
Mobilenet-v1 ImageNet train2012 val2012 448 - - -
Mobilenet-v2 ImageNet train2012 val2012 448 - - -
Mobilenet-v3-small ImageNet train2012 val2012 448 - - -
Mobilenet-v3-large ImageNet train2012 val2012 448 - - -
Pretrained Model Weights Download

[Usage]

Model Training

  • You can train various classifier architectures (ResNet18, ResNet34, ResNet50, ResNet101, DarkNet19, DarkNet53, and CSP-DarkNet53, Mobilenetv1-v3). In addition, you can finetune classifier adding "--pretrained" in training command after putting the weight files into "./weights" directory with {model name}.
  • In case of fine-tuning with 448px image, we finetune pretrained 224px model for 15~20 epochs without warming up learning rate. That is the comment like shown below. python3 train.py --exp darknet19-448 --model darknet19 --batch-size 128 --base-lr 0.001 --warmup 0 --img-size 448 --num-epochs 15 --pretrained
python train.py --exp my_test --data imagenet.yaml --model resnet18
                                                   --model resnet34
                                                   --model resnet50
                                                   --model resnet101
                                                   --model darknet19
                                                   --model darknet53
                                                   --model darknet53-tiny
                                                   --model csp-darknet53 --width_multiple 1.0 --depth_multiple 1.0
                                                   --model mobilenet-v1 --width_multiple 1.0
                                                   --model mobilenet-v2 --width_multiple 1.0
                                                   --model mobilenet-v3 --mode {large, small} --width_multiple 1.0

Classification Evaluation

  • It computes Top-1 accuracy. Top-1 accuracy is the conventional accuracy, the model answer (the one with highest probability) must be exactly the expected answer.
python val.py --exp my_test --data voc.yaml --ckpt-name best.pt

[Contact]