cfzd / Ultra-Fast-Lane-Detection

Ultra Fast Structure-aware Deep Lane Detection (ECCV 2020)
MIT License
1.76k stars 491 forks source link

trt_infer问题 #365

Open Isla0628 opened 2 months ago

Isla0628 commented 2 months ago

你好,我在将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

Isla0628 commented 2 months ago

大家有没有遇到同类问题的,怎么解决呢?