An example of deep object detection and tracking with a Raspberry Pi, PiCamera, and Pimoroni Pantilt Hat
Project description
Raspberry Pi Deep PanTilt
Build List
- Raspberry Pi 4 (4GB recommended)
- Raspberry Pi Camera V2
- Pimoroni Pan-tilt Kit
- Micro SD card 16+ GB
- Micro HDMI Cable
- 12" CSI/DSI ribbon for Raspberry Pi Camera (optional, but highly recommended)
- Coral Edge TPU USB Accelerator (optional)
- RGB NeoPixel Stick (optional, makes lighting conditions more consistent)
An example of deep object detection and tracking with a Raspberry Pi
- Free software: MIT license
- Documentation: https://rpi-deep-pantilt.readthedocs.io.
Basic Setup
Before you get started, you should have an up-to-date installation of Raspbian 10 (Buster) running on your Raspberry Pi. You'll also need to configure SSH access into your Pi.
Installation
- Install system dependencies
sudo apt-get update && sudo apt-get install -y \
cmake python3-dev libjpeg-dev libatlas-base-dev raspi-gpio libhdf5-dev python3-smbus
- Install the
rpi-deep-pantilt
package.
pip install rpi-deep-pantilt
Example Usage
Real-time object detection
The following will start a PiCamera preview and render detected objects as an overlay. Ensure you're able to detect an object before trying to track it.
rpi-deep-pantilt detect
rpi-deep-pantilt detect --help
Usage: rpi-deep-pantilt detect [OPTIONS]
Options:
--loglevel TEXT Run object detection without pan-tilt controls. Pass
--loglevel=DEBUG to inspect FPS.
--help Show this message and exit.
Real-time object tracking
The following will start a PiCamera preview, render detected objects as an overlay, and track an object's movement with the pan-tilt HAT.
By default, this will track any person
in the frame. You can track other objects by passing the --label
rpi-deep-pantilt track
rpi-deep-pantilt track --help
Usage: rpi-deep-pantilt track [OPTIONS]
Options:
--label TEXT The class label to track, e.g `orange`. Run `rpi-deep-
pantilt list-labels` to inspect all valid values
[required]
--loglevel TEXT
--help Show this message and exit.
rpi-deep-pantilt list-labels
The following labels are valid tracking targets.
['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush']
Credits
The MobileNetV3-SSD model in this package was derived from TensorFlow's model zoo, with post-processing ops added.
The PID control scheme in this package was inspired by Adrian Rosebrock tutorial Pan/tilt face tracking with a Raspberry Pi and OpenCV
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
1.0.0 (2019-12-01)
- First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file rpi_deep_pantilt-1.0.0rc4.tar.gz
.
File metadata
- Download URL: rpi_deep_pantilt-1.0.0rc4.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 089a21668c6b4729da2e9af0aeba8778f3afce9654194cab2908b3a6421b3676 |
|
MD5 | e6fcd4f8ee4160bf47584600aa720861 |
|
BLAKE2b-256 | df7c88284dc79ccd094c934b7b07f2b08ade14aa3a830762a6a21727008865f8 |