Deep Learning Libraries

Introduction

Discussion, and some examples on the most common deep learning libraries:

  • Caffe
  • Torch
  • TensorFlow
  • Theano
  • CNTK

Caffe


One of the most basic characteristic of caffe is that is easy to train simple non recurrent models.

Most cool features:

  • Good Performance, allows training with multiple GPUs
  • Implementation for CPU and GPU
  • Source code is easy to read
  • Allow layer definition in Python
  • Has bidings for Python and Matlab
  • Allows network definition with text language (No need to write code)
  • Fast dataset access through LMDB
  • Allows network vizualization
  • Has web interface (Digits)

Caffe Main classes:

  • Blob: Used to store data and diffs(Derivatives)
  • Layer: Some operation that transform a bottom blob(input) to top blobs(outputs)
  • Net: Set of connected layers
  • Solver: Call Net forward and backward propagation, update weights using gradient methods (Gradient descent, SGD, adagrad, etc...)

Caffe training/validation files

path/to/image/1.jpg [label]

Simple example

Here a logistic regression classifier. Imagine as a neural network with one layer and a sigmoid (cross-entropy softmax) non-linearity.

Caffe Cons

  • Need to write C++ / Cuda code for new layers
  • Bad to write protofiles for big networks (Resnet, googlenet)
  • Bad to experience new architectures (Mainstream version does not support Fast RCNN)

Torch


Really good for research, the problem is that use a new language called Lua.

Torch Pros

  • Flexible
  • Very easy source code
  • Easy biding with C/C++
  • Web interface (Digits)

Torch Cons

  • New language Lua
  • Difficult to load data from directories
  • No Matlab bidings
  • Less Plug and play than caffe
  • Not easy for RNN

Theano


Theano Cons

  • More manual
  • No matlab biding
  • Slower than other frameworks
  • No much pre-trained models

Tensorflow


Tensorflow Pros

  • Flexible
  • Good for RNN
  • Allow distributed training
  • Tensorboard for signal visualization
  • Python Numpy

Tensorflow Cons

  • Not much pre-trained models
  • No Support for new object detection features (Ex Roi pooling)
  • No support for datasets like Caffe
  • Slower than Caffe for single GPU training

CNTK


CNTK Pros

  • Flexible
  • Good for RNN
  • Allows distributed training

CNTK Cons

  • No visualization
  • Any error CNTK crash
  • No simple source code to read
  • New language (ndl) to describe networks
  • No current matlab or python bindings

Summary

  • For research use Torch or Tensorflow (Last option Theano)
  • For training convnets or use pre-trained models use Caffe

CS231n Deep learning course summary

  • Get features from known model (Alexnet, Googlenet, Vgg): Use caffe
  • Fine tune known models (Alexnet, Googlenet, Vgg): Use Caffe
  • Image Captioning: Torch or Tensorflow
  • Segmentation: Caffe, Torch
  • Object Detection: Caffe with python layers, Torch (More work)
  • Language Modelling: Torch, Theano
  • Implement Bath Norm: Torch, Theano or Tensorflow

Normally Tensorflow can be used in all cased that torch can, but if you need to understand what a specific layer does, or if you need to create a new layer, use torch instead of tensorflow. Torch is preferable on those cases, because the layer source code is more easy to read in torch.

Next Chapter


On the next chapter we will discuss Distributed Learning

results matching ""

    No results matching ""