Shortcuts

Image Classification

Install Package

  • Clone the GitHub repo:

    git clone https://github.com/zhanghang1989/PyTorch-Encoding
    
  • Install PyTorch Encoding (if not yet). Please follow the installation guide Installing PyTorch Encoding.

Get Pre-trained Model

Hint

How to get pretrained model, for example ResNeSt50:

model = encoding.models.get_model('ResNeSt50', pretrained=True)

After clicking cmd in the table, the command for training the model can be found below the table.

ResNeSt

Note

The provided models were trained using MXNet Gluon, this PyTorch implementation is slightly worse than the original implementation.

Model crop-size Acc Command
ResNeSt-50 224 81.03 cmd
ResNeSt-101 256 82.83 cmd
ResNeSt-200 320 83.84 cmd
ResNeSt-269 416 84.54 cmd

Test Pretrained

  • Prepare the datasets by downloading the data into current folder and then runing the scripts in the scripts/ folder:

    python scripts/prepare_imagenet.py --data-dir ./
    
  • The test script is in the experiments/recognition/ folder. For evaluating the model (using MS), for example ResNeSt50:

    python verify.py --dataset imagenet --model ResNeSt50 --crop-size 224
    

Train Your Own Model

  • Prepare the datasets by downloading the data into current folder and then runing the scripts in the scripts/ folder:

    python scripts/prepare_imagenet.py --data-dir ./
    
  • The training script is in the experiments/recognition/ folder. Commands for reproducing pre-trained models can be found in the table.