diff --git a/app_desktop.py b/app_desktop.py index a24c6de..29ac1a5 100644 --- a/app_desktop.py +++ b/app_desktop.py @@ -15,7 +15,7 @@ The following are some notes about How I worked for it. - flaskwebgui github repo: https://github.com/ClimenteA/flaskwebgui b. add some scripts to keep server running while gui is running - see here: https://github.com/ClimenteA/flaskwebgui#install - - I added the code in the index.js + - I added the code in the index.js (around line 355) c. Then run: `python app_desktop.py`, the web browser will be automatically lauched for onnx-modifier 2. How to generate excutable files: diff --git a/docs/add_new_outputs.gif b/docs/add_new_outputs.gif new file mode 100644 index 0000000..456013e Binary files /dev/null and b/docs/add_new_outputs.gif differ diff --git a/docs/rename_model_io.gif b/docs/rename_model_io.gif new file mode 100644 index 0000000..389358c Binary files /dev/null and b/docs/rename_model_io.gif differ diff --git a/docs/todo_list.md b/docs/todo_list.md index 746058b..dc198fb 100644 --- a/docs/todo_list.md +++ b/docs/todo_list.md @@ -1,15 +1,17 @@ # TODO -- support desktop application. -- support more flexible downloading schema - - As this [request](https://github.com/ZhangGe6/onnx-modifier/pull/5) notes, the current downloading schema prevents `onnx-modifier ` from being deployed remotely as a service. - -- support adding more complicated nodes (which has some simple parameters like `reshape`). -- support adding model input/output node. -- support combine models. -- support user-defined input/output number when the type of node's input/output is list. -- slim the codes. - - because some `.js` files (like electron.js and even python.js) in the `static` folder and `electron.html` in `templates` folder are legacy of Netron and can be further slimmed. +- [ ] support desktop application. + - [x] Windows + - [ ] Linux +- [ ] support more flexible downloading schema + - [ ] As this [request](https://github.com/ZhangGe6/onnx-modifier/pull/5) notes, the current downloading schema prevents `onnx-modifier ` from being deployed remotely as a service. +- [ ] support adding more complicated nodes (which has some simple parameters like `reshape`). +- [ ] support combine models. +- [ ] support user-defined input/output number when the type of node's input/output is list. +- [ ] slim the code. + - [ ] because some `.js` files (like electron.js and even python.js) in the `static` folder and `electron.html` in `templates` folder are legacy of Netron and can be further slimmed. +- [x] support adding model input/output node. +- [x] fix issue that "extra model inputs" emerges after deleting nodes. [issue#12](https://github.com/ZhangGe6/onnx-modifier/issues/12) # Some known reference issues/feature requests diff --git a/docs/update_log.md b/docs/update_log.md index 7688aa4..5d9b360 100644 --- a/docs/update_log.md +++ b/docs/update_log.md @@ -1,15 +1,23 @@ # onnx-modifier update log +## 20220813 + +- support adding model input/output node. [issue 7](https://github.com/ZhangGe6/onnx-modifier/issues/7), [issue 8](https://github.com/ZhangGe6/onnx-modifier/issues/8), [issue 13](https://github.com/ZhangGe6/onnx-modifier/issues/13) + +- fix issue that "extra model inputs" emerges after deleting nodes. [issue#12](https://github.com/ZhangGe6/onnx-modifier/issues/12) +- update windows executable file. + ## 20220701 -support renaming model input/output + +- support renaming model input/output ## 20220621 -add Dockerfile - - thanks to [fengwang](https://github.com/fengwang) +- add Dockerfile + - thanks to [fengwang](https://github.com/fengwang) ## 20220620 -add Windows executable file. +- add Windows executable file. ## 20220612 diff --git a/onnx_modifier.py b/onnx_modifier.py index bf42a59..5bb4029 100644 --- a/onnx_modifier.py +++ b/onnx_modifier.py @@ -299,12 +299,11 @@ if __name__ == "__main__": def test_inference(): onnx_modifier.inference() - test_inference() + # test_inference() def test_add_output(): # print(onnx_modifier.graph.output) onnx_modifier.add_outputs(['fire2/squeeze1x1_1']) # print(onnx_modifier.graph.output) onnx_modifier.check_and_save_model() - # test_add_output() - \ No newline at end of file + # test_add_output() \ No newline at end of file diff --git a/readme.md b/readme.md index 6c1d359..1d253a3 100644 --- a/readme.md +++ b/readme.md @@ -20,6 +20,7 @@ Currently, the following editing operations are supported: - Recover a deleted node. - [x] Rename the node inputs/outputs - [x] Rename the model inputs/outputs +- [x] Add new model outputs - [x] Edit the attribute of nodes - [x] Add new nodes (experimental) @@ -52,8 +53,8 @@ Click the url in the output info generated by flask (`http://127.0.0.1:5000/` fo ## launch from executable file
Click to expand - -- Windows: Download [onnx-modifier.exe (27.6MB)](https://drive.google.com/file/d/1y7mYlvF0G5iiNDgOFh1ESXlTs8I2ipVQ/view?usp=sharing), double-click it and enjoy. + +- Windows: Download [onnx-modifier.exe (27.6MB)](https://drive.google.com/file/d/1LRXgZauQ5BUENe_PvilRW8WvSO-4Jr9j/view?usp=sharing), double-click it and enjoy. - Edge browser is used for runtime environment by default. > I recorded how I made the the executable file in `app_desktop.py`. The executable file for other platforms are left for future work. @@ -139,6 +140,16 @@ The process is shown in the following figure: ## Rename the model inputs/outputs Click the model input/output node, type a new name in the sidebar, then we are done. +![rename_model_io](./docs/rename_model_io.gif) + +## Add new model outputs + +Sometimes we want to add/extract the output of a certain node as model output. For example, we want to add a new model output after the old one was deleted, or extract intermediate layer output for fine-grained analysis. In `onnx-modifier`, we can achieve this by simply clicking the `Add Output` button in the sidebar of the corresponding node. Then we can get a new model output node following the corresponding node. Its name is the same as the output of the corresponding node. + +In the following example, we add 2 new model outputs, which are the outputs of the 1st `Conv` node and 2nd `Conv` node, respectively. + +![add_new_outputs](./docs/add_new_outputs.gif) + ## Edit the attribute of nodes Change the original attribute to a new value, then we are done. diff --git a/readme_zh-CN.md b/readme_zh-CN.md index e383ccb..0a4432c 100644 --- a/readme_zh-CN.md +++ b/readme_zh-CN.md @@ -20,6 +20,8 @@ - 删除一个节点及所有以该节点为根节点的子节点 - 恢复误删的节点 - [x] 修改节点输入输出名 +- [x] 修改模型输入输出名 +- [x] 增加模型输出节点 - [x] 编辑节点属性值 - [x] 增加新节点(beta) @@ -47,7 +49,7 @@ ``` ## 从可执行文件启动 -- Windows: 下载可执行文件[onnx-modifier.exe (27.6MB)](https://drive.google.com/file/d/1y7mYlvF0G5iiNDgOFh1ESXlTs8I2ipVQ/view?usp=sharing),双击即可启动。 +- Windows: 下载可执行文件[onnx-modifier.exe (27.6MB)](https://drive.google.com/file/d/1LRXgZauQ5BUENe_PvilRW8WvSO-4Jr9j/view?usp=sharing),双击即可启动。 - 默认使用Edge浏览器作为运行环境。 > 生成可执行文件的步骤记录在`app_desktop.py`文件中。未来会为其他平台生成可执行文件。 @@ -102,6 +104,22 @@ +## 修改模型输入输出名称 + +点击模型输入或输出节点,在弹出的侧边栏中,为模型输入输出键入新的名称即可。 + +![rename_model_io](./docs/rename_model_io.gif) + +## 增加模型输出节点 + +有时候我们需要增加/抽取某个特定节点的输出作为整个模型的输出。比如之前的模型输出节点在编辑过程中被删除了,需要增加新的,或者有时候我们需要抽取一些中间层特征输出做更细致的分析。 + +通过`onnx-modifier`,我们只需要在对应节点的侧边栏中,点击`Add Output`按钮即可在该节点后部增加一个模型输出节点,其名称与原节点的输出名相同。 + +如下图,我们增加了两个模型输出节点,分别为第一个卷积层的输出和第二个卷积层的输出。 + +![add_new_outputs](./docs/add_new_outputs.gif) + ## 编辑节点属性值 在节点侧边栏对应的属性值输入框中,键入新的属性值即可。