การนำโมเดล AI ขึ้นอุปกรณ์ปลายทาง

Quantisation, ONNX, TensorRT, latency measurement and power constraints

Last updated:

Why it matters

A model trained on a server with a powerful GPU is usually too slow, too large and too power-hungry for the small computer on a drone. An edge device is a computer that processes data close to where it is produced, such as a Jetson or Raspberry Pi board on the drone or at the ground station. Running models there lets the system decide without internet access, reduces the data sent to the ground and responds quickly, at the cost of limited compute, memory, heat dissipation and power.

From model to board

  1. Train and evaluate on a powerful machine and record reference accuracy.
  2. Export to ONNX (Open Neural Network Exchange), an intermediate format read by many frameworks and runtimes, and check that outputs match the original model.
  3. Choose a runtime for the hardware, for example ONNX Runtime on a CPU or with a hardware execution provider, or TensorRT on NVIDIA GPUs, which fuses layers, selects kernels and supports FP16 and INT8.
  4. Reduce numerical precision with quantisation, then re-evaluate accuracy.
  5. Measure on the real board: latency, accuracy, memory, temperature and power, in conditions close to real flight.

Quantisation

Quantisation stores weights and activations with fewer bits, for example 8-bit integers (INT8) instead of 32-bit floats (FP32), through the linear mapping x ≈ s(q − z), where s is the scale and z the zero-point. A model with 25 million parameters needs about 100 MB in FP32, 50 MB in FP16 and 25 MB in INT8.

  • Dynamic quantisation computes activation scales at run time and is easy to apply.
  • Static quantisation uses a small calibration set of sample images to fix scales in advance; ONNX Runtime recommends it for CNNs.
  • The calibration images must represent real conditions, for example both morning and evening light, or the scales will be wrong and accuracy will drop.

Measuring latency properly

The latency that matters is end-to-end, from receiving an image to having a result you can act on. It includes pre-processing, model inference and post-processing such as NMS. Measure after several warm-up runs, report p95 or p99 rather than just the mean, and run long enough for the board to reach full temperature, because many boards slow down when hot (thermal throttling). A TOPS figure in a datasheet, such as the 67 TOPS quoted for the Jetson Orin Nano Super, an INT8 sparse figure, does not tell you how fast your model will run. The MLPerf Inference rules are a good example of stating measurement conditions clearly.

Worked example: how much flight time does an onboard computer cost?

Example: an energy budget for edge AI

An assumed multirotor uses a 6S 10 Ah battery (3.7 V nominal per cell) with 80% of capacity usable and draws 450 W in hover. The added computer uses 15 W, and its extra mass raises hover power by about 10 W (all values assumed).

  1. Battery energy = 6 × 3.7 × 10 = 222 Wh; usable 0.8 × 222 = 177.6 Wh.
  2. Without the computer: 177.6 / 450 × 60 ≈ 23.7 minutes.
  3. With the computer: 177.6 / (450 + 15 + 10) × 60 ≈ 22.4 minutes, about 1.3 minutes or roughly 5% less.
  4. If the computer processes 30 frames per second at 15 W, the energy per frame is 15 / 30 = 0.5 J.

If quantisation makes the model fast enough to process only the frames that are needed, or to run the board in a lower power mode, energy per frame falls, but accuracy after each change must still meet the task's criterion. Fitting a computer on board is a decision about accuracy, latency, mass and energy together.

On the drone, at the ground station, or in the cloud

WhereAdvantagesLimits
On the droneFast response, no dependence on the linkMass, power, heat
Ground stationMore compute, no extra mass on boardDepends on video link bandwidth and stability
CloudLarge compute, easy model updatesHigh latency, needs internet, data privacy issues

Common pitfalls

  • Trusting TOPS figures instead of measuring your model on the real board.
  • Timing inference only, forgetting pre- and post-processing.
  • Reporting the mean, which hides unusually slow frames.
  • Not re-evaluating accuracy after quantisation, or calibrating with unrepresentative images.
  • Testing on a desk in an air-conditioned room and then flying in hot sun, where the board runs much hotter.
  • Not recording model version, runtime and settings, so results cannot be reproduced or rolled back; keep a model card for every version.

Continue in the lessons

Key references

  1. ONNX Runtime. Documentation. link
  2. Microsoft. Quantize ONNX models. ONNX Runtime documentation. link
  3. NVIDIA. NVIDIA TensorRT documentation. link
  4. Warden, P., & Situnayake, D. (2020). TinyML: Machine learning with TensorFlow Lite on Arduino and ultra-low-power microcontrollers. O'Reilly Media.
  5. NVIDIA. (2024). NVIDIA Jetson Orin Nano developer kit gets a "super" boost. NVIDIA Technical Blog. link
  6. MLCommons. MLPerf inference rules. link

Used in courses

How to cite this page

Drone Institute, Rangsit University. (2026). การนำโมเดล AI ขึ้นอุปกรณ์ปลายทาง. In UAS Technology Knowledge Hub (B.Tech.). https://rsu-uat.pk-research.work/en/kb/new/edge-deploy/