The Raspberry Pi 5 is significantly faster than its predecessor — a 2–3× CPU improvement. However, for real-time inference of detection, classification, or text generation, a hardware accelerator is often mandatory. We have been deploying AI on Pi for over 5 years and have helped dozens of projects move from prototype to production. For example, a client from the electronics industry wanted to detect scratches on a circuit board in real time. Without an accelerator, YOLOv8n delivered 15 FPS — insufficient for a 30 cm/s conveyor. After optimization with Hailo-8 and INT8 quantization, we achieved stable 110 FPS. According to Wikipedia, Edge AI is an approach that processes data locally without latency, which is critical for industrial tasks. Below are practical recommendations.
Which Accelerator to Choose for Raspberry Pi 5?
There are three main options on the market:
| Accelerator |
Performance (TOPS) |
Power Consumption |
Model Support |
Works with Pi 5 |
| Hailo-8 HAT+ (M.2) |
26 TOPS |
5 W |
Any (via Hailo SDK) |
Yes (M.2 slot via HAT) |
| Google Coral USB Accelerator |
4 TOPS |
2–3 W |
Only INT8 TFLite |
Yes (USB, Pi 4/5) |
| Intel Neural Compute Stick 2 |
1 TOPS |
1–2 W |
OpenVINO, outdated |
Partially |
The Hailo-8 is the choice today: 26 TOPS at minimal power consumption. In our projects, it delivers 120+ FPS on YOLOv8n. Coral is a budget option for ready-made TFLite models. Intel NCS2 is only found in legacy systems.
How Hailo-8 Affects Performance
| Model |
Without Accelerator (Pi 5 CPU) |
With Hailo-8 |
| YOLOv8n (detection) |
~30 FPS |
120+ FPS |
| MobileNetV3 (classification) |
~15 FPS |
60+ FPS |
| Llama 3.2 1B (generation) |
8–12 tokens/s |
— (not yet supported) |
The difference is 4–5×. For real-time tasks (video surveillance, robotics), an accelerator is mandatory. Budget savings with this approach can reach 40% compared to cloud solutions. For a typical project, the total cost ranges from $2,000 to $5,000, including hardware, optimization, and deployment. Over three years, this solution saves up to 40% compared to cloud inference, with full data privacy.
Stack Without Accelerator (Pure Pi 5)
If the task is not time-critical, the CPU with TFLite + XNNPACK (ARM Neon) suffices. For NLP — Llama.cpp using transformer-based models: Llama 3.2 1B runs at 8–12 tokens/s. That is enough for an offline assistant or simple classification. For CV tasks, you can use MobileNetV3-SSD: 8–10 FPS at 320×320 resolution. But if you need latency < 100 ms, YOLOv8n on Hailo-8 is essential.
How We Optimize Models and Deploy AI
From Our Practice: Defectoscopy Case
Client — electronics manufacturer. Needed real-time scratch detection on circuit boards. Problems: YOLOv8n model was heavy for Pi 5 (15 FPS), heat dissipation. We:
- Performed INT8 quantization using Hailo SDK — FPS rose to 110.
- Configured pipeline via GStreamer, reducing p99 latency to 30 ms.
- Added CPU throttling to avoid overheating.
Result: stable 30 FPS on the conveyor, 99.9% reliability.
We specialize in model optimization for Raspberry Pi platforms, applying quantization-aware training and optimizing runtime kernels for ARM Neon.
Process of Work
Deployment Stages:
- Analysis: load, latency requirements, accelerator selection.
- Design: inference pipeline architecture.
- Implementation: quantization, model conversion, SDK setup.
- Testing: FPS measurements, p99 latency, thermal stress.
- Deployment: deploy on Pi, monitoring, documentation.
What Is Included in the Work?
- Selection of hardware accelerator and components.
- Model optimization (quantization, conversion) for the specific SDK.
- System setup (OS, drivers, libraries).
- Integration of inference pipeline (GStreamer, OpenCV, etc.).
- Performance testing and stress test.
- Documentation and operation instructions.
- Training of your team (up to 2 hours).
- Post-deployment support (1 month).
Common Mistakes When Deploying AI on Pi
- Ignoring heat dissipation — throttling reduces FPS.
- Using FP32 models instead of INT8 quantized models with proper calibration.
- Non-optimized input/output pipeline (GStreamer is mandatory).
- Incorrect model selection: overly heavy architectures (YOLOv8m) give 5 FPS even with an accelerator due to memory bandwidth limits.
- Lack of temperature monitoring — at 85°C, Pi drops its frequency.
Why Trust Us with Deployment?
We have over 5 years of experience in edge AI and more than 50 successful projects on Raspberry Pi. We integrate edge MLOps practices for continuous model updates and provide a documented performance guarantee. Get a consultation — contact us, and we will assess your project within one day. The Hailo HAT+ is a high-performance accelerator we recommend for Raspberry Pi 5. Request an evaluation of your project. We will help select an accelerator and optimize the model for your requirements.
Edge AI is the entry point to smart devices without the cloud.
Edge AI and Optimization: How to Deploy Models Without Cloud?
Imagine: your face recognition model has 4 seconds latency on Jetson Orin, the battery runs out in an hour, and the model crashes with OOM. We are a team of Edge AI engineers with 5+ years in production — we have optimized over 150 models for edge devices. Without profiling and proper choice of quantization or distillation, the project is doomed. The gap between research code and edge deployment is a separate engineering discipline; we help you master it in 2–16 weeks turnkey. Edge AI and model optimization services are not just export, but systematic work with hardware.
Why Simply Exporting a Model Doesn't Work?
A PyTorch model with float32 and batch_size=32 is not ready for edge. Typical problems:
- ResNet-50 in fp32 occupies 98 MB, inference on Cortex-A78 — 380 ms. After INT8 quantization via
torch.ao.quantization — 24 MB, 95 ms. Export to ONNX + TensorRT on Jetson — 28 ms.
- YOLOv8m on Raspberry Pi 5 in fp32 — 2.8 fps. TFLite INT8 — 9.4 fps. With XNNPACK delegate — 14 fps (1.5× faster than pure INT8).
- Transformer encoder on mobile CPU: MobileBERT in fp16 via CoreML on iPhone 15 — 18 ms/inference.
distilbert-base-uncased in ONNX — 42 ms.
The problem is not choosing "quantize or not" — the right path is determined by the device, task, and acceptable metric degradation. We offer an assessment of your project: within 24 hours we will tell you how feasible it is to speed up the model.
How to Choose Quantization Method for Your Task?
PTQ (Post-Training Quantization) — a quick path. Take a trained model, run a calibration dataset (200–1000 samples), get INT8 or INT4 weights. Tools: torch.ao.quantization, ONNX Runtime quantization tool, bitsandbytes. Accuracy degradation: 0.5–2% on classification. Red zone — small object detection and segmentation, where PTQ gives -4–8% mAP.
QAT (Quantization-Aware Training) — training with simulated quantization noise. More expensive (retraining), but degradation 0.1–0.5%. Justified when PTQ is unacceptable. In PyTorch — torch.ao.quantization.prepare_qat().
GPTQ / AWQ — for LLMs. AWQ better preserves quality at 4-bit quantization. llm-compressor from Neural Magic or autoawq are the main libraries.
| Method |
Implementation Time |
Accuracy Degradation |
Tools |
| PTQ |
1–2 days |
0.5–2% (up to 8% on detection) |
torch.ao, ONNX RT, bitsandbytes |
| QAT |
1–3 weeks |
0.1–0.5% |
torch.ao.prepare_qat, TF Quantization |
| GPTQ/AWQ |
3–7 days |
1–3% (LLM) |
autoawq, llm-compressor |
Potential savings from choosing the right method can be substantial — for example, reducing cloud inference costs by up to 70% when deploying to edge. Project cost is calculated individually based on model complexity and target platform.
When to Use Pruning vs Distillation?
Structural pruning removes channels or layers. torch.nn.utils.prune — basic tool. For transformers — attention head pruning (LTP, movement pruning). Result: ResNet-50 after removing 40% of channels with fine-tuning — -35% size, -28% latency, -1.2% top-1 accuracy.
Knowledge distillation — train a small student to mimic a large teacher. Classic via KLDivLoss on soft labels. Feature distillation on intermediate layers is more effective. Hugging Face DistilBERT: 66M vs 110M parameters, -40% latency, -3% on GLUE. This is a model compression technique.
Combined approach: distillation → pruning → QAT. Gives maximum effect on limited hardware. We recorded a case where a client achieved 70% reduction in cloud compute spend after moving to edge with this pipeline.
Target Platforms and Tools
| Platform |
Preferred Format |
Tool |
Specifics |
| NVIDIA Jetson |
TensorRT engine |
trtexec, torch2trt |
INT8 calibration, DLA offload |
| Apple Silicon / iOS |
CoreML (.mlmodel) |
coremltools |
ANE (Neural Engine) automatically |
| Android |
TFLite (.tflite) |
tf.lite.TFLiteConverter |
GPU delegate, NNAPI |
| x86 CPU |
ONNX + ORT |
onnxruntime |
AVX-512, VNNI |
| Arm Cortex |
TFLite / ONNX |
ort-arm, tflite |
XNNPACK, NEON |
| Qualcomm NPU |
QNN (.dlc) |
Qualcomm AI Hub |
Hexagon DSP |
TensorRT — the main tool for NVIDIA edge. TRT builds a graph with operator fusion, selects optimal kernels. On Jetson AGX Orin YOLOv8m in TRT INT8 gives 78 fps vs 22 fps in fp16 PyTorch — 3.5× improvement.
Practical Case: How We Detected Defects on a Production Line (Our Client)
Task: real-time scratch detection on metal, 30 fps, camera to Jetson Xavier NX (16GB). Original model YOLOv8l mAP50 0.91, server inference 28 ms, on Jetson in fp16 — 110 ms (9 fps). Not suitable.
Optimization steps we performed for our client:
- Switch to YOLOv8m — mAP50 0.887 (-2.3%), 68 ms
- Export to TensorRT FP16 via
yolo export format=engine half=True — 31 ms (32 fps)
- INT8 calibration on 500 frames — 22 ms (45 fps), mAP50 0.879
Result: 3.5% degradation at 5× speedup. Client received engine and documentation. We guarantee metric will not drop below agreed threshold — specified in contract.
Example model profiling (layer latency)
Profile slice of YOLOv8m on Jetson Xavier NX (fp16):
- Convolution (layer 1–5): 12 ms
- Bottleneck (layer 6–10): 8 ms
- Head (detection): 11 ms
Bottleneck is the last layers of the head. After quantizing the head separately, head latency dropped to 4 ms.
What is Included in the Work?
- Report on model profiling on target device (layer latency, bottlenecks)
- Selection and justification of optimization methods (quantization / pruning / distillation)
- Optimized model (TensorRT engine / TFLite / CoreML / ONNX)
- Configs for reproducibility (scripts, Docker image, instructions)
- Testing on real device (at least 10,000 inferences)
- Training of your team (2 hours online)
- 1 month support after delivery
How to Order Model Optimization
- Submit a request on the website or contact us in any convenient way.
- We perform free profiling of your model on the target device within 24 hours.
- We prepare an optimization plan with trade-off estimates (speed vs quality).
- You approve the plan — we start work.
- After completion, we deliver the optimized model, configs, and documentation.
- We train your team and provide monthly support.
Timeline: optimization of an existing model — 2–4 weeks. Development from scratch for edge — 6–16 weeks.
Get a consultation — we will evaluate your model for free and offer a plan within 24 hours. Order free profiling now. For complex projects, contact our engineering team to discuss custom optimisation strategies.