Skip to content

Instantly share code, notes, and snippets.

@kendemu
Last active August 29, 2015 14:27
Show Gist options
  • Save kendemu/7f091ef25b369ca82522 to your computer and use it in GitHub Desktop.
Save kendemu/7f091ef25b369ca82522 to your computer and use it in GitHub Desktop.
Using NVIDIA DIGITS RC 2.0 in linux

What is NVIDIA DIGITS?

It is a deep learning framework enables to get GPU acceleration, GUI manipulation, and WEB API manipulation. The backend is Caffe.(Usually it is for feed-forward neural network/ Convolutional Neural Network)
In default, LeNet, GoogleNet, and AlexNet Architecture is supported, and it is also able to import other caffe models.
https://developer.nvidia.com/digits
The newest release NVIDIA DIGITS RC 2.0 have multiple GPU support and Nesterov's Accelerated Gradient/AdaGrad Optimization.

Register to NVIDIA Developer Zone

You can install NVIDIA DIGITS from NVIDIA Developer Zone.

Enviromental Setup

  1. Install Xubuntu in ISO level
  2. sudo add-apt-repository ppa:xorg-edgers/ppa
  3. sudo apt-get update
  4. sudo apt-get install nvidia-355
  5. Install NVIDIA CUDA RC 7.5 from https://developer.nvidia.com/rdp/cuda-75-release-candidate
  6. echo "export CUDA_HOME=/usr/local/cuda >> ~/.bashrc"
  7. echo "export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64"
  8. Install NVIDIA DIGITS 2.0 RC from NVIDIA Developers Zone https://developer.nvidia.com/digits
  9. open DIGITS archive and execute digits-2.0/install.sh
  10. cd digits-2.0/digits && for req in $(cat requirements.txt); do sudo pip install $req; done
  11. Install libcudnn from NVIDIA Developers Zone https://developer.nvidia.com/cudnn
  12. open cudnn archive and execute sudo cp -a libcudnn* $CUDA_HOME/lib64 && sudo cp cudnn.h $CUDA_HOME/include/
  13. move to digits-2.0/lib/cuda and execute sudo cp libcudart.so.7.0 /usr/local/cuda/lib64 && sudo ldconfig && source ~/.bashrc
  14. echo "export $PYTHONPATH=${HOME}/digits-2.0/caffe/python:${PYTHONPATH} >> ~/.bashrc"
  15. digit-2.0/runme.sh and access to localhost:5000 with your favorite browser
  16. Do training with your favorite network architecture, then configuration file will be created in digits-2.0/digits/digits/jobs
  17. digits-2.0/digits/examples/classification/example.py caffemodel(.prototxt) deployfile(.prototxt) image(.png or .jpg) --labels labelfile(.txt) the configuration file is located in digits-2.0/digits/digits/jobs

Performance Benchmark

I had to make a gemder classifier in the RoboCup@home task.(Our team:https://www.facebook.com/happyrobotmini)
I trained LeNet from 700 image of men/women in each categories with Nesterov's Accelerated Gradient optimization.
The accuracy was 75% in validation set, and got high recognition results in woman recognition.
I was able to point in the gender classification RoboCup@home task.
When using NVIDIA GPU for laptops, I got a memory allocation error when I am training with Network in Network architecture googlenet unless I do online learning(batch 1), and also it overfits.
LeNet will make the best results.
About the comparison of optimization, it took about 50 minutes training in Stocastic Gradient Descent, but using AdaGrad/NAG, the training time was below 10 minutes(training from 700 image in each categories).
Also I got the similar results with other classification tasks.

Collecting datasets

I couldn't find open face dataset suitable for me(FERET database was not the choice), so I collected 1400 images from the Internet.
Although it is able to collect images using crawlers, but quite of the web sites blocks crawlers these days, so I prefer manual collecting using the firefox plugin "Downthemall!".
It took 16 hours to collect 1400 images.

Scaling images, writing labels.txt/train.txt

You have to convert the input image for training in a specific size.(e.g. 28x28, 32x32, 256x256 pixel)
Imagemajick will be convenient for this(sudo apt-get install imagemajick).
Also, for training, you have to make train.txt/labels.txt, and making this text manually is too redundant.
I have an automization shellscript and the gender classifier in https://github.com/demulab/woman-man-recog , and feel free to use!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment