Squeezenet is one of the recent models to do image recognition, with focus on model size reduction. It can achieve AlexNet-level accuracy on ImageNet with 50x fewer parameters. The original paper of this network is here.
This gist implements an Squeezenet service in Owl, and provides simple interfaces to use. Here is an example:
#zoo "7aa3d8a7ba02cb3826fe08f2b7bf4f11" let img = "/path/to/your/image.png";; let labels = Squeezenet_CG.infer img;; let labels_json = Squeezenet_CG.to_json ~top:5 labels;; let labels_tuples = Squeezenet_CG.to_tuples labels;;
infer function takes image path as input. The image chould be of any popular formats: jpeg, png, etc. This gist contains an exemplar image for you to use, but feel free to use your own.
The output of this function is a
1x1000 vector. The user can further get human-readable classification results by passing this vector
to_tuples. The output of former function is the top-N inference result as a json string, and the latter's is a list, each element in the form of
[class: string; propability: float]. The probability is in range [0, 1].
top parameter specifies how many top-N results are shown. It is default to be 5.
This application relies on the tool
ImageMagick to manipulate image format conversion and resizing. Please make sure it is installed. For example, on Ubuntu or Debian, you can use command:
sudo apt-get install imagemagick