Skip to content

Commit ef7e9cf

Browse files
marc0oloclaude
andcommitted
docs(rust/face-recognition): document benchmarking.rs purpose and improve module comment
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 09d7999 commit ef7e9cf

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

rust/face-recognition/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This example demonstrates running face detection and face recognition inside an
44

55
The example consists of two canisters:
66

7-
- **backend** — embeds the Tract ONNX inference engine. Exposes endpoints for uploading ONNX model files in chunks, loading them into memory, detecting faces, computing face embeddings, and recognizing people.
7+
- **backend** — embeds the Tract ONNX inference engine. Exposes endpoints for uploading ONNX model files in chunks, loading them into memory, detecting faces, computing face embeddings, and recognizing people. Also exposes `run_detection` and `run_recognition` which run the models against a built-in test image and print the IC instruction count — useful for smoke-testing and capacity planning.
88
- **frontend** — serves the web UI (HTML/JS/CSS).
99

1010
## Models

rust/face-recognition/backend/src/benchmarking.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
// The code below is used for testing and benchmarking.
1+
// Benchmarking and smoke-test endpoints.
2+
//
3+
// run_detection() and run_recognition() run the respective models against a
4+
// hardcoded test image embedded in the Wasm binary. They print the IC instruction
5+
// count so you can measure the computational cost of each inference call.
6+
//
7+
// run_detection is a query (fast, single-node execution).
8+
// run_recognition is an update (replicated execution, consistent with recognize()).
29

310
use crate::{onnx, Detection, Error, Recognition};
411

512
const IMAGE: &'static [u8] = include_bytes!("../assets/image.png");
613

7-
/// Formats thousands for the specified `u64` integer (helper function).
14+
/// Formats a u64 with thousands separators, e.g. 1_234_567.
815
fn fmt(n: u64) -> String {
916
n.to_string()
1017
.as_bytes()

0 commit comments

Comments
 (0)