From e3ff0defdd75c04c8289551f9979ae7cd713b09e Mon Sep 17 00:00:00 2001 From: chenyx113 Date: Tue, 11 Mar 2025 20:51:12 +0800 Subject: [PATCH 1/4] [tools/onnx-subgraph] add guide in README.md for subgraphs verification guide for mse comparing of src model and multi sub models ONE-DCO-1.0-Signed-off-by: Youxin Chen --- tools/onnx_subgraph/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/onnx_subgraph/README.md b/tools/onnx_subgraph/README.md index b3b3ae67acd..3b2653bcd84 100644 --- a/tools/onnx_subgraph/README.md +++ b/tools/onnx_subgraph/README.md @@ -60,3 +60,18 @@ sub models. ├── NPUsubgraph0.onnx └── NPUsubgraph1.onnx ``` +## Verify the subgraphs inference with original model file + compare the MSE of original inference result and subgraphs inference result +```bash + python scripts/single_vs_multiple_onnx.py \ + -s ./resnet-test.onnx \ + -m ./subgraphs/ \ + -n scripts/subgraphs_ios.txt +``` + output: +```bash + Single model inference completed! + Multiple subgraph inference completed! + Comparing inference results between single ONNX model and multiple subgraphs... + Output '316' MSE: 5.125894080395578e-14 +``` From 86ee7af77ca48299ea33793c3824843039355d8e Mon Sep 17 00:00:00 2001 From: chenyx113 Date: Wed, 12 Mar 2025 09:02:44 +0800 Subject: [PATCH 2/4] Update README.md update as code review --- tools/onnx_subgraph/README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/onnx_subgraph/README.md b/tools/onnx_subgraph/README.md index 3b2653bcd84..e461a657178 100644 --- a/tools/onnx_subgraph/README.md +++ b/tools/onnx_subgraph/README.md @@ -61,17 +61,15 @@ sub models. └── NPUsubgraph1.onnx ``` ## Verify the subgraphs inference with original model file - compare the MSE of original inference result and subgraphs inference result +compare the MSE of original inference result and subgraphs inference result ```bash python scripts/single_vs_multiple_onnx.py \ -s ./resnet-test.onnx \ -m ./subgraphs/ \ -n scripts/subgraphs_ios.txt ``` - output: -```bash - Single model inference completed! - Multiple subgraph inference completed! - Comparing inference results between single ONNX model and multiple subgraphs... - Output '316' MSE: 5.125894080395578e-14 -``` +output: +Single model inference completed! +Multiple subgraph inference completed! +Comparing inference results between single ONNX model and multiple subgraphs... +Output '316' MSE: 5.125894080395578e-14 From f88b1f6712783ac8d16874796dc27d97c6442208 Mon Sep 17 00:00:00 2001 From: chenyx113 Date: Wed, 12 Mar 2025 09:05:11 +0800 Subject: [PATCH 3/4] Update README.md update as code review --- tools/onnx_subgraph/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/onnx_subgraph/README.md b/tools/onnx_subgraph/README.md index e461a657178..7ce3c9b3cf1 100644 --- a/tools/onnx_subgraph/README.md +++ b/tools/onnx_subgraph/README.md @@ -68,8 +68,8 @@ compare the MSE of original inference result and subgraphs inference result -m ./subgraphs/ \ -n scripts/subgraphs_ios.txt ``` -output: -Single model inference completed! -Multiple subgraph inference completed! -Comparing inference results between single ONNX model and multiple subgraphs... +output: \ +Single model inference completed! \ +Multiple subgraph inference completed! \ +Comparing inference results between single ONNX model and multiple subgraphs... \ Output '316' MSE: 5.125894080395578e-14 From e215daab367bb531dde9eec971306a9732c8c80a Mon Sep 17 00:00:00 2001 From: chenyx113 Date: Wed, 12 Mar 2025 09:18:47 +0800 Subject: [PATCH 4/4] Update README.md annotate for the shell printing --- tools/onnx_subgraph/README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/onnx_subgraph/README.md b/tools/onnx_subgraph/README.md index 7ce3c9b3cf1..a8f857b0965 100644 --- a/tools/onnx_subgraph/README.md +++ b/tools/onnx_subgraph/README.md @@ -68,8 +68,10 @@ compare the MSE of original inference result and subgraphs inference result -m ./subgraphs/ \ -n scripts/subgraphs_ios.txt ``` -output: \ -Single model inference completed! \ -Multiple subgraph inference completed! \ -Comparing inference results between single ONNX model and multiple subgraphs... \ -Output '316' MSE: 5.125894080395578e-14 +output: +```bash + Single model inference completed! + Multiple subgraph inference completed! + Comparing inference results between single ONNX model and multiple subgraphs... + Output '316' MSE: 5.125894080395578e-14 +```