Pan/tilt face tracking with a Raspberry Pi + NCS
[Github 原文档] @Bobby Chen 记得留下小星星
This project using the NCS with openvino and ServoBlaster to drive multiple servos via the GPIO pins to face tracking
本项目利用英特尔神经计算棒以及OpenVINO工具进行实时人脸检测并通过ServoBlaster工具对伺服电机进行控制实现实时人脸追踪
Demo video is shown [YouTube] [Bilibili]
[代码及Demo视频可见Github原文档] - [Github 原文档]
Installation Python Libraries:
- Python 3.5
- Picamera
- OpenVINO
- Numpy
Things needed:
本项目物品使用清单
- A raspberry pi 3B - 树莓派3B
- A Intel® Neural Compute Stick - (NCS1/2) - OpenVINO支持intel神经计算棒1代及2代
- A pan/tilt bracket - (3D printer) - 所使用云台由3D打印机制作
- Two Servos - (SG90) - 两个SG90伺服电机
- A GPIO expansion board - 某宝购树莓派GPIO扩展版
- Pi Camera or USB Webcam - 树莓派Pi相机或普通USB相机
Pan-and-tilt bracket: ProfileBlock_SUCPT_CamMount_28.5mm.gcode
3D打印Gcode文件在Github原文档可直接下载 - [Link]
[GPIO 4 -> PanMotor] [GPIO 17 -> TiltMotor]
The code defaults to driving 8 servos, the control signals of which should be
connected to P1 header pins as follows:
Servo number GPIO number Pin in P1 header Pan-Tilt Motor
0 4 P1-7 Pan-Motor
1 17 P1-11 Tilt-Motor
2 18 P1-12
3 21/27 P1-13
4 22 P1-15
5 23 P1-16
6 24 P1-18
7 25 P1-22
Install the OpenVINO™ Toolkit for Raspbian* OS Package - OpenVINO 树莓派安装指南
FaceDetection model (IR) ./models:
- Network - face-detection-retail-0004.bin
- Weights - face-detection-retail-0004.xml
Face detector based on SqueezeNet light (half-channels) as a backbone with a single SSD for indoor/outdoor scenes shot by a front-facing camera.
METHOD 1:
-
Run this script ./Install_openvino.sh
1. 可直接在树莓派运行shell脚本安装配置OpenVINO
This script provides all instructions on install the OpenVINO™ toolkit package for Raspbian OS*
METHOD 2:
-
The following steps will be covered: [Guide]
2. 或按官方安装指南步骤安装OpenVINO
This guide provides step-by-step instructions on how to install the OpenVINO™ toolkit for Raspbian OS*
To test your OpenVINO, open a new terminal. You will see the following:
OpenVINO配置成功后每次启动终端都会有以下显示
[setupvars.sh] OpenVINO environment initialized
Getting Started:
开始项目
Install and start multiple servos:
先下载本项目并进入ServoBlaster目录下
git clone git@github.com:yehengchen/FaceTracking-RPI3-NCS.git
cd FaceTracking-RPI3-NCS/ServoBlaster/user
sudo ./servod
Testing multiple servos:
测试双伺服电机是否运转
echo 0=+10 > /dev/servoblaster
echo 1=+10 > /dev/servoblaster
Testing Picamera:
检测Picamera是否运行
raspistill -o image.jpg
Run face tracking:
运行人脸追踪
python3 pi_NCS_face_traking.py