Files
fcb_photo_review/tool/paddle2nb.py
2025-01-15 16:47:21 +08:00

18 lines
558 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# paddle模型转nb格式推荐使用paddlelite2.10
from paddlelite.lite import Opt
if __name__ == '__main__':
# 1. 创建opt实例
opt = Opt()
# 2. 指定输入模型地址
opt.set_model_dir("./model")
# 3. 指定转化类型: arm、x86、opencl、npu
# 一般认为arm为cpuopencl为gpu
opt.set_valid_places("arm")
# 4. 指定模型转化类型: naive_buffer、protobuf
opt.set_model_type("naive_buffer")
# 4. 输出模型地址
opt.set_optimize_out("model")
# 5. 执行模型优化
opt.run()