Advanced level · Module 10: Edge Computer Vision · Lesson 1 of 4
Edge Hardware and Quantising for Deployment
Learners compare hardware tiers (laptop CPU, Raspberry Pi-class single-board computer, free cloud GPU), quantise their ONNX model with ONNX Runtime and measure speed, size and accuracy on the target.
In this lesson you will
- Choose hardware for a vision task
- Quantise an ONNX model and measure the trade-offs
Key concepts
hardware tiersONNX Runtime quantize_dynamic / quantize_staticcalibration data readerlatency on target deviceaccuracy after quantisation
The lesson
Edge devices process images where they are captured, which reduces bandwidth, keeps data local and works without internet. A Raspberry Pi-class single-board computer is affordable and low-power but much slower than a laptop; small models and small input sizes are essential.
ONNX Runtime provides quantisation tools: dynamic quantisation is simple; static quantisation uses a calibration data reader fed with representative images (the calibration set from Module 2) and usually works better for convolution models. Ultralytics also supports INT8 ONNX export using ONNX Runtime static quantisation.
Measure on the actual target: latency per image, memory, file size and accuracy on the local test set. Accept quantisation only if accuracy stays within an agreed tolerance.
Step by step
- Quantise the capstone ONNX model with static quantisation and the calibration set.
- Compare FP32 and INT8 on the lab laptop.
- If a single-board computer is available, run both there; otherwise estimate with CPU thread limits.
- Decide whether to accept the quantised model.
From a trained PyTorch model to an offline edge device
The steps that turn a notebook model into a small, verified and monitored system that runs on a CPU or single-board computer without internet.
Train and select
Fine-tune a small pretrained model; record test results on public and local data.
ML developer
Export to ONNX
Export with torch.onnx.export (or Ultralytics export) and document the exact preprocessing.
ML developer
Verify
Run the same images through PyTorch and ONNX Runtime and confirm the outputs match within tolerance.
ML developer
Quantise
Apply ONNX Runtime static INT8 quantisation with a calibration set of representative local images; accept only if accuracy stays within tolerance.
ML developer
Package offline
Bundle the model, wheels and instructions; install on a clean device without internet and test.
deployment lead
Run and monitor
The device processes images locally, stores counts or labels and blurred samples only, and sends summaries when connected.
site operator
Each season, a person checks a sample of local images and outputs; corrections become new test data, and any retrained model goes through export, verification and quantisation again before replacing the old one.
Why it works
Typical results: INT8 models are about four times smaller than FP32. Speed gains depend on the hardware and must be measured on the target device. Check model and dataset licences (for example, Ultralytics models are AGPL-3.0 unless an Enterprise licence is held) before deployment.
Practice activity
Produce a quantisation and hardware report for the capstone model.
Expected result: Measured size, speed and accuracy on the target, and a justified decision.
Check your understanding
-
Why does static quantisation need calibration data?
Show answer
To choose value ranges for activations from representative inputs.
-
What is the main benefit of processing on the edge?
Show answer
Less bandwidth, local data and operation without internet.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.