Raspberry Pi (On Device)
Deploy your Roboflow Train models to Raspberry Pi.
Our Hosted API is suitable for most use-cases; it uses battle-tested infrastructure and seamlessly autoscales up and down to handle even the most intense use-cases. But, because it is hosted remotely, there are some scenarios where it's not ideal. Our Raspberry Pi deployment option runs directly on your devices in situations where you need to run your model without a reliable Internet connection.


You'll need a Raspberry Pi 4 (or Raspberry Pi 400) running the 64bit version of Ubuntu. To verify that you're running a compatible system, type arch into your Raspberry Pi's command line and verify that it outputs aarch64.
Then, install Docker on your Pi using the convenience script:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Inference Server

The inference API is available as a Docker container optimized and configured for the Raspberry Pi. To install, simply pull the container:
sudo docker pull roboflow/inference-server:cpu
This will automatically detect your Pi's CPU and pull down the correct container.
Then run it:
sudo docker run --net=host roboflow/inference-server:cpu
You can now use your Pi as a drop-in replacement for the Hosted Inference API (see those docs for example code snippets in several programming languages).
For example, install our python package with pip install roboflow then
from roboflow import Roboflow
rf = Roboflow(api_key="YOUR_API_KEY_HERE")
version = rf.workspace("your-workspace").project("YOUR_PROJECT").version(1, local="http://localhost:9001")
prediction = version.model.predict("YOUR_IMAGE.jpg")
You can also run as a client-server context and send images to the Pi for inference from another machine on your network; simply replace localhost above with the Pi's local IP address.
Note: The first call to the model will take a few seconds to download and initialize your model weights; subsequent predictions will be much quicker.

Performance Expectations

On we saw about 1.3 frames per second on the Raspberry Pi 400. These results were obtained using while operating in a client-server context (so there is some minor network latency involved) and a 416x416 model.
If you need faster speeds you might want to try using the Luxonis OAK AI Cameras with your Raspberry Pi to accelerate your models.

Offline Mode

The weights for your model are downloaded each time the container runs. Full offline mode support (for autonomous and air-gapped devices) is available for enterprise deployments.