Frequently Asked Questions
How to specify server host and port ?
./dede -host yourhost -port 8888
and replace yourhost
and 8888
by your own values. Default values are localhost
and 8080
respectively.
What are the machine learning frameworks and algorithms supported by the server ?
Two libraries are supported at the moment:
Caffe, a powerful highly configurable and portable deep neural network framework. Jolibrain maintains a highly customized version of Caffe that has support for many neural architectures and data types, including logistic regression, multi-layer perceptron, convolutional networks, recurrent nets, object detection architectures, image segmentation with advanced losses, time-series, etc… This is the backend of choice for DeepDetect. Don’t mind Caffe is a supposedly ‘old’ framework, our customized Open Source version fares extremely well from Cloud to embedded devices.
XGBoost, one of the most regarded machine learning frameworks for a wide range of applications. Gradient boosted trees are a form of decision trees.
Caffe2, one of the best libraries for Deep Learning. DeepDetect supports training and prediction for image classification, and prediction with most Detectron flavors for object detection and image segmentation. Caffe2 can be seen as the Pytorch-compatible next default backend for DeepDetect.
NCNN, an excellent Deep Learning inference library for mobile platforms, including Raspberry Pi. Jolibrain maintains a customized version of NCNN and contributes to the original library. NCNN can be seen as the lightweighted inference-only version of Caffe.
Dlib for object detection inference only.
Tensorflow, DeepDetect supports image classification inference only at the moment.
Getting this error: ‘dd_msg’: ‘src/caffe/syncedmem.cpp:65 / Check failed (custom): (error) == (cudaSuccess)’
Most likely your operations are requiring more memory than what is available on your GPU. Try setting gpu:false
everywhere to run on CPU. If this goes through, this is a confirmed GPU memory error.
To avoid this error, try lowering the batch_size
as much as possible or feasible for your need.
Getting this error: “using template while network weights exist, remove ‘template’ from ‘mllib’ or would you like to ‘finetune’ instead”
The deepdetect server protects existing neural net models and architectures from being overriden by a template, called from API. This protects the Caffe prototxt
files to be modified when neural net trained weights are in place, which would lead to potential inconsistencies.
This protection is useful in production systems, but can be annoying in the development phase, here is how to proceed safely:
if you are re-creating a service from a model repository after creating it with a built-in template, simply remove the
template
parameter from thePUT /services/yourservice
callif you are changing template and don’t mind recomputing the training and testing sets, simply clear up everything with:
curl -X DELETE "http://localhost:8080/services/yourservice?clear=full"
if you are changing template and don’t want to recompute the training set (e.g. useful on large image datasets), clear up the models:
curl -X DELETE "http://localhost:8080/services/yourservice?clear=lib"
Getting this error: “negative supervised discrete target (e.g. wrong use of label_offset ?)”
DeepDetect requires discrete classification labels to start from 0 to your problem’s number of classes in increment of 1, e.g. 0, 1, 2, 3, … This is mostly to harmonize among machine learning back-ends and because Softmax requires positive integers. If your dataset labels start from 1, you’d have to use label_offset:-1
or make modification to your dataset.
Notes:
- If your classes are strings like cats, dogs, etc…, DeepDetect does the conversion automatically, there’s no issue
- If your labels are -1 and 1 as can be common in some binary classification problems, you need to modify your dataset, e.g. to get 0 and 1.
How to import a model from Caffe into DeepDetect
Importing a model is done by moving the Caffe neural net definition files .prototxt
and optionnally the model weights file .caffemodel
into a DeepDetect model repository
. In general, the .prototxt
files need the following modifications:
the
.prototxt
file definition for training and testing need to have at least the test input as aMemoryDataLayer
, e.g.:layer { name: "googlenet" type: "MemoryData" top: "data" top: "label" memory_data_param { batch_size: 1 channels: 3 height: 224 width: 224 } include { phase: TEST } }
In general this is a trivial modification to most of the existing Caffe model definitions. The built-in Caffe templates can be used as examples.
- the
.prototxt
definition file for prediction needs to be renameddeploy.prototxt
and its input layer must use aMemoryDataLayer
- the solver
.prototxt
file must end with_solver.prototxt
Why does the first predict call can take longer ?
The first /predict
call does load the model if not already loaded. If you’ve just trained a model in a service, it is already loaded. Otherwise, the server waits for the first predict call. Subsequent calls are then much faster.
Tip: in production, when spawning the dede
server, you can prepare a dummy /predict
call to pre-load the model up.