> Unzip the ImageNet2012 dataset to any path you want and the folder structure should be as follows:
> ```
> .
> ├── train # train dataset
> └── val # infer dataset
> ```
## Example structure
``` shell
.
├── config.py # parameter configuration
├── dataset.py # data preprocessing
├── eval.py # infer script
├── launch.py # launcher for distributed training
├── lr_generator.py # generate learning rate for each step
├── run_infer.sh # launch infering
├── run_train.sh # launch training
└── train.py # train script
```
## Parameter configuration
Parameters for both training and inference can be set in 'config.py'.
```
"num_classes": 1000, # dataset class num
"image_height": 224, # image height
"image_width": 224, # image width
"batch_size": 256, # training or infering batch size
"epoch_size": 200, # total training epochs, including warmup_epochs
"warmup_epochs": 4, # warmup epochs
"lr": 0.4, # base learning rate
"momentum": 0.9, # momentum
"weight_decay": 4e-5, # weight decay
"loss_scale": 1024, # loss scale
"save_checkpoint": True, # whether save checkpoint
"save_checkpoint_epochs": 1, # the epoch interval between two checkpoints
"keep_checkpoint_max": 200, # only keep the last keep_checkpoint_max checkpoint
"save_checkpoint_path": "./checkpoint" # path to save checkpoint
```
## Running the example
### Train
#### Usage
Usage: sh run_train.sh [DEVICE_NUM] [SERVER_IP(x.x.x.x)] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]
#### Launch
```
# training example
sh run_train.sh 8 192.168.0.1 0,1,2,3,4,5,6,7 ~/imagenet
```
#### Result
Training result will be stored in the example path. Checkpoints will be stored at `. /checkpoint` by default, and training log will be redirected to `./train/train.log` like followings.