A Set of Deep Neural Network Models for Classification
A Set of Deep Neural Network Models for Classification
Below are a range of deep neural network models that are free, even for commercial use in your applications. These models have been trained over images for a range of domains. Thus they should accomodate a range of applications, from fashion item recognition to sports and gender classification.
This page lists a growing list of available models, along with information on how to use them and how they were built.
General Information
The primary intention behind these models is to ease the setup, deployment and testing of a range of applications around deep neural models.
Notes
-
The models are very good for building and testing an application pipeline that includes one or more deep neural networks. However, the models should not be considered suited for many high accuracy production tasks. This is because most models are rough in the sense that the average accuracy can be low on some types of images and classes.
-
The models are free, even for commercial use. The training sets cannot be shared at this stage since images are copyrighted. However, as some training sets originate from Imagenet, they can be reconstructed out of category names without much work…
-
These models are intended to primarily be used with DeepDetect which relies on Caffe but can be converted. First they can easily be used with Caffe alone. Second, if you’re using TensorFlow, see how to convert Caffe models to Tensorflow, and similar conversion for Torch.
-
The model classes are exclusive. In other words, there no control over the attention of a model: this means that using a
furnitures
recognition model, in an image containing a chair and a table, one or the other will be recognized best, most often not both. For other types of models, contact us. -
Not finding what you need or assistance needed ? Let us know or report difficulties, our pipeline is automated, and some models can be easily built.
What applications are these models good for ?
These models are good for classification and recommendation for instance. They are especially useful for building and testing an application pipeline. Typically:
- Build up an application that uses one or more deep models
- Test the application on your production data
- The application can then be made more accurate by either finetuning the deep model or building a new more accurate one. You can do that or ask us for assistance, as needed.
As an example of applications, see how easy it is to build an image search engine with ElasticSearch.
Requirements
Works best on GPU but fine on multi-core CPU as well. DeepDetect is supported on Ubuntu 14.04 LTS but builds on other Linux flavors.
Model Usage
Below are instructions for setting up a classification service for a given model from command line and from python client. Importantly:
-
The number of classes
nclasses
needs to be specified at service creation. This is model-dependent, and the number of classes can be obtained from the list below or themodel.json
file included in the model tarball -
The service name is for you to set, below examples use the
clothing
model and the service is namedclothing
-
A batch of multiple images can be passed over at once to the server for classification.
Steps for setting up a model service:
- Select & download a model tarball
- Uncompress in the repository of your choice, e.g.
/home/me/models/clothing
- Build and run dede
- Use the code samples below to build your classification pipeline
- See the API for more details on the various parameters and options
Shell
Service creation:
curl -X PUT "http://localhost:8080/services/clothing" -d "{\"mllib\":\"caffe\",\"description\":\"clothes classification\",\"type\":\"supervised\",\"parameters\":{\"input\":{\"connector\":\"image\",\"height\":224,\"width\":224},\"mllib\":{\"nclasses\":304}},\"model\":{\"repository\":\"/home/me/models/clothing\"}}"
Classification of a single image:
curl -X POST "http://localhost:8080/predict" -d "{\"service\":\"clothing\",\"parameters\":{\"output\":{\"best\":5}},\"data\":[\"http://4.bp.blogspot.com/-uwu7SmTbBXI/VD_NNJc4Y-I/AAAAAAAAK1I/rt9de3mWXJo/s1600/faux-fur-coat-winter-2014-big-trend-10.jpg\"]}"
Python
Service creation:
from dd_client import DD
model_repo = '/home/me/models/clothes'
height = width = 224
nclasses = 304
# setting up DD client
host = '127.0.0.1'
sname = 'clothing'
description = 'clothes classification'
mllib = 'caffe'
dd = DD(host)
dd.set_return_format(dd.RETURN_PYTHON)
# creating ML service
model = {'repository':model_repo}
parameters_input = {'connector':'image','width':width,'height':height}
parameters_mllib = {'nclasses':nclasses}
parameters_output = {}
dd.put_service(sname,model,description,mllib,
parameters_input,parameters_mllib,parameters_output)
Classifying a single image
parameters_input = {}
parameters_mllib = {}
parameters_output = {'best':5}
data = ['http://4.bp.blogspot.com/-uwu7SmTbBXI/VD_NNJc4Y-I/AAAAAAAAK1I/rt9de3mWXJo/s1600/faux-fur-coat-winter-2014-big-trend-10.jpg']
classif = dd.post_predict(sname,data,parameters_input,parameters_mllib,parameters_output)
print classif
Results
Visualizing the result from the sample above:
This naturally comes in JSON form:
{"status":{"code":200,"msg":"OK"},"head":{"method":"/predict","time":1675.0,"service":"clothing"},"body":{"predictions":{"uri":"http://4.bp.blogspot.com/-uwu7SmTbBXI/VD_NNJc4Y-I/AAAAAAAAK1I/rt9de3mWXJo/s1600/faux-fur-coat-winter-2014-big-trend-10.jpg","classes":[{"prob":0.6452152132987976,"cat":"fur coat"},{"prob":0.3132794201374054,"cat":"overgarment, outer garment"},{"prob":0.014557755552232266,"cat":"fur"},{"prob":0.009311402216553688,"cat":"sheepskin coat, afghan"},{"prob":0.005403662566095591,"last":true,"cat":"coat"}]}}}
DeepDetect supports turning the JSON output into any custom format through output templates
. See the example on how to push results into ElasticSearch without glue code.
Image Classification Models
Model Training
All models below have been trained as follows:
- Dataset is split as 90% training and 10% testing
- A GoogleNet is initialized with ILSVRC12 weights (aka 1000 classes from Imagenet)
- Network is trained in between 50000 and 300000 steps with step control of the learning rate and SGD or Nesterov as optimizer
- Data augmentation varies from mirroring to mirroring + rotations
The model tarballs include the network training:
googlenet.prototxt
is the neural network definition file for traininggooglenet_solver.prototxt
contains the default parameters for trainingmodel.json
contains the history of training calls and parameters. This is where you want to start looking in order to re-train or finetune a model.deploy.prototxt
is the neural network definition file for prediction
If you have difficulties finetuning the models, contact us.
List of Image Classification Models
-
Clothing
- number of classes: 304
- list of classes: costume, belt, ready-to-wear, …
- download: clothing.tar.bz2
-
Bags
- number of classes: 37
- list of classes: golf bag, sleeping bag, sachet, …
- download: bags.tar.bz2
-
Footwear
- number of classes: 51
- list of classes: bowling shoe, baby shoe, sandal, …
- download: footwear.tar.bz2
-
Buildings
- number of classes: 185
- list of classes: casino, beach house, chalet, …
- download: buildings.tar.bz2
-
Fabric
- number of classes: 233
- list of classes: chino, patch, cobweb, russet, …
- download: fabric.tar.bz2
-
Gender
- number of classes: 2
- list of classes: man, woman
- download: gender.tar.bz2
-
Furnitures
- number of classes: 179
- list of classes: single bed, red carpet, floor lamp, china cabinet, …
- download: furnitures.tar.bz2
-
Sports
- number of classes: 143
- list of classes: polo, hockey, roller skating, football, …
- download: sports.tar.bz2
-
Trees
- number of classes: 890
- list of classes: nut tree, conifer, cherry plum, …
- download: trees.tar.bz2