Giter Club home page Giter Club logo

raspberrypi-facedetection-mtcnn-caffe-with-motion's Introduction

MTCNN with Motion Detection On Raspberry Pi 3

The Python version(python 2.7) of MTCNN running on Raspberry Pi 3 with Love.
Also a motion detection trigger will help to improve the quality.

Requirement

Installation of dependencies:

  sudo apt-get update && sudo apt-get upgrade
  sudo apt-get install -y gfortran cython
  sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler git
  sudo apt-get install --no-install-recommends libboost-all-dev
  sudo apt-get install -y python-dev libgflags-dev libgoogle-glog-dev liblmdb-dev libatlas-base-dev python-skimage
  sudo pip install pyzmq jsonschema pillow numpy scipy ipython jupyter pyyaml
  1. Raspbian
  2. Caffe && PyCaffe: https://github.com/BVLC/caffe

Install caffe:

  git clone https://github.com/BVLC/caffe
  cd caffe
  cp Makefile.config.example Makefile.config
  sudo nano Makefile.config

Modify next lines, instead of these

  #CPU_ONLY := 1
  #OPENCV_VERSION := 3
  PYTHON_INCLUDE := /usr/include/python2.7 \
  	/usr/lib/python2.7/dist-packages/numpy/core/include
  INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
  LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

with:

  CPU_ONLY := 1
  OPENCV_VERSION := 3
  PYTHON_INCLUDE := /usr/include/python2.7 \
  	/usr/local/lib/python2.7/dist-packages/numpy/core/include
  INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
  LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/arm-linux-gnueabihf/hdf5/serial/
  make all
  make test
  make runtest
  make pycaffe
  
  ./scripts/download_model_binary.py models/bvlc_googlenet
  sudo nano ~/.bashrc
  export PYTHONPATH=/home/pi/deepdream/caffe/python:$PYTHONPATH // Add at the end of file

Protobuf python support installation:

   sudo pip install protobuf
  1. OpenCV && CV2: My Blog
    If you have good luck, sudo apt-get install opencv python-opencv will have it done. or search installation guide from google.

  2. WebCam(D-Link DCS-932L)
    I have it on hand, so have to write a IPCamera class for it.
    You can simply use a Camera Model of PI (OV5647), it need Camera White Balance and parameter finetune. (PR Welcome)

 if you use PiNor Cam module or other nonUSB cam, you may need do following changes:

  sudo modprobe bcm2835-v4l2
code:
  ret, frame = ipCam.read()
  _, cnts, _ = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)

Tell mtcnn where pycaffe is

If you had export caffe to PYTHONPATH environment var,this isnot needed. Edit _init_paths.py, change caffe_path to your own.

Run

	python demo.py
	
- jupyter notebook demo: [Demo.ipynb](Demo.ipynb)

raspberrypi-facedetection-mtcnn-caffe-with-motion's People

Contributors

duinodu avatar solderzzc avatar victorluli avatar wmatrix 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.