DeepDetect Client Rails Example


  • Ubuntu 14.04 or Ubuntu 16.04
  • Rails 5+
  • Ruby 2.2+
  • Redis

Install DeepDetect

Install dependencies:

sudo apt-get install build-essential libgoogle-glog-dev libgflags-dev libeigen3-dev libopencv-dev libcppnetlib-dev libboost-dev libboost-iostreams-dev libcurlpp-dev libcurl4-openssl-dev protobuf-compiler libopenblas-dev libhdf5-dev libprotobuf-dev libleveldb-dev libsnappy-dev liblmdb-dev libutfcpp-dev cmake libgoogle-perftools-dev unzip

Clone & build deepdetect:

cd && mkdir Projects && git clone
cd deepdetect && mkdir build
cd build
cmake ..

Start the server:

cd build/main

DeepDetect [ commit 73d4e638498d51254862572fe577a21ab8de2ef1 ]
Running DeepDetect HTTP server on localhost:8080


Clone models that are trained by me:

cd && mkdir Models
tar xvf person_yes_no.tar.gz

Type cmd pwd at folder Models to get absolute path

Example with my absolute path model


How to run

git clone
bundle install

# edit config/database.yml then run
rails db:create && rails db:migrate && rails db:seed

# edit deepdetect config at config/deepdetect.json
# update model_path like this
  "model_path": "/home/tamnguyen/Models"

# run on development
rails s -b

# run on production as daemonize
bundler exec puma -C config/puma.rb -e production -d


Predict an image by model

- Endpoint: `POST /v1/predict`
- Header:
  - Authorization: Authentication token
- Params:
  - image_url: string, required
  - model: string, required

How to use

curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Authorization: Token token=TtDKqIuz50GyNpl7z8tMtQtt' -d '' ''

OR use API docs at http://localhost:3000/docs

Example DeepDetect result for predicting a image

Architecture Diagram

Machine Learning Service Application Architecture

I will upload more models when I have free time šŸ˜€ šŸ˜›

you can get more models at