hilaus-arm commited on
Commit
36d3072
·
verified ·
1 Parent(s): e0976c1

Generate model weights locally

Browse files

Remove the converted model binary from the repository. Download and verify the official YOLO26n checkpoint, then generate the benchmark artifact locally. Keep the AI Portal accuracy report aligned with the current coco-128-by-sa measurement.

README.md CHANGED
@@ -13,7 +13,7 @@ The runtime, converter, Python API, and Ultralytics adapter correspond to
13
  commit `9056a527deaf2adc6123f43424d07672753a9524` of
14
  [Arm-Runtime-for-YOLO26-on-Raspberry-Pi-5](https://github.com/arm/Arm-Runtime-for-YOLO26-on-Raspberry-Pi-5).
15
 
16
- ## Benchmark the supplied converted model
17
 
18
  Internet access is required during setup and while downloading the official
19
  YOLO26n checkpoint and the validation dataset. Authenticate with `hf auth
@@ -26,9 +26,10 @@ python3 repro.py benchmark
26
 
27
  `repro.py setup` installs Ultralytics 8.4.108 and applies the included patch
28
  that registers this runtime as an Ultralytics export format and inference
29
- backend. The benchmark therefore uses Ultralytics `benchmark()`, with an
30
- explicit integration patch because upstream Ultralytics does not natively know
31
- how to load this runtime.
 
32
 
33
  Before starting, the benchmark checks for filesystem and memory conditions
34
  that could distort performance, including RAM-backed model or dataset paths,
@@ -55,9 +56,10 @@ python3 repro.py benchmark
55
 
56
  Export creates a runnable model directory under
57
  `build/arm_yolo26n_pi5_model/`. Benchmark automatically selects it and checks
58
- that the source checkpoint matches the converted model. No PyTorch checkpoint
59
- is distributed in this repository; the stock benchmark downloads and verifies
60
- the official checkpoint when needed.
 
61
 
62
  ## About this version
63
 
 
13
  commit `9056a527deaf2adc6123f43424d07672753a9524` of
14
  [Arm-Runtime-for-YOLO26-on-Raspberry-Pi-5](https://github.com/arm/Arm-Runtime-for-YOLO26-on-Raspberry-Pi-5).
15
 
16
+ ## Benchmark the standard model
17
 
18
  Internet access is required during setup and while downloading the official
19
  YOLO26n checkpoint and the validation dataset. Authenticate with `hf auth
 
26
 
27
  `repro.py setup` installs Ultralytics 8.4.108 and applies the included patch
28
  that registers this runtime as an Ultralytics export format and inference
29
+ backend. On its first run, the benchmark downloads the verified official
30
+ YOLO26n checkpoint and converts it locally under `build/`. It then uses
31
+ Ultralytics `benchmark()`, with an explicit integration patch because upstream
32
+ Ultralytics does not natively know how to load this runtime.
33
 
34
  Before starting, the benchmark checks for filesystem and memory conditions
35
  that could distort performance, including RAM-backed model or dataset paths,
 
56
 
57
  Export creates a runnable model directory under
58
  `build/arm_yolo26n_pi5_model/`. Benchmark automatically selects it and checks
59
+ that the source checkpoint matches the converted model. Neither a PyTorch
60
+ checkpoint nor converted model weights are distributed in this repository;
61
+ the stock benchmark downloads, verifies, and converts the official checkpoint
62
+ when needed.
63
 
64
  ## About this version
65
 
metadata.yaml CHANGED
@@ -2,10 +2,10 @@ schema_version: 1.0.0
2
  report_type: vision-detection
3
  task_type: object-detection
4
  title: YOLO26n for Raspberry Pi 5
5
- description: An Arm-optimized YOLO26n object-detection model for CPU inference on Raspberry Pi 5 using the project-specific Arm Runtime.
6
  family_name: YOLO26
7
  id: Arm/Arm-Runtime-for-YOLO26-on-Raspberry-Pi-5
8
- filename: runtime/arm_yolo26n_pi5_model/model/model.bin
9
  base_model_id: yolo26n
10
  vendor: Ultralytics
11
  base_model_url: https://docs.ultralytics.com/models/yolo26/
 
2
  report_type: vision-detection
3
  task_type: object-detection
4
  title: YOLO26n for Raspberry Pi 5
5
+ description: An Arm-optimized YOLO26n object-detection model generated locally for CPU inference on Raspberry Pi 5 using the project-specific Arm Runtime.
6
  family_name: YOLO26
7
  id: Arm/Arm-Runtime-for-YOLO26-on-Raspberry-Pi-5
8
+ filename: build/arm_yolo26n_pi5_model/model/model.bin
9
  base_model_id: yolo26n
10
  vendor: Ultralytics
11
  base_model_url: https://docs.ultralytics.com/models/yolo26/
model/README.md CHANGED
@@ -4,3 +4,4 @@ To export another compatible YOLO26n model, place its checkpoint here as
4
  `yolo26n.pt`, then run `python3 repro.py export` from the repository root.
5
 
6
  No PyTorch checkpoint is distributed in this repository.
 
 
4
  `yolo26n.pt`, then run `python3 repro.py export` from the repository root.
5
 
6
  No PyTorch checkpoint is distributed in this repository.
7
+ Converted model weights are also generated locally and are not distributed.
repro.py CHANGED
@@ -30,7 +30,7 @@ STOCK_CHECKPOINT_SHA256 = (
30
  "9b09cc8bf347f0fc8a5f7657480587f25db09b34bf33b0652110fb03a8ad4fef"
31
  )
32
  STOCK_CHECKPOINT = ROOT / "downloads/yolo26n.pt"
33
- SUPPLIED_MODEL = ROOT / "runtime/arm_yolo26n_pi5_model"
34
  EXPORTED_MODEL = ROOT / "build/arm_yolo26n_pi5_model"
35
 
36
 
@@ -144,9 +144,9 @@ def ensure_stock_checkpoint() -> Path:
144
  return STOCK_CHECKPOINT
145
 
146
 
147
- def export_model() -> None:
148
  python = VENV / "bin/python"
149
- checkpoint = ROOT / "model/yolo26n.pt"
150
  if not python.is_file():
151
  raise SystemExit("run 'python3 repro.py setup' first")
152
  if not checkpoint.is_file():
@@ -176,7 +176,7 @@ def export_model() -> None:
176
  env=environment,
177
  )
178
  assembled = temporary / EXPORTED_MODEL.name
179
- shutil.copytree(SUPPLIED_MODEL, assembled)
180
  shutil.rmtree(assembled / "model")
181
  shutil.copytree(converted_model, assembled / "model")
182
  assembled.rename(EXPORTED_MODEL)
@@ -293,10 +293,13 @@ def benchmark() -> None:
293
  raise SystemExit("run 'python3 repro.py setup' first")
294
  dataset_yaml = ensure_dataset(python)
295
 
296
- model = EXPORTED_MODEL if EXPORTED_MODEL.is_dir() else SUPPLIED_MODEL
297
- checkpoint = ROOT / "model/yolo26n.pt" if model == EXPORTED_MODEL else ensure_stock_checkpoint()
298
- if not checkpoint.is_file():
299
- raise SystemExit("the exported model requires its source checkpoint at model/yolo26n.pt")
 
 
 
300
  preflight((model.resolve(), DATASET_DIR.resolve()))
301
 
302
  governor = Path("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor")
 
30
  "9b09cc8bf347f0fc8a5f7657480587f25db09b34bf33b0652110fb03a8ad4fef"
31
  )
32
  STOCK_CHECKPOINT = ROOT / "downloads/yolo26n.pt"
33
+ RUNTIME_TEMPLATE = ROOT / "runtime/arm_yolo26n_pi5_model"
34
  EXPORTED_MODEL = ROOT / "build/arm_yolo26n_pi5_model"
35
 
36
 
 
144
  return STOCK_CHECKPOINT
145
 
146
 
147
+ def export_model(checkpoint: Path | None = None) -> None:
148
  python = VENV / "bin/python"
149
+ checkpoint = checkpoint or ROOT / "model/yolo26n.pt"
150
  if not python.is_file():
151
  raise SystemExit("run 'python3 repro.py setup' first")
152
  if not checkpoint.is_file():
 
176
  env=environment,
177
  )
178
  assembled = temporary / EXPORTED_MODEL.name
179
+ shutil.copytree(RUNTIME_TEMPLATE, assembled)
180
  shutil.rmtree(assembled / "model")
181
  shutil.copytree(converted_model, assembled / "model")
182
  assembled.rename(EXPORTED_MODEL)
 
293
  raise SystemExit("run 'python3 repro.py setup' first")
294
  dataset_yaml = ensure_dataset(python)
295
 
296
+ custom_checkpoint = ROOT / "model/yolo26n.pt"
297
+ if EXPORTED_MODEL.is_dir():
298
+ checkpoint = custom_checkpoint if custom_checkpoint.is_file() else ensure_stock_checkpoint()
299
+ else:
300
+ checkpoint = ensure_stock_checkpoint()
301
+ export_model(checkpoint)
302
+ model = EXPORTED_MODEL
303
  preflight((model.resolve(), DATASET_DIR.resolve()))
304
 
305
  governor = Path("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor")
results/REFERENCE.md CHANGED
@@ -21,6 +21,6 @@ writeback data, no refaults or reclaim scans, and no swap activity. The model
21
  and dataset were on ext4. The CPU governor was `ondemand`, and the device
22
  reported no throttling (`0x0`).
23
 
24
- The export path was also verified with the same stock checkpoint. It reproduced
25
- the packaged `model.bin` byte-for-byte and completed the benchmark with the same
26
- 0.4866 mAP50-95 result.
 
21
  and dataset were on ext4. The CPU governor was `ondemand`, and the device
22
  reported no throttling (`0x0`).
23
 
24
+ The local export path was verified with the same stock checkpoint and completed
25
+ the benchmark with the same 0.4866 mAP50-95 result. Converted model weights are
26
+ not distributed in this repository.
runtime/arm_yolo26n_pi5_model/model/model.bin DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:031991352d4c1bcca4ad5b6f7023b6e3d66bdf896b476c66b851b1a29c5bdaff
3
- size 9640064