Getting Started with DeepStack

DeepStack is distributed as a docker image. In this tutorial, we shall go through the complete process of using DeepStack to build a Face Recognition system.

Setting Up DeepStack

Follow instructions on read DeepStack Beta - Nodejs Guide to install the CPU Version of DeepStack If you have a system with Nvidia GPU, follow instruction on read Using DeepStack with NVIDIA GPU to install the GPU Version of DeepStack

To install the GPU Accelerated Version, follow Using DeepStack with NVIDIA GPU

Starting DeepStack

Below we shall run DeepStack with only the FACE features enabled

sudo docker run -e VISION-FACE=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack

Basic Parameters

-e VISION-FACE=True This enables the face recognition APIs, all apis are disabled by default.

-v localstorage:/datastore This specifies the local volume where deepstack will store all data.

-p 80:5000 This makes deepstack accessible via port 80 of the machine.


If you installed the GPU Version, remmember to add the args args –rm –runtime=nvidia The equivalent run command for the gpu version is

sudo docker run --rm --runtime=nvidia -e VISION-FACE=True -v localstorage:/datastore \
-p 80:5000 deepquestai/deepstack:gpu

Face Recognition

Think of a software that can identity known people by their names. Face Recognition does exactly that. Register a picture of a number of people and the system will be able to recognize them again anytime. Face Recognition is a two step process: The first is to register a known face and second is to recognize unknown faces.


Here we are building an application that can tell the names of a number of popular celebrities. First we collect pictures of a number of celebrities and we register them with deepstack


Below we will register the faces with their names

import requests

tom_cruise = open("cruise.jpg","rb").read()
adele = open("adele.jpg","rb").read()
elba = open("elba.jpg","rb").read()
perri = open("perri.jpg","rb").read()"http://localhost:80/v1/vision/face/register",files={"image":tom_cruise}, data={"userid":"Tom Cruise"})"http://localhost:80/v1/vision/face/register",files={"image":adele}, data={"userid":"Adele"})"http://localhost:80/v1/vision/face/register",files={"image":elba}, data={"userid":"Idris Elba"})"http://localhost:80/v1/vision/face/register",files={"image":perri}, data={"userid":"Christina Perri"})


{ success: true, message: 'face added' }
{ success: true, message: 'face added' }
{ success: true, message: 'face added' }

{ success: true, message: ‘face updated’ }


Now we shall attempt to recognize any of these celebrities using DeepStack. Below we will send in a whole new picture of Adele and DeepStack will attempt to predict the name.


Prediction code

const request = require("request")
const fs = require("fs")

image_stream = fs.createReadStream("test-image.jpg")

var form = {"image":image_stream}{url:"http://localhost:80/v1/vision/face/recognize", formData:form},function(err,res,body){

    response = JSON.parse(body)
    predictions = response["predictions"]
    for(var i =0; i < predictions.length; i++){






We have just created a face recognition system. You can try with different people and test on different pictures of them.

The next tutorial is dedicated to the full power of the face recognition api as well as best practices to make the best out of it.


DeepStack offers three modes allowing you to tradeoff speed for peformance. During startup, you can specify performance mode to be , “High”,”Medium” and “Low”

The default mode is “Medium”

You can speciy a different mode as seen below

sudo docker run -e MODE=High -e VISION-FACE=True -v localstorage:/datastore \
-p 80:5000 deepquestai/deepstack

Note the -e MODE=High above