UGREENDEV commited on
Commit
8ebb7a3
·
verified ·
1 Parent(s): 1aa06cf

Mirror RKNNAI/RK182X-CNN-ResNet50V2@55342e91b0a9 (main)

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ ResNet50V2-224x224-w8a8-1/ResNet50V2.rknn filter=lfs diff=lfs merge=lfs -text
37
+ ResNet50V2-224x224-w8a8-1/ResNet50V2.weight filter=lfs diff=lfs merge=lfs -text
38
+ ResNet50V2-224x224-w8a8-1/resnet50-v2-7.rknn filter=lfs diff=lfs merge=lfs -text
39
+ ResNet50V2-224x224-w8a8-1/resnet50-v2-7.weight filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Source model: onnx/models
2
+ Source URL: https://github.com/onnx/models/tree/main/validated/vision/classification/resnet
3
+ Source artifact: resnet50-v2-7.onnx
4
+ Source artifact SHA-256: 868b9232278efd4da8f10b9a99070eeaa983cd32ffbb2883b111219114242bb1
5
+ Source revision: not recoverable from conversion records
6
+ Source license: Apache License 2.0
7
+
8
+ The files in this repository are RKNN-converted derivatives, not unmodified upstream weights.
9
+ Conversion and validation date: 2026-09-29.
README.md ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: "apache-2.0"
3
+ ---
4
+ # ResNet50V2
5
+
6
+ [English](README.md) | [简体中文](README_CN.md)
7
+
8
+ ## 1. Model Introduction
9
+
10
+ ResNet50V2 is a 50-layer residual neural network for ImageNet image classification with 1,000 output classes. This repository provides RKNN deployment artifacts.
11
+
12
+ | Field | Value |
13
+ | --- | --- |
14
+ | Model ID | `UGREENDEV/RK182X-CNN-ResNet50V2` |
15
+ | Display Name | `RK182X-CNN-ResNet50V2` |
16
+ | Source Model | `https://github.com/onnx/models/tree/main/validated/vision/classification/resnet` |
17
+ | Model Type | CNN |
18
+
19
+ ### Available Models
20
+
21
+ | Configuration | Supported Chips | RKNN Runtime Version | Quantization | NPU Cores | Resolution |
22
+ | --- | --- | --- | --- | --- | --- |
23
+ | [ResNet50V2-224x224-w8a8-1](ResNet50V2-224x224-w8a8-1/README.md) | RK1820, RK1828 | - | w8a8 | 1 | 224x224 |
24
+
25
+ ## 2. Files
26
+
27
+ | Path | Description |
28
+ | --- | --- |
29
+ | `README.md` | English documentation |
30
+ | `README_CN.md` | Chinese documentation |
31
+ | `LICENSE` | License |
32
+ | `ResNet50V2-224x224-w8a8-1/` | Deployment configuration |
33
+
34
+ ## 3. Download
35
+
36
+ ### ModelScope
37
+
38
+ Full repository:
39
+
40
+ ```bash
41
+ modelscope download --model UGREENDEV/RK182X-CNN-ResNet50V2 --revision master --local_dir ./RK182X-CNN-ResNet50V2
42
+ ```
43
+
44
+ Selected configuration and root documents:
45
+
46
+ ```python
47
+ from modelscope import snapshot_download
48
+
49
+ snapshot_download(
50
+ "UGREENDEV/RK182X-CNN-ResNet50V2",
51
+ revision="master",
52
+ allow_patterns=["README.md", "README_CN.md", "LICENSE", "ResNet50V2-224x224-w8a8-1/**"],
53
+ local_dir="./RK182X-CNN-ResNet50V2",
54
+ )
55
+ ```
56
+
57
+ ### Hugging Face
58
+
59
+ Full repository:
60
+
61
+ ```bash
62
+ hf download UGREENDEV/RK182X-CNN-ResNet50V2 --revision v1.2.0 --local-dir ./RK182X-CNN-ResNet50V2
63
+ ```
64
+
65
+ Selected configuration and root documents:
66
+
67
+ ```bash
68
+ hf download UGREENDEV/RK182X-CNN-ResNet50V2 --revision v1.2.0 --local-dir ./RK182X-CNN-ResNet50V2 --include README.md README_CN.md LICENSE 'ResNet50V2-224x224-w8a8-1/**'
69
+ ```
70
+
71
+ ## 4. SHA-256 Verification
72
+
73
+ From the directory where you ran the download command, enter the configuration directory and verify:
74
+
75
+ ```bash
76
+ cd ./RK182X-CNN-ResNet50V2/ResNet50V2-224x224-w8a8-1
77
+ sha256sum -c SHA256SUMS
78
+ ```
79
+
80
+ All entries must report `OK` before deployment.
81
+
82
+ ## 5. Compatibility and Limitations
83
+
84
+ - Supported chips are listed per configuration above.
85
+ - Use the matching files from the same configuration.
86
+
87
+ ## 6. Copyright and License
88
+
89
+ The upstream ONNX ResNet model is distributed under Apache License 2.0. See [LICENSE](LICENSE) and the [upstream model documentation](https://github.com/onnx/models/blob/main/validated/vision/classification/resnet/README.md#license). These deployment artifacts were converted from resnet50-v2-7.onnx and quantized to W8A8.
README_CN.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ResNet50V2
2
+
3
+ [English](README.md) | [简体中文](README_CN.md)
4
+
5
+ ## 1. 模型介绍
6
+
7
+ ResNet50V2 是用于 ImageNet 图像分类的 50 层残差神经网络,输出 1,000 个类别。本仓库提供 RKNN 部署文件。
8
+
9
+ | 字段 | 内容 |
10
+ | --- | --- |
11
+ | Model ID | `UGREENDEV/RK182X-CNN-ResNet50V2` |
12
+ | 模型显示名 | `RK182X-CNN-ResNet50V2` |
13
+ | 源模型 | `https://github.com/onnx/models/tree/main/validated/vision/classification/resnet` |
14
+ | 模型类型 | CNN |
15
+
16
+ ### 可用模型
17
+
18
+ | 配置 | 支持芯片 | RKNN Runtime 版本 | 量化 | 核数 | 分辨率 |
19
+ | --- | --- | --- | --- | --- | --- |
20
+ | [ResNet50V2-224x224-w8a8-1](ResNet50V2-224x224-w8a8-1/README_CN.md) | RK1820, RK1828 | - | w8a8 | 1 | 224x224 |
21
+
22
+ ## 2. 文件说明
23
+
24
+ | 路径 | 说明 |
25
+ | --- | --- |
26
+ | `README.md` | 英文文档 |
27
+ | `README_CN.md` | 中文文档 |
28
+ | `LICENSE` | 许可证 |
29
+ | `ResNet50V2-224x224-w8a8-1/` | 部署配置 |
30
+
31
+ ## 3. 模型下载
32
+
33
+ ### ModelScope
34
+
35
+ 完整仓库:
36
+
37
+ ```bash
38
+ modelscope download --model UGREENDEV/RK182X-CNN-ResNet50V2 --revision master --local_dir ./RK182X-CNN-ResNet50V2
39
+ ```
40
+
41
+ 当前配置及根文档:
42
+
43
+ ```python
44
+ from modelscope import snapshot_download
45
+
46
+ snapshot_download(
47
+ "UGREENDEV/RK182X-CNN-ResNet50V2",
48
+ revision="master",
49
+ allow_patterns=["README.md", "README_CN.md", "LICENSE", "ResNet50V2-224x224-w8a8-1/**"],
50
+ local_dir="./RK182X-CNN-ResNet50V2",
51
+ )
52
+ ```
53
+
54
+ ### Hugging Face
55
+
56
+ 完整仓库:
57
+
58
+ ```bash
59
+ hf download UGREENDEV/RK182X-CNN-ResNet50V2 --revision v1.2.0 --local-dir ./RK182X-CNN-ResNet50V2
60
+ ```
61
+
62
+ 当前配置及根文档:
63
+
64
+ ```bash
65
+ hf download UGREENDEV/RK182X-CNN-ResNet50V2 --revision v1.2.0 --local-dir ./RK182X-CNN-ResNet50V2 --include README.md README_CN.md LICENSE 'ResNet50V2-224x224-w8a8-1/**'
66
+ ```
67
+
68
+ ## 4. SHA-256 校验
69
+
70
+ 从执行下载命令的目录进入配置目录并校验:
71
+
72
+ ```bash
73
+ cd ./RK182X-CNN-ResNet50V2/ResNet50V2-224x224-w8a8-1
74
+ sha256sum -c SHA256SUMS
75
+ ```
76
+
77
+ 所有条目显示 `OK` 后再部署。
78
+
79
+ ## 5. 兼容性与限制
80
+
81
+ - 支持芯片见上方各配置。
82
+ - 使用同一配置内的配套文件。
83
+
84
+ ## 6. 版权与许可证
85
+
86
+ 上游 ONNX ResNet 模型采用 Apache License 2.0,详见 [LICENSE](LICENSE) 和[上游模型文档](https://github.com/onnx/models/blob/main/validated/vision/classification/resnet/README.md#license)。本部署模型由 resnet50-v2-7.onnx 转换,并进行了 W8A8 量化。
ResNet50V2-224x224-w8a8-1/README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ResNet50V2-224x224-w8a8-1
2
+
3
+ [English](README.md) | [简体中文](README_CN.md) · [Model Overview](../README.md)
4
+
5
+ ## Configuration
6
+
7
+ | Field | Value |
8
+ | --- | --- |
9
+ | Model ID | `UGREENDEV/RK182X-CNN-ResNet50V2` |
10
+ | Display Name | `RK182X-CNN-ResNet50V2` |
11
+ | Configuration Path | `ResNet50V2-224x224-w8a8-1` |
12
+ | RKNN Runtime Version | - |
13
+ | Source Model | `https://github.com/onnx/models/tree/main/validated/vision/classification/resnet` |
14
+ | Source Revision | - |
15
+ | Chip Label | RK182X |
16
+ | Supported Chips | RK1820, RK1828 |
17
+ | Model Type | CNN |
18
+ | Quantization | w8a8 |
19
+ | Algorithm | normal |
20
+ | NPU Cores | 1 |
21
+ | Resolution | 224x224 |
22
+ | Validation Date | - |
23
+
24
+ ## Files
25
+
26
+ | Path | Description |
27
+ | --- | --- |
28
+ | `README.md` | English documentation |
29
+ | `README_CN.md` | Chinese documentation |
30
+ | `ResNet50V2.rknn` | RKNN model |
31
+ | `ResNet50V2.weight` | Model weights |
32
+ | `ResNet50V2_report.html` | Compilation report |
33
+ | `SHA256SUMS` | SHA-256 checksums |
34
+ | `config.json` | Model configuration and file list |
35
+
36
+ ## Download
37
+
38
+ ### ModelScope
39
+
40
+ ```python
41
+ from modelscope import snapshot_download
42
+
43
+ snapshot_download(
44
+ "UGREENDEV/RK182X-CNN-ResNet50V2",
45
+ revision="master",
46
+ allow_patterns=["README.md", "README_CN.md", "LICENSE", "ResNet50V2-224x224-w8a8-1/**"],
47
+ local_dir="./RK182X-CNN-ResNet50V2",
48
+ )
49
+ ```
50
+
51
+ ### Hugging Face
52
+
53
+ ```bash
54
+ hf download UGREENDEV/RK182X-CNN-ResNet50V2 --revision v1.2.0 --local-dir ./RK182X-CNN-ResNet50V2 --include README.md README_CN.md LICENSE 'ResNet50V2-224x224-w8a8-1/**'
55
+ ```
56
+
57
+ ## Verification
58
+
59
+ From the directory where you ran the download command, enter the configuration directory and verify:
60
+
61
+ ```bash
62
+ cd ./RK182X-CNN-ResNet50V2/ResNet50V2-224x224-w8a8-1
63
+ sha256sum -c SHA256SUMS
64
+ ```
65
+
66
+ All entries must report `OK` before deployment.
67
+
68
+ ## Limitations
69
+
70
+ - Supported chips: RK1820, RK1828
71
+ - Use the matching files from this configuration.
72
+
73
+ ## Copyright and License
74
+
75
+ See [Copyright and License](../README.md#6-copyright-and-license).
ResNet50V2-224x224-w8a8-1/README_CN.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ResNet50V2-224x224-w8a8-1
2
+
3
+ [English](README.md) | [简体中文](README_CN.md) · [模型主页](../README_CN.md)
4
+
5
+ ## 配置
6
+
7
+ | 字段 | 内容 |
8
+ | --- | --- |
9
+ | Model ID | `UGREENDEV/RK182X-CNN-ResNet50V2` |
10
+ | 模型显示名 | `RK182X-CNN-ResNet50V2` |
11
+ | 配置路径 | `ResNet50V2-224x224-w8a8-1` |
12
+ | RKNN Runtime 版本 | - |
13
+ | 源模型 | `https://github.com/onnx/models/tree/main/validated/vision/classification/resnet` |
14
+ | 源版本 | - |
15
+ | 芯片标签 | RK182X |
16
+ | 支持芯片 | RK1820, RK1828 |
17
+ | 模型类型 | CNN |
18
+ | 量化 | w8a8 |
19
+ | 量化算法 | normal |
20
+ | 核数 | 1 |
21
+ | 分辨率 | 224x224 |
22
+ | 验证日期 | - |
23
+
24
+ ## 文件列表
25
+
26
+ | 路径 | 说明 |
27
+ | --- | --- |
28
+ | `README.md` | 英文文档 |
29
+ | `README_CN.md` | 中文文档 |
30
+ | `ResNet50V2.rknn` | RKNN 模型 |
31
+ | `ResNet50V2.weight` | 模型权重 |
32
+ | `ResNet50V2_report.html` | 模型编译报告 |
33
+ | `SHA256SUMS` | SHA-256 校验清单 |
34
+ | `config.json` | 模型配置与文件清单 |
35
+
36
+ ## 下载
37
+
38
+ ### ModelScope
39
+
40
+ ```python
41
+ from modelscope import snapshot_download
42
+
43
+ snapshot_download(
44
+ "UGREENDEV/RK182X-CNN-ResNet50V2",
45
+ revision="master",
46
+ allow_patterns=["README.md", "README_CN.md", "LICENSE", "ResNet50V2-224x224-w8a8-1/**"],
47
+ local_dir="./RK182X-CNN-ResNet50V2",
48
+ )
49
+ ```
50
+
51
+ ### Hugging Face
52
+
53
+ ```bash
54
+ hf download UGREENDEV/RK182X-CNN-ResNet50V2 --revision v1.2.0 --local-dir ./RK182X-CNN-ResNet50V2 --include README.md README_CN.md LICENSE 'ResNet50V2-224x224-w8a8-1/**'
55
+ ```
56
+
57
+ ## 校验
58
+
59
+ 从执行下载命令的目录进入配置目录并校验:
60
+
61
+ ```bash
62
+ cd ./RK182X-CNN-ResNet50V2/ResNet50V2-224x224-w8a8-1
63
+ sha256sum -c SHA256SUMS
64
+ ```
65
+
66
+ 所有条目显示 `OK` 后再部署。
67
+
68
+ ## 限制
69
+
70
+ - 支持芯片:RK1820, RK1828
71
+ - 使用本配置内的配套文件。
72
+
73
+ ## 版权与许可证
74
+
75
+ 见[版权与许可证](../README_CN.md#6-版权与许可证)。
ResNet50V2-224x224-w8a8-1/ResNet50V2-model_report.html ADDED
@@ -0,0 +1,1341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <title>RKNX Model Visualization</title>
6
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
7
+ <style>
8
+ .task-columns {
9
+ display: flex;
10
+ gap: 20px;
11
+ overflow-x: auto;
12
+ padding: 20px 0;
13
+ }
14
+
15
+ .task-column {
16
+ min-width: 300px;
17
+ flex: 0 0 auto;
18
+ border: 1px solid #dee2e6;
19
+ border-radius: 8px;
20
+ padding: 15px;
21
+ }
22
+
23
+ .column-header {
24
+ background: #f8f9fa;
25
+ padding: 10px;
26
+ margin: -15px -15px 15px -15px;
27
+ border-radius: 8px 8px 0 0;
28
+ border-bottom: 1px solid #dee2e6;
29
+ }
30
+
31
+ .task-card {
32
+ border: 1px solid #e9ecef;
33
+ border-radius: 4px;
34
+ margin-bottom: 10px;
35
+ padding: 10px;
36
+ }
37
+
38
+ .task-card:hover {
39
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
40
+ }
41
+
42
+ .task-header {
43
+ cursor: pointer;
44
+ display: flex;
45
+ justify-content: space-between;
46
+ align-items: center;
47
+ padding: 8px;
48
+ background: #f8f9fa;
49
+ border-radius: 4px;
50
+ }
51
+
52
+ .task-header:hover {
53
+ background: #e9ecef;
54
+ }
55
+
56
+ .task-content {
57
+ display: none;
58
+ padding: 10px;
59
+ margin-top: 10px;
60
+ border-top: 1px solid #e9ecef;
61
+ }
62
+
63
+ .expand-icon {
64
+ font-family: monospace;
65
+ font-weight: bold;
66
+ font-size: 16px;
67
+ color: #666;
68
+ width: 20px;
69
+ text-align: center;
70
+ }
71
+
72
+ .task-header:hover .expand-icon {
73
+ color: #333;
74
+ }
75
+
76
+ .task-basic-info {
77
+ flex-grow: 1;
78
+ margin-right: 10px;
79
+ }
80
+
81
+ .operator-preview {
82
+ color: #666;
83
+ font-size: 0.9em;
84
+ margin-top: 4px;
85
+ }
86
+
87
+ .section-header {
88
+ font-size: 0.9rem;
89
+ color: #666;
90
+ margin: 10px 0 5px;
91
+ padding-bottom: 3px;
92
+ border-bottom: 1px solid #eee;
93
+ }
94
+
95
+ .operator-list {
96
+ margin-left: 10px;
97
+ }
98
+
99
+ .operator-item {
100
+ padding: 3px 0;
101
+ font-size: 0.9rem;
102
+ }
103
+
104
+ .operator-header {
105
+ cursor: pointer;
106
+ display: flex;
107
+ align-items: center;
108
+ padding: 5px 0;
109
+ }
110
+
111
+ .operator-header:hover {
112
+ background: #f1f1f1;
113
+ }
114
+
115
+ .operator-expand-icon {
116
+ font-family: monospace;
117
+ font-weight: bold;
118
+ font-size: 14px;
119
+ color: #666;
120
+ width: 20px;
121
+ text-align: center;
122
+ margin-right: 8px;
123
+ }
124
+
125
+ .memory-columns {
126
+ display: flex;
127
+ gap: 20px;
128
+ overflow-x: auto;
129
+ padding: 20px 0;
130
+ }
131
+
132
+ .memory-column {
133
+ min-width: 300px;
134
+ flex: 0 0 auto;
135
+ border: 1px solid #dee2e6;
136
+ border-radius: 8px;
137
+ padding: 15px;
138
+ }
139
+
140
+ .memory-header {
141
+ background: #f8f9fa;
142
+ padding: 10px;
143
+ margin: -15px -15px 15px -15px;
144
+ border-radius: 8px 8px 0 0;
145
+ border-bottom: 1px solid #dee2e6;
146
+ }
147
+
148
+ .memory-content {
149
+ padding: 10px;
150
+ }
151
+
152
+ .memory-item {
153
+ margin-bottom: 8px;
154
+ }
155
+
156
+ .memory-item:last-child {
157
+ margin-bottom: 0;
158
+ }
159
+
160
+ .task-table {
161
+ width: 100%;
162
+ overflow-x: auto;
163
+ }
164
+
165
+ .task-table-header {
166
+ display: flex;
167
+ gap: 20px;
168
+ margin-bottom: 15px;
169
+ }
170
+
171
+ .task-column-header {
172
+ min-width: 300px;
173
+ flex: 1;
174
+ background: #f8f9fa;
175
+ padding: 12px;
176
+ border: 1px solid #dee2e6;
177
+ border-radius: 8px;
178
+ text-align: center;
179
+ }
180
+
181
+ .task-column-header h6 {
182
+ color: #495057;
183
+ margin-bottom: 4px;
184
+ }
185
+
186
+ .task-column-header small {
187
+ color: #6c757d;
188
+ }
189
+
190
+ .task-table-body {
191
+ display: flex;
192
+ flex-direction: column;
193
+ gap: 10px;
194
+ }
195
+
196
+ .task-row {
197
+ display: flex;
198
+ gap: 20px;
199
+ }
200
+
201
+ .task-cell {
202
+ min-width: 300px;
203
+ flex: 1;
204
+ padding: 5px;
205
+ border: 1px solid transparent;
206
+ }
207
+
208
+ .task-cell:empty {
209
+ border-color: #f8f9fa;
210
+ background: #fafafa;
211
+ border-radius: 4px;
212
+ }
213
+
214
+ .card-header[role="button"] {
215
+ cursor: pointer;
216
+ }
217
+
218
+ .card-header[role="button"]:hover {
219
+ background-color: #f8f9fa;
220
+ }
221
+
222
+ .collapse-icon {
223
+ font-family: monospace;
224
+ font-weight: bold;
225
+ font-size: 16px;
226
+ color: #666;
227
+ transition: transform 0.2s;
228
+ }
229
+
230
+ .list-unstyled {
231
+ margin-bottom: 0;
232
+ }
233
+
234
+ .tensor-header {
235
+ cursor: pointer;
236
+ padding: 8px;
237
+ background-color: #f8f9fa;
238
+ border-radius: 4px;
239
+ border: 1px solid #dee2e6;
240
+ }
241
+
242
+ .tensor-header:hover {
243
+ background-color: #e9ecef;
244
+ }
245
+
246
+ .tensor-details {
247
+ padding: 10px;
248
+ border: 1px solid #dee2e6;
249
+ border-top: none;
250
+ border-radius: 0 0 4px 4px;
251
+ background-color: #fff;
252
+ }
253
+
254
+ .collapse-icon {
255
+ font-family: monospace;
256
+ font-weight: bold;
257
+ font-size: 16px;
258
+ color: #666;
259
+ min-width: 20px;
260
+ text-align: center;
261
+ }
262
+
263
+ .list-unstyled li:last-child {
264
+ margin-bottom: 0 !important;
265
+ }
266
+
267
+ /* 基础样式 */
268
+ .info-group {
269
+ display: flex;
270
+ flex-direction: column;
271
+ gap: 0.5rem;
272
+ }
273
+
274
+ .info-item {
275
+ display: flex;
276
+ align-items: baseline;
277
+ padding: 0.5rem;
278
+ border-radius: 4px;
279
+ background-color: #f8f9fa;
280
+ }
281
+
282
+ .info-label {
283
+ font-weight: 600;
284
+ color: #495057;
285
+ min-width: 140px;
286
+ }
287
+
288
+ .info-value {
289
+ color: #212529;
290
+ }
291
+
292
+ /* 内部卡片样式 */
293
+ .inner-card {
294
+ box-shadow: none;
295
+ border: 1px solid rgba(0,0,0,.125);
296
+ }
297
+
298
+ .inner
299
+
300
+ .task-name {
301
+ font-size: 0.9em;
302
+ margin-top: 2px;
303
+ margin-bottom: 4px;
304
+ color: #666;
305
+ word-break: break-word;
306
+ }
307
+
308
+ .task-onnx-link {
309
+ margin-top: 5px;
310
+ }
311
+
312
+ .task-onnx-link button {
313
+ font-size: 0.8em;
314
+ padding: 2px 8px;
315
+ }
316
+
317
+ .task-info {
318
+ background-color: #f8f9fa;
319
+ padding: 10px;
320
+ border-radius: 4px;
321
+ font-size: 0.9em;
322
+ }
323
+
324
+ .task-info > div {
325
+ margin-bottom: 4px;
326
+ }
327
+
328
+ .task-info > div:last-child {
329
+ margin-bottom: 0;
330
+ }
331
+
332
+ .task-name-section {
333
+ border: 1px solid #dee2e6;
334
+ border-radius: 4px;
335
+ overflow: hidden;
336
+ }
337
+
338
+ .task-name-header {
339
+ padding: 8px;
340
+ background-color: #f8f9fa;
341
+ cursor: pointer;
342
+ display: flex;
343
+ align-items: center;
344
+ user-select: none;
345
+ }
346
+
347
+ .task-name-header:hover {
348
+ background-color: #e9ecef;
349
+ }
350
+
351
+ .task-name-icon {
352
+ font-family: monospace;
353
+ font-weight: bold;
354
+ font-size: 14px;
355
+ width: 20px;
356
+ display: inline-block;
357
+ text-align: center;
358
+ color: #666;
359
+ }
360
+
361
+ .task-name-content {
362
+ display: none;
363
+ padding: 8px;
364
+ border-top: 1px solid #dee2e6;
365
+ word-break: break-word;
366
+ }
367
+
368
+ /* 添加compute_graph切换器样式 */
369
+ .graph-switcher {
370
+ margin-bottom: 20px;
371
+ padding: 10px;
372
+ background-color: #f8f9fa;
373
+ border-radius: 8px;
374
+ border: 1px solid #dee2e6;
375
+ }
376
+
377
+ .graph-switcher-title {
378
+ font-weight: bold;
379
+ margin-bottom: 10px;
380
+ }
381
+
382
+ .graph-switcher-buttons {
383
+ display: flex;
384
+ flex-wrap: wrap;
385
+ gap: 10px;
386
+ }
387
+
388
+ .graph-button {
389
+ padding: 5px 15px;
390
+ border: 1px solid #dee2e6;
391
+ border-radius: 4px;
392
+ background-color: #fff;
393
+ cursor: pointer;
394
+ transition: all 0.2s;
395
+ }
396
+
397
+ .graph-button:hover {
398
+ background-color: #e9ecef;
399
+ }
400
+
401
+ .graph-button.active {
402
+ background-color: #0d6efd;
403
+ color: white;
404
+ border-color: #0d6efd;
405
+ }
406
+
407
+ .compute-graph {
408
+ display: none;
409
+ }
410
+
411
+ .compute-graph.active {
412
+ display: block;
413
+ }
414
+
415
+ /* 全局形状切换器样式 */
416
+ .global-shape-switcher {
417
+ position: sticky;
418
+ top: 0;
419
+ z-index: 100;
420
+ background-color: #fff;
421
+ padding: 15px;
422
+ margin-bottom: 20px;
423
+ border-radius: 8px;
424
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
425
+ border: 1px solid #dee2e6;
426
+ }
427
+
428
+ .global-shape-switcher-title {
429
+ font-weight: bold;
430
+ margin-bottom: 10px;
431
+ }
432
+
433
+ .file-path-container {
434
+ display: flex;
435
+ align-items: center;
436
+ margin-top: 10px;
437
+ }
438
+
439
+ .file-path-container input {
440
+ font-family: monospace;
441
+ font-size: 0.9em;
442
+ }
443
+
444
+ .modal {
445
+ z-index: 1050;
446
+ }
447
+
448
+ .modal-backdrop {
449
+ z-index: 1040;
450
+ }
451
+
452
+ .work-dir-settings {
453
+ position: sticky;
454
+ top: 0;
455
+ z-index: 99;
456
+ background-color: #fff;
457
+ padding: 15px;
458
+ margin-bottom: 20px;
459
+ border-radius: 8px;
460
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
461
+ border: 1px solid #dee2e6;
462
+ }
463
+
464
+ .work-dir-input {
465
+ display: flex;
466
+ align-items: center;
467
+ gap: 10px;
468
+ }
469
+
470
+ .work-dir-input input {
471
+ flex: 1;
472
+ font-family: monospace;
473
+ }
474
+ </style>
475
+ </head>
476
+ <body>
477
+ <div class="container-fluid p-4">
478
+ <!-- task onnx文件目录设置 -->
479
+ <div class="work-dir-settings">
480
+ <div class="work-dir-settings-title">
481
+ <h6 class="mb-2">
482
+ <i class="fas fa-folder-open me-2"></i>task onnx目录设置
483
+ </h6>
484
+ </div>
485
+ <div class="work-dir-input">
486
+ <label for="work-dir-input" class="form-label mb-0" style="min-width: 100px;">task onnx目录:</label>
487
+ <input type="text" id="work-dir-input" class="form-control" placeholder="请输入task onnx目录路径..." />
488
+ <button class="btn btn-sm btn-primary" onclick="updateWorkDir()">更新</button>
489
+ <button class="btn btn-sm btn-outline-secondary" onclick="resetWorkDir()">重置</button>
490
+ </div>
491
+ <div class="mt-2">
492
+ <small class="text-muted">
493
+ 当前ONNX文件路径: <span id="current-onnx-path">tmp</span>
494
+ </small>
495
+ </div>
496
+ </div>
497
+
498
+ <!-- 全局形状切换器 -->
499
+ <div id="global-shape-switcher" class="global-shape-switcher" style="display: none;">
500
+ <div class="global-shape-switcher-title">Select Shape Configuration:</div>
501
+ <div class="global-shape-switcher-buttons" id="global-shape-buttons"></div>
502
+ </div>
503
+
504
+ <div id="model-info"></div>
505
+ <div id="submodels"></div>
506
+
507
+ <script>
508
+ const modelData = {"header": {"version": 2, "description": "RKNX model", "compiler_version": "(compiler version: 1.1.1a1 (25ae96410a@2026-09-08T14:30:38))", "toolkit_version": "rknn3-toolkit 1.1.1a1(7d35c8ebd@2026-09-08T09:49:01)", "framework_layout": "undefined", "target_platform": "p1", "vrv_number": 1, "npu_core_number": 1, "inference_mode": "static", "default_shape_id": 0, "io_configs": [{"shape_id": 0, "inputs": [{"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "input", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "outputs": [{"name": "resnetv24_dense0_fwd", "type": "int8", "shape": [1, 1000], "orig_shape": [1, 1000], "layout": "undefined", "category": "output", "qtype": "int8", "qmethod": "layer", "scale": [0.14674615859985352], "zero_point": [-62], "min": [-9.656500816345215], "max": [27.763769149780273], "plan_offset": 0, "plan_size": 1000, "stride": [1000, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "input_tiling_infos": [], "output_tiling_infos": []}]}, "sub_models": [{"vrv_id": 0, "npu_number_per_vrv": 1, "inference_mode": "static", "compute_graphs": [{"tasks": [{"id": 0, "name": "task_sub_0_segment_0", "core_id": 0, "type": "single", "inputs": [0], "outputs": [1], "internals": [3], "operators": [], "commands": [{"size": 194048, "offset": 0}], "weights": [{"size": 26035712, "offset": 512}], "private_rknn_region": []}], "tensors": [{"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "input", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "resnetv24_dense0_fwd", "type": "int8", "shape": [1, 1000], "orig_shape": [1, 1000], "layout": "undefined", "category": "output", "qtype": "int8", "qmethod": "layer", "scale": [0.14674615859985352], "zero_point": [-62], "min": [-9.656500816345215], "max": [27.763769149780273], "plan_offset": 0, "plan_size": 1000, "stride": [1000, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "internal", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "task_sub_0_internal", "type": "undefined", "shape": [], "orig_shape": [], "layout": "undefined", "category": "task_internal", "qtype": "", "qmethod": "", "scale": [], "zero_point": [], "min": [], "max": [], "plan_offset": 0, "plan_size": 5569536, "stride": [], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "inputs": [0], "outputs": [1], "memory_allocations": [{"core_index": 0, "total_size": 31799808, "weights_size": 26036224, "kvcache_size": 0, "command_size": 194048, "internal_size": 5569536}]}], "command_size": 194048, "weight_size": 26036224, "kvcache_size": 0, "internal_size": 5569536, "const_data_size": 194048, "binary_data": [{"core_id": 0, "commands": [{"task_id": 0, "offset": 0, "size": 194048}], "weights": [{"task_id": 0, "offset": 512, "size": 26035712}]}]}]};
509
+ const defaultDumpDir = 'tmp';
510
+ let currentWorkDir = '';
511
+ let currentShapeId = modelData.header.default_shape_id || 0;
512
+
513
+ // 初始化task onnx目录
514
+ function initWorkDir() {
515
+ // 尝试从localStorage获取之前保存的task onnx目录
516
+ const savedWorkDir = localStorage.getItem('rknx_work_dir');
517
+ if (savedWorkDir) {
518
+ currentWorkDir = savedWorkDir;
519
+ document.getElementById('work-dir-input').value = savedWorkDir;
520
+ }
521
+ updateOnnxPathDisplay();
522
+ }
523
+
524
+ // 更新task onnx目录
525
+ function updateWorkDir() {
526
+ const input = document.getElementById('work-dir-input');
527
+ const newWorkDir = input.value.trim();
528
+
529
+ if (newWorkDir) {
530
+ currentWorkDir = newWorkDir;
531
+ // 保存到localStorage
532
+ localStorage.setItem('rknx_work_dir', newWorkDir);
533
+ updateOnnxPathDisplay();
534
+
535
+ // 显示成功提示
536
+ showToast('工作目录已更新!', 'success');
537
+ } else {
538
+ showToast('请输入有效的工作目录路径!', 'warning');
539
+ }
540
+ }
541
+
542
+ // 重置工作目录
543
+ function resetWorkDir() {
544
+ currentWorkDir = '';
545
+ document.getElementById('work-dir-input').value = '';
546
+ localStorage.removeItem('rknx_work_dir');
547
+ updateOnnxPathDisplay();
548
+ showToast('工作目录已重置!', 'info');
549
+ }
550
+
551
+ // 更新ONNX路径显示
552
+ function updateOnnxPathDisplay() {
553
+ const pathElement = document.getElementById('current-onnx-path');
554
+ if (currentWorkDir) {
555
+ pathElement.textContent = currentWorkDir + '/' + defaultDumpDir;
556
+ } else {
557
+ pathElement.textContent = './' + defaultDumpDir + ' (当前脚本执行目录)';
558
+ }
559
+ }
560
+
561
+ // 构建ONNX文件的完整路径
562
+ function buildOnnxFilePath(taskName) {
563
+ const onnxFileName = taskName + '.onnx';
564
+ if (currentWorkDir) {
565
+ return currentWorkDir + '/' + defaultDumpDir + '/' + onnxFileName;
566
+ } else {
567
+ // 使用当前脚本执行目录 + dump_dir
568
+ return './' + defaultDumpDir + '/' + onnxFileName;
569
+ }
570
+ }
571
+
572
+ function formatBytes(bytes) {
573
+ if (bytes === 0) return '0 Bytes';
574
+ const k = 1024;
575
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
576
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
577
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
578
+ }
579
+
580
+ function calculateCoreConstInputSize(graph, coreId) {
581
+ const seenTensorNames = new Set();
582
+ return (graph.tensors || [])
583
+ .filter(tensor => tensor.category === 'const_input' && (Number(tensor.plan_core_id) || 0) === coreId)
584
+ .reduce((sum, tensor) => {
585
+ const tensorName = String(tensor.name || '');
586
+ const planSize = Number(tensor.plan_size) || 0;
587
+ if (seenTensorNames.has(tensorName)) {
588
+ return sum;
589
+ }
590
+ seenTensorNames.add(tensorName);
591
+ return sum + planSize;
592
+ }, 0);
593
+ }
594
+
595
+ function calculateCoreProfileInfoSize(graph, coreId) {
596
+ return (graph.tasks || [])
597
+ .filter(task => (Number(task.core_id) || 0) === coreId)
598
+ .reduce((sum, task) => {
599
+ const taskPrivateSize = (task.private_rknn_region || [])
600
+ .reduce((innerSum, region) => innerSum + (Number(region.size) || 0), 0);
601
+ return sum + taskPrivateSize;
602
+ }, 0);
603
+ }
604
+
605
+ function toggleTask(element) {
606
+ const content = element.nextElementSibling;
607
+ const icon = element.querySelector('.expand-icon');
608
+
609
+ if (content.style.display === 'block') {
610
+ content.style.display = 'none';
611
+ icon.textContent = '+';
612
+ } else {
613
+ content.style.display = 'block';
614
+ icon.textContent = '-';
615
+ }
616
+ }
617
+
618
+ function toggleOperator(element) {
619
+ const content = element.nextElementSibling;
620
+ const icon = element.querySelector('.operator-expand-icon');
621
+
622
+ if (content.style.display === 'block') {
623
+ content.style.display = 'none';
624
+ icon.textContent = '+';
625
+ } else {
626
+ content.style.display = 'block';
627
+ icon.textContent = '-';
628
+ }
629
+ }
630
+
631
+ // 初始化全局形状切换器
632
+ function initGlobalShapeSwitcher() {
633
+ const header = modelData.header;
634
+ if (header.inference_mode === 'dynamic_bucket' && header.io_configs && header.io_configs.length > 1) {
635
+ const switcherHtml = header.io_configs.map(config => `
636
+ <button class="btn btn-sm ${config.shape_id === currentShapeId ? 'btn-primary' : 'btn-outline-secondary'} me-2 mb-2"
637
+ onclick="switchGlobalShapeConfig(${config.shape_id})">
638
+ Shape ID ${config.shape_id}
639
+ </button>
640
+ `).join('');
641
+
642
+ document.getElementById('global-shape-buttons').innerHTML = switcherHtml;
643
+ document.getElementById('global-shape-switcher').style.display = 'block';
644
+ }
645
+ }
646
+
647
+ // 全局形状配置切换函数
648
+ function switchGlobalShapeConfig(shapeId) {
649
+ currentShapeId = shapeId;
650
+
651
+ // 更新按钮状态
652
+ const buttons = document.querySelectorAll('#global-shape-buttons button');
653
+ buttons.forEach(btn => {
654
+ if (btn.textContent.includes(`Shape ID ${shapeId}`)) {
655
+ btn.classList.remove('btn-outline-secondary');
656
+ btn.classList.add('btn-primary');
657
+ } else {
658
+ btn.classList.remove('btn-primary');
659
+ btn.classList.add('btn-outline-secondary');
660
+ }
661
+ });
662
+
663
+ // 重新渲染模型信息和子模型
664
+ renderModelInfo();
665
+ renderSubModels();
666
+ }
667
+
668
+ function renderModelInfo() {
669
+ const header = modelData.header;
670
+
671
+ // 获取当前选择的形状配置
672
+ const currentConfig = header.io_configs.find(config => config.shape_id === currentShapeId) || header.io_configs[0];
673
+
674
+ const html = `
675
+ <!-- Header Information Card -->
676
+ <div class="card mb-4">
677
+ <div class="card-header bg-primary text-white">
678
+ <h5 class="mb-0">Model Information</h5>
679
+ </div>
680
+ <div class="card-body">
681
+ <div class="row">
682
+ <!-- Basic Info -->
683
+ <div class="col-md-6">
684
+ <div class="info-group">
685
+ <div class="info-item">
686
+ <span class="info-label">Target Platform:</span>
687
+ <span class="info-value">${header.target_platform}</span>
688
+ </div>
689
+ <div class="info-item">
690
+ <span class="info-label">Description:</span>
691
+ <span class="info-value">${header.description}</span>
692
+ </div>
693
+ <div class="info-item">
694
+ <span class="info-label">Version:</span>
695
+ <span class="info-value">${header.version}</span>
696
+ </div>
697
+ <div class="info-item">
698
+ <span class="info-label">Compiler Version:</span>
699
+ <span class="info-value">${header.compiler_version}</span>
700
+ </div>
701
+ <div class="info-item">
702
+ <span class="info-label">Toolkit Version:</span>
703
+ <span class="info-value">${header.toolkit_version}</span>
704
+ </div>
705
+ <div class="info-item">
706
+ <span class="info-label">NPU Cores:</span>
707
+ <span class="info-value badge bg-secondary">${header.npu_core_number}</span>
708
+ </div>
709
+ <div class="info-item">
710
+ <span class="info-label">VRV Number:</span>
711
+ <span class="info-value badge bg-secondary">${header.vrv_number}</span>
712
+ </div>
713
+ <div class="info-item">
714
+ <span class="info-label">Inference Mode:</span>
715
+ <span class="info-value badge ${header.inference_mode === 'dynamic_bucket' ? 'bg-warning' : 'bg-info'}">${header.inference_mode}</span>
716
+ </div>
717
+ ${header.inference_mode === 'dynamic_bucket' ? `
718
+ <div class="info-item">
719
+ <span class="info-label">Current Shape ID:</span>
720
+ <span class="info-value badge bg-secondary">${currentShapeId}</span>
721
+ </div>
722
+ <div class="info-item">
723
+ <span class="info-label">Shape Configs:</span>
724
+ <span class="info-value badge bg-secondary">${header.io_configs.length}</span>
725
+ </div>
726
+ ` : ''}
727
+ </div>
728
+ </div>
729
+
730
+ <!-- Tensors Info -->
731
+ <div class="col-md-6">
732
+ <!-- Input Tensors Section -->
733
+ <div class="card mb-3 inner-card">
734
+ <div class="card-header">
735
+ <h6 class="mb-0 d-flex align-items-center">
736
+ <i class="fas fa-sign-in-alt me-2"></i>Input Tensors
737
+ </h6>
738
+ </div>
739
+ <div class="card-body p-0">
740
+ <ul class="list-group list-group-flush">
741
+ ${currentConfig.inputs.map((tensor, idx) => `
742
+ <li class="list-group-item p-2">
743
+ <div class="tensor-header" role="button" onclick="toggleTensorDetails(this)">
744
+ <div class="d-flex justify-content-between align-items-center">
745
+ <div class="tensor-basic-info">
746
+ <span class="tensor-name">${tensor.name}</span>
747
+ <div class="tensor-type-shape">
748
+ <span class="badge bg-light text-dark me-2">${tensor.type}</span>
749
+ <span class="badge bg-light text-dark">shape=[${tensor.shape.join(', ')}]</span>
750
+ </div>
751
+ </div>
752
+ <span class="collapse-icon">+</span>
753
+ </div>
754
+ </div>
755
+ <div class="tensor-details" style="display: none;">
756
+ <div class="ms-3 mt-2">
757
+ <div class="detail-section">
758
+ <div class="detail-header">Quantization</div>
759
+ <div class="detail-content">
760
+ <div class="detail-item">
761
+ <span class="detail-label">QType:</span>
762
+ <span class="detail-value">${tensor.qtype}</span>
763
+ </div>
764
+ <div class="detail-item">
765
+ <span class="detail-label">QMethod:</span>
766
+ <span class="detail-value">${tensor.qmethod || 'N/A'}</span>
767
+ </div>
768
+ <div class="detail-item">
769
+ <span class="detail-label">Scale:</span>
770
+ <span class="detail-value">${tensor.scale.length ? tensor.scale.join(', ') : 'N/A'}</span>
771
+ </div>
772
+ <div class="detail-item">
773
+ <span class="detail-label">Zero Point:</span>
774
+ <span class="detail-value">${tensor.zero_point.length ? tensor.zero_point.join(', ') : 'N/A'}</span>
775
+ </div>
776
+ <div class="detail-item">
777
+ <span class="detail-label">Min:</span>
778
+ <span class="detail-value">${tensor.min.length ? tensor.min.join(', ') : 'N/A'}</span>
779
+ </div>
780
+ <div class="detail-item">
781
+ <span class="detail-label">Max:</span>
782
+ <span class="detail-value">${tensor.max.length ? tensor.max.join(', ') : 'N/A'}</span>
783
+ </div>
784
+ </div>
785
+ </div>
786
+ ${currentConfig.input_tiling_infos[idx] ? `
787
+ <div class="detail-section mt-3">
788
+ <div class="detail-header">Tiling Info</div>
789
+ <div class="detail-content">
790
+ <div class="detail-item">
791
+ <span class="detail-label">Tile Offset:</span>
792
+ <span class="detail-value">${currentConfig.input_tiling_infos[idx].tile_offset.join(', ')}</span>
793
+ </div>
794
+ <div class="detail-item">
795
+ <span class="detail-label">Tile Size:</span>
796
+ <span class="detail-value">${currentConfig.input_tiling_infos[idx].tile_size.join(', ')}</span>
797
+ </div>
798
+ </div>
799
+ </div>
800
+ ` : ''}
801
+ </div>
802
+ </div>
803
+ </li>
804
+ `).join('')}
805
+ </ul>
806
+ </div>
807
+ </div>
808
+
809
+ <!-- Output Tensors Section -->
810
+ <div class="card inner-card">
811
+ <div class="card-header">
812
+ <h6 class="mb-0 d-flex align-items-center">
813
+ <i class="fas fa-sign-out-alt me-2"></i>Output Tensors
814
+ </h6>
815
+ </div>
816
+ <div class="card-body p-0">
817
+ <ul class="list-group list-group-flush">
818
+ ${currentConfig.outputs.map((tensor, idx) => `
819
+ <li class="list-group-item p-2">
820
+ <div class="tensor-header" role="button" onclick="toggleTensorDetails(this)">
821
+ <div class="d-flex justify-content-between align-items-center">
822
+ <div class="tensor-basic-info">
823
+ <span class="tensor-name">${tensor.name}</span>
824
+ <div class="tensor-type-shape">
825
+ <span class="badge bg-light text-dark me-2">${tensor.type}</span>
826
+ <span class="badge bg-light text-dark">shape=[${tensor.shape.join(', ')}]</span>
827
+ </div>
828
+ </div>
829
+ <span class="collapse-icon">+</span>
830
+ </div>
831
+ </div>
832
+ <div class="tensor-details" style="display: none;">
833
+ <div class="ms-3 mt-2">
834
+ <div class="detail-section">
835
+ <div class="detail-header">Quantization</div>
836
+ <div class="detail-content">
837
+ <div class="detail-item">
838
+ <span class="detail-label">QType:</span>
839
+ <span class="detail-value">${tensor.qtype}</span>
840
+ </div>
841
+ <div class="detail-item">
842
+ <span class="detail-label">QMethod:</span>
843
+ <span class="detail-value">${tensor.qmethod || 'N/A'}</span>
844
+ </div>
845
+ <div class="detail-item">
846
+ <span class="detail-label">Scale:</span>
847
+ <span class="detail-value">${tensor.scale.length ? tensor.scale.join(', ') : 'N/A'}</span>
848
+ </div>
849
+ <div class="detail-item">
850
+ <span class="detail-label">Zero Point:</span>
851
+ <span class="detail-value">${tensor.zero_point.length ? tensor.zero_point.join(', ') : 'N/A'}</span>
852
+ </div>
853
+ <div class="detail-item">
854
+ <span class="detail-label">Min:</span>
855
+ <span class="detail-value">${tensor.min.length ? tensor.min.join(', ') : 'N/A'}</span>
856
+ </div>
857
+ <div class="detail-item">
858
+ <span class="detail-label">Max:</span>
859
+ <span class="detail-value">${tensor.max.length ? tensor.max.join(', ') : 'N/A'}</span>
860
+ </div>
861
+ </div>
862
+ </div>
863
+ ${currentConfig.output_tiling_infos[idx] ? `
864
+ <div class="detail-section mt-3">
865
+ <div class="detail-header">Tiling Info</div>
866
+ <div class="detail-content">
867
+ <div class="detail-item">
868
+ <span class="detail-label">Tile Offset:</span>
869
+ <span class="detail-value">${currentConfig.output_tiling_infos[idx].tile_offset.join(', ')}</span>
870
+ </div>
871
+ <div class="detail-item">
872
+ <span class="detail-label">Tile Size:</span>
873
+ <span class="detail-value">${currentConfig.output_tiling_infos[idx].tile_size.join(', ')}</span>
874
+ </div>
875
+ </div>
876
+ </div>
877
+ ` : ''}
878
+ </div>
879
+ </div>
880
+ </li>
881
+ `).join('')}
882
+ </ul>
883
+ </div>
884
+ </div>
885
+ </div>
886
+ </div>
887
+ </div>
888
+ </div>
889
+ `;
890
+ document.getElementById('model-info').innerHTML = html;
891
+ }
892
+
893
+ // 添加切换详情的函数
894
+ function toggleTensorDetails(element) {
895
+ const details = element.nextElementSibling;
896
+ const icon = element.querySelector('.collapse-icon');
897
+
898
+ if (details.style.display === 'none') {
899
+ details.style.display = 'block';
900
+ icon.textContent = '-';
901
+ } else {
902
+ details.style.display = 'none';
903
+ icon.textContent = '+';
904
+ }
905
+ }
906
+
907
+ function renderSubModels() {
908
+ const html = modelData.sub_models.map((subModel, subModelIdx) => `
909
+ <div class="card mb-4">
910
+ <div class="card-header">
911
+ <h5>SubModel ${subModelIdx} (VRV ID: ${subModel.vrv_id})</h5>
912
+ <div class="text-muted">
913
+ Inference Mode: ${subModel.inference_mode}<br>
914
+ Command Size: ${formatBytes(subModel.command_size)} (${subModel.command_size} bytes)<br>
915
+ Weight Size: ${formatBytes(subModel.weight_size)} (${subModel.weight_size} bytes)<br>
916
+ KVCache Size: ${formatBytes(subModel.kvcache_size)} (${subModel.kvcache_size} bytes)<br>
917
+ Internal Size: ${formatBytes(subModel.internal_size)} (${subModel.internal_size} bytes)
918
+ </div>
919
+ </div>
920
+ <div class="card-body">
921
+ <div id="compute-graphs-${subModelIdx}">
922
+ ${subModel.compute_graphs.map((graph, graphIdx) => `
923
+ <div class="compute-graph ${graphIdx === currentShapeId ? 'active' : ''}" id="graph-${subModelIdx}-${graphIdx}"
924
+ style="display: ${graphIdx === currentShapeId ? 'block' : 'none'}">
925
+ <div class="task-columns">
926
+ ${generateTaskColumns(
927
+ graph.tasks,
928
+ modelData.header.npu_core_number,
929
+ subModel.vrv_id,
930
+ modelData.header.vrv_number
931
+ )}
932
+ </div>
933
+
934
+ <div class="memory-columns mt-4">
935
+ ${generateMemoryColumns(
936
+ graph.memory_allocations,
937
+ modelData.header.npu_core_number,
938
+ subModel.vrv_id,
939
+ modelData.header.vrv_number,
940
+ graph
941
+ )}
942
+ </div>
943
+ </div>
944
+ `).join('')}
945
+ </div>
946
+ </div>
947
+ </div>
948
+ `).join('');
949
+
950
+ document.getElementById('submodels').innerHTML = html;
951
+ }
952
+
953
+ function generateTaskColumns(tasks, npu_core_number, vrv_id, vrv_number) {
954
+ // 直接按实际的 core_id 分组,不再过滤
955
+ const tasksByCore = {};
956
+ const allTaskIds = new Set();
957
+
958
+ tasks.forEach(task => {
959
+ if (!tasksByCore[task.core_id]) {
960
+ tasksByCore[task.core_id] = {};
961
+ }
962
+ tasksByCore[task.core_id][task.id] = task;
963
+ allTaskIds.add(task.id);
964
+ });
965
+
966
+ // 获取所有参与的 core_id 并排序
967
+ const coreIds = Object.keys(tasksByCore).map(Number).sort((a, b) => a - b);
968
+
969
+ // 将所有 task id 排序
970
+ const sortedTaskIds = Array.from(allTaskIds).sort((a, b) => a - b);
971
+
972
+ return `
973
+ <div class="task-table">
974
+ <!-- 添加 core id 标题行 -->
975
+ <div class="task-table-header">
976
+ ${coreIds.map(core_id => `
977
+ <div class="task-column-header">
978
+ <h6 class="mb-0">Core ${core_id}</h6>
979
+ <small class="text-muted">Tasks: ${Object.keys(tasksByCore[core_id]).length}</small>
980
+ </div>
981
+ `).join('')}
982
+ </div>
983
+
984
+ <div class="task-table-body">
985
+ ${sortedTaskIds.map(taskId => `
986
+ <div class="task-row">
987
+ ${coreIds.map(core_id => {
988
+ const task = tasksByCore[core_id] ? tasksByCore[core_id][taskId] : null;
989
+ return `
990
+ <div class="task-cell">
991
+ ${task ? `
992
+ <div class="task-card">
993
+ <div class="task-header" onclick="toggleTask(this)">
994
+ <div class="task-basic-info">
995
+ <div>
996
+ <strong>Task ${taskId}</strong>
997
+ <span class="badge bg-secondary ms-2">${task.type}</span>
998
+ <small class="text-muted ms-2">${task.operators.length} ops</small>
999
+ </div>
1000
+ <div class="task-name">${task.name || 'Unnamed Task'}</div>
1001
+ <div class="task-onnx-link">
1002
+ <button class="btn btn-sm btn-outline-primary" onclick="openOnnxFile('${task.name || 'Unnamed Task'}', event)">
1003
+ <i class="fas fa-external-link-alt"></i> Open ONNX
1004
+ </button>
1005
+ </div>
1006
+ </div>
1007
+ <span class="expand-icon">+</span>
1008
+ </div>
1009
+
1010
+ <div class="task-content">
1011
+ <!-- Task Information -->
1012
+ <div class="section-header">Task Information</div>
1013
+ <div class="task-info mb-3">
1014
+ <div><strong>ID:</strong> ${taskId}</div>
1015
+ <div><strong>Name:</strong> ${task.name || 'Unnamed Task'}</div>
1016
+ <div><strong>Type:</strong> ${task.type}</div>
1017
+ <div><strong>Core:</strong> ${core_id}</div>
1018
+ <div><strong>ONNX File:</strong> ${task.name || 'Unnamed Task'}.onnx</div>
1019
+ </div>
1020
+
1021
+ <!-- Operators Section -->
1022
+ <div class="section-header">Operators</div>
1023
+ <div class="operator-list">
1024
+ ${task.operators.map(op => `
1025
+ <div class="operator-item">
1026
+ <span class="operator-header" onclick="toggleOperator(this)">
1027
+ <span class="operator-expand-icon">+</span>${op.type}
1028
+ </span>
1029
+ <div class="operator-content" style="display: none;">
1030
+ <strong>Name:</strong> ${op.name}<br>
1031
+ </div>
1032
+ </div>
1033
+ `).join('')}
1034
+ </div>
1035
+
1036
+ <!-- Memory & Tensors Section -->
1037
+ <div class="section-header mt-3">Memory & Tensors</div>
1038
+ <div class="memory-info">
1039
+ <div><small>Inputs:</small> ${task.inputs.join(', ')}</div>
1040
+ <div><small>Outputs:</small> ${task.outputs.join(', ')}</div>
1041
+ <div class="mt-2">
1042
+ <small>Commands:</small>
1043
+ <table class="table table-sm table-bordered mt-1">
1044
+ <thead>
1045
+ <tr>
1046
+ <th>Index</th>
1047
+ <th>Size (bytes)</th>
1048
+ <th>Offset (bytes)</th>
1049
+ </tr>
1050
+ </thead>
1051
+ <tbody>
1052
+ ${task.commands.map((cmd, idx) => `
1053
+ <tr>
1054
+ <td>${idx}</td>
1055
+ <td>${cmd.size}</td>
1056
+ <td>${cmd.offset}</td>
1057
+ </tr>
1058
+ `).join('')}
1059
+ </tbody>
1060
+ </table>
1061
+ </div>
1062
+ <div class="mt-2">
1063
+ <small>Weights:</small>
1064
+ <table class="table table-sm table-bordered mt-1">
1065
+ <thead>
1066
+ <tr>
1067
+ <th>Index</th>
1068
+ <th>Size (bytes)</th>
1069
+ <th>Offset (bytes)</th>
1070
+ </tr>
1071
+ </thead>
1072
+ <tbody>
1073
+ ${task.weights.map((init, idx) => `
1074
+ <tr>
1075
+ <td>${idx}</td>
1076
+ <td>${init.size}</td>
1077
+ <td>${init.offset}</td>
1078
+ </tr>
1079
+ `).join('')}
1080
+ </tbody>
1081
+ </table>
1082
+ </div>
1083
+ </div>
1084
+ </div>
1085
+ </div>
1086
+ ` : ''}
1087
+ </div>
1088
+ `;
1089
+ }).join('')}
1090
+ </div>
1091
+ `).join('')}
1092
+ </div>
1093
+ </div>
1094
+ `;
1095
+ }
1096
+
1097
+ function generateMemoryColumns(memory_allocations, npu_core_number, vrv_id, vrv_number, graph) {
1098
+ // 计算当前VRV负责的core范围
1099
+ const core_per_vrv = Math.ceil(npu_core_number / vrv_number);
1100
+ const core_start = vrv_id * core_per_vrv;
1101
+ const core_end = core_start + core_per_vrv;
1102
+
1103
+ const memoryByCore = {};
1104
+ memory_allocations.forEach(mem => {
1105
+ if (mem.core_index >= core_start && mem.core_index < core_end) {
1106
+ memoryByCore[mem.core_index] = mem;
1107
+ }
1108
+ });
1109
+
1110
+ return Array.from({length: core_per_vrv}, (_, i) => {
1111
+ const core_id = core_start + i;
1112
+ const rawCommandSize = memoryByCore[core_id] ? (Number(memoryByCore[core_id].command_size) || 0) : 0;
1113
+ const constInputSize = calculateCoreConstInputSize(graph, core_id);
1114
+ const profileInfoSize = calculateCoreProfileInfoSize(graph, core_id);
1115
+ const commandSize = Math.max(0, rawCommandSize - constInputSize - profileInfoSize);
1116
+ return `
1117
+ <div class="memory-column">
1118
+ <div class="memory-header">
1119
+ <h6 class="mb-0">Core ${core_id} Memory</h6>
1120
+ </div>
1121
+ ${memoryByCore[core_id] ? `
1122
+ <div class="memory-content">
1123
+ <div class="memory-item">
1124
+ <strong>Total Size:</strong><br>
1125
+ ${formatBytes(memoryByCore[core_id].total_size)} (${memoryByCore[core_id].total_size} bytes)
1126
+ </div>
1127
+ <div class="memory-item">
1128
+ <strong>Weights:</strong><br>
1129
+ ${formatBytes(memoryByCore[core_id].weights_size)} (${memoryByCore[core_id].weights_size} bytes)
1130
+ </div>
1131
+ <div class="memory-item">
1132
+ <strong>Command Size:</strong><br>
1133
+ ${formatBytes(commandSize)} (${commandSize} bytes)
1134
+ </div>
1135
+ <div class="memory-item">
1136
+ <strong>Const Input Size:</strong><br>
1137
+ ${formatBytes(constInputSize)} (${constInputSize} bytes)
1138
+ </div>
1139
+ <div class="memory-item">
1140
+ <strong>Profile Info Size:</strong><br>
1141
+ ${formatBytes(profileInfoSize)} (${profileInfoSize} bytes)
1142
+ </div>
1143
+ <div class="memory-item">
1144
+ <strong>KVCache:</strong><br>
1145
+ ${formatBytes(memoryByCore[core_id].kvcache_size)} (${memoryByCore[core_id].kvcache_size} bytes)
1146
+ </div>
1147
+ <div class="memory-item">
1148
+ <strong>Internal:</strong><br>
1149
+ ${formatBytes(memoryByCore[core_id].internal_size)} (${memoryByCore[core_id].internal_size} bytes)
1150
+ </div>
1151
+ </div>
1152
+ ` : `
1153
+ <div class="memory-content text-muted">
1154
+ No memory allocation
1155
+ </div>
1156
+ `}
1157
+ </div>
1158
+ `;
1159
+ }).join('');
1160
+ }
1161
+
1162
+ // 初始化页面
1163
+ document.addEventListener('DOMContentLoaded', function() {
1164
+ initWorkDir();
1165
+ initGlobalShapeSwitcher();
1166
+ renderModelInfo();
1167
+ renderSubModels();
1168
+ });
1169
+
1170
+ // 添加打开ONNX文件的函数
1171
+ function openOnnxFile(taskName, event) {
1172
+ // 阻止事件冒泡,防止触发task展开/收缩
1173
+ event.stopPropagation();
1174
+
1175
+ // 构建ONNX文件路径
1176
+ const onnxFilePath = buildOnnxFilePath(taskName);
1177
+
1178
+ // 尝试多种方式打开ONNX文件
1179
+ try {
1180
+ // 方式1: 尝试使用Netron在线版本
1181
+ const netronUrl = 'https://netron.app/';
1182
+ const newWindow = window.open(netronUrl, '_blank');
1183
+
1184
+ if (newWindow) {
1185
+ // 显示文件路径信息
1186
+ showOnnxFileInfo(onnxFilePath, netronUrl);
1187
+ } else {
1188
+ // 如果弹窗被阻止,显示手动操作提示
1189
+ showManualOnnxInstructions(onnxFilePath);
1190
+ }
1191
+ } catch (error) {
1192
+ console.error('Error opening ONNX file:', error);
1193
+ showManualOnnxInstructions(onnxFilePath);
1194
+ }
1195
+ }
1196
+
1197
+ function showOnnxFileInfo(filePath, netronUrl) {
1198
+ const modal = document.createElement('div');
1199
+ modal.className = 'modal fade show';
1200
+ modal.style.display = 'block';
1201
+ modal.style.backgroundColor = 'rgba(0,0,0,0.5)';
1202
+ modal.innerHTML = `
1203
+ <div class="modal-dialog">
1204
+ <div class="modal-content">
1205
+ <div class="modal-header">
1206
+ <h5 class="modal-title">ONNX文件信息</h5>
1207
+ <button type="button" class="btn-close" onclick="closeModal(this)"></button>
1208
+ </div>
1209
+ <div class="modal-body">
1210
+ <div class="alert alert-info">
1211
+ <h6>Netron已在新窗口中打开!</h6>
1212
+ <p>请在Netron中打开以下文件:</p>
1213
+ <div class="file-path-container">
1214
+ <input type="text" class="form-control" value="${filePath}" readonly>
1215
+ <button class="btn btn-sm btn-outline-secondary ms-2" onclick="copyToClipboard('${filePath}')">
1216
+ <i class="fas fa-copy"></i> 复制路径
1217
+ </button>
1218
+ </div>
1219
+ </div>
1220
+ <div class="alert alert-warning">
1221
+ <h6>使用说明:</h6>
1222
+ <ol>
1223
+ <li>在Netron窗口中点击"Open Model"按钮</li>
1224
+ <li>粘贴或输入上述文件路径</li>
1225
+ <li>点击打开即可查看ONNX模型结构</li>
1226
+ </ol>
1227
+ </div>
1228
+ </div>
1229
+ <div class="modal-footer">
1230
+ <button type="button" class="btn btn-secondary" onclick="closeModal(this)">关闭</button>
1231
+ <button type="button" class="btn btn-primary" onclick="window.open('${netronUrl}', '_blank')">重新打开Netron</button>
1232
+ </div>
1233
+ </div>
1234
+ </div>
1235
+ `;
1236
+ document.body.appendChild(modal);
1237
+ }
1238
+
1239
+ function showManualOnnxInstructions(filePath) {
1240
+ const modal = document.createElement('div');
1241
+ modal.className = 'modal fade show';
1242
+ modal.style.display = 'block';
1243
+ modal.style.backgroundColor = 'rgba(0,0,0,0.5)';
1244
+ modal.innerHTML = `
1245
+ <div class="modal-dialog">
1246
+ <div class="modal-content">
1247
+ <div class="modal-header">
1248
+ <h5 class="modal-title">打开ONNX文件</h5>
1249
+ <button type="button" class="btn-close" onclick="closeModal(this)"></button>
1250
+ </div>
1251
+ <div class="modal-body">
1252
+ <div class="alert alert-info">
1253
+ <h6>ONNX文件路径:</h6>
1254
+ <div class="file-path-container">
1255
+ <input type="text" class="form-control" value="${filePath}" readonly>
1256
+ <button class="btn btn-sm btn-outline-secondary ms-2" onclick="copyToClipboard('${filePath}')">
1257
+ <i class="fas fa-copy"></i> 复制路径
1258
+ </button>
1259
+ </div>
1260
+ </div>
1261
+ <div class="alert alert-warning">
1262
+ <h6>手动打开方式:</h6>
1263
+ <ol>
1264
+ <li><strong>在线版本:</strong> <a href="https://netron.app/" target="_blank">点击打开Netron在线版</a></li>
1265
+ <li><strong>本地版本:</strong> 如果已安装Netron,可在终端运行:<br>
1266
+ <code>netron "${filePath}"</code>
1267
+ </li>
1268
+ <li><strong>其他工具:</strong> 也可使用其他ONNX查看工具打开该文件</li>
1269
+ </ol>
1270
+ </div>
1271
+ </div>
1272
+ <div class="modal-footer">
1273
+ <button type="button" class="btn btn-secondary" onclick="closeModal(this)">关闭</button>
1274
+ <button type="button" class="btn btn-primary" onclick="window.open('https://netron.app/', '_blank')">打开Netron在线版</button>
1275
+ </div>
1276
+ </div>
1277
+ </div>
1278
+ `;
1279
+ document.body.appendChild(modal);
1280
+ }
1281
+
1282
+ function copyToClipboard(text) {
1283
+ navigator.clipboard.writeText(text).then(() => {
1284
+ showToast('路径已复制到剪贴板!', 'success');
1285
+ }).catch(err => {
1286
+ console.error('复制失败:', err);
1287
+ // 降级处理:选择文本
1288
+ const textArea = document.createElement('textarea');
1289
+ textArea.value = text;
1290
+ document.body.appendChild(textArea);
1291
+ textArea.select();
1292
+ document.execCommand('copy');
1293
+ document.body.removeChild(textArea);
1294
+ showToast('路径已复制到剪贴板!', 'success');
1295
+ });
1296
+ }
1297
+
1298
+ function showToast(message, type = 'info') {
1299
+ const toast = document.createElement('div');
1300
+ toast.className = 'toast-notification';
1301
+ toast.textContent = message;
1302
+
1303
+ const colorMap = {
1304
+ 'success': '#28a745',
1305
+ 'warning': '#ffc107',
1306
+ 'info': '#17a2b8',
1307
+ 'error': '#dc3545'
1308
+ };
1309
+
1310
+ toast.style.cssText = `
1311
+ position: fixed;
1312
+ top: 20px;
1313
+ right: 20px;
1314
+ background: ${colorMap[type] || colorMap.info};
1315
+ color: white;
1316
+ padding: 10px 20px;
1317
+ border-radius: 4px;
1318
+ z-index: 9999;
1319
+ box-shadow: 0 2px 5px rgba(0,0,0,0.2);
1320
+ font-size: 14px;
1321
+ `;
1322
+ document.body.appendChild(toast);
1323
+
1324
+ setTimeout(() => {
1325
+ if (document.body.contains(toast)) {
1326
+ document.body.removeChild(toast);
1327
+ }
1328
+ }, 3000);
1329
+ }
1330
+
1331
+ function closeModal(button) {
1332
+ const modal = button.closest('.modal');
1333
+ if (modal && document.body.contains(modal)) {
1334
+ document.body.removeChild(modal);
1335
+ }
1336
+ }
1337
+ </script>
1338
+ </div>
1339
+ </body>
1340
+ </html>
1341
+
ResNet50V2-224x224-w8a8-1/ResNet50V2.rknn ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5dd23b15d4d3b68a337f4c9c0e7a386a2e81689a221db69cf01ab7be9d696bb1
3
+ size 193136
ResNet50V2-224x224-w8a8-1/ResNet50V2.weight ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc0b10741339aea31b5f6d578c28daab4348244acb2bdb837782e02d4cea7aac
3
+ size 26036224
ResNet50V2-224x224-w8a8-1/ResNet50V2_report.html ADDED
@@ -0,0 +1,1341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <title>RKNX Model Visualization</title>
6
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
7
+ <style>
8
+ .task-columns {
9
+ display: flex;
10
+ gap: 20px;
11
+ overflow-x: auto;
12
+ padding: 20px 0;
13
+ }
14
+
15
+ .task-column {
16
+ min-width: 300px;
17
+ flex: 0 0 auto;
18
+ border: 1px solid #dee2e6;
19
+ border-radius: 8px;
20
+ padding: 15px;
21
+ }
22
+
23
+ .column-header {
24
+ background: #f8f9fa;
25
+ padding: 10px;
26
+ margin: -15px -15px 15px -15px;
27
+ border-radius: 8px 8px 0 0;
28
+ border-bottom: 1px solid #dee2e6;
29
+ }
30
+
31
+ .task-card {
32
+ border: 1px solid #e9ecef;
33
+ border-radius: 4px;
34
+ margin-bottom: 10px;
35
+ padding: 10px;
36
+ }
37
+
38
+ .task-card:hover {
39
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
40
+ }
41
+
42
+ .task-header {
43
+ cursor: pointer;
44
+ display: flex;
45
+ justify-content: space-between;
46
+ align-items: center;
47
+ padding: 8px;
48
+ background: #f8f9fa;
49
+ border-radius: 4px;
50
+ }
51
+
52
+ .task-header:hover {
53
+ background: #e9ecef;
54
+ }
55
+
56
+ .task-content {
57
+ display: none;
58
+ padding: 10px;
59
+ margin-top: 10px;
60
+ border-top: 1px solid #e9ecef;
61
+ }
62
+
63
+ .expand-icon {
64
+ font-family: monospace;
65
+ font-weight: bold;
66
+ font-size: 16px;
67
+ color: #666;
68
+ width: 20px;
69
+ text-align: center;
70
+ }
71
+
72
+ .task-header:hover .expand-icon {
73
+ color: #333;
74
+ }
75
+
76
+ .task-basic-info {
77
+ flex-grow: 1;
78
+ margin-right: 10px;
79
+ }
80
+
81
+ .operator-preview {
82
+ color: #666;
83
+ font-size: 0.9em;
84
+ margin-top: 4px;
85
+ }
86
+
87
+ .section-header {
88
+ font-size: 0.9rem;
89
+ color: #666;
90
+ margin: 10px 0 5px;
91
+ padding-bottom: 3px;
92
+ border-bottom: 1px solid #eee;
93
+ }
94
+
95
+ .operator-list {
96
+ margin-left: 10px;
97
+ }
98
+
99
+ .operator-item {
100
+ padding: 3px 0;
101
+ font-size: 0.9rem;
102
+ }
103
+
104
+ .operator-header {
105
+ cursor: pointer;
106
+ display: flex;
107
+ align-items: center;
108
+ padding: 5px 0;
109
+ }
110
+
111
+ .operator-header:hover {
112
+ background: #f1f1f1;
113
+ }
114
+
115
+ .operator-expand-icon {
116
+ font-family: monospace;
117
+ font-weight: bold;
118
+ font-size: 14px;
119
+ color: #666;
120
+ width: 20px;
121
+ text-align: center;
122
+ margin-right: 8px;
123
+ }
124
+
125
+ .memory-columns {
126
+ display: flex;
127
+ gap: 20px;
128
+ overflow-x: auto;
129
+ padding: 20px 0;
130
+ }
131
+
132
+ .memory-column {
133
+ min-width: 300px;
134
+ flex: 0 0 auto;
135
+ border: 1px solid #dee2e6;
136
+ border-radius: 8px;
137
+ padding: 15px;
138
+ }
139
+
140
+ .memory-header {
141
+ background: #f8f9fa;
142
+ padding: 10px;
143
+ margin: -15px -15px 15px -15px;
144
+ border-radius: 8px 8px 0 0;
145
+ border-bottom: 1px solid #dee2e6;
146
+ }
147
+
148
+ .memory-content {
149
+ padding: 10px;
150
+ }
151
+
152
+ .memory-item {
153
+ margin-bottom: 8px;
154
+ }
155
+
156
+ .memory-item:last-child {
157
+ margin-bottom: 0;
158
+ }
159
+
160
+ .task-table {
161
+ width: 100%;
162
+ overflow-x: auto;
163
+ }
164
+
165
+ .task-table-header {
166
+ display: flex;
167
+ gap: 20px;
168
+ margin-bottom: 15px;
169
+ }
170
+
171
+ .task-column-header {
172
+ min-width: 300px;
173
+ flex: 1;
174
+ background: #f8f9fa;
175
+ padding: 12px;
176
+ border: 1px solid #dee2e6;
177
+ border-radius: 8px;
178
+ text-align: center;
179
+ }
180
+
181
+ .task-column-header h6 {
182
+ color: #495057;
183
+ margin-bottom: 4px;
184
+ }
185
+
186
+ .task-column-header small {
187
+ color: #6c757d;
188
+ }
189
+
190
+ .task-table-body {
191
+ display: flex;
192
+ flex-direction: column;
193
+ gap: 10px;
194
+ }
195
+
196
+ .task-row {
197
+ display: flex;
198
+ gap: 20px;
199
+ }
200
+
201
+ .task-cell {
202
+ min-width: 300px;
203
+ flex: 1;
204
+ padding: 5px;
205
+ border: 1px solid transparent;
206
+ }
207
+
208
+ .task-cell:empty {
209
+ border-color: #f8f9fa;
210
+ background: #fafafa;
211
+ border-radius: 4px;
212
+ }
213
+
214
+ .card-header[role="button"] {
215
+ cursor: pointer;
216
+ }
217
+
218
+ .card-header[role="button"]:hover {
219
+ background-color: #f8f9fa;
220
+ }
221
+
222
+ .collapse-icon {
223
+ font-family: monospace;
224
+ font-weight: bold;
225
+ font-size: 16px;
226
+ color: #666;
227
+ transition: transform 0.2s;
228
+ }
229
+
230
+ .list-unstyled {
231
+ margin-bottom: 0;
232
+ }
233
+
234
+ .tensor-header {
235
+ cursor: pointer;
236
+ padding: 8px;
237
+ background-color: #f8f9fa;
238
+ border-radius: 4px;
239
+ border: 1px solid #dee2e6;
240
+ }
241
+
242
+ .tensor-header:hover {
243
+ background-color: #e9ecef;
244
+ }
245
+
246
+ .tensor-details {
247
+ padding: 10px;
248
+ border: 1px solid #dee2e6;
249
+ border-top: none;
250
+ border-radius: 0 0 4px 4px;
251
+ background-color: #fff;
252
+ }
253
+
254
+ .collapse-icon {
255
+ font-family: monospace;
256
+ font-weight: bold;
257
+ font-size: 16px;
258
+ color: #666;
259
+ min-width: 20px;
260
+ text-align: center;
261
+ }
262
+
263
+ .list-unstyled li:last-child {
264
+ margin-bottom: 0 !important;
265
+ }
266
+
267
+ /* 基础样式 */
268
+ .info-group {
269
+ display: flex;
270
+ flex-direction: column;
271
+ gap: 0.5rem;
272
+ }
273
+
274
+ .info-item {
275
+ display: flex;
276
+ align-items: baseline;
277
+ padding: 0.5rem;
278
+ border-radius: 4px;
279
+ background-color: #f8f9fa;
280
+ }
281
+
282
+ .info-label {
283
+ font-weight: 600;
284
+ color: #495057;
285
+ min-width: 140px;
286
+ }
287
+
288
+ .info-value {
289
+ color: #212529;
290
+ }
291
+
292
+ /* 内部卡片样式 */
293
+ .inner-card {
294
+ box-shadow: none;
295
+ border: 1px solid rgba(0,0,0,.125);
296
+ }
297
+
298
+ .inner
299
+
300
+ .task-name {
301
+ font-size: 0.9em;
302
+ margin-top: 2px;
303
+ margin-bottom: 4px;
304
+ color: #666;
305
+ word-break: break-word;
306
+ }
307
+
308
+ .task-onnx-link {
309
+ margin-top: 5px;
310
+ }
311
+
312
+ .task-onnx-link button {
313
+ font-size: 0.8em;
314
+ padding: 2px 8px;
315
+ }
316
+
317
+ .task-info {
318
+ background-color: #f8f9fa;
319
+ padding: 10px;
320
+ border-radius: 4px;
321
+ font-size: 0.9em;
322
+ }
323
+
324
+ .task-info > div {
325
+ margin-bottom: 4px;
326
+ }
327
+
328
+ .task-info > div:last-child {
329
+ margin-bottom: 0;
330
+ }
331
+
332
+ .task-name-section {
333
+ border: 1px solid #dee2e6;
334
+ border-radius: 4px;
335
+ overflow: hidden;
336
+ }
337
+
338
+ .task-name-header {
339
+ padding: 8px;
340
+ background-color: #f8f9fa;
341
+ cursor: pointer;
342
+ display: flex;
343
+ align-items: center;
344
+ user-select: none;
345
+ }
346
+
347
+ .task-name-header:hover {
348
+ background-color: #e9ecef;
349
+ }
350
+
351
+ .task-name-icon {
352
+ font-family: monospace;
353
+ font-weight: bold;
354
+ font-size: 14px;
355
+ width: 20px;
356
+ display: inline-block;
357
+ text-align: center;
358
+ color: #666;
359
+ }
360
+
361
+ .task-name-content {
362
+ display: none;
363
+ padding: 8px;
364
+ border-top: 1px solid #dee2e6;
365
+ word-break: break-word;
366
+ }
367
+
368
+ /* 添加compute_graph切换器样式 */
369
+ .graph-switcher {
370
+ margin-bottom: 20px;
371
+ padding: 10px;
372
+ background-color: #f8f9fa;
373
+ border-radius: 8px;
374
+ border: 1px solid #dee2e6;
375
+ }
376
+
377
+ .graph-switcher-title {
378
+ font-weight: bold;
379
+ margin-bottom: 10px;
380
+ }
381
+
382
+ .graph-switcher-buttons {
383
+ display: flex;
384
+ flex-wrap: wrap;
385
+ gap: 10px;
386
+ }
387
+
388
+ .graph-button {
389
+ padding: 5px 15px;
390
+ border: 1px solid #dee2e6;
391
+ border-radius: 4px;
392
+ background-color: #fff;
393
+ cursor: pointer;
394
+ transition: all 0.2s;
395
+ }
396
+
397
+ .graph-button:hover {
398
+ background-color: #e9ecef;
399
+ }
400
+
401
+ .graph-button.active {
402
+ background-color: #0d6efd;
403
+ color: white;
404
+ border-color: #0d6efd;
405
+ }
406
+
407
+ .compute-graph {
408
+ display: none;
409
+ }
410
+
411
+ .compute-graph.active {
412
+ display: block;
413
+ }
414
+
415
+ /* 全局形状切换器样式 */
416
+ .global-shape-switcher {
417
+ position: sticky;
418
+ top: 0;
419
+ z-index: 100;
420
+ background-color: #fff;
421
+ padding: 15px;
422
+ margin-bottom: 20px;
423
+ border-radius: 8px;
424
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
425
+ border: 1px solid #dee2e6;
426
+ }
427
+
428
+ .global-shape-switcher-title {
429
+ font-weight: bold;
430
+ margin-bottom: 10px;
431
+ }
432
+
433
+ .file-path-container {
434
+ display: flex;
435
+ align-items: center;
436
+ margin-top: 10px;
437
+ }
438
+
439
+ .file-path-container input {
440
+ font-family: monospace;
441
+ font-size: 0.9em;
442
+ }
443
+
444
+ .modal {
445
+ z-index: 1050;
446
+ }
447
+
448
+ .modal-backdrop {
449
+ z-index: 1040;
450
+ }
451
+
452
+ .work-dir-settings {
453
+ position: sticky;
454
+ top: 0;
455
+ z-index: 99;
456
+ background-color: #fff;
457
+ padding: 15px;
458
+ margin-bottom: 20px;
459
+ border-radius: 8px;
460
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
461
+ border: 1px solid #dee2e6;
462
+ }
463
+
464
+ .work-dir-input {
465
+ display: flex;
466
+ align-items: center;
467
+ gap: 10px;
468
+ }
469
+
470
+ .work-dir-input input {
471
+ flex: 1;
472
+ font-family: monospace;
473
+ }
474
+ </style>
475
+ </head>
476
+ <body>
477
+ <div class="container-fluid p-4">
478
+ <!-- task onnx文件目录设置 -->
479
+ <div class="work-dir-settings">
480
+ <div class="work-dir-settings-title">
481
+ <h6 class="mb-2">
482
+ <i class="fas fa-folder-open me-2"></i>task onnx目录设置
483
+ </h6>
484
+ </div>
485
+ <div class="work-dir-input">
486
+ <label for="work-dir-input" class="form-label mb-0" style="min-width: 100px;">task onnx目录:</label>
487
+ <input type="text" id="work-dir-input" class="form-control" placeholder="请输入task onnx目录路径..." />
488
+ <button class="btn btn-sm btn-primary" onclick="updateWorkDir()">更新</button>
489
+ <button class="btn btn-sm btn-outline-secondary" onclick="resetWorkDir()">重置</button>
490
+ </div>
491
+ <div class="mt-2">
492
+ <small class="text-muted">
493
+ 当前ONNX文件路径: <span id="current-onnx-path">/hdd_data/workspaces/cdd/rknn-convert/tasks/resnet50-v2-7/RK1820/224x224-w8a8-1/work/rknn-build-ddpc93sz/tmp</span>
494
+ </small>
495
+ </div>
496
+ </div>
497
+
498
+ <!-- 全局形状切换器 -->
499
+ <div id="global-shape-switcher" class="global-shape-switcher" style="display: none;">
500
+ <div class="global-shape-switcher-title">Select Shape Configuration:</div>
501
+ <div class="global-shape-switcher-buttons" id="global-shape-buttons"></div>
502
+ </div>
503
+
504
+ <div id="model-info"></div>
505
+ <div id="submodels"></div>
506
+
507
+ <script>
508
+ const modelData = {"header": {"version": 2, "description": "RKNX model", "compiler_version": "(compiler version: 1.2.0 (7051fe72a1@2026-10-16T10:56:25))", "toolkit_version": "rknn3-toolkit 1.2.0(c89896903@2026-10-17T10:51:37)", "framework_layout": "undefined", "target_platform": "p1", "vrv_number": 1, "npu_core_number": 1, "inference_mode": "static", "default_shape_id": 0, "io_configs": [{"shape_id": 0, "inputs": [{"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "input", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "outputs": [{"name": "resnetv24_dense0_fwd", "type": "int8", "shape": [1, 1000], "orig_shape": [1, 1000], "layout": "undefined", "category": "output", "qtype": "int8", "qmethod": "layer", "scale": [0.14674615859985352], "zero_point": [-62], "min": [-9.656500816345215], "max": [27.763769149780273], "plan_offset": 0, "plan_size": 1024, "stride": [1000, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "input_tiling_infos": [], "output_tiling_infos": []}]}, "sub_models": [{"vrv_id": 0, "npu_number_per_vrv": 1, "inference_mode": "static", "compute_graphs": [{"tasks": [{"id": 0, "name": "task_sub_0_segment_0", "core_id": 0, "type": "single", "inputs": [0], "outputs": [1], "internals": [3], "operators": [], "commands": [{"size": 190464, "offset": 0}], "weights": [{"size": 26035712, "offset": 512}], "private_rknn_region": []}], "tensors": [{"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "input", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "resnetv24_dense0_fwd", "type": "int8", "shape": [1, 1000], "orig_shape": [1, 1000], "layout": "undefined", "category": "output", "qtype": "int8", "qmethod": "layer", "scale": [0.14674615859985352], "zero_point": [-62], "min": [-9.656500816345215], "max": [27.763769149780273], "plan_offset": 0, "plan_size": 1024, "stride": [1000, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "internal", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "task_sub_0_internal", "type": "undefined", "shape": [], "orig_shape": [], "layout": "undefined", "category": "task_internal", "qtype": "", "qmethod": "", "scale": [], "zero_point": [], "min": [], "max": [], "plan_offset": 0, "plan_size": 5569536, "stride": [], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "inputs": [0], "outputs": [1], "memory_allocations": [{"core_index": 0, "total_size": 31796224, "weights_size": 26036224, "kvcache_size": 0, "command_size": 190464, "internal_size": 5569536}]}], "command_size": 190464, "weight_size": 26036224, "kvcache_size": 0, "internal_size": 5569536, "const_data_size": 190464, "binary_data": [{"core_id": 0, "commands": [{"task_id": 0, "offset": 0, "size": 190464}], "weights": [{"task_id": 0, "offset": 512, "size": 26035712}]}]}]};
509
+ const defaultDumpDir = '/hdd_data/workspaces/cdd/rknn-convert/tasks/resnet50-v2-7/RK1820/224x224-w8a8-1/work/rknn-build-ddpc93sz/tmp';
510
+ let currentWorkDir = '';
511
+ let currentShapeId = modelData.header.default_shape_id || 0;
512
+
513
+ // 初始化task onnx目录
514
+ function initWorkDir() {
515
+ // 尝试从localStorage获取之前保存的task onnx目录
516
+ const savedWorkDir = localStorage.getItem('rknx_work_dir');
517
+ if (savedWorkDir) {
518
+ currentWorkDir = savedWorkDir;
519
+ document.getElementById('work-dir-input').value = savedWorkDir;
520
+ }
521
+ updateOnnxPathDisplay();
522
+ }
523
+
524
+ // 更新task onnx目录
525
+ function updateWorkDir() {
526
+ const input = document.getElementById('work-dir-input');
527
+ const newWorkDir = input.value.trim();
528
+
529
+ if (newWorkDir) {
530
+ currentWorkDir = newWorkDir;
531
+ // 保存到localStorage
532
+ localStorage.setItem('rknx_work_dir', newWorkDir);
533
+ updateOnnxPathDisplay();
534
+
535
+ // 显示成功提示
536
+ showToast('工作目录已更新!', 'success');
537
+ } else {
538
+ showToast('请输入有效的工作目录路径!', 'warning');
539
+ }
540
+ }
541
+
542
+ // 重置工作目录
543
+ function resetWorkDir() {
544
+ currentWorkDir = '';
545
+ document.getElementById('work-dir-input').value = '';
546
+ localStorage.removeItem('rknx_work_dir');
547
+ updateOnnxPathDisplay();
548
+ showToast('工作目录已重置!', 'info');
549
+ }
550
+
551
+ // 更新ONNX路径显示
552
+ function updateOnnxPathDisplay() {
553
+ const pathElement = document.getElementById('current-onnx-path');
554
+ if (currentWorkDir) {
555
+ pathElement.textContent = currentWorkDir + '/' + defaultDumpDir;
556
+ } else {
557
+ pathElement.textContent = './' + defaultDumpDir + ' (当前脚本执行目录)';
558
+ }
559
+ }
560
+
561
+ // 构建ONNX文件的完整路径
562
+ function buildOnnxFilePath(taskName) {
563
+ const onnxFileName = taskName + '.onnx';
564
+ if (currentWorkDir) {
565
+ return currentWorkDir + '/' + defaultDumpDir + '/' + onnxFileName;
566
+ } else {
567
+ // 使用当前脚本执行目录 + dump_dir
568
+ return './' + defaultDumpDir + '/' + onnxFileName;
569
+ }
570
+ }
571
+
572
+ function formatBytes(bytes) {
573
+ if (bytes === 0) return '0 Bytes';
574
+ const k = 1024;
575
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
576
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
577
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
578
+ }
579
+
580
+ function calculateCoreConstInputSize(graph, coreId) {
581
+ const seenTensorNames = new Set();
582
+ return (graph.tensors || [])
583
+ .filter(tensor => tensor.category === 'const_input' && (Number(tensor.plan_core_id) || 0) === coreId)
584
+ .reduce((sum, tensor) => {
585
+ const tensorName = String(tensor.name || '');
586
+ const planSize = Number(tensor.plan_size) || 0;
587
+ if (seenTensorNames.has(tensorName)) {
588
+ return sum;
589
+ }
590
+ seenTensorNames.add(tensorName);
591
+ return sum + planSize;
592
+ }, 0);
593
+ }
594
+
595
+ function calculateCoreProfileInfoSize(graph, coreId) {
596
+ return (graph.tasks || [])
597
+ .filter(task => (Number(task.core_id) || 0) === coreId)
598
+ .reduce((sum, task) => {
599
+ const taskPrivateSize = (task.private_rknn_region || [])
600
+ .reduce((innerSum, region) => innerSum + (Number(region.size) || 0), 0);
601
+ return sum + taskPrivateSize;
602
+ }, 0);
603
+ }
604
+
605
+ function toggleTask(element) {
606
+ const content = element.nextElementSibling;
607
+ const icon = element.querySelector('.expand-icon');
608
+
609
+ if (content.style.display === 'block') {
610
+ content.style.display = 'none';
611
+ icon.textContent = '+';
612
+ } else {
613
+ content.style.display = 'block';
614
+ icon.textContent = '-';
615
+ }
616
+ }
617
+
618
+ function toggleOperator(element) {
619
+ const content = element.nextElementSibling;
620
+ const icon = element.querySelector('.operator-expand-icon');
621
+
622
+ if (content.style.display === 'block') {
623
+ content.style.display = 'none';
624
+ icon.textContent = '+';
625
+ } else {
626
+ content.style.display = 'block';
627
+ icon.textContent = '-';
628
+ }
629
+ }
630
+
631
+ // 初始化全局形状切换器
632
+ function initGlobalShapeSwitcher() {
633
+ const header = modelData.header;
634
+ if (header.inference_mode === 'dynamic_bucket' && header.io_configs && header.io_configs.length > 1) {
635
+ const switcherHtml = header.io_configs.map(config => `
636
+ <button class="btn btn-sm ${config.shape_id === currentShapeId ? 'btn-primary' : 'btn-outline-secondary'} me-2 mb-2"
637
+ onclick="switchGlobalShapeConfig(${config.shape_id})">
638
+ Shape ID ${config.shape_id}
639
+ </button>
640
+ `).join('');
641
+
642
+ document.getElementById('global-shape-buttons').innerHTML = switcherHtml;
643
+ document.getElementById('global-shape-switcher').style.display = 'block';
644
+ }
645
+ }
646
+
647
+ // 全局形状配置切换函数
648
+ function switchGlobalShapeConfig(shapeId) {
649
+ currentShapeId = shapeId;
650
+
651
+ // 更新按钮状态
652
+ const buttons = document.querySelectorAll('#global-shape-buttons button');
653
+ buttons.forEach(btn => {
654
+ if (btn.textContent.includes(`Shape ID ${shapeId}`)) {
655
+ btn.classList.remove('btn-outline-secondary');
656
+ btn.classList.add('btn-primary');
657
+ } else {
658
+ btn.classList.remove('btn-primary');
659
+ btn.classList.add('btn-outline-secondary');
660
+ }
661
+ });
662
+
663
+ // 重新渲染模型信息和子模型
664
+ renderModelInfo();
665
+ renderSubModels();
666
+ }
667
+
668
+ function renderModelInfo() {
669
+ const header = modelData.header;
670
+
671
+ // 获取当前选择的形状配置
672
+ const currentConfig = header.io_configs.find(config => config.shape_id === currentShapeId) || header.io_configs[0];
673
+
674
+ const html = `
675
+ <!-- Header Information Card -->
676
+ <div class="card mb-4">
677
+ <div class="card-header bg-primary text-white">
678
+ <h5 class="mb-0">Model Information</h5>
679
+ </div>
680
+ <div class="card-body">
681
+ <div class="row">
682
+ <!-- Basic Info -->
683
+ <div class="col-md-6">
684
+ <div class="info-group">
685
+ <div class="info-item">
686
+ <span class="info-label">Target Platform:</span>
687
+ <span class="info-value">${header.target_platform}</span>
688
+ </div>
689
+ <div class="info-item">
690
+ <span class="info-label">Description:</span>
691
+ <span class="info-value">${header.description}</span>
692
+ </div>
693
+ <div class="info-item">
694
+ <span class="info-label">Version:</span>
695
+ <span class="info-value">${header.version}</span>
696
+ </div>
697
+ <div class="info-item">
698
+ <span class="info-label">Compiler Version:</span>
699
+ <span class="info-value">${header.compiler_version}</span>
700
+ </div>
701
+ <div class="info-item">
702
+ <span class="info-label">Toolkit Version:</span>
703
+ <span class="info-value">${header.toolkit_version}</span>
704
+ </div>
705
+ <div class="info-item">
706
+ <span class="info-label">NPU Cores:</span>
707
+ <span class="info-value badge bg-secondary">${header.npu_core_number}</span>
708
+ </div>
709
+ <div class="info-item">
710
+ <span class="info-label">VRV Number:</span>
711
+ <span class="info-value badge bg-secondary">${header.vrv_number}</span>
712
+ </div>
713
+ <div class="info-item">
714
+ <span class="info-label">Inference Mode:</span>
715
+ <span class="info-value badge ${header.inference_mode === 'dynamic_bucket' ? 'bg-warning' : 'bg-info'}">${header.inference_mode}</span>
716
+ </div>
717
+ ${header.inference_mode === 'dynamic_bucket' ? `
718
+ <div class="info-item">
719
+ <span class="info-label">Current Shape ID:</span>
720
+ <span class="info-value badge bg-secondary">${currentShapeId}</span>
721
+ </div>
722
+ <div class="info-item">
723
+ <span class="info-label">Shape Configs:</span>
724
+ <span class="info-value badge bg-secondary">${header.io_configs.length}</span>
725
+ </div>
726
+ ` : ''}
727
+ </div>
728
+ </div>
729
+
730
+ <!-- Tensors Info -->
731
+ <div class="col-md-6">
732
+ <!-- Input Tensors Section -->
733
+ <div class="card mb-3 inner-card">
734
+ <div class="card-header">
735
+ <h6 class="mb-0 d-flex align-items-center">
736
+ <i class="fas fa-sign-in-alt me-2"></i>Input Tensors
737
+ </h6>
738
+ </div>
739
+ <div class="card-body p-0">
740
+ <ul class="list-group list-group-flush">
741
+ ${currentConfig.inputs.map((tensor, idx) => `
742
+ <li class="list-group-item p-2">
743
+ <div class="tensor-header" role="button" onclick="toggleTensorDetails(this)">
744
+ <div class="d-flex justify-content-between align-items-center">
745
+ <div class="tensor-basic-info">
746
+ <span class="tensor-name">${tensor.name}</span>
747
+ <div class="tensor-type-shape">
748
+ <span class="badge bg-light text-dark me-2">${tensor.type}</span>
749
+ <span class="badge bg-light text-dark">shape=[${tensor.shape.join(', ')}]</span>
750
+ </div>
751
+ </div>
752
+ <span class="collapse-icon">+</span>
753
+ </div>
754
+ </div>
755
+ <div class="tensor-details" style="display: none;">
756
+ <div class="ms-3 mt-2">
757
+ <div class="detail-section">
758
+ <div class="detail-header">Quantization</div>
759
+ <div class="detail-content">
760
+ <div class="detail-item">
761
+ <span class="detail-label">QType:</span>
762
+ <span class="detail-value">${tensor.qtype}</span>
763
+ </div>
764
+ <div class="detail-item">
765
+ <span class="detail-label">QMethod:</span>
766
+ <span class="detail-value">${tensor.qmethod || 'N/A'}</span>
767
+ </div>
768
+ <div class="detail-item">
769
+ <span class="detail-label">Scale:</span>
770
+ <span class="detail-value">${tensor.scale.length ? tensor.scale.join(', ') : 'N/A'}</span>
771
+ </div>
772
+ <div class="detail-item">
773
+ <span class="detail-label">Zero Point:</span>
774
+ <span class="detail-value">${tensor.zero_point.length ? tensor.zero_point.join(', ') : 'N/A'}</span>
775
+ </div>
776
+ <div class="detail-item">
777
+ <span class="detail-label">Min:</span>
778
+ <span class="detail-value">${tensor.min.length ? tensor.min.join(', ') : 'N/A'}</span>
779
+ </div>
780
+ <div class="detail-item">
781
+ <span class="detail-label">Max:</span>
782
+ <span class="detail-value">${tensor.max.length ? tensor.max.join(', ') : 'N/A'}</span>
783
+ </div>
784
+ </div>
785
+ </div>
786
+ ${currentConfig.input_tiling_infos[idx] ? `
787
+ <div class="detail-section mt-3">
788
+ <div class="detail-header">Tiling Info</div>
789
+ <div class="detail-content">
790
+ <div class="detail-item">
791
+ <span class="detail-label">Tile Offset:</span>
792
+ <span class="detail-value">${currentConfig.input_tiling_infos[idx].tile_offset.join(', ')}</span>
793
+ </div>
794
+ <div class="detail-item">
795
+ <span class="detail-label">Tile Size:</span>
796
+ <span class="detail-value">${currentConfig.input_tiling_infos[idx].tile_size.join(', ')}</span>
797
+ </div>
798
+ </div>
799
+ </div>
800
+ ` : ''}
801
+ </div>
802
+ </div>
803
+ </li>
804
+ `).join('')}
805
+ </ul>
806
+ </div>
807
+ </div>
808
+
809
+ <!-- Output Tensors Section -->
810
+ <div class="card inner-card">
811
+ <div class="card-header">
812
+ <h6 class="mb-0 d-flex align-items-center">
813
+ <i class="fas fa-sign-out-alt me-2"></i>Output Tensors
814
+ </h6>
815
+ </div>
816
+ <div class="card-body p-0">
817
+ <ul class="list-group list-group-flush">
818
+ ${currentConfig.outputs.map((tensor, idx) => `
819
+ <li class="list-group-item p-2">
820
+ <div class="tensor-header" role="button" onclick="toggleTensorDetails(this)">
821
+ <div class="d-flex justify-content-between align-items-center">
822
+ <div class="tensor-basic-info">
823
+ <span class="tensor-name">${tensor.name}</span>
824
+ <div class="tensor-type-shape">
825
+ <span class="badge bg-light text-dark me-2">${tensor.type}</span>
826
+ <span class="badge bg-light text-dark">shape=[${tensor.shape.join(', ')}]</span>
827
+ </div>
828
+ </div>
829
+ <span class="collapse-icon">+</span>
830
+ </div>
831
+ </div>
832
+ <div class="tensor-details" style="display: none;">
833
+ <div class="ms-3 mt-2">
834
+ <div class="detail-section">
835
+ <div class="detail-header">Quantization</div>
836
+ <div class="detail-content">
837
+ <div class="detail-item">
838
+ <span class="detail-label">QType:</span>
839
+ <span class="detail-value">${tensor.qtype}</span>
840
+ </div>
841
+ <div class="detail-item">
842
+ <span class="detail-label">QMethod:</span>
843
+ <span class="detail-value">${tensor.qmethod || 'N/A'}</span>
844
+ </div>
845
+ <div class="detail-item">
846
+ <span class="detail-label">Scale:</span>
847
+ <span class="detail-value">${tensor.scale.length ? tensor.scale.join(', ') : 'N/A'}</span>
848
+ </div>
849
+ <div class="detail-item">
850
+ <span class="detail-label">Zero Point:</span>
851
+ <span class="detail-value">${tensor.zero_point.length ? tensor.zero_point.join(', ') : 'N/A'}</span>
852
+ </div>
853
+ <div class="detail-item">
854
+ <span class="detail-label">Min:</span>
855
+ <span class="detail-value">${tensor.min.length ? tensor.min.join(', ') : 'N/A'}</span>
856
+ </div>
857
+ <div class="detail-item">
858
+ <span class="detail-label">Max:</span>
859
+ <span class="detail-value">${tensor.max.length ? tensor.max.join(', ') : 'N/A'}</span>
860
+ </div>
861
+ </div>
862
+ </div>
863
+ ${currentConfig.output_tiling_infos[idx] ? `
864
+ <div class="detail-section mt-3">
865
+ <div class="detail-header">Tiling Info</div>
866
+ <div class="detail-content">
867
+ <div class="detail-item">
868
+ <span class="detail-label">Tile Offset:</span>
869
+ <span class="detail-value">${currentConfig.output_tiling_infos[idx].tile_offset.join(', ')}</span>
870
+ </div>
871
+ <div class="detail-item">
872
+ <span class="detail-label">Tile Size:</span>
873
+ <span class="detail-value">${currentConfig.output_tiling_infos[idx].tile_size.join(', ')}</span>
874
+ </div>
875
+ </div>
876
+ </div>
877
+ ` : ''}
878
+ </div>
879
+ </div>
880
+ </li>
881
+ `).join('')}
882
+ </ul>
883
+ </div>
884
+ </div>
885
+ </div>
886
+ </div>
887
+ </div>
888
+ </div>
889
+ `;
890
+ document.getElementById('model-info').innerHTML = html;
891
+ }
892
+
893
+ // 添加切换详情的函数
894
+ function toggleTensorDetails(element) {
895
+ const details = element.nextElementSibling;
896
+ const icon = element.querySelector('.collapse-icon');
897
+
898
+ if (details.style.display === 'none') {
899
+ details.style.display = 'block';
900
+ icon.textContent = '-';
901
+ } else {
902
+ details.style.display = 'none';
903
+ icon.textContent = '+';
904
+ }
905
+ }
906
+
907
+ function renderSubModels() {
908
+ const html = modelData.sub_models.map((subModel, subModelIdx) => `
909
+ <div class="card mb-4">
910
+ <div class="card-header">
911
+ <h5>SubModel ${subModelIdx} (VRV ID: ${subModel.vrv_id})</h5>
912
+ <div class="text-muted">
913
+ Inference Mode: ${subModel.inference_mode}<br>
914
+ Command Size: ${formatBytes(subModel.command_size)} (${subModel.command_size} bytes)<br>
915
+ Weight Size: ${formatBytes(subModel.weight_size)} (${subModel.weight_size} bytes)<br>
916
+ KVCache Size: ${formatBytes(subModel.kvcache_size)} (${subModel.kvcache_size} bytes)<br>
917
+ Internal Size: ${formatBytes(subModel.internal_size)} (${subModel.internal_size} bytes)
918
+ </div>
919
+ </div>
920
+ <div class="card-body">
921
+ <div id="compute-graphs-${subModelIdx}">
922
+ ${subModel.compute_graphs.map((graph, graphIdx) => `
923
+ <div class="compute-graph ${graphIdx === currentShapeId ? 'active' : ''}" id="graph-${subModelIdx}-${graphIdx}"
924
+ style="display: ${graphIdx === currentShapeId ? 'block' : 'none'}">
925
+ <div class="task-columns">
926
+ ${generateTaskColumns(
927
+ graph.tasks,
928
+ modelData.header.npu_core_number,
929
+ subModel.vrv_id,
930
+ modelData.header.vrv_number
931
+ )}
932
+ </div>
933
+
934
+ <div class="memory-columns mt-4">
935
+ ${generateMemoryColumns(
936
+ graph.memory_allocations,
937
+ modelData.header.npu_core_number,
938
+ subModel.vrv_id,
939
+ modelData.header.vrv_number,
940
+ graph
941
+ )}
942
+ </div>
943
+ </div>
944
+ `).join('')}
945
+ </div>
946
+ </div>
947
+ </div>
948
+ `).join('');
949
+
950
+ document.getElementById('submodels').innerHTML = html;
951
+ }
952
+
953
+ function generateTaskColumns(tasks, npu_core_number, vrv_id, vrv_number) {
954
+ // 直接按实际的 core_id 分组,不再过滤
955
+ const tasksByCore = {};
956
+ const allTaskIds = new Set();
957
+
958
+ tasks.forEach(task => {
959
+ if (!tasksByCore[task.core_id]) {
960
+ tasksByCore[task.core_id] = {};
961
+ }
962
+ tasksByCore[task.core_id][task.id] = task;
963
+ allTaskIds.add(task.id);
964
+ });
965
+
966
+ // 获取所有参与的 core_id 并排序
967
+ const coreIds = Object.keys(tasksByCore).map(Number).sort((a, b) => a - b);
968
+
969
+ // 将所有 task id 排序
970
+ const sortedTaskIds = Array.from(allTaskIds).sort((a, b) => a - b);
971
+
972
+ return `
973
+ <div class="task-table">
974
+ <!-- 添加 core id 标题行 -->
975
+ <div class="task-table-header">
976
+ ${coreIds.map(core_id => `
977
+ <div class="task-column-header">
978
+ <h6 class="mb-0">Core ${core_id}</h6>
979
+ <small class="text-muted">Tasks: ${Object.keys(tasksByCore[core_id]).length}</small>
980
+ </div>
981
+ `).join('')}
982
+ </div>
983
+
984
+ <div class="task-table-body">
985
+ ${sortedTaskIds.map(taskId => `
986
+ <div class="task-row">
987
+ ${coreIds.map(core_id => {
988
+ const task = tasksByCore[core_id] ? tasksByCore[core_id][taskId] : null;
989
+ return `
990
+ <div class="task-cell">
991
+ ${task ? `
992
+ <div class="task-card">
993
+ <div class="task-header" onclick="toggleTask(this)">
994
+ <div class="task-basic-info">
995
+ <div>
996
+ <strong>Task ${taskId}</strong>
997
+ <span class="badge bg-secondary ms-2">${task.type}</span>
998
+ <small class="text-muted ms-2">${task.operators.length} ops</small>
999
+ </div>
1000
+ <div class="task-name">${task.name || 'Unnamed Task'}</div>
1001
+ <div class="task-onnx-link">
1002
+ <button class="btn btn-sm btn-outline-primary" onclick="openOnnxFile('${task.name || 'Unnamed Task'}', event)">
1003
+ <i class="fas fa-external-link-alt"></i> Open ONNX
1004
+ </button>
1005
+ </div>
1006
+ </div>
1007
+ <span class="expand-icon">+</span>
1008
+ </div>
1009
+
1010
+ <div class="task-content">
1011
+ <!-- Task Information -->
1012
+ <div class="section-header">Task Information</div>
1013
+ <div class="task-info mb-3">
1014
+ <div><strong>ID:</strong> ${taskId}</div>
1015
+ <div><strong>Name:</strong> ${task.name || 'Unnamed Task'}</div>
1016
+ <div><strong>Type:</strong> ${task.type}</div>
1017
+ <div><strong>Core:</strong> ${core_id}</div>
1018
+ <div><strong>ONNX File:</strong> ${task.name || 'Unnamed Task'}.onnx</div>
1019
+ </div>
1020
+
1021
+ <!-- Operators Section -->
1022
+ <div class="section-header">Operators</div>
1023
+ <div class="operator-list">
1024
+ ${task.operators.map(op => `
1025
+ <div class="operator-item">
1026
+ <span class="operator-header" onclick="toggleOperator(this)">
1027
+ <span class="operator-expand-icon">+</span>${op.type}
1028
+ </span>
1029
+ <div class="operator-content" style="display: none;">
1030
+ <strong>Name:</strong> ${op.name}<br>
1031
+ </div>
1032
+ </div>
1033
+ `).join('')}
1034
+ </div>
1035
+
1036
+ <!-- Memory & Tensors Section -->
1037
+ <div class="section-header mt-3">Memory & Tensors</div>
1038
+ <div class="memory-info">
1039
+ <div><small>Inputs:</small> ${task.inputs.join(', ')}</div>
1040
+ <div><small>Outputs:</small> ${task.outputs.join(', ')}</div>
1041
+ <div class="mt-2">
1042
+ <small>Commands:</small>
1043
+ <table class="table table-sm table-bordered mt-1">
1044
+ <thead>
1045
+ <tr>
1046
+ <th>Index</th>
1047
+ <th>Size (bytes)</th>
1048
+ <th>Offset (bytes)</th>
1049
+ </tr>
1050
+ </thead>
1051
+ <tbody>
1052
+ ${task.commands.map((cmd, idx) => `
1053
+ <tr>
1054
+ <td>${idx}</td>
1055
+ <td>${cmd.size}</td>
1056
+ <td>${cmd.offset}</td>
1057
+ </tr>
1058
+ `).join('')}
1059
+ </tbody>
1060
+ </table>
1061
+ </div>
1062
+ <div class="mt-2">
1063
+ <small>Weights:</small>
1064
+ <table class="table table-sm table-bordered mt-1">
1065
+ <thead>
1066
+ <tr>
1067
+ <th>Index</th>
1068
+ <th>Size (bytes)</th>
1069
+ <th>Offset (bytes)</th>
1070
+ </tr>
1071
+ </thead>
1072
+ <tbody>
1073
+ ${task.weights.map((init, idx) => `
1074
+ <tr>
1075
+ <td>${idx}</td>
1076
+ <td>${init.size}</td>
1077
+ <td>${init.offset}</td>
1078
+ </tr>
1079
+ `).join('')}
1080
+ </tbody>
1081
+ </table>
1082
+ </div>
1083
+ </div>
1084
+ </div>
1085
+ </div>
1086
+ ` : ''}
1087
+ </div>
1088
+ `;
1089
+ }).join('')}
1090
+ </div>
1091
+ `).join('')}
1092
+ </div>
1093
+ </div>
1094
+ `;
1095
+ }
1096
+
1097
+ function generateMemoryColumns(memory_allocations, npu_core_number, vrv_id, vrv_number, graph) {
1098
+ // 计算当前VRV负责的core范围
1099
+ const core_per_vrv = Math.ceil(npu_core_number / vrv_number);
1100
+ const core_start = vrv_id * core_per_vrv;
1101
+ const core_end = core_start + core_per_vrv;
1102
+
1103
+ const memoryByCore = {};
1104
+ memory_allocations.forEach(mem => {
1105
+ if (mem.core_index >= core_start && mem.core_index < core_end) {
1106
+ memoryByCore[mem.core_index] = mem;
1107
+ }
1108
+ });
1109
+
1110
+ return Array.from({length: core_per_vrv}, (_, i) => {
1111
+ const core_id = core_start + i;
1112
+ const rawCommandSize = memoryByCore[core_id] ? (Number(memoryByCore[core_id].command_size) || 0) : 0;
1113
+ const constInputSize = calculateCoreConstInputSize(graph, core_id);
1114
+ const profileInfoSize = calculateCoreProfileInfoSize(graph, core_id);
1115
+ const commandSize = Math.max(0, rawCommandSize - constInputSize - profileInfoSize);
1116
+ return `
1117
+ <div class="memory-column">
1118
+ <div class="memory-header">
1119
+ <h6 class="mb-0">Core ${core_id} Memory</h6>
1120
+ </div>
1121
+ ${memoryByCore[core_id] ? `
1122
+ <div class="memory-content">
1123
+ <div class="memory-item">
1124
+ <strong>Total Size:</strong><br>
1125
+ ${formatBytes(memoryByCore[core_id].total_size)} (${memoryByCore[core_id].total_size} bytes)
1126
+ </div>
1127
+ <div class="memory-item">
1128
+ <strong>Weights:</strong><br>
1129
+ ${formatBytes(memoryByCore[core_id].weights_size)} (${memoryByCore[core_id].weights_size} bytes)
1130
+ </div>
1131
+ <div class="memory-item">
1132
+ <strong>Command Size:</strong><br>
1133
+ ${formatBytes(commandSize)} (${commandSize} bytes)
1134
+ </div>
1135
+ <div class="memory-item">
1136
+ <strong>Const Input Size:</strong><br>
1137
+ ${formatBytes(constInputSize)} (${constInputSize} bytes)
1138
+ </div>
1139
+ <div class="memory-item">
1140
+ <strong>Profile Info Size:</strong><br>
1141
+ ${formatBytes(profileInfoSize)} (${profileInfoSize} bytes)
1142
+ </div>
1143
+ <div class="memory-item">
1144
+ <strong>KVCache:</strong><br>
1145
+ ${formatBytes(memoryByCore[core_id].kvcache_size)} (${memoryByCore[core_id].kvcache_size} bytes)
1146
+ </div>
1147
+ <div class="memory-item">
1148
+ <strong>Internal:</strong><br>
1149
+ ${formatBytes(memoryByCore[core_id].internal_size)} (${memoryByCore[core_id].internal_size} bytes)
1150
+ </div>
1151
+ </div>
1152
+ ` : `
1153
+ <div class="memory-content text-muted">
1154
+ No memory allocation
1155
+ </div>
1156
+ `}
1157
+ </div>
1158
+ `;
1159
+ }).join('');
1160
+ }
1161
+
1162
+ // 初始化页面
1163
+ document.addEventListener('DOMContentLoaded', function() {
1164
+ initWorkDir();
1165
+ initGlobalShapeSwitcher();
1166
+ renderModelInfo();
1167
+ renderSubModels();
1168
+ });
1169
+
1170
+ // 添加打开ONNX文件的函数
1171
+ function openOnnxFile(taskName, event) {
1172
+ // 阻止事件冒泡,防止触发task展开/收缩
1173
+ event.stopPropagation();
1174
+
1175
+ // 构建ONNX文件路径
1176
+ const onnxFilePath = buildOnnxFilePath(taskName);
1177
+
1178
+ // 尝试多种方式打开ONNX文件
1179
+ try {
1180
+ // 方式1: 尝试使用Netron在线版本
1181
+ const netronUrl = 'https://netron.app/';
1182
+ const newWindow = window.open(netronUrl, '_blank');
1183
+
1184
+ if (newWindow) {
1185
+ // 显示文件路径信息
1186
+ showOnnxFileInfo(onnxFilePath, netronUrl);
1187
+ } else {
1188
+ // 如果弹窗被阻止,显示手动操作提示
1189
+ showManualOnnxInstructions(onnxFilePath);
1190
+ }
1191
+ } catch (error) {
1192
+ console.error('Error opening ONNX file:', error);
1193
+ showManualOnnxInstructions(onnxFilePath);
1194
+ }
1195
+ }
1196
+
1197
+ function showOnnxFileInfo(filePath, netronUrl) {
1198
+ const modal = document.createElement('div');
1199
+ modal.className = 'modal fade show';
1200
+ modal.style.display = 'block';
1201
+ modal.style.backgroundColor = 'rgba(0,0,0,0.5)';
1202
+ modal.innerHTML = `
1203
+ <div class="modal-dialog">
1204
+ <div class="modal-content">
1205
+ <div class="modal-header">
1206
+ <h5 class="modal-title">ONNX文件信息</h5>
1207
+ <button type="button" class="btn-close" onclick="closeModal(this)"></button>
1208
+ </div>
1209
+ <div class="modal-body">
1210
+ <div class="alert alert-info">
1211
+ <h6>Netron已在新窗口中打开!</h6>
1212
+ <p>请在Netron中打开以下文件:</p>
1213
+ <div class="file-path-container">
1214
+ <input type="text" class="form-control" value="${filePath}" readonly>
1215
+ <button class="btn btn-sm btn-outline-secondary ms-2" onclick="copyToClipboard('${filePath}')">
1216
+ <i class="fas fa-copy"></i> 复制路径
1217
+ </button>
1218
+ </div>
1219
+ </div>
1220
+ <div class="alert alert-warning">
1221
+ <h6>使用说明:</h6>
1222
+ <ol>
1223
+ <li>在Netron窗口中点击"Open Model"按钮</li>
1224
+ <li>粘贴或输入上述文件路径</li>
1225
+ <li>点击打开即可查看ONNX模型结构</li>
1226
+ </ol>
1227
+ </div>
1228
+ </div>
1229
+ <div class="modal-footer">
1230
+ <button type="button" class="btn btn-secondary" onclick="closeModal(this)">关闭</button>
1231
+ <button type="button" class="btn btn-primary" onclick="window.open('${netronUrl}', '_blank')">重新打开Netron</button>
1232
+ </div>
1233
+ </div>
1234
+ </div>
1235
+ `;
1236
+ document.body.appendChild(modal);
1237
+ }
1238
+
1239
+ function showManualOnnxInstructions(filePath) {
1240
+ const modal = document.createElement('div');
1241
+ modal.className = 'modal fade show';
1242
+ modal.style.display = 'block';
1243
+ modal.style.backgroundColor = 'rgba(0,0,0,0.5)';
1244
+ modal.innerHTML = `
1245
+ <div class="modal-dialog">
1246
+ <div class="modal-content">
1247
+ <div class="modal-header">
1248
+ <h5 class="modal-title">打开ONNX文件</h5>
1249
+ <button type="button" class="btn-close" onclick="closeModal(this)"></button>
1250
+ </div>
1251
+ <div class="modal-body">
1252
+ <div class="alert alert-info">
1253
+ <h6>ONNX文件路径:</h6>
1254
+ <div class="file-path-container">
1255
+ <input type="text" class="form-control" value="${filePath}" readonly>
1256
+ <button class="btn btn-sm btn-outline-secondary ms-2" onclick="copyToClipboard('${filePath}')">
1257
+ <i class="fas fa-copy"></i> 复制路径
1258
+ </button>
1259
+ </div>
1260
+ </div>
1261
+ <div class="alert alert-warning">
1262
+ <h6>手动打开方式:</h6>
1263
+ <ol>
1264
+ <li><strong>在线版本:</strong> <a href="https://netron.app/" target="_blank">点击打开Netron在线版</a></li>
1265
+ <li><strong>本地版本:</strong> 如果已安装Netron,可在终端运行:<br>
1266
+ <code>netron "${filePath}"</code>
1267
+ </li>
1268
+ <li><strong>其他工具:</strong> 也可使用其他ONNX查看工具打开该文件</li>
1269
+ </ol>
1270
+ </div>
1271
+ </div>
1272
+ <div class="modal-footer">
1273
+ <button type="button" class="btn btn-secondary" onclick="closeModal(this)">关闭</button>
1274
+ <button type="button" class="btn btn-primary" onclick="window.open('https://netron.app/', '_blank')">打开Netron在线版</button>
1275
+ </div>
1276
+ </div>
1277
+ </div>
1278
+ `;
1279
+ document.body.appendChild(modal);
1280
+ }
1281
+
1282
+ function copyToClipboard(text) {
1283
+ navigator.clipboard.writeText(text).then(() => {
1284
+ showToast('路径已复制到剪贴板!', 'success');
1285
+ }).catch(err => {
1286
+ console.error('复制失败:', err);
1287
+ // 降级处理:选择文本
1288
+ const textArea = document.createElement('textarea');
1289
+ textArea.value = text;
1290
+ document.body.appendChild(textArea);
1291
+ textArea.select();
1292
+ document.execCommand('copy');
1293
+ document.body.removeChild(textArea);
1294
+ showToast('路径已复制到剪贴板!', 'success');
1295
+ });
1296
+ }
1297
+
1298
+ function showToast(message, type = 'info') {
1299
+ const toast = document.createElement('div');
1300
+ toast.className = 'toast-notification';
1301
+ toast.textContent = message;
1302
+
1303
+ const colorMap = {
1304
+ 'success': '#28a745',
1305
+ 'warning': '#ffc107',
1306
+ 'info': '#17a2b8',
1307
+ 'error': '#dc3545'
1308
+ };
1309
+
1310
+ toast.style.cssText = `
1311
+ position: fixed;
1312
+ top: 20px;
1313
+ right: 20px;
1314
+ background: ${colorMap[type] || colorMap.info};
1315
+ color: white;
1316
+ padding: 10px 20px;
1317
+ border-radius: 4px;
1318
+ z-index: 9999;
1319
+ box-shadow: 0 2px 5px rgba(0,0,0,0.2);
1320
+ font-size: 14px;
1321
+ `;
1322
+ document.body.appendChild(toast);
1323
+
1324
+ setTimeout(() => {
1325
+ if (document.body.contains(toast)) {
1326
+ document.body.removeChild(toast);
1327
+ }
1328
+ }, 3000);
1329
+ }
1330
+
1331
+ function closeModal(button) {
1332
+ const modal = button.closest('.modal');
1333
+ if (modal && document.body.contains(modal)) {
1334
+ document.body.removeChild(modal);
1335
+ }
1336
+ }
1337
+ </script>
1338
+ </div>
1339
+ </body>
1340
+ </html>
1341
+
ResNet50V2-224x224-w8a8-1/SHA256SUMS ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ 237176152a59bd8dc36797717c7f1cbee8afbad0cb74660d66cacf0641af2206 README.md
2
+ a17637cefaaa27d640a0cac1bbd1d26a286fa3ad3c5e0194ea264847940231c6 README_CN.md
3
+ 5dd23b15d4d3b68a337f4c9c0e7a386a2e81689a221db69cf01ab7be9d696bb1 ResNet50V2.rknn
4
+ bc0b10741339aea31b5f6d578c28daab4348244acb2bdb837782e02d4cea7aac ResNet50V2.weight
5
+ a512aca4dfe8d088b62c7708c2e55db2cc50b3d55e892922124bea5f2020a459 ResNet50V2_report.html
6
+ 30532294a4656fdc85a2c34763d762bd01849de2726e09dd8c8db55c8d5f75f9 config.json
ResNet50V2-224x224-w8a8-1/config.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "1.0",
3
+ "model_id": "UGREENDEV/RK182X-CNN-ResNet50V2",
4
+ "display_name": "RK182X-CNN-ResNet50V2",
5
+ "model_name": "ResNet50V2",
6
+ "source_model": "https://github.com/onnx/models/tree/main/validated/vision/classification/resnet",
7
+ "source_revision": null,
8
+ "release_tag": "v1.2.0",
9
+ "runtime_type": "rknn",
10
+ "rknn_version": null,
11
+ "chip_label": "RK182X",
12
+ "supported_chips": [
13
+ "RK1820",
14
+ "RK1828"
15
+ ],
16
+ "model_type": "CNN",
17
+ "deployment": {
18
+ "card_count": 1
19
+ },
20
+ "validated_at": null,
21
+ "models": [
22
+ {
23
+ "model_name": "ResNet50V2",
24
+ "role": "vision",
25
+ "model_path": "ResNet50V2.rknn",
26
+ "report_path": "ResNet50V2_report.html",
27
+ "npu_cores": 1,
28
+ "quantization": "w8a8",
29
+ "quantization_algorithm": "normal",
30
+ "resolution": [
31
+ 224,
32
+ 224
33
+ ],
34
+ "pixel_inputs": [
35
+ "data"
36
+ ],
37
+ "compiled_io": [
38
+ {
39
+ "shape_id": 0,
40
+ "inputs": [
41
+ {
42
+ "name": "data",
43
+ "type": "uint8",
44
+ "layout": "NHWC",
45
+ "shape": [
46
+ 1,
47
+ 224,
48
+ 224,
49
+ 3
50
+ ]
51
+ }
52
+ ],
53
+ "outputs": [
54
+ {
55
+ "name": "resnetv24_dense0_fwd",
56
+ "type": "int8",
57
+ "layout": "undefined",
58
+ "shape": [
59
+ 1,
60
+ 1000
61
+ ]
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ }
67
+ ],
68
+ "files": [
69
+ "README.md",
70
+ "README_CN.md",
71
+ "ResNet50V2.rknn",
72
+ "ResNet50V2.weight",
73
+ "ResNet50V2_report.html",
74
+ "SHA256SUMS",
75
+ "config.json"
76
+ ]
77
+ }
ResNet50V2-224x224-w8a8-1/resnet50-v2-7.rknn ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4021f099497c8f6d0765f88bbab9da7542b13db3c3a9078a33ae22b129f65047
3
+ size 196704
ResNet50V2-224x224-w8a8-1/resnet50-v2-7.weight ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7df31afdb844bef961ada36566918140ae60ed185264452d4f73d7248c40edda
3
+ size 26036224
ResNet50V2-224x224-w8a8-1/resnet50-v2-7_report.html ADDED
@@ -0,0 +1,1341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <title>RKNX Model Visualization</title>
6
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
7
+ <style>
8
+ .task-columns {
9
+ display: flex;
10
+ gap: 20px;
11
+ overflow-x: auto;
12
+ padding: 20px 0;
13
+ }
14
+
15
+ .task-column {
16
+ min-width: 300px;
17
+ flex: 0 0 auto;
18
+ border: 1px solid #dee2e6;
19
+ border-radius: 8px;
20
+ padding: 15px;
21
+ }
22
+
23
+ .column-header {
24
+ background: #f8f9fa;
25
+ padding: 10px;
26
+ margin: -15px -15px 15px -15px;
27
+ border-radius: 8px 8px 0 0;
28
+ border-bottom: 1px solid #dee2e6;
29
+ }
30
+
31
+ .task-card {
32
+ border: 1px solid #e9ecef;
33
+ border-radius: 4px;
34
+ margin-bottom: 10px;
35
+ padding: 10px;
36
+ }
37
+
38
+ .task-card:hover {
39
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
40
+ }
41
+
42
+ .task-header {
43
+ cursor: pointer;
44
+ display: flex;
45
+ justify-content: space-between;
46
+ align-items: center;
47
+ padding: 8px;
48
+ background: #f8f9fa;
49
+ border-radius: 4px;
50
+ }
51
+
52
+ .task-header:hover {
53
+ background: #e9ecef;
54
+ }
55
+
56
+ .task-content {
57
+ display: none;
58
+ padding: 10px;
59
+ margin-top: 10px;
60
+ border-top: 1px solid #e9ecef;
61
+ }
62
+
63
+ .expand-icon {
64
+ font-family: monospace;
65
+ font-weight: bold;
66
+ font-size: 16px;
67
+ color: #666;
68
+ width: 20px;
69
+ text-align: center;
70
+ }
71
+
72
+ .task-header:hover .expand-icon {
73
+ color: #333;
74
+ }
75
+
76
+ .task-basic-info {
77
+ flex-grow: 1;
78
+ margin-right: 10px;
79
+ }
80
+
81
+ .operator-preview {
82
+ color: #666;
83
+ font-size: 0.9em;
84
+ margin-top: 4px;
85
+ }
86
+
87
+ .section-header {
88
+ font-size: 0.9rem;
89
+ color: #666;
90
+ margin: 10px 0 5px;
91
+ padding-bottom: 3px;
92
+ border-bottom: 1px solid #eee;
93
+ }
94
+
95
+ .operator-list {
96
+ margin-left: 10px;
97
+ }
98
+
99
+ .operator-item {
100
+ padding: 3px 0;
101
+ font-size: 0.9rem;
102
+ }
103
+
104
+ .operator-header {
105
+ cursor: pointer;
106
+ display: flex;
107
+ align-items: center;
108
+ padding: 5px 0;
109
+ }
110
+
111
+ .operator-header:hover {
112
+ background: #f1f1f1;
113
+ }
114
+
115
+ .operator-expand-icon {
116
+ font-family: monospace;
117
+ font-weight: bold;
118
+ font-size: 14px;
119
+ color: #666;
120
+ width: 20px;
121
+ text-align: center;
122
+ margin-right: 8px;
123
+ }
124
+
125
+ .memory-columns {
126
+ display: flex;
127
+ gap: 20px;
128
+ overflow-x: auto;
129
+ padding: 20px 0;
130
+ }
131
+
132
+ .memory-column {
133
+ min-width: 300px;
134
+ flex: 0 0 auto;
135
+ border: 1px solid #dee2e6;
136
+ border-radius: 8px;
137
+ padding: 15px;
138
+ }
139
+
140
+ .memory-header {
141
+ background: #f8f9fa;
142
+ padding: 10px;
143
+ margin: -15px -15px 15px -15px;
144
+ border-radius: 8px 8px 0 0;
145
+ border-bottom: 1px solid #dee2e6;
146
+ }
147
+
148
+ .memory-content {
149
+ padding: 10px;
150
+ }
151
+
152
+ .memory-item {
153
+ margin-bottom: 8px;
154
+ }
155
+
156
+ .memory-item:last-child {
157
+ margin-bottom: 0;
158
+ }
159
+
160
+ .task-table {
161
+ width: 100%;
162
+ overflow-x: auto;
163
+ }
164
+
165
+ .task-table-header {
166
+ display: flex;
167
+ gap: 20px;
168
+ margin-bottom: 15px;
169
+ }
170
+
171
+ .task-column-header {
172
+ min-width: 300px;
173
+ flex: 1;
174
+ background: #f8f9fa;
175
+ padding: 12px;
176
+ border: 1px solid #dee2e6;
177
+ border-radius: 8px;
178
+ text-align: center;
179
+ }
180
+
181
+ .task-column-header h6 {
182
+ color: #495057;
183
+ margin-bottom: 4px;
184
+ }
185
+
186
+ .task-column-header small {
187
+ color: #6c757d;
188
+ }
189
+
190
+ .task-table-body {
191
+ display: flex;
192
+ flex-direction: column;
193
+ gap: 10px;
194
+ }
195
+
196
+ .task-row {
197
+ display: flex;
198
+ gap: 20px;
199
+ }
200
+
201
+ .task-cell {
202
+ min-width: 300px;
203
+ flex: 1;
204
+ padding: 5px;
205
+ border: 1px solid transparent;
206
+ }
207
+
208
+ .task-cell:empty {
209
+ border-color: #f8f9fa;
210
+ background: #fafafa;
211
+ border-radius: 4px;
212
+ }
213
+
214
+ .card-header[role="button"] {
215
+ cursor: pointer;
216
+ }
217
+
218
+ .card-header[role="button"]:hover {
219
+ background-color: #f8f9fa;
220
+ }
221
+
222
+ .collapse-icon {
223
+ font-family: monospace;
224
+ font-weight: bold;
225
+ font-size: 16px;
226
+ color: #666;
227
+ transition: transform 0.2s;
228
+ }
229
+
230
+ .list-unstyled {
231
+ margin-bottom: 0;
232
+ }
233
+
234
+ .tensor-header {
235
+ cursor: pointer;
236
+ padding: 8px;
237
+ background-color: #f8f9fa;
238
+ border-radius: 4px;
239
+ border: 1px solid #dee2e6;
240
+ }
241
+
242
+ .tensor-header:hover {
243
+ background-color: #e9ecef;
244
+ }
245
+
246
+ .tensor-details {
247
+ padding: 10px;
248
+ border: 1px solid #dee2e6;
249
+ border-top: none;
250
+ border-radius: 0 0 4px 4px;
251
+ background-color: #fff;
252
+ }
253
+
254
+ .collapse-icon {
255
+ font-family: monospace;
256
+ font-weight: bold;
257
+ font-size: 16px;
258
+ color: #666;
259
+ min-width: 20px;
260
+ text-align: center;
261
+ }
262
+
263
+ .list-unstyled li:last-child {
264
+ margin-bottom: 0 !important;
265
+ }
266
+
267
+ /* 基础样式 */
268
+ .info-group {
269
+ display: flex;
270
+ flex-direction: column;
271
+ gap: 0.5rem;
272
+ }
273
+
274
+ .info-item {
275
+ display: flex;
276
+ align-items: baseline;
277
+ padding: 0.5rem;
278
+ border-radius: 4px;
279
+ background-color: #f8f9fa;
280
+ }
281
+
282
+ .info-label {
283
+ font-weight: 600;
284
+ color: #495057;
285
+ min-width: 140px;
286
+ }
287
+
288
+ .info-value {
289
+ color: #212529;
290
+ }
291
+
292
+ /* 内部卡片样式 */
293
+ .inner-card {
294
+ box-shadow: none;
295
+ border: 1px solid rgba(0,0,0,.125);
296
+ }
297
+
298
+ .inner
299
+
300
+ .task-name {
301
+ font-size: 0.9em;
302
+ margin-top: 2px;
303
+ margin-bottom: 4px;
304
+ color: #666;
305
+ word-break: break-word;
306
+ }
307
+
308
+ .task-onnx-link {
309
+ margin-top: 5px;
310
+ }
311
+
312
+ .task-onnx-link button {
313
+ font-size: 0.8em;
314
+ padding: 2px 8px;
315
+ }
316
+
317
+ .task-info {
318
+ background-color: #f8f9fa;
319
+ padding: 10px;
320
+ border-radius: 4px;
321
+ font-size: 0.9em;
322
+ }
323
+
324
+ .task-info > div {
325
+ margin-bottom: 4px;
326
+ }
327
+
328
+ .task-info > div:last-child {
329
+ margin-bottom: 0;
330
+ }
331
+
332
+ .task-name-section {
333
+ border: 1px solid #dee2e6;
334
+ border-radius: 4px;
335
+ overflow: hidden;
336
+ }
337
+
338
+ .task-name-header {
339
+ padding: 8px;
340
+ background-color: #f8f9fa;
341
+ cursor: pointer;
342
+ display: flex;
343
+ align-items: center;
344
+ user-select: none;
345
+ }
346
+
347
+ .task-name-header:hover {
348
+ background-color: #e9ecef;
349
+ }
350
+
351
+ .task-name-icon {
352
+ font-family: monospace;
353
+ font-weight: bold;
354
+ font-size: 14px;
355
+ width: 20px;
356
+ display: inline-block;
357
+ text-align: center;
358
+ color: #666;
359
+ }
360
+
361
+ .task-name-content {
362
+ display: none;
363
+ padding: 8px;
364
+ border-top: 1px solid #dee2e6;
365
+ word-break: break-word;
366
+ }
367
+
368
+ /* 添加compute_graph切换器样式 */
369
+ .graph-switcher {
370
+ margin-bottom: 20px;
371
+ padding: 10px;
372
+ background-color: #f8f9fa;
373
+ border-radius: 8px;
374
+ border: 1px solid #dee2e6;
375
+ }
376
+
377
+ .graph-switcher-title {
378
+ font-weight: bold;
379
+ margin-bottom: 10px;
380
+ }
381
+
382
+ .graph-switcher-buttons {
383
+ display: flex;
384
+ flex-wrap: wrap;
385
+ gap: 10px;
386
+ }
387
+
388
+ .graph-button {
389
+ padding: 5px 15px;
390
+ border: 1px solid #dee2e6;
391
+ border-radius: 4px;
392
+ background-color: #fff;
393
+ cursor: pointer;
394
+ transition: all 0.2s;
395
+ }
396
+
397
+ .graph-button:hover {
398
+ background-color: #e9ecef;
399
+ }
400
+
401
+ .graph-button.active {
402
+ background-color: #0d6efd;
403
+ color: white;
404
+ border-color: #0d6efd;
405
+ }
406
+
407
+ .compute-graph {
408
+ display: none;
409
+ }
410
+
411
+ .compute-graph.active {
412
+ display: block;
413
+ }
414
+
415
+ /* 全局形状切换器样式 */
416
+ .global-shape-switcher {
417
+ position: sticky;
418
+ top: 0;
419
+ z-index: 100;
420
+ background-color: #fff;
421
+ padding: 15px;
422
+ margin-bottom: 20px;
423
+ border-radius: 8px;
424
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
425
+ border: 1px solid #dee2e6;
426
+ }
427
+
428
+ .global-shape-switcher-title {
429
+ font-weight: bold;
430
+ margin-bottom: 10px;
431
+ }
432
+
433
+ .file-path-container {
434
+ display: flex;
435
+ align-items: center;
436
+ margin-top: 10px;
437
+ }
438
+
439
+ .file-path-container input {
440
+ font-family: monospace;
441
+ font-size: 0.9em;
442
+ }
443
+
444
+ .modal {
445
+ z-index: 1050;
446
+ }
447
+
448
+ .modal-backdrop {
449
+ z-index: 1040;
450
+ }
451
+
452
+ .work-dir-settings {
453
+ position: sticky;
454
+ top: 0;
455
+ z-index: 99;
456
+ background-color: #fff;
457
+ padding: 15px;
458
+ margin-bottom: 20px;
459
+ border-radius: 8px;
460
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
461
+ border: 1px solid #dee2e6;
462
+ }
463
+
464
+ .work-dir-input {
465
+ display: flex;
466
+ align-items: center;
467
+ gap: 10px;
468
+ }
469
+
470
+ .work-dir-input input {
471
+ flex: 1;
472
+ font-family: monospace;
473
+ }
474
+ </style>
475
+ </head>
476
+ <body>
477
+ <div class="container-fluid p-4">
478
+ <!-- task onnx文件目录设置 -->
479
+ <div class="work-dir-settings">
480
+ <div class="work-dir-settings-title">
481
+ <h6 class="mb-2">
482
+ <i class="fas fa-folder-open me-2"></i>task onnx目录设置
483
+ </h6>
484
+ </div>
485
+ <div class="work-dir-input">
486
+ <label for="work-dir-input" class="form-label mb-0" style="min-width: 100px;">task onnx目录:</label>
487
+ <input type="text" id="work-dir-input" class="form-control" placeholder="请输入task onnx目录路径..." />
488
+ <button class="btn btn-sm btn-primary" onclick="updateWorkDir()">更新</button>
489
+ <button class="btn btn-sm btn-outline-secondary" onclick="resetWorkDir()">重置</button>
490
+ </div>
491
+ <div class="mt-2">
492
+ <small class="text-muted">
493
+ 当前ONNX文件路径: <span id="current-onnx-path">tmp</span>
494
+ </small>
495
+ </div>
496
+ </div>
497
+
498
+ <!-- 全局形状切换器 -->
499
+ <div id="global-shape-switcher" class="global-shape-switcher" style="display: none;">
500
+ <div class="global-shape-switcher-title">Select Shape Configuration:</div>
501
+ <div class="global-shape-switcher-buttons" id="global-shape-buttons"></div>
502
+ </div>
503
+
504
+ <div id="model-info"></div>
505
+ <div id="submodels"></div>
506
+
507
+ <script>
508
+ const modelData = {"header": {"version": 2, "description": "RKNX model", "compiler_version": "(compiler version: 1.1.1a1 (25ae96410a@2026-09-08T14:30:38))", "toolkit_version": "rknn3-toolkit 1.1.1a1(7d35c8ebd@2026-09-08T09:49:01)", "framework_layout": "undefined", "target_platform": "p1", "vrv_number": 1, "npu_core_number": 1, "inference_mode": "static", "default_shape_id": 0, "io_configs": [{"shape_id": 0, "inputs": [{"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "input", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "outputs": [{"name": "resnetv24_dense0_fwd", "type": "int8", "shape": [1, 1000], "orig_shape": [1, 1000], "layout": "undefined", "category": "output", "qtype": "int8", "qmethod": "layer", "scale": [0.14674615859985352], "zero_point": [-62], "min": [-9.656500816345215], "max": [27.763769149780273], "plan_offset": 0, "plan_size": 1000, "stride": [1000, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "input_tiling_infos": [], "output_tiling_infos": []}]}, "sub_models": [{"vrv_id": 0, "npu_number_per_vrv": 1, "inference_mode": "static", "compute_graphs": [{"tasks": [{"id": 0, "name": "task_sub_0_segment_0", "core_id": 0, "type": "single", "inputs": [0], "outputs": [1], "internals": [3], "operators": [], "commands": [{"size": 194048, "offset": 0}], "weights": [{"size": 26035712, "offset": 512}], "private_rknn_region": []}], "tensors": [{"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "input", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "resnetv24_dense0_fwd", "type": "int8", "shape": [1, 1000], "orig_shape": [1, 1000], "layout": "undefined", "category": "output", "qtype": "int8", "qmethod": "layer", "scale": [0.14674615859985352], "zero_point": [-62], "min": [-9.656500816345215], "max": [27.763769149780273], "plan_offset": 0, "plan_size": 1000, "stride": [1000, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "data", "type": "uint8", "shape": [1, 224, 224, 3], "orig_shape": [1, 3, 224, 224], "layout": "NHWC", "category": "internal", "qtype": "int8", "qmethod": "layer", "scale": [0.01865844801068306], "zero_point": [-14], "min": [-2.1179039478302], "max": [2.640000104904175], "plan_offset": 0, "plan_size": 150528, "stride": [150528, 672, 3, 1], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}, {"name": "task_sub_0_internal", "type": "undefined", "shape": [], "orig_shape": [], "layout": "undefined", "category": "task_internal", "qtype": "", "qmethod": "", "scale": [], "zero_point": [], "min": [], "max": [], "plan_offset": 0, "plan_size": 5569536, "stride": [], "surf_align_size": 1, "stride_align_size": 1, "plan_core_id": 0}], "inputs": [0], "outputs": [1], "memory_allocations": [{"core_index": 0, "total_size": 31799808, "weights_size": 26036224, "kvcache_size": 0, "command_size": 194048, "internal_size": 5569536}]}], "command_size": 194048, "weight_size": 26036224, "kvcache_size": 0, "internal_size": 5569536, "const_data_size": 194048, "binary_data": [{"core_id": 0, "commands": [{"task_id": 0, "offset": 0, "size": 194048}], "weights": [{"task_id": 0, "offset": 512, "size": 26035712}]}]}]};
509
+ const defaultDumpDir = 'tmp';
510
+ let currentWorkDir = '';
511
+ let currentShapeId = modelData.header.default_shape_id || 0;
512
+
513
+ // 初始化task onnx目录
514
+ function initWorkDir() {
515
+ // 尝试从localStorage获取之前保存的task onnx目录
516
+ const savedWorkDir = localStorage.getItem('rknx_work_dir');
517
+ if (savedWorkDir) {
518
+ currentWorkDir = savedWorkDir;
519
+ document.getElementById('work-dir-input').value = savedWorkDir;
520
+ }
521
+ updateOnnxPathDisplay();
522
+ }
523
+
524
+ // 更新task onnx目录
525
+ function updateWorkDir() {
526
+ const input = document.getElementById('work-dir-input');
527
+ const newWorkDir = input.value.trim();
528
+
529
+ if (newWorkDir) {
530
+ currentWorkDir = newWorkDir;
531
+ // 保存到localStorage
532
+ localStorage.setItem('rknx_work_dir', newWorkDir);
533
+ updateOnnxPathDisplay();
534
+
535
+ // 显示成功提示
536
+ showToast('工作目录已更新!', 'success');
537
+ } else {
538
+ showToast('请输入有效的工作目录路径!', 'warning');
539
+ }
540
+ }
541
+
542
+ // 重置工作目录
543
+ function resetWorkDir() {
544
+ currentWorkDir = '';
545
+ document.getElementById('work-dir-input').value = '';
546
+ localStorage.removeItem('rknx_work_dir');
547
+ updateOnnxPathDisplay();
548
+ showToast('工作目录已重置!', 'info');
549
+ }
550
+
551
+ // 更新ONNX路径显示
552
+ function updateOnnxPathDisplay() {
553
+ const pathElement = document.getElementById('current-onnx-path');
554
+ if (currentWorkDir) {
555
+ pathElement.textContent = currentWorkDir + '/' + defaultDumpDir;
556
+ } else {
557
+ pathElement.textContent = './' + defaultDumpDir + ' (当前脚本执行目录)';
558
+ }
559
+ }
560
+
561
+ // 构建ONNX文件的完整路径
562
+ function buildOnnxFilePath(taskName) {
563
+ const onnxFileName = taskName + '.onnx';
564
+ if (currentWorkDir) {
565
+ return currentWorkDir + '/' + defaultDumpDir + '/' + onnxFileName;
566
+ } else {
567
+ // 使用当前脚本执行目录 + dump_dir
568
+ return './' + defaultDumpDir + '/' + onnxFileName;
569
+ }
570
+ }
571
+
572
+ function formatBytes(bytes) {
573
+ if (bytes === 0) return '0 Bytes';
574
+ const k = 1024;
575
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
576
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
577
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
578
+ }
579
+
580
+ function calculateCoreConstInputSize(graph, coreId) {
581
+ const seenTensorNames = new Set();
582
+ return (graph.tensors || [])
583
+ .filter(tensor => tensor.category === 'const_input' && (Number(tensor.plan_core_id) || 0) === coreId)
584
+ .reduce((sum, tensor) => {
585
+ const tensorName = String(tensor.name || '');
586
+ const planSize = Number(tensor.plan_size) || 0;
587
+ if (seenTensorNames.has(tensorName)) {
588
+ return sum;
589
+ }
590
+ seenTensorNames.add(tensorName);
591
+ return sum + planSize;
592
+ }, 0);
593
+ }
594
+
595
+ function calculateCoreProfileInfoSize(graph, coreId) {
596
+ return (graph.tasks || [])
597
+ .filter(task => (Number(task.core_id) || 0) === coreId)
598
+ .reduce((sum, task) => {
599
+ const taskPrivateSize = (task.private_rknn_region || [])
600
+ .reduce((innerSum, region) => innerSum + (Number(region.size) || 0), 0);
601
+ return sum + taskPrivateSize;
602
+ }, 0);
603
+ }
604
+
605
+ function toggleTask(element) {
606
+ const content = element.nextElementSibling;
607
+ const icon = element.querySelector('.expand-icon');
608
+
609
+ if (content.style.display === 'block') {
610
+ content.style.display = 'none';
611
+ icon.textContent = '+';
612
+ } else {
613
+ content.style.display = 'block';
614
+ icon.textContent = '-';
615
+ }
616
+ }
617
+
618
+ function toggleOperator(element) {
619
+ const content = element.nextElementSibling;
620
+ const icon = element.querySelector('.operator-expand-icon');
621
+
622
+ if (content.style.display === 'block') {
623
+ content.style.display = 'none';
624
+ icon.textContent = '+';
625
+ } else {
626
+ content.style.display = 'block';
627
+ icon.textContent = '-';
628
+ }
629
+ }
630
+
631
+ // 初始化全局形状切换器
632
+ function initGlobalShapeSwitcher() {
633
+ const header = modelData.header;
634
+ if (header.inference_mode === 'dynamic_bucket' && header.io_configs && header.io_configs.length > 1) {
635
+ const switcherHtml = header.io_configs.map(config => `
636
+ <button class="btn btn-sm ${config.shape_id === currentShapeId ? 'btn-primary' : 'btn-outline-secondary'} me-2 mb-2"
637
+ onclick="switchGlobalShapeConfig(${config.shape_id})">
638
+ Shape ID ${config.shape_id}
639
+ </button>
640
+ `).join('');
641
+
642
+ document.getElementById('global-shape-buttons').innerHTML = switcherHtml;
643
+ document.getElementById('global-shape-switcher').style.display = 'block';
644
+ }
645
+ }
646
+
647
+ // 全局形状配置切换函数
648
+ function switchGlobalShapeConfig(shapeId) {
649
+ currentShapeId = shapeId;
650
+
651
+ // 更新按钮状态
652
+ const buttons = document.querySelectorAll('#global-shape-buttons button');
653
+ buttons.forEach(btn => {
654
+ if (btn.textContent.includes(`Shape ID ${shapeId}`)) {
655
+ btn.classList.remove('btn-outline-secondary');
656
+ btn.classList.add('btn-primary');
657
+ } else {
658
+ btn.classList.remove('btn-primary');
659
+ btn.classList.add('btn-outline-secondary');
660
+ }
661
+ });
662
+
663
+ // 重新渲染模型信息和子模型
664
+ renderModelInfo();
665
+ renderSubModels();
666
+ }
667
+
668
+ function renderModelInfo() {
669
+ const header = modelData.header;
670
+
671
+ // 获取当前选择的形状配置
672
+ const currentConfig = header.io_configs.find(config => config.shape_id === currentShapeId) || header.io_configs[0];
673
+
674
+ const html = `
675
+ <!-- Header Information Card -->
676
+ <div class="card mb-4">
677
+ <div class="card-header bg-primary text-white">
678
+ <h5 class="mb-0">Model Information</h5>
679
+ </div>
680
+ <div class="card-body">
681
+ <div class="row">
682
+ <!-- Basic Info -->
683
+ <div class="col-md-6">
684
+ <div class="info-group">
685
+ <div class="info-item">
686
+ <span class="info-label">Target Platform:</span>
687
+ <span class="info-value">${header.target_platform}</span>
688
+ </div>
689
+ <div class="info-item">
690
+ <span class="info-label">Description:</span>
691
+ <span class="info-value">${header.description}</span>
692
+ </div>
693
+ <div class="info-item">
694
+ <span class="info-label">Version:</span>
695
+ <span class="info-value">${header.version}</span>
696
+ </div>
697
+ <div class="info-item">
698
+ <span class="info-label">Compiler Version:</span>
699
+ <span class="info-value">${header.compiler_version}</span>
700
+ </div>
701
+ <div class="info-item">
702
+ <span class="info-label">Toolkit Version:</span>
703
+ <span class="info-value">${header.toolkit_version}</span>
704
+ </div>
705
+ <div class="info-item">
706
+ <span class="info-label">NPU Cores:</span>
707
+ <span class="info-value badge bg-secondary">${header.npu_core_number}</span>
708
+ </div>
709
+ <div class="info-item">
710
+ <span class="info-label">VRV Number:</span>
711
+ <span class="info-value badge bg-secondary">${header.vrv_number}</span>
712
+ </div>
713
+ <div class="info-item">
714
+ <span class="info-label">Inference Mode:</span>
715
+ <span class="info-value badge ${header.inference_mode === 'dynamic_bucket' ? 'bg-warning' : 'bg-info'}">${header.inference_mode}</span>
716
+ </div>
717
+ ${header.inference_mode === 'dynamic_bucket' ? `
718
+ <div class="info-item">
719
+ <span class="info-label">Current Shape ID:</span>
720
+ <span class="info-value badge bg-secondary">${currentShapeId}</span>
721
+ </div>
722
+ <div class="info-item">
723
+ <span class="info-label">Shape Configs:</span>
724
+ <span class="info-value badge bg-secondary">${header.io_configs.length}</span>
725
+ </div>
726
+ ` : ''}
727
+ </div>
728
+ </div>
729
+
730
+ <!-- Tensors Info -->
731
+ <div class="col-md-6">
732
+ <!-- Input Tensors Section -->
733
+ <div class="card mb-3 inner-card">
734
+ <div class="card-header">
735
+ <h6 class="mb-0 d-flex align-items-center">
736
+ <i class="fas fa-sign-in-alt me-2"></i>Input Tensors
737
+ </h6>
738
+ </div>
739
+ <div class="card-body p-0">
740
+ <ul class="list-group list-group-flush">
741
+ ${currentConfig.inputs.map((tensor, idx) => `
742
+ <li class="list-group-item p-2">
743
+ <div class="tensor-header" role="button" onclick="toggleTensorDetails(this)">
744
+ <div class="d-flex justify-content-between align-items-center">
745
+ <div class="tensor-basic-info">
746
+ <span class="tensor-name">${tensor.name}</span>
747
+ <div class="tensor-type-shape">
748
+ <span class="badge bg-light text-dark me-2">${tensor.type}</span>
749
+ <span class="badge bg-light text-dark">shape=[${tensor.shape.join(', ')}]</span>
750
+ </div>
751
+ </div>
752
+ <span class="collapse-icon">+</span>
753
+ </div>
754
+ </div>
755
+ <div class="tensor-details" style="display: none;">
756
+ <div class="ms-3 mt-2">
757
+ <div class="detail-section">
758
+ <div class="detail-header">Quantization</div>
759
+ <div class="detail-content">
760
+ <div class="detail-item">
761
+ <span class="detail-label">QType:</span>
762
+ <span class="detail-value">${tensor.qtype}</span>
763
+ </div>
764
+ <div class="detail-item">
765
+ <span class="detail-label">QMethod:</span>
766
+ <span class="detail-value">${tensor.qmethod || 'N/A'}</span>
767
+ </div>
768
+ <div class="detail-item">
769
+ <span class="detail-label">Scale:</span>
770
+ <span class="detail-value">${tensor.scale.length ? tensor.scale.join(', ') : 'N/A'}</span>
771
+ </div>
772
+ <div class="detail-item">
773
+ <span class="detail-label">Zero Point:</span>
774
+ <span class="detail-value">${tensor.zero_point.length ? tensor.zero_point.join(', ') : 'N/A'}</span>
775
+ </div>
776
+ <div class="detail-item">
777
+ <span class="detail-label">Min:</span>
778
+ <span class="detail-value">${tensor.min.length ? tensor.min.join(', ') : 'N/A'}</span>
779
+ </div>
780
+ <div class="detail-item">
781
+ <span class="detail-label">Max:</span>
782
+ <span class="detail-value">${tensor.max.length ? tensor.max.join(', ') : 'N/A'}</span>
783
+ </div>
784
+ </div>
785
+ </div>
786
+ ${currentConfig.input_tiling_infos[idx] ? `
787
+ <div class="detail-section mt-3">
788
+ <div class="detail-header">Tiling Info</div>
789
+ <div class="detail-content">
790
+ <div class="detail-item">
791
+ <span class="detail-label">Tile Offset:</span>
792
+ <span class="detail-value">${currentConfig.input_tiling_infos[idx].tile_offset.join(', ')}</span>
793
+ </div>
794
+ <div class="detail-item">
795
+ <span class="detail-label">Tile Size:</span>
796
+ <span class="detail-value">${currentConfig.input_tiling_infos[idx].tile_size.join(', ')}</span>
797
+ </div>
798
+ </div>
799
+ </div>
800
+ ` : ''}
801
+ </div>
802
+ </div>
803
+ </li>
804
+ `).join('')}
805
+ </ul>
806
+ </div>
807
+ </div>
808
+
809
+ <!-- Output Tensors Section -->
810
+ <div class="card inner-card">
811
+ <div class="card-header">
812
+ <h6 class="mb-0 d-flex align-items-center">
813
+ <i class="fas fa-sign-out-alt me-2"></i>Output Tensors
814
+ </h6>
815
+ </div>
816
+ <div class="card-body p-0">
817
+ <ul class="list-group list-group-flush">
818
+ ${currentConfig.outputs.map((tensor, idx) => `
819
+ <li class="list-group-item p-2">
820
+ <div class="tensor-header" role="button" onclick="toggleTensorDetails(this)">
821
+ <div class="d-flex justify-content-between align-items-center">
822
+ <div class="tensor-basic-info">
823
+ <span class="tensor-name">${tensor.name}</span>
824
+ <div class="tensor-type-shape">
825
+ <span class="badge bg-light text-dark me-2">${tensor.type}</span>
826
+ <span class="badge bg-light text-dark">shape=[${tensor.shape.join(', ')}]</span>
827
+ </div>
828
+ </div>
829
+ <span class="collapse-icon">+</span>
830
+ </div>
831
+ </div>
832
+ <div class="tensor-details" style="display: none;">
833
+ <div class="ms-3 mt-2">
834
+ <div class="detail-section">
835
+ <div class="detail-header">Quantization</div>
836
+ <div class="detail-content">
837
+ <div class="detail-item">
838
+ <span class="detail-label">QType:</span>
839
+ <span class="detail-value">${tensor.qtype}</span>
840
+ </div>
841
+ <div class="detail-item">
842
+ <span class="detail-label">QMethod:</span>
843
+ <span class="detail-value">${tensor.qmethod || 'N/A'}</span>
844
+ </div>
845
+ <div class="detail-item">
846
+ <span class="detail-label">Scale:</span>
847
+ <span class="detail-value">${tensor.scale.length ? tensor.scale.join(', ') : 'N/A'}</span>
848
+ </div>
849
+ <div class="detail-item">
850
+ <span class="detail-label">Zero Point:</span>
851
+ <span class="detail-value">${tensor.zero_point.length ? tensor.zero_point.join(', ') : 'N/A'}</span>
852
+ </div>
853
+ <div class="detail-item">
854
+ <span class="detail-label">Min:</span>
855
+ <span class="detail-value">${tensor.min.length ? tensor.min.join(', ') : 'N/A'}</span>
856
+ </div>
857
+ <div class="detail-item">
858
+ <span class="detail-label">Max:</span>
859
+ <span class="detail-value">${tensor.max.length ? tensor.max.join(', ') : 'N/A'}</span>
860
+ </div>
861
+ </div>
862
+ </div>
863
+ ${currentConfig.output_tiling_infos[idx] ? `
864
+ <div class="detail-section mt-3">
865
+ <div class="detail-header">Tiling Info</div>
866
+ <div class="detail-content">
867
+ <div class="detail-item">
868
+ <span class="detail-label">Tile Offset:</span>
869
+ <span class="detail-value">${currentConfig.output_tiling_infos[idx].tile_offset.join(', ')}</span>
870
+ </div>
871
+ <div class="detail-item">
872
+ <span class="detail-label">Tile Size:</span>
873
+ <span class="detail-value">${currentConfig.output_tiling_infos[idx].tile_size.join(', ')}</span>
874
+ </div>
875
+ </div>
876
+ </div>
877
+ ` : ''}
878
+ </div>
879
+ </div>
880
+ </li>
881
+ `).join('')}
882
+ </ul>
883
+ </div>
884
+ </div>
885
+ </div>
886
+ </div>
887
+ </div>
888
+ </div>
889
+ `;
890
+ document.getElementById('model-info').innerHTML = html;
891
+ }
892
+
893
+ // 添加切换详情的函数
894
+ function toggleTensorDetails(element) {
895
+ const details = element.nextElementSibling;
896
+ const icon = element.querySelector('.collapse-icon');
897
+
898
+ if (details.style.display === 'none') {
899
+ details.style.display = 'block';
900
+ icon.textContent = '-';
901
+ } else {
902
+ details.style.display = 'none';
903
+ icon.textContent = '+';
904
+ }
905
+ }
906
+
907
+ function renderSubModels() {
908
+ const html = modelData.sub_models.map((subModel, subModelIdx) => `
909
+ <div class="card mb-4">
910
+ <div class="card-header">
911
+ <h5>SubModel ${subModelIdx} (VRV ID: ${subModel.vrv_id})</h5>
912
+ <div class="text-muted">
913
+ Inference Mode: ${subModel.inference_mode}<br>
914
+ Command Size: ${formatBytes(subModel.command_size)} (${subModel.command_size} bytes)<br>
915
+ Weight Size: ${formatBytes(subModel.weight_size)} (${subModel.weight_size} bytes)<br>
916
+ KVCache Size: ${formatBytes(subModel.kvcache_size)} (${subModel.kvcache_size} bytes)<br>
917
+ Internal Size: ${formatBytes(subModel.internal_size)} (${subModel.internal_size} bytes)
918
+ </div>
919
+ </div>
920
+ <div class="card-body">
921
+ <div id="compute-graphs-${subModelIdx}">
922
+ ${subModel.compute_graphs.map((graph, graphIdx) => `
923
+ <div class="compute-graph ${graphIdx === currentShapeId ? 'active' : ''}" id="graph-${subModelIdx}-${graphIdx}"
924
+ style="display: ${graphIdx === currentShapeId ? 'block' : 'none'}">
925
+ <div class="task-columns">
926
+ ${generateTaskColumns(
927
+ graph.tasks,
928
+ modelData.header.npu_core_number,
929
+ subModel.vrv_id,
930
+ modelData.header.vrv_number
931
+ )}
932
+ </div>
933
+
934
+ <div class="memory-columns mt-4">
935
+ ${generateMemoryColumns(
936
+ graph.memory_allocations,
937
+ modelData.header.npu_core_number,
938
+ subModel.vrv_id,
939
+ modelData.header.vrv_number,
940
+ graph
941
+ )}
942
+ </div>
943
+ </div>
944
+ `).join('')}
945
+ </div>
946
+ </div>
947
+ </div>
948
+ `).join('');
949
+
950
+ document.getElementById('submodels').innerHTML = html;
951
+ }
952
+
953
+ function generateTaskColumns(tasks, npu_core_number, vrv_id, vrv_number) {
954
+ // 直接按实际的 core_id 分组,不再过滤
955
+ const tasksByCore = {};
956
+ const allTaskIds = new Set();
957
+
958
+ tasks.forEach(task => {
959
+ if (!tasksByCore[task.core_id]) {
960
+ tasksByCore[task.core_id] = {};
961
+ }
962
+ tasksByCore[task.core_id][task.id] = task;
963
+ allTaskIds.add(task.id);
964
+ });
965
+
966
+ // 获取所有参与的 core_id 并排序
967
+ const coreIds = Object.keys(tasksByCore).map(Number).sort((a, b) => a - b);
968
+
969
+ // 将所有 task id 排序
970
+ const sortedTaskIds = Array.from(allTaskIds).sort((a, b) => a - b);
971
+
972
+ return `
973
+ <div class="task-table">
974
+ <!-- 添加 core id 标题行 -->
975
+ <div class="task-table-header">
976
+ ${coreIds.map(core_id => `
977
+ <div class="task-column-header">
978
+ <h6 class="mb-0">Core ${core_id}</h6>
979
+ <small class="text-muted">Tasks: ${Object.keys(tasksByCore[core_id]).length}</small>
980
+ </div>
981
+ `).join('')}
982
+ </div>
983
+
984
+ <div class="task-table-body">
985
+ ${sortedTaskIds.map(taskId => `
986
+ <div class="task-row">
987
+ ${coreIds.map(core_id => {
988
+ const task = tasksByCore[core_id] ? tasksByCore[core_id][taskId] : null;
989
+ return `
990
+ <div class="task-cell">
991
+ ${task ? `
992
+ <div class="task-card">
993
+ <div class="task-header" onclick="toggleTask(this)">
994
+ <div class="task-basic-info">
995
+ <div>
996
+ <strong>Task ${taskId}</strong>
997
+ <span class="badge bg-secondary ms-2">${task.type}</span>
998
+ <small class="text-muted ms-2">${task.operators.length} ops</small>
999
+ </div>
1000
+ <div class="task-name">${task.name || 'Unnamed Task'}</div>
1001
+ <div class="task-onnx-link">
1002
+ <button class="btn btn-sm btn-outline-primary" onclick="openOnnxFile('${task.name || 'Unnamed Task'}', event)">
1003
+ <i class="fas fa-external-link-alt"></i> Open ONNX
1004
+ </button>
1005
+ </div>
1006
+ </div>
1007
+ <span class="expand-icon">+</span>
1008
+ </div>
1009
+
1010
+ <div class="task-content">
1011
+ <!-- Task Information -->
1012
+ <div class="section-header">Task Information</div>
1013
+ <div class="task-info mb-3">
1014
+ <div><strong>ID:</strong> ${taskId}</div>
1015
+ <div><strong>Name:</strong> ${task.name || 'Unnamed Task'}</div>
1016
+ <div><strong>Type:</strong> ${task.type}</div>
1017
+ <div><strong>Core:</strong> ${core_id}</div>
1018
+ <div><strong>ONNX File:</strong> ${task.name || 'Unnamed Task'}.onnx</div>
1019
+ </div>
1020
+
1021
+ <!-- Operators Section -->
1022
+ <div class="section-header">Operators</div>
1023
+ <div class="operator-list">
1024
+ ${task.operators.map(op => `
1025
+ <div class="operator-item">
1026
+ <span class="operator-header" onclick="toggleOperator(this)">
1027
+ <span class="operator-expand-icon">+</span>${op.type}
1028
+ </span>
1029
+ <div class="operator-content" style="display: none;">
1030
+ <strong>Name:</strong> ${op.name}<br>
1031
+ </div>
1032
+ </div>
1033
+ `).join('')}
1034
+ </div>
1035
+
1036
+ <!-- Memory & Tensors Section -->
1037
+ <div class="section-header mt-3">Memory & Tensors</div>
1038
+ <div class="memory-info">
1039
+ <div><small>Inputs:</small> ${task.inputs.join(', ')}</div>
1040
+ <div><small>Outputs:</small> ${task.outputs.join(', ')}</div>
1041
+ <div class="mt-2">
1042
+ <small>Commands:</small>
1043
+ <table class="table table-sm table-bordered mt-1">
1044
+ <thead>
1045
+ <tr>
1046
+ <th>Index</th>
1047
+ <th>Size (bytes)</th>
1048
+ <th>Offset (bytes)</th>
1049
+ </tr>
1050
+ </thead>
1051
+ <tbody>
1052
+ ${task.commands.map((cmd, idx) => `
1053
+ <tr>
1054
+ <td>${idx}</td>
1055
+ <td>${cmd.size}</td>
1056
+ <td>${cmd.offset}</td>
1057
+ </tr>
1058
+ `).join('')}
1059
+ </tbody>
1060
+ </table>
1061
+ </div>
1062
+ <div class="mt-2">
1063
+ <small>Weights:</small>
1064
+ <table class="table table-sm table-bordered mt-1">
1065
+ <thead>
1066
+ <tr>
1067
+ <th>Index</th>
1068
+ <th>Size (bytes)</th>
1069
+ <th>Offset (bytes)</th>
1070
+ </tr>
1071
+ </thead>
1072
+ <tbody>
1073
+ ${task.weights.map((init, idx) => `
1074
+ <tr>
1075
+ <td>${idx}</td>
1076
+ <td>${init.size}</td>
1077
+ <td>${init.offset}</td>
1078
+ </tr>
1079
+ `).join('')}
1080
+ </tbody>
1081
+ </table>
1082
+ </div>
1083
+ </div>
1084
+ </div>
1085
+ </div>
1086
+ ` : ''}
1087
+ </div>
1088
+ `;
1089
+ }).join('')}
1090
+ </div>
1091
+ `).join('')}
1092
+ </div>
1093
+ </div>
1094
+ `;
1095
+ }
1096
+
1097
+ function generateMemoryColumns(memory_allocations, npu_core_number, vrv_id, vrv_number, graph) {
1098
+ // 计算当前VRV负责的core范围
1099
+ const core_per_vrv = Math.ceil(npu_core_number / vrv_number);
1100
+ const core_start = vrv_id * core_per_vrv;
1101
+ const core_end = core_start + core_per_vrv;
1102
+
1103
+ const memoryByCore = {};
1104
+ memory_allocations.forEach(mem => {
1105
+ if (mem.core_index >= core_start && mem.core_index < core_end) {
1106
+ memoryByCore[mem.core_index] = mem;
1107
+ }
1108
+ });
1109
+
1110
+ return Array.from({length: core_per_vrv}, (_, i) => {
1111
+ const core_id = core_start + i;
1112
+ const rawCommandSize = memoryByCore[core_id] ? (Number(memoryByCore[core_id].command_size) || 0) : 0;
1113
+ const constInputSize = calculateCoreConstInputSize(graph, core_id);
1114
+ const profileInfoSize = calculateCoreProfileInfoSize(graph, core_id);
1115
+ const commandSize = Math.max(0, rawCommandSize - constInputSize - profileInfoSize);
1116
+ return `
1117
+ <div class="memory-column">
1118
+ <div class="memory-header">
1119
+ <h6 class="mb-0">Core ${core_id} Memory</h6>
1120
+ </div>
1121
+ ${memoryByCore[core_id] ? `
1122
+ <div class="memory-content">
1123
+ <div class="memory-item">
1124
+ <strong>Total Size:</strong><br>
1125
+ ${formatBytes(memoryByCore[core_id].total_size)} (${memoryByCore[core_id].total_size} bytes)
1126
+ </div>
1127
+ <div class="memory-item">
1128
+ <strong>Weights:</strong><br>
1129
+ ${formatBytes(memoryByCore[core_id].weights_size)} (${memoryByCore[core_id].weights_size} bytes)
1130
+ </div>
1131
+ <div class="memory-item">
1132
+ <strong>Command Size:</strong><br>
1133
+ ${formatBytes(commandSize)} (${commandSize} bytes)
1134
+ </div>
1135
+ <div class="memory-item">
1136
+ <strong>Const Input Size:</strong><br>
1137
+ ${formatBytes(constInputSize)} (${constInputSize} bytes)
1138
+ </div>
1139
+ <div class="memory-item">
1140
+ <strong>Profile Info Size:</strong><br>
1141
+ ${formatBytes(profileInfoSize)} (${profileInfoSize} bytes)
1142
+ </div>
1143
+ <div class="memory-item">
1144
+ <strong>KVCache:</strong><br>
1145
+ ${formatBytes(memoryByCore[core_id].kvcache_size)} (${memoryByCore[core_id].kvcache_size} bytes)
1146
+ </div>
1147
+ <div class="memory-item">
1148
+ <strong>Internal:</strong><br>
1149
+ ${formatBytes(memoryByCore[core_id].internal_size)} (${memoryByCore[core_id].internal_size} bytes)
1150
+ </div>
1151
+ </div>
1152
+ ` : `
1153
+ <div class="memory-content text-muted">
1154
+ No memory allocation
1155
+ </div>
1156
+ `}
1157
+ </div>
1158
+ `;
1159
+ }).join('');
1160
+ }
1161
+
1162
+ // 初始化页面
1163
+ document.addEventListener('DOMContentLoaded', function() {
1164
+ initWorkDir();
1165
+ initGlobalShapeSwitcher();
1166
+ renderModelInfo();
1167
+ renderSubModels();
1168
+ });
1169
+
1170
+ // 添加打开ONNX文件的函数
1171
+ function openOnnxFile(taskName, event) {
1172
+ // 阻止事件冒泡,防止触发task展开/收缩
1173
+ event.stopPropagation();
1174
+
1175
+ // 构建ONNX文件路径
1176
+ const onnxFilePath = buildOnnxFilePath(taskName);
1177
+
1178
+ // 尝试多种方式打开ONNX文件
1179
+ try {
1180
+ // 方式1: 尝试使用Netron在线版本
1181
+ const netronUrl = 'https://netron.app/';
1182
+ const newWindow = window.open(netronUrl, '_blank');
1183
+
1184
+ if (newWindow) {
1185
+ // 显示文件路径信息
1186
+ showOnnxFileInfo(onnxFilePath, netronUrl);
1187
+ } else {
1188
+ // 如果弹窗被阻止,显示手动操作提示
1189
+ showManualOnnxInstructions(onnxFilePath);
1190
+ }
1191
+ } catch (error) {
1192
+ console.error('Error opening ONNX file:', error);
1193
+ showManualOnnxInstructions(onnxFilePath);
1194
+ }
1195
+ }
1196
+
1197
+ function showOnnxFileInfo(filePath, netronUrl) {
1198
+ const modal = document.createElement('div');
1199
+ modal.className = 'modal fade show';
1200
+ modal.style.display = 'block';
1201
+ modal.style.backgroundColor = 'rgba(0,0,0,0.5)';
1202
+ modal.innerHTML = `
1203
+ <div class="modal-dialog">
1204
+ <div class="modal-content">
1205
+ <div class="modal-header">
1206
+ <h5 class="modal-title">ONNX文件信息</h5>
1207
+ <button type="button" class="btn-close" onclick="closeModal(this)"></button>
1208
+ </div>
1209
+ <div class="modal-body">
1210
+ <div class="alert alert-info">
1211
+ <h6>Netron已在新窗口中打开!</h6>
1212
+ <p>请在Netron中打开以下文件:</p>
1213
+ <div class="file-path-container">
1214
+ <input type="text" class="form-control" value="${filePath}" readonly>
1215
+ <button class="btn btn-sm btn-outline-secondary ms-2" onclick="copyToClipboard('${filePath}')">
1216
+ <i class="fas fa-copy"></i> 复制路径
1217
+ </button>
1218
+ </div>
1219
+ </div>
1220
+ <div class="alert alert-warning">
1221
+ <h6>使用说明:</h6>
1222
+ <ol>
1223
+ <li>在Netron窗口中点击"Open Model"按钮</li>
1224
+ <li>粘贴或输入上述文件路径</li>
1225
+ <li>点击打开即可查看ONNX模型结构</li>
1226
+ </ol>
1227
+ </div>
1228
+ </div>
1229
+ <div class="modal-footer">
1230
+ <button type="button" class="btn btn-secondary" onclick="closeModal(this)">关闭</button>
1231
+ <button type="button" class="btn btn-primary" onclick="window.open('${netronUrl}', '_blank')">重新打开Netron</button>
1232
+ </div>
1233
+ </div>
1234
+ </div>
1235
+ `;
1236
+ document.body.appendChild(modal);
1237
+ }
1238
+
1239
+ function showManualOnnxInstructions(filePath) {
1240
+ const modal = document.createElement('div');
1241
+ modal.className = 'modal fade show';
1242
+ modal.style.display = 'block';
1243
+ modal.style.backgroundColor = 'rgba(0,0,0,0.5)';
1244
+ modal.innerHTML = `
1245
+ <div class="modal-dialog">
1246
+ <div class="modal-content">
1247
+ <div class="modal-header">
1248
+ <h5 class="modal-title">打开ONNX文件</h5>
1249
+ <button type="button" class="btn-close" onclick="closeModal(this)"></button>
1250
+ </div>
1251
+ <div class="modal-body">
1252
+ <div class="alert alert-info">
1253
+ <h6>ONNX文件路径:</h6>
1254
+ <div class="file-path-container">
1255
+ <input type="text" class="form-control" value="${filePath}" readonly>
1256
+ <button class="btn btn-sm btn-outline-secondary ms-2" onclick="copyToClipboard('${filePath}')">
1257
+ <i class="fas fa-copy"></i> 复制路径
1258
+ </button>
1259
+ </div>
1260
+ </div>
1261
+ <div class="alert alert-warning">
1262
+ <h6>手动打开方式:</h6>
1263
+ <ol>
1264
+ <li><strong>在线版本:</strong> <a href="https://netron.app/" target="_blank">点击打开Netron在线版</a></li>
1265
+ <li><strong>本地版本:</strong> 如果已安装Netron,可在终端运行:<br>
1266
+ <code>netron "${filePath}"</code>
1267
+ </li>
1268
+ <li><strong>其他工具:</strong> 也可使用其他ONNX查看工具打开该文件</li>
1269
+ </ol>
1270
+ </div>
1271
+ </div>
1272
+ <div class="modal-footer">
1273
+ <button type="button" class="btn btn-secondary" onclick="closeModal(this)">关闭</button>
1274
+ <button type="button" class="btn btn-primary" onclick="window.open('https://netron.app/', '_blank')">打开Netron在线版</button>
1275
+ </div>
1276
+ </div>
1277
+ </div>
1278
+ `;
1279
+ document.body.appendChild(modal);
1280
+ }
1281
+
1282
+ function copyToClipboard(text) {
1283
+ navigator.clipboard.writeText(text).then(() => {
1284
+ showToast('路径已复制到剪贴板!', 'success');
1285
+ }).catch(err => {
1286
+ console.error('复制失败:', err);
1287
+ // 降级处理:选择文本
1288
+ const textArea = document.createElement('textarea');
1289
+ textArea.value = text;
1290
+ document.body.appendChild(textArea);
1291
+ textArea.select();
1292
+ document.execCommand('copy');
1293
+ document.body.removeChild(textArea);
1294
+ showToast('路径已复制到剪贴板!', 'success');
1295
+ });
1296
+ }
1297
+
1298
+ function showToast(message, type = 'info') {
1299
+ const toast = document.createElement('div');
1300
+ toast.className = 'toast-notification';
1301
+ toast.textContent = message;
1302
+
1303
+ const colorMap = {
1304
+ 'success': '#28a745',
1305
+ 'warning': '#ffc107',
1306
+ 'info': '#17a2b8',
1307
+ 'error': '#dc3545'
1308
+ };
1309
+
1310
+ toast.style.cssText = `
1311
+ position: fixed;
1312
+ top: 20px;
1313
+ right: 20px;
1314
+ background: ${colorMap[type] || colorMap.info};
1315
+ color: white;
1316
+ padding: 10px 20px;
1317
+ border-radius: 4px;
1318
+ z-index: 9999;
1319
+ box-shadow: 0 2px 5px rgba(0,0,0,0.2);
1320
+ font-size: 14px;
1321
+ `;
1322
+ document.body.appendChild(toast);
1323
+
1324
+ setTimeout(() => {
1325
+ if (document.body.contains(toast)) {
1326
+ document.body.removeChild(toast);
1327
+ }
1328
+ }, 3000);
1329
+ }
1330
+
1331
+ function closeModal(button) {
1332
+ const modal = button.closest('.modal');
1333
+ if (modal && document.body.contains(modal)) {
1334
+ document.body.removeChild(modal);
1335
+ }
1336
+ }
1337
+ </script>
1338
+ </div>
1339
+ </body>
1340
+ </html>
1341
+