Tencent / TNN

TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.
Other
4.41k stars 771 forks source link

onnx转tnn,No module named 'onnx2tnn.onnx_optimizer #803

Closed Ashinhuang closed 3 years ago

Ashinhuang commented 3 years ago

1. 环境(environment)

No module named 'onnx2tnn.onnx_optimizer'; 'onnx2tnn' is not a package

6. 运行日志(runtime log)

(base) ubuntu@elcnlhdcgpu03:/data/Framework/TNN/tools/onnx2tnn/onnx-converter$ python onnx2tnn.py /data/Framework/TNN/xin_demo/yolov4_1_3_416_416_static.onnx -version=v1.0 -optimize=1 -half=0 -o /data/Framework/TNN/xin_demo/ -input_shape input:1,3,416,416
0.----onnx version:1.4.1
algo_optimize 1
onnx_net_opt_path /data/Framework/TNN/xin_demo/yolov4_1_3_416_416_static.opt.onnx
1.----onnx_optimizer: /data/Framework/TNN/xin_demo/yolov4_1_3_416_416_static.onnx
Traceback (most recent call last):
  File "onnx2tnn.py", line 41, in do_optimize
    import onnx2tnn.onnx_optimizer.onnx_optimizer as opt
ModuleNotFoundError: No module named 'onnx2tnn.onnx_optimizer'; 'onnx2tnn' is not a package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "onnx2tnn.py", line 140, in <module>
    main()
  File "onnx2tnn.py", line 120, in main
    do_optimize(onnx_net_path, input_shape)
  File "onnx2tnn.py", line 43, in do_optimize
    import onnx_optimizer.onnx_optimizer as opt
  File "/data/Framework/TNN/tools/onnx2tnn/onnx-converter/onnx_optimizer/onnx_optimizer.py", line 13, in <module>
    from onnxsim import onnx_simplifier
ModuleNotFoundError: No module named 'onnxsim'

7. 截图(Screenshots)

![image](https://user-images.githubusercontent.com/33593302/108586287-63150300-7388-11eb-9bbb-4a6e284b42e7.png)
1627180283 commented 3 years ago

你可以先看一下有没有安装 onnx-simplifier

1627180283 commented 3 years ago

模型转换可以参考使用 convert2tnn 工具 https://github.com/Tencent/TNN/blob/master/doc/cn/user/convert.md#convert2tnn-%E5%B7%A5%E5%85%B7%E7%9A%84%E4%BD%BF%E7%94%A8

Ashinhuang commented 3 years ago

Thanks a lot!