In this example, we convert Residual Networks trained on Torch to SINGA for image classification. Tested with the parameters pretrained by Torch
Please
cd
tosinga/examples/imagenet/resnet/
for the following commands
Download one parameter checkpoint file (see below) and the synset word file of ImageNet into this folder, e.g.,
$ wget https://s3-ap-southeast-1.amazonaws.com/dlfile/resnet/resnet-18.tar.gz $ wget https://s3-ap-southeast-1.amazonaws.com/dlfile/resnet/synset_words.txt $ tar xvf resnet-18.tar.gz
$ python serve.py -h
# use cpu $ python serve.py --use_cpu --parameter_file resnet-18.pickle --model resnet --depth 18 & # use gpu $ python serve.py --parameter_file resnet-18.pickle --model resnet --depth 18 &
The parameter files for the following model and depth configuration pairs are provided:
$ 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 convert.py program.
Usage:
$ python convert.py -h