An extremely nice material to introduce i image processing kernels

http://setosa.io/ev/image-kernels/

Advertisements

Very good materials for docker beginners

My target of using Docker: To build a docker container which contains all the prevalent deep learning libraries and frameworks for both GPU and CPU.

  1.  Docker到底是什么?为什么它这么火!
  2. What is Docker and why is it so darn popular?
  3. 初探Docker
  4. Deep learning: All in one docker
  5. How to Use Docker: Creating Your First Docker Container
  6. Code for deep learning docker

Yolo

For my opencv version is 3.0+, somehow have conflict with Caffe when makefile.

When install yolo:

In /.bashrc comment out like:

#Opencv
#export LD_LIBRARY_PATH=/home/kaku/anaconda3/lib:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=”/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH”

When install caffe:

In /.bashrc comment like:

#Opencv
export LD_LIBRARY_PATH=/home/kaku/anaconda3/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=”/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH”

Video detection:

./darknet detector demo cfg/coco.data cfg/yolo.cfg yolo.weights ./data/IMG_5954.MOV thresh -0.1

 

 

Chainer+CUDNN+CUDA

The reason I wanna use Chainer:

  1. I am confused the way of install Caffe
  2. I wanna use the available Fast-CNN code
    1. https://github.com/mitmul/chainer-faster-rcnn

Chainer is really easy to install, just follow the home-page

http://docs.chainer.org/en/stable/install.html

If wanna use gpu in the mnist example:

  1. mnist$ python train_mnist.py –gpu=0      GPU using
  2. mnist$ python train_mnist.py                       CPU using

Debug

  1. Try the sample can not from chainer import training
    solution: reinstal chainer
  2. To use Cudnn and CUDA
    1. Need cudnn.h
    2. libcudnn.so*

To check it use CUDA or not

>>> from chainer import cuda
>>> cuda.check_cuda_available()

I hope to have a deep understanding of Chainer in the near future!

Caffe+Python3.5+Anaconda3+Opencv3.1+Cuda7.5+Ubuntu14.04

I almost spent(waisted) one week to configure caffe on Ubuntu 14.04, the reason why it too time consuming is that I am using the newest version of Opencv Python and anaconda. Here I want to share my experience.

  1. Makefile.config
    • # cuDNN acceleration switch (uncomment to build with cuDNN).
      USE_CUDNN := 1
      # Uncomment if you’re using OpenCV 3
      OPENCV_VERSION := 3
      # CUDA directory contains bin/ and lib/ directories that we need.
      CUDA_DIR := /usr/local/cuda
      # CUDA architecture setting: going with all of them.
      # For CUDA < 6.0, comment the *_50 lines for compatibility.
      CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
      -gencode arch=compute_20,code=sm_21 \
      -gencode arch=compute_30,code=sm_30 \
      -gencode arch=compute_35,code=sm_35 \
      -gencode arch=compute_50,code=sm_50 \
      -gencode arch=compute_50,code=compute_50
      # BLAS choice: atlas for ATLAS (default)
      BLAS := atlas
      # We need to be able to find Python.h and numpy/arrayobject.h.
      ANACONDA_HOME := $(HOME)/anaconda3
      PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
      $(ANACONDA_HOME)/include/python3.5m \
      $(ANACONDA_HOME)/lib/python3.5/site-packages/numpy/core/include \
      # Uncomment to use Python 3 (default is Python 2)
      PYTHON_LIBRARIES := boost_python3 python3.5m
      # We need to be able to find libpythonX.X.so or .dylib.
      PYTHON_LIB := $(ANACONDA_HOME)/lib
      # Whatever else you find you need goes here.
      INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
      LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
      # N.B. both build and distribute dirs are cleared on `make clean`
      BUILD_DIR := build
      DISTRIBUTE_DIR := distribute
      # The ID of the GPU that ‘make runtest’ will use to run unit tests.
      TEST_GPUID := 0
      # enable pretty build (comment to see full commands)
      Q ?= @
  2. ./bashrc.
    • #Caffemake
      export PYTHONPATH=~/caffe/python/:$PYTHONPATH#Opencv
      export LD_LIBRARY_PATH=/home/kaku/anaconda3/lib:$LD_LIBRARY_PATH
      export LD_LIBRARY_PATH=”/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH”

Notes:

  1. library must be installed:
    1. libboost-all-dev, although in some tutorial mentioned must install libboost1.55-all-dev.
    2. protobuf-cpp-3.0.0-beta-2.zip or upper one
      protobuf-python-3.0.0-beta-2.zip or upper one

      1. http://blog.csdn.net/lien0906/article/details/51784191
      2. https://github.com/google/protobuf/issues/1276
  2. Debug:
    1. Opencv3.1
      • In my computer I installed two versions Opencv, 2.4 and 3.1
      • 2.4 in the route: /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4
      • 3.1 in the route /home/kaku/anaconda3/lib/libopencv_imgproc.so.3.1 and  /home/kaku/anaconda3/pkgs/opencv3-3.1.0-py35_0/lib/libopencv_imgproc.so.3.1
      • If in the .bashrc I export opencv path as: /usr/lib/x86_64-linux-gnu/, or the path contain both 3.1 and 2.4, will be conflict, as follows:
        1. /usr/bin/ld: warning: libopencv_imgproc.so.3.1, needed by /home/kaku/anaconda3/lib/libopencv_imgcodecs.so, may conflict with libopencv_imgproc.so.2.4
        2. .build_release/tools/caffe: error while loading shared libraries: libopencv_core.so.3.1: cannot open shared object file: No such file or directory
          make: *** [runtest] Error 127
      • Solution:
        • In .bashrc
          1. export LD_LIBRARY_PATH=/home/kaku/anaconda3/lib:$LD_LIBRARY_PATH
          2. export LD_LIBRARY_PATH=”/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH”
        • In Makefile.config
          • Delete: PYTHON_LIB := /usr/lib
    2. fatal error: Python.h: No such file or directory
      • Actually I have python.h, but in the following files:
        • /media/kaku/Work/software/study software/Anaconda/include/Python.h
          /home/kaku/anaconda3/pkgs/python-3.5.1-0/include/python3.5m/Python.h
          /home/kaku/anaconda3/include/python3.5m/Python.h
          /usr/include/python2.7/Python.h
      • Solution:
        • In .bashrc add:
          • ANACONDA_HOME := $(HOME)/anaconda3
            PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
            $(ANACONDA_HOME)/include/python3.5m \
          • PYTHON_LIBRARIES := boost_python3 python3.5m
        • Can not contain route: /usr/include/python2.7/
    3. Thanks to:
      1. http://sunshineatnoon.github.io/How-to-install-caffe/
      2. http://qiita.com/TD72/items/bcb243ee02760ea1d8bb
      3. http://blog.csdn.net/u012675539/article/details/51351553
      4. http://blog.csdn.net/lien0906/article/details/5178419
      5. https://github.com/google/protobuf/issues/1276
      6. http://blog.csdn.net/lien0906/article/details/51784191
      7. http://caffe.berkeleyvision.org/install_apt.html