From 0d8a9814f97ea4a9744e7adc22d3fe6ee5064e75 Mon Sep 17 00:00:00 2001 From: ZhangGe6 Date: Sun, 8 May 2022 00:01:49 +0800 Subject: [PATCH] add sample models in the readme --- app.py | 4 ++-- readme.md | 13 +++++++++++++ readme_zh-CN.md | 14 ++++++++++++++ static/index.js | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 1e9ac1c..1bbedc4 100644 --- a/app.py +++ b/app.py @@ -6,8 +6,8 @@ app = Flask(__name__) def index(): return render_template('index.html') -@app.route('/return_file', methods=['POST']) -def return_file(): +@app.route('/open_model', methods=['POST']) +def open_model(): # https://blog.miguelgrinberg.com/post/handling-file-uploads-with-flask onnx_file = request.files['file'] diff --git a/readme.md b/readme.md index 826dc04..9ca4d04 100644 --- a/readme.md +++ b/readme.md @@ -89,11 +89,21 @@ For example, Now we want remove the preprocess operators (`Sub->Mul->Sub->Trans rename_node_io +# Sample models +For quick testing, some typical sample models are provided as following. Most of them are from [onnx model zoo](https://github.com/onnx/models) + +- squeezeNet [Link (4.72MB)](https://github.com/onnx/models/blob/main/vision/classification/squeezenet/model/squeezenet1.0-12.onnx) +- MobileNet [Link (13.3MB)](https://github.com/onnx/models/blob/main/vision/classification/mobilenet/model/mobilenetv2-7.onnx) +- ResNet50-int8 [Link (24.6MB)](https://github.com/onnx/models/blob/main/vision/classification/resnet/model/resnet50-v1-12-int8.onnx) +- movenet-lightning [Link (9.01MB)](https://pan.baidu.com/s/1MVheshDu58o4AAgoR9awRQ?pwd=jub9) + - Converted from the pretrained [tflite model](https://tfhub.dev/google/movenet/singlepose/lightning/4) using [tensorflow-onnx](https://github.com/onnx/tensorflow-onnx); + - There are preprocess nodes and a big bunch of postprocessing nodes in the model. `onnx-modifier` is under active development :hammer_and_wrench:. Welcome to use, create issues and pull requests! 🥰 # Credits and referred materials + - [Netron](https://github.com/lutzroeder/netron) - [flask](https://github.com/pallets/flask) - ONNX Python API [Official doc](https://github.com/onnx/onnx/blob/main/docs/PythonAPIOverview.md), [Leimao's Blog](https://leimao.github.io/blog/ONNX-Python-API/) @@ -101,3 +111,6 @@ For example, Now we want remove the preprocess operators (`Sub->Mul->Sub->Trans - [onnx-utils](https://github.com/saurabh-shandilya/onnx-utils) - [sweetalert](https://github.com/t4t5/sweetalert) + + +[https://github.com/onnx/models/blob/main/vision/classification/mobilenet/model/mobilenetv2-7.onnx]: diff --git a/readme_zh-CN.md b/readme_zh-CN.md index dcd0a52..9eb8421 100644 --- a/readme_zh-CN.md +++ b/readme_zh-CN.md @@ -85,10 +85,24 @@ `onnx-modifer`正在活跃地更新中:hammer_and_wrench:。 欢迎使用,提issue,如果有帮助的话,感谢给个:star:~ +# 示例模型文件 + +为方便测试,以下提供一些典型的样例模型文件,主要来自于[onnx model zoo](https://github.com/onnx/models) + +- squeezeNet [链接 (4.72MB)](https://github.com/onnx/models/blob/main/vision/classification/squeezenet/model/squeezenet1.0-12.onnx) +- MobileNet [链接 (13.3MB)](https://github.com/onnx/models/blob/main/vision/classification/mobilenet/model/mobilenetv2-7.onnx) +- ResNet50-int8 [链接 (24.6MB)](https://github.com/onnx/models/blob/main/vision/classification/resnet/model/resnet50-v1-12-int8.onnx) +- movenet-lightning [链接 (9.01MB)](https://pan.baidu.com/s/1MVheshDu58o4AAgoR9awRQ?pwd=jub9) + - 将Google提供的预训练[tflite模型](https://tfhub.dev/google/movenet/singlepose/lightning/4),使用[tensorflow-onnx](https://github.com/onnx/tensorflow-onnx)转换得到; + - 模型中包含前处理和一大块后处理节点。 + # 参考资料 + - [Netron](https://github.com/lutzroeder/netron) - [flask](https://github.com/pallets/flask) - ONNX Python API [Official doc](https://github.com/onnx/onnx/blob/main/docs/PythonAPIOverview.md), [Leimao's Blog](https://leimao.github.io/blog/ONNX-Python-API/) - ONNX IO Stream [Leimao's Blog](https://leimao.github.io/blog/ONNX-IO-Stream/) - [onnx-utils](https://github.com/saurabh-shandilya/onnx-utils) - [sweetalert](https://github.com/t4t5/sweetalert) + +[https://github.com/onnx/models/blob/main/vision/classification/mobilenet/model/mobilenetv2-7.onnx]: diff --git a/static/index.js b/static/index.js index 1249c6d..668316a 100644 --- a/static/index.js +++ b/static/index.js @@ -289,7 +289,7 @@ host.BrowserHost = class { form.append('file', file); // https://stackoverflow.com/questions/66039996/javascript-fetch-upload-files-to-python-flask-restful - fetch('/return_file', { + fetch('/open_model', { method: 'POST', body: form }).then(function (response) {