Image Classification using Residual Networks

In this example, we convert Residual Networks trained on Torch to SINGA for image classification. Tested on [SINGA commit] with the parameters pretrained by Torch


  • Download one parameter checkpoint file (see below) and the synset word file of ImageNet into this folder, e.g.,

      $ wget
      $ wget
      $ tar xvf resnet-18.tar.gz
  • Usage

      $ python -h
  • Example

      # use cpu
      $ python --use_cpu --parameter_file resnet-18.pickle --model resnet --depth 18 &
      # use gpu
      $ python --parameter_file resnet-18.pickle --model resnet --depth 18 &

    The parameter files for the following model and depth configuration pairs are provided:

    • resnet (original resnet), 18|34|101|152
    • addbn (resnet with a batch normalization layer after the addition), 50
    • wrn (wide resnet), 50
    • preact (resnet with pre-activation) 200
  • Submit images for classification

      $ curl -i -F image=@image1.jpg http://localhost:9999/api
      $ curl -i -F image=@image2.jpg http://localhost:9999/api
      $ curl -i -F image=@image3.jpg http://localhost:9999/api

image1.jpg, image2.jpg and image3.jpg should be downloaded before executing the above commands.


The parameter files were extracted from the original torch files via the program.


$ python -h