This project is a sandbox project! This projects will be used for experiments!
- This project can be run only linux environment.
- This project is recommended to run on virtual environment include docker.
- Command
pip install -r requirements.txtto install dependency.
-
Train:
python3 train.py option=<configuration file (optional)>- Used to obtain weights.
- The
optionmeans argument for indivisual training options.
-
Resume:
python3 train.py resume=<checkpoint path>- The <checkpoint path> means a path of
checkpoint_pathandcheckpoint_nameinoption.yaml
- The <checkpoint path> means a path of
-
Predict:
python3 classify.py weights=path/to/checkpoint_path/checkpoint_name image=path/to/image(s/dir) epoch=[best|last|<an epoch number>](optional) output_format=[csv|stdout](optional) -
Export:
python3 export.py path=path/to/checkpoint_path/checkpoint_name epoch=[best|last|<an epoch number>] image_size=<image_size>- Export weights to saved_model and TFLite
- The weights files will be saved onto
path/to/checkpoint_path/checkpoint_name/export.
-
Select specific GPU (example):
CUDA_VISIBLE_DEVICES=[cpu|<GPU numbers (example: 0,1,2,3)>] python3 train.py option=example.yaml- The default uses all GPUs.
- If you have multiple GPUs and want to select specific GPU, you have to use this command form or set the
CUDA_VISIBLE_DEVICESvariable.
dataset/
├ train/
│ ├ class1/
| | └ image1.xxx
│ └ class2/
| └ image2.xxx
└ val/
├ class1/
| └ image3.xxx
└ class2/
└ image4.xxx
cfg/settings.yaml(default settings)option.yaml(user global settings)- configuration file (copied from
option.yaml)
- Dataloader options
- Image crop options
- Image translate options
- Color adjustment options
- Quality adjustment options
- Other dataloader options
- Train options
- Checkpoint path
- Training options (optimizer, loss, etc.)
- Learning rate scheduler options
- Model option
-
ResNet Models
resnet/18.yamlresnet/34.yamlresnet/50.yamlresnet/110.yamlresnet/152.yaml
-
CSPResNetS models
cspresnets/18.yamlcspresnets/34.yamlcspresnets/50.yamlcspresnets/101.yamlcspresnets/152.yaml
-
CSPResNetP models
cspresnetp/18.yamlcspresnetp/34.yamlcspresnetp/50.yamlcspresnetp/101.yamlcspresnetp/152.yaml
-
S/P suffix of CSPResNet is meaning of implementation method. S is split by channels, P is projection by channales
-
Other Models
vgg16.yamlgooglenet.yaml
- CPU: AMD Ryzen 7900
- Memory: DDR5 128GB
- GPU: RTX 5060 Ti 16GB @ 2.0GHz x2
- OS: Ubuntu 24.04 (docker image: nvidia/cuda:12.8.1-cudnn8-devel-ubuntu24.04)
- Python: CPython 3.12
- TensorFlow version: 2.20.0
| Model | Accuracy | Params | FLOPs |
|---|---|---|---|
| ResNet18 | 67.15% | 11.70M | 3.63G |
| ResNet34 | 69.34% | 21.81M | 7.34G |
| ResNet50 | 72.36% | 26.73M | 8.64G |
| ResNet101 | 72.76% | 44.65M | 15.64G |
| ResNet152 | 73.17% | 60.34M | 23.08G |
| CSPResNetS18 | 66.88% | 7.28M | 1.88G |
| CSPResNetS34 | 69.19% | 9.82M | 2.92G |
| CSPResNetS50 | 71.81% | 19.77M | 5.52G |
| CSPResNetS101 | 73.13% | 24.27M | 7.27G |
| CSPResNetS152 | 73.94% | 28.22M | 9.14G |
| CSPResNetP18 | 68.16% | 7.64M | 2.10G |
| CSPResNetP34 | 69.85% | 10.18M | 3.03G |
| CSPResNetP50 | 71.03% | 25.33M | 7.00G |
| CSPResNetP101 | 71.59% | 29.83M | 8.76G |
| CSPResNetP152 | 71.91% | 33.78M | 10.62G |
Trained and evaluated in ImageNet2012 dataset.