1 Star 0 Fork 0

Rocky/deep_learning

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
deploy.py 966 Bytes
一键复制 编辑 原始数据 按行查看 历史
import argparse
from core.api.export import export_onnx
from core.api.utils import init_cfg
def main():
opt = argparse.ArgumentParser("main")
opt.add_argument("--config", type=str, required=True, help="config file")
opt.add_argument("--epoch", type=int, required=True, help="epoch to export")
opt.add_argument("--inputs", type=str, nargs="+", required=True,
help="input name and shape, eg. image:1,3,224,224 mask:1,1,224,224")
opt.add_argument("--outputs", type=str, nargs="*", help="output names eg. output1 output2")
args = opt.parse_args()
cfg = init_cfg(args.config)
inputs = []
for i in args.inputs:
tmp = i.split(":")
name = tmp[0]
shape = [int(x) for x in tmp[1].split(",")]
inputs.append((name, tuple(shape)))
outputs = ["output"] if args.outputs is None else args.outputs
export_onnx(cfg, args.epoch, inputs, outputs)
if __name__ == '__main__':
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lc123/deep_learning.git
git@gitee.com:lc123/deep_learning.git
lc123
deep_learning
deep_learning
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385