Overview
YOLO-Pi can be deployed on x86 systems (MacBook, Linux workstations) using Docker. This is ideal for development and testing before deploying to Raspberry Pi hardware.Building the Docker image takes approximately 20 minutes due to OpenCV compilation from source.
Prerequisites
- Docker installed on your system
- USB camera or built-in webcam
- At least 4GB of available disk space
Building the Image
Build the Docker image
Build the image using the x86 Dockerfile:This process will:
- Install Python 3.6 and dependencies
- Build OpenCV 3.3.0 from source with optimizations (AVX, TBB, V4L)
- Install TensorFlow 1.1.0, Keras 2.1.2, and other dependencies
- Copy application code to
/app
Running the Container
Interactive Mode
Run the container interactively with camera access:Command breakdown
Command breakdown
-it: Interactive terminal--rm: Remove container after exit--privileged: Grant extended privileges (required for some camera access)--device=/dev/video0:/dev/video0: Mount camera device-v \pwd`:/app`: Mount current directory to /app (optional, for development)/bin/bash: Start bash shell instead of running application
Running the Application
To run YOLO-Pi directly:Camera Device Access
Linux
On Linux, camera devices are typically/dev/video0. List available cameras:
/dev/video1), adjust the --device flag:
macOS
Docker on macOS has limited USB device passthrough support. For testing on Mac, consider:
- Using a native Python environment with conda
- Running the container and accessing a network camera
- Testing with video files instead of live camera feed
Troubleshooting
Camera not detected
Camera not detected
Check that your user has permissions to access the camera device:Then log out and back in for changes to take effect.
Build fails during OpenCV compilation
Build fails during OpenCV compilation
Ensure you have enough disk space (at least 4GB) and memory (4GB+ recommended).You can limit build parallelism to reduce memory usage by modifying the Dockerfile to use
make -j2 install instead of make install.MQTT connection error
MQTT connection error
The application requires an MQTT broker. Ensure:
- The MQTT broker is running and accessible
- The
MQTTenvironment variable is set correctly - Port 1883 is open on the MQTT server
OpenCV 3.1.1 crashes on Mac
OpenCV 3.1.1 crashes on Mac
The project specifically uses OpenCV 3.0.0 due to stability issues with 3.1.1 on macOS. Stick with version 3.0.0 or use 3.3.0 as configured in the Dockerfile.
Image Details
The x86 Docker image includes:- Base Image:
python:3.6 - OpenCV: 3.3.0 compiled with AVX, TBB, OpenGL, OpenCL, V4L support
- TensorFlow: 1.1.0
- Keras: 2.1.2
- Additional Libraries:
- NumPy (latest)
- Pillow 4.3.0
- h5py 2.7.1
- kafka-python
- paho-mqtt
Next Steps
Raspberry Pi Deployment
Deploy to Raspberry Pi hardware
Production Setup
Production deployment best practices

