Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ The diagram below illustrates the RPS application architecture. During algorithm
1. [Create the input interface](./Documentation/README.md#input-interface-and-signal-conditioning), add signal conditioning, and start capturing data for ML model training.
2. [Select an ML model](./Documentation/README.md#create-ml-model), then use the captured data for training, analysis, and creation of the optimized ML model.
3. [Integrate the ML model](./Documentation/README.md#integrate-ml-model) into the SDS framework and analyze performance.
4. Configure `OUTPUT_PREDICTION_METADATA` based on your workflow:

**Configuration file:**
`RockPaperScissors/AppKit-E8_USB/algorithm/AlgorithmTest.cproject.yml`
- Set `OUTPUT_PREDICTION_METADATA = 0` to view the generated `.sds` files using the Arm SDS VS Code extension.
- Set `OUTPUT_PREDICTION_METADATA = 1` to enable live inference streaming in Fusion Studio, which parses the prediction metadata (predicted class label, confidence score, and class index) to render overlayed frames.
> [!Note]
>
> By default, `OUTPUT_PREDICTION_METADATA` is set to `0`

**Test Embedded Application:**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ project:
- ET_DEBUG_BUFFER_SIZE: 0x8000
- USE_PERFORMANCE_MONITOR
- USE_SEGGER_SYSVIEW
- OUTPUT_PREDICTION_METADATA: 0

setups:
- setup: Scratch pool for non-simulator
Expand Down
7 changes: 5 additions & 2 deletions RockPaperScissors/AppKit-E8_USB/algorithm/algorithm_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@
#define ALGO_DATA_IN_BLOCK_SIZE (ML_IMAGE_WIDTH * ML_IMAGE_HEIGHT * 3U)
#endif

// Output Data block size, in bytes
#ifndef ALGO_DATA_OUT_BLOCK_SIZE
#define ALGO_DATA_OUT_BLOCK_SIZE (MODEL_NUM_CLASSES * sizeof(float))
#if defined(OUTPUT_PREDICTION_METADATA) && OUTPUT_PREDICTION_METADATA
#define ALGO_DATA_OUT_BLOCK_SIZE (120U)
#else
#define ALGO_DATA_OUT_BLOCK_SIZE (MODEL_NUM_CLASSES * sizeof(float))
#endif
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -953,9 +953,15 @@ void postprocess(RunnerContext& ctx, uint8_t* img_buf,
print_outputs(ctx);

/* Copy shortened label plus confidence into caller's output buffer */
#if OUTPUT_PREDICTION_METADATA
if (out_num >= sizeof(output_label_t)) {
memcpy(out_buf, &output_label, sizeof(output_label));
}
#else
if (out_num >= sizeof(class_probs)) {
memcpy(out_buf, class_probs, sizeof(class_probs));
}
#endif

/* Only draw if label is valid */
if (output_label.label_name[0] != '\0')
Expand Down