首先确保已经安装了tnn环境:onnx2tnn
转tnn:
代码语言:javascript复制def onnx2tnn(self):
assert os.path.isfile(simplified_onnx_path)
os.system('cd {}n'
'python onnx2tnn.py {} -version=v1.0 -optimize=1 -half=1 -o {} -input_shape input:1,{},{},{}'
.format(C.onnx2tnn_base_dir,
simplified_onnx_path, model_folder, C.input_shape[0], C.input_shape[1], C.input_shape[2]))
print('n tnn has been save to {}n'.format(model_folder))