GithubHelp home page GithubHelp logo

linecode / deepdetect Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jolibrain/deepdetect

0.0 1.0 0.0 6.06 MB

Deep Learning API and Server in C++11 with Python bindings and support for Caffe, Tensorflow, XGBoost and TSNE

Home Page: http://www.deepdetect.com/

License: Other

CMake 2.69% Python 1.62% Shell 20.22% M4 0.34% C++ 73.61% C 1.52%

deepdetect's Introduction

DeepDetect : Open Source Deep Learning Server & API

Join the chat at https://gitter.im/beniz/deepdetect Build Status

DeepDetect (http://www.deepdetect.com/) is a machine learning API and server written in C++11. It makes state of the art machine learning easy to work with and integrate into existing applications.

DeepDetect relies on external machine learning libraries through a very generic and flexible API. At the moment it has support for:

  • the deep learning library Caffe
  • distributed gradient boosting library XGBoost
  • the deep learning and other usages library Tensorflow
  • clustering with T-SNE

Machine Learning functionalities per library (current):

Training Prediction Classification Object Detection Segmentation Regression Autoencoder
Caffe Y Y Y Y Y Y Y
XGBoost Y Y Y N N Y N/A
Tensorflow N Y Y N N N N
T-SNE Y N/A N/A N/A N/A N/A N/A

GPU support per library

Training Prediction
Caffe Y Y
XGBoost Y N
Tensorflow Y Y
T-SNE N N

Input data support per library (current):

CSV SVM Text words Text characters Images
Caffe Y Y Y Y Y
XGBoost Y Y Y N N
Tensorflow N N N N Y
T-SNE Y N N N Y
(*) more input support for T-SNE is pending

Main functionalities

DeepDetect implements support for supervised and unsupervised deep learning of images, text and other data, with focus on simplicity and ease of use, test and connection into existing applications. It supports classification, object detection, segmentation, regression, autoencoders, ...

Support

Please join either the community on Gitter or on IRC Freenode #deepdetect, where we help users get through with installation, API, neural nets and connection to external applications.

Supported Platforms

The reference platforms with support are Ubuntu 14.04 LTS and Ubuntu 16.04 LTS.

Supported images that come with pre-trained image classification deep (residual) neural nets:

Performances

See https://github.com/jolibrain/dd_performances for a report on performances on NVidia Desktop and embedded GPUs, along with Raspberry Pi 3.

Quickstart

Setup an image classifier API service in a few minutes: http://www.deepdetect.com/tutorials/imagenet-classifier/

Tutorials

List of tutorials, training from text, data and images, setup of prediction services, and export to external software (e.g. ElasticSearch): http://www.deepdetect.com/tutorials/tutorials/

Features and Documentation

Current features include:

  • high-level API for machine learning and deep learning
  • Support for Caffe, Tensorflow, XGBoost and T-SNE
  • classification, regression, autoencoders, object detection, segmentation
  • JSON communication format
  • remote Python client library
  • dedicated server with support for asynchronous training calls
  • high performances, benefit from multicore CPU and GPU
  • connector to handle large collections of images with on-the-fly data augmentation (e.g. rotations, mirroring)
  • connector to handle CSV files with preprocessing capabilities
  • connector to handle text files, sentences, and character-based models
  • connector to handle SVM file format for sparse data
  • range of built-in model assessment measures (e.g. F1, multiclass log loss, ...)
  • no database dependency and sync, all information and model parameters organized and available from the filesystem
  • flexible template output format to simplify connection to external applications
  • templates for the most useful neural architectures (e.g. Googlenet, Alexnet, ResNet, convnet, character-based convnet, mlp, logistic regression)
  • support for sparse features and computations on both GPU and CPU
Documentation
Clients
Tools
  • Log DeepDetect training metrics via Tensorboard with dd_board
Dependencies
  • C++, gcc >= 4.8 or clang with support for C++11 (there are issues with Clang + Boost)
  • eigen for all matrix operations;
  • glog for logging events and debug;
  • gflags for command line parsing;
  • OpenCV >= 2.4
  • cppnetlib
  • Boost
  • curl
  • curlpp
  • utfcpp
  • gtest for unit testing (optional);
Caffe Dependencies
  • CUDA 8 or 7.5 is recommended for GPU mode.
  • BLAS via ATLAS, MKL, or OpenBLAS.
  • protobuf
  • IO libraries hdf5, leveldb, snappy, lmdb
XGBoost Dependencies

None outside of C++ compiler and make

  • CUDA 8 or 7.5 is recommended for GPU mode.

Tensorflow Dependencies

Caffe version

By default DeepDetect automatically relies on a modified version of Caffe, https://github.com/beniz/caffe/tree/master This version includes many improvements over the original Caffe, such as sparse input data support, exception handling, class weights, object detection, segmentation, and various additional losses and layers.

Implementation

The code makes use of C++ policy design for modularity, performance and putting the maximum burden on the checks at compile time. The implementation uses many features from C++11.

Demo
  • Image classification Web interface: HTML and javascript classification image demo in demo/imgdetect

  • Image similarity search: Python script for indexing and searching images is in demo/imgsearch

  • Image object detection: Python script for object detection within images is in demo/objdetect

  • Image segmentation: Python script for image segmentation is in demo/segmentation

Examples
Models
Caffe Tensorflow Source Top-1 Accuracy (ImageNet)
AlexNet Y N BVLC 57.1%
SqueezeNet Y N DeepScale 59.5%
Inception v1 / GoogleNet Y Y BVLC / Google 67.9%
Inception v2 N Y Google 72.2%
Inception v3 N Y Google 76.9%
Inception v4 N Y Google 80.2%
ResNet 50 Y Y MSR 75.3%
ResNet 101 Y Y MSR 76.4%
ResNet 152 Y Y MSR 77%
Inception-ResNet-v2 N Y Google 79.79%
VGG-16 Y Y Oxford 70.5%
VGG-19 Y Y Oxford 71.3%
ResNext 50 Y N https://github.com/terrychenism/ResNeXt 76.9%
ResNext 101 Y N https://github.com/terrychenism/ResNeXt 77.9%
ResNext 152 Y N https://github.com/terrychenism/ResNeXt 78.7%
DenseNet-121 Y N https://github.com/shicai/DenseNet-Caffe 74.9%
DenseNet-161 Y N https://github.com/shicai/DenseNet-Caffe 77.6%
DenseNet-169 Y N https://github.com/shicai/DenseNet-Caffe 76.1%
DenseNet-201 Y N https://github.com/shicai/DenseNet-Caffe 77.3%
VOC0712 (object detection) Y N https://github.com/weiliu89/caffe/tree/ssd 71.2 mAP

More models:

Templates

DeepDetect comes with a built-in system of neural network templates (Caffe backend only at the moment). This allows the creation of custom networks based on recognized architectures, for images, text and data, and with much simplicity.

Usage:

  • specify template to use, from mlp, convnet and resnet
  • specify the architecture with the layers parameter:
    • for mlp, e.g. [300,100,10]
    • for convnet, e.g. ["1CR64","1CR128","2CR256","1024","512"], where the main pattern is xCRywhereyis the number of outputs (feature maps),CRstands for Convolution + Activation (withreluas default), andxspecifies the number of chainedCRblocks without pooling. Pooling is applied between allxCRy`
  • for resnets:
    • with images, e.g. ["Res50"] where the main pattern is ResX with X the depth of the Resnet
    • with character-based models (text), use the xCRy pattern of convnets instead, with the main difference that x now specifies the number of chained CR blocks within a resnet block
    • for Resnets applied to CSV or SVM (sparse data), use the mlp pattern. In this latter case, at the moment, the resnet is built with blocks made of two layers for each specified layer after the first one. Here is an example: [300,100,10] means that a first hidden layer of size 300 is applied followed by a resnet block made of two 100 fully connected layer, and another block of two 10 fully connected layers. This is subjected to future changes and more control.

Authors

DeepDetect is designed and implemented by Emmanuel Benazera [email protected].

Build

Below are instructions for Ubuntu 14.04 LTS. For other Linux and Unix systems, steps may differ, CUDA, Caffe and other libraries may prove difficult to setup. If you are building on 16.04 LTS, look at https://github.com/beniz/deepdetect/issues/126 that tells you how to proceed.

Beware of dependencies, typically on Debian/Ubuntu Linux, do:

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

Default build with Caffe

For compiling along with Caffe:

mkdir build
cd build
cmake ..
make

If you are building for one or more GPUs, you may need to add CUDA to your ld path:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

If you would like to build with cuDNN, your cmake line should be:

cmake .. -DUSE_CUDNN=ON

To target the build of underlying Caffe to a specific CUDA architecture (e.g. Pascal), you can use:

cmake .. -DCUDA_ARCH="-gencode arch=compute_61,code=sm_61"

If you would like a CPU only build, use:

cmake .. -DUSE_CPU_ONLY=ON

If you would like to constrain Caffe to CPU only, use:

cmake .. -DUSE_CAFFE_CPU_ONLY=ON

Build with XGBoost support

If you would like to build with XGBoost, include the -DUSE_XGBOOST=ON parameter to cmake:

cmake .. -DUSE_XGBOOST=ON

If you would like to build the GPU support for XGBoost (experimental from DMLC), use the -DUSE_XGBOOST_GPU=ON parameter to cmake:

cmake .. -DUSE_XGBOOST=ON -DUSE_XGBOOST_GPU=ON

Build with Tensorflow support

First you must install Bazel and Cmake with version > 3.

And other dependencies:

sudo apt-get install python-numpy swig python-dev python-wheel unzip

If you would like to build with Tensorflow, include the -DUSE_TF=ON paramter to cmake:

cmake .. -DUSE_TF=ON

If you would like to constrain Tensorflow to CPU, use:

cmake .. -DUSE_TF=ON -DUSE_TF_CPU_ONLY=ON

You can combine with XGBoost support with:

cmake .. -DUSE_TF=ON -DUSE_XGBOOST=ON

Build with T-SNE support

Simply specify the option via cmake command line:

cmake .. -DUSE_TSNE=ON

Run tests

Note: running tests requires the automated download of ~75Mb of datasets, and computations may take around thirty minutes on a CPU-only machines.

To prepare for tests, compile with:

cmake -DBUILD_TESTS=ON ..
make

Run tests with:

ctest

Start the server

cd build/main
./dede

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

Main options are:

  • -host to select which host to run on, default is localhost, use 0.0.0.0 to listen on all interfaces
  • -port to select which port to listen to, default is 8080
  • -nthreads to select the number of HTTP threads, default is 10

To see all options, do:

./dede --help

Pure command line JSON API

To use deepdetect without the client/server architecture while passing the exact same JSON messages from the API:

./dede --jsonapi 1 <other options>

where <other options> stands for the command line parameters from the command line JSON API:

-info (/info JSON call) type: bool default: false
-service_create (/service/service_name call JSON string) type: string default: ""
-service_delete (/service/service_name DELETE call JSON string) type: string default: ""
-service_name (service name string for JSON call /service/service_name) type: string default: ""
-service_predict (/predict POST call JSON string) type: string default: ""
-service_train (/train POST call JSON string) type: string default: ""
-service_train_delete (/train DELETE call JSON string) type: string default: ""
-service_train_status (/train GET call JSON string) type: string default: ""
							  

The options above can be obtained from running

./dede --help

Example of creating a service then listing it:

./dede --jsonapi 1 --service_name test --service_create '{"mllib":"caffe","description":"classification service","type":"supervised","parameters":{"input":{"connector":"image"},"mllib":{"template":"googlenet","nclasses":10}},"model":{"templates":"/path/to/deepdetect/templates/caffe/","repository":"/path/to/model/"}}'

Note that in command line mode the --service_xxx calls are executed sequentially, and synchronously. Also note the logs are those from the server, the JSON API response is not available in pure command line mode.

Run examples

See tutorials from http://www.deepdetect.com/tutorials/tutorials/

References

deepdetect's People

Contributors

alx avatar beniz avatar cchadowitz avatar conchylicultor avatar gitter-badger avatar jsaksris avatar kyrs avatar panchishin avatar yayab avatar yuduowu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.