Skip to content

Latest commit

 

History

History
 
 

gluon

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Train ResNeSt with MXNet Gluon

For training with PyTorch, please visit PyTorch Encoding Toolkit

Install MXNet with Horovod

# assuming you have CUDA 10.0 on your machine
pip install mxnet-cu100
HOROVOD_GPU_ALLREDUCE=NCCL pip install -v --no-cache-dir horovod
pip install --no-cache mpi4py

Prepare ImageNet recordio data format

  • Unfortunately ,this is required for training using MXNet Gluon. Please follow the GluonCV tutorial to prepare the data.

  • Copy the data into ramdisk (optional):

     cd ~/
     sudo mkdir -p /media/ramdisk
     sudo mount -t tmpfs -o size=200G tmpfs /media/ramdisk
     cp -r /home/ubuntu/data/ILSVRC2012/ /media/ramdisk
    

Training command

Using ResNeSt-50 as the target model:

horovodrun -np 64 --hostfile hosts python train.py \
--rec-train /media/ramdisk/ILSVRC2012/train.rec \
--rec-val /media/ramdisk/ILSVRC2012/val.rec \
--model resnest50 --lr 0.05 --num-epochs 270 --batch-size 128 \
--use-rec --dtype float32 --warmup-epochs 5 --last-gamma --no-wd \
--label-smoothing --mixup --save-dir params_ resnest50 \
--log-interval 50 --eval-frequency 5 --auto_aug --input-size 224

Verify pretrained model

python verify.py --model resnest50 --crop-size 224 --resume params_ resnest50/imagenet-resnest50-269.params