Image Classification using DenseNet

In this example, we convert DenseNet on PyTorch to SINGA for image classification.


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

      $ wget
      $ wget
      $ tar xvf densenet-121.tar.gz
  • Usage

      $ python -h
  • Example

      # use cpu
      $ python --use_cpu --parameter_file densenet-121.pickle --depth 121 &
      # use gpu
      $ python --parameter_file densenet-121.pickle --depth 121 &

    The parameter files for the following model and depth configuration pairs are provided: 121, 169, 201, 161

  • 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 converted from the pytorch via the program.


$ python -h