Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trt_infer问题 #181

Open
Isla0628 opened this issue Apr 29, 2024 · 0 comments
Open

trt_infer问题 #181

Isla0628 opened this issue Apr 29, 2024 · 0 comments

Comments

@Isla0628
Copy link

你好,我在将tusimple_res18.pth转化为tusimple_res18.engine,但是在tusimple数据集上的测试结果非常差?麻烦帮我看看转换有什么问题,非常感谢!首先我利用deploy/pt2onnx.py --config_path configs/tusimple_res18.py --model_path weight/tusimple_res18.pth将其转换为tusimple_res18.onnx,在pt2onnx.py我修改了parser.add_argument('--size', default=(800, 320), help='size of original frame', type=tuple)中为800,320,然后利用trtexec --onnx=weight/tusimple_res18.onnx --saveEngine=weights/tusimple_res18.engine继续转化格式,最后在推理阶段python deploy/trt_infer.py --config_path configs/tusimple_res18.py --engine_path weight/tusimple_res18.engine,将trt_infer.py进行了如下修改
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--config_path', default='configs/culane_res34.py', help='path to config file', type=str)
parser.add_argument('--engine_path', default='weights/culane_res34.engine',
help='path to engine file', type=str)
parser.add_argument('--ori_size', default=(800, 320), help='size of original frame', type=tuple)
return parser.parse_args()

if name == "main":
args = get_args()
isnet = UFLDv2(args.engine_path, args.config_path, args.ori_size)
img=cv2.imread('./test/1.jpg')
#img = img[380:700,:, :]
isnet.forward(img)
但是,测试的结果如下:
result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant