YOLOv5s optimized for Arm-based Edge Linux systems

An INT8-quantized version of YOLOv5s for object detection, exported to ExecuTorch (.pte) and optimized for Arm-based Edge Linux systems.

Summary

This repository contains an Arm-optimized version of YOLOv5s for object detection, quantized to INT8 via static post-training quantization — per-channel symmetric weights, per-tensor affine activations. The model is provided in ExecuTorch (.pte) format, targeting Edge Linux systems.

This version is intended to demonstrate efficient inference on Arm-based platforms while preserving the original model's intended behavior. Arm has evaluated this model on COCO 2017 val and measured performance on a representative evaluation target.

Key results

Area Result
Model format ExecuTorch (.pte)
Target device class Edge Linux
Reference device Raspberry Pi 5 (Cortex-A76, Linux Raspberry Pi OS 64-bit, based on Debian 13 "Trixie")
Primary performance result p50 latency 258.068 ms (2.40x faster than baseline)
Accuracy result mAP@0.5:0.95 36.09%, mAP@0.5 54.97%
Size / memory result 7.133 MB (3.88x smaller), peak memory 109.44 MB

Original model

Field Value
Original model YOLOv5s
Original source GitHub
Original developer Ultralytics
Original model card Ultralytics/YOLOv5
Original checkpoint yolov5s.pt — the COCO 2017-trained checkpoint this model was quantized from, loaded through torch.hub
Original license AGPL-3.0

Model files

File Description
yolov5s_raspberry_executorch_optimized.pte Arm-optimized INT8 model for deployment
example.py Minimal inference example
pyproject.toml Pinned runtime dependencies for example.py, resolved with uv
uv.lock Locked dependency resolution for pyproject.toml
config.yaml Model input/output contract used by the example
benchmarks/ FP32 baseline and Arm-optimized benchmark records

Performance

Performance was measured on the reference configuration below. Results are intended to make the optimization reproducible but do not guarantee identical performance on every Arm-based system.

Reference configuration

Field Value
Device / platform Raspberry Pi 5
CPU architecture arm64
CPU Cortex-A76, 4 cores @ 2.4 GHz
System memory 8 GB
OS Linux, Raspberry Pi OS 64-bit, based on Debian 13 "Trixie"
Runtime ExecuTorch 1.1.0
Execution backend CPU, 1 thread (XNNPACK, KleidiAI)
Precision INT8, static PTQ — per-channel symmetric weights, per-tensor affine activations
Batch size 1
Input resolution 640x640
Runs / warmup 100 / 10

Performance results

Metric Original / baseline Arm-optimized Improvement
Model size (MB) 27.655 7.133 3.88x smaller
End-to-end latency p50 (ms) 618.283 258.068 2.40x faster
End-to-end latency p90 (ms) 618.753 258.763 2.39x faster
Model load time (ms) 43.973 17.156 2.56x faster
Time to first inference (ms) 643.82 276.763 2.33x faster
Peak memory (MB) 154.58 109.44 1.41x less
XNNPACK delegation (%) 98.14
Average memory (MB) 153.94 108.55 1.42x less
Frames per second 1.62 3.87 2.39x

Accuracy

Accuracy was evaluated using the same preprocessing, input resolution, and evaluation protocol described below. Where possible, the optimized model is compared against the original model under the same evaluation conditions.

Evaluation setup

Field Value
Dataset COCO 2017
Split val2017
Sample count 5000
Metric(s) mAP@0.5:0.95, mAP@0.5, mAP@0.75
Runtime ExecuTorch 1.1.0 (CPU, XNNPACK, KleidiAI)

Accuracy results

Metric Original / baseline Arm-optimized Change
mAP@0.5:0.95 (%) 37.10 36.09 -1.01 pp
mAP@0.5 (%) 55.60 54.97 -0.63 pp
mAP@0.75 (%) 40.46 39.71 -0.75 pp

Accuracy was measured using the evaluation setup described above. Users should re-evaluate the model on their own data before production use.

Arm optimization approach

Arm optimized this model for efficient inference on Arm-based platforms using a hardware-aware conversion and validation flow.

For this release, Arm used:

Optimization area Applied? Notes
Model conversion Yes Captured with torch.export and converted to ExecuTorch .pte
Quantization Yes INT8 static PTQ via the PT2E path — per-channel symmetric weights, per-tensor affine activations; calibrated on 1,000 randomly selected COCO 2017 images. Layers were skipped from quantization to keep accuracy within acceptable ranges
Runtime/backend selection Yes XNNPACK + KleidiAI delegate
Graph/runtime compatibility updates Yes Post-convert graph surgery strips the Q/DQ pairs that XNNPACKQuantizer._annotate_cat inserts around the detection head's concatenation and view nodes despite the layer filter, and peels the equivalent pair off the output node
Accuracy validation Yes Compared against the original model or published baseline
Performance validation Yes Measured on the reference Arm platform

The goal of this process is to improve deployment characteristics such as latency, memory use, model size, and runtime compatibility while preserving the model's intended behavior. Detailed conversion scripts, calibration configuration, or backend-specific implementation details may be provided separately where appropriate.

Using this model

Install dependencies

Dependencies are declared in pyproject.toml, which ships with this repository. Resolve and install them into a local virtual environment with uv:

uv python install
uv sync --frozen

Download yolov5s_raspberry_executorch_optimized.pte and place it beside example.py.

Run the example

uv run example.py

The script reads sample_input.jpg — a samoyed lying on a beach — runs inference with yolov5s_raspberry_executorch_optimized.pte, prints the detections it kept, and writes:

  • sample_output.jpg — the input image at its native resolution with each detection's box and label drawn in red
  • detections.json — the class, score, and xyxy box of every detection, in original-image coordinates

Both files ship with this repository as expected results, and the run overwrites them in place. Copy the directory first if you want to keep them for comparison.

Expected input

Property Value
Shape [1, 3, 640, 640]
Dtype float32
Range [0.0, 1.0]; no mean/std normalization — YOLOv5 consumes raw [0, 1] values
Preprocessing to tensor and divide by 255, then letterbox to 640x640: aspect-preserving F.interpolate(mode="bilinear", align_corners=False) followed by centerd padding with the Ultralytics gray fill of 114/255

Resizing runs on the [0, 1] tensor rather than the PIL image, and the aspect ratio is preserved. A plain stretch to 640x640 would shift every box and move the results away from the numbers above.

Expected output

Property Value
Shape [1, 25200, 85]
Format Per anchor: 4 xywh center coordinates + 1 objectness + 80 class scores
Postprocessing sigmoid applied to objectness and class scores only if they fall outside [0, 1]; score = objectness x max(class scores); confidence threshold 0.25; xywh to xyxy; per-class batched NMS at IoU 0.45; inverse letterbox back to native resolution, clamped to the image bounds

Intended use

This model is intended for developers evaluating object detection workloads on Arm-based platforms. It is suitable as a reference implementation for benchmarking, prototyping, and integration exploration.

Limitations

  • Evaluated on 5000 images from COCO 2017 val2017, the full validation split
  • Fixed input size of 640x640 with letterbox padding — other input resolutions require re-export, and small objects lose resolution relative to their native size
  • Detects only the 80 COCO classes; anything outside that vocabulary is either missed or reported as the nearest COCO class
  • Performance measurements are from Raspberry Pi 5 hardware; results may differ on other Arm devices

Additional notes

The detection head concatenates box coordinates in the 0-640 range with class confidence scores in the 0-1 range into one output tensor, so a single per-tensor scale would crush the small-range channels to zero. Layers were therefore skipped from quantization to keep accuracy within acceptable ranges: the first backbone convolution stays in FP32 as the input-quantization boundary, and within the head the convolutional and linear layers are quantized while the element-wise operations (sigmoid, multiply, add, concatenation) are kept in FP32. Calibration used 1,000 randomly selected images from COCO 2017.

Confidence filtering, box decoding, and NMS run in Python rather than inside the exported graph, so PT2E canonicalization cannot affect the result.

  • Sample input: sample_input.jpg is derived from Samoyed on Beach by Appleinfl, via Wikimedia Commons (public domain).

About this version

Original Model: YOLOv5s by Ultralytics - Repository

Optimization/conversion: Arm-Optimized version for execution on Arm-based platforms.

Converted/optimized by: Arm

License: The Original Model and the Optimized Model are subject to AGPL-3.0.

This repository contains a converted or optimized version of the Original Model (the “Optimized Model”). The Original Model has been converted or optimized as described above for execution on Arm-based platforms.

No retraining or fine-tuning of the Original Model was performed as part of the conversion or optimization. The conversion or optimization was not intended to change the Original Model’s behavior or intended use.

Original Model and Documentation

For information about the Original Model, including its development, training data, intended uses, limitations and other relevant information, please refer to the Original Model repository. Information in that repository was provided by the original developer or other third parties and, unless expressly stated otherwise, has not been independently verified by Arm.

Licenses and Third-Party Terms

Use of the Original Model and the Optimized Model is subject to the applicable licenses, usage restrictions and other terms identified above and in the relevant repositories. Publication of the Optimized Model does not grant any rights beyond those provided under the applicable license terms.

You are responsible for reviewing those terms and ensuring that your use of the Original Model and the Optimized Model is permitted.

Purpose of this Release

The Optimized Model is provided as a reference implementation to demonstrate and evaluate execution and performance on Arm-based systems. It is not a production-ready or supported solution.

Arm’s publication of the Optimized Model does not constitute an endorsement or certification of the Original Model or a representation that the Optimized Model is suitable for production use or any particular purpose.

To the fullest extent permitted by applicable law (i) the Optimized Model is provided “as is.” Arm makes no representations or warranties that the Original Model, the Optimized Model or their outputs are accurate, safe, secure, non-infringing, legally compliant, suitable for production use or fit for any particular purpose; and (ii) Arm will not be liable for any loss or damage arising from or in connection with the Optimized Model, its use or its outputs.

You are responsible for independently evaluating the Optimized Model, its outputs and its suitability for your intended use, including compliance with applicable legal, regulatory, safety and security requirements.

Arm does not commit to provide ongoing support, maintenance or updates for the Optimized Model. Any use of or reliance on the Optimized Model or its outputs is at your own risk.

Use of Ultralytics models

Ultralytics provides Ultralytics YOLO software and models available through the Arm AI Portal and/or Arm's Hugging Face Organization under the GNU Affero General Public License v3.0 ("AGPL-3.0"), unless you have entered into a separate written license agreement with Ultralytics. Accessing, downloading, or retraining these materials through Arm AI Portal does not grant you an Ultralytics Enterprise License or any other proprietary Ultralytics license.

AGPL-3.0 requires you to release the complete source code of any application that uses Ultralytics YOLO, including applications made available over a network, under the same license. If you are embedding YOLO in a commercial product, internal tool, or production deployment and cannot open-source your code, you need an Ultralytics Enterprise License.

You are responsible for determining which applies to your use. Terms and enterprise licensing options are available at ultralytics.com.

Downloads last month
21
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Arm/yolov5s-int8-xnnpack-executorch

Quantized
(33)
this model

Collection including Arm/yolov5s-int8-xnnpack-executorch