TrojanXu / yolov5-tensorrt

A tensorrt implementation of yolov5: https://github.com/ultralytics/yolov5
Apache License 2.0
190 stars 46 forks source link

ERROR: Failed to parse the ONNX file. #35

Open tensorflowt opened 4 years ago

tensorflowt commented 4 years ago

ERROR: Failed to parse the ONNX file. In node -1 (parseGraph): UNSUPPORTED_NODE: Assertion failed: convertOnnxWeights(initializer, &weights, ctx) Traceback (most recent call last): File "main.py", line 372, in trt_result = profile_trt(build_engine(onnx_path, using_half), batch_size, 10, 100) File "main.py", line 275, in profile_trt assert(engine is not None) AssertionError

Hello! Thank you very much for your open source project, great! However, I met the above problems when I was replicating your project. I saw that others also met these problems. I hope to get your help.

1.My environment configuration is as follows: CUDA:10.1 CUDNN:v7.6.5 tensorrt:7.0.0.11 python:3.6 2.The source of my Yolov5s model file is as follows: https://github.com/ultralytics/yolov5/tree/37e13f88467d29bfb5461ae041fa88e211fbc7ca 3.The implementation process: 1)pt2onnx succeed 2)onnx simplify failure 3)onnx2engine todo 4)profiler todo just for 2): step1: python -m onnxsim yolov5_1.onnx outputmodel.onnx step2: change code ` if name == 'main': batch_size = 1 using_half = False onnxpath = 'yolov5{}.onnx'.format(batch_size) #change the simplified model name to yolov5_1.onnx with torch.no_grad():

model = load_model()

    #export_onnx(model, batch_size)
    simplify_onnx(onnx_path)

    trt_result = profile_trt(build_engine(onnx_path, using_half), batch_size, 10, 100)
    if using_half:
        model.half()
    torch_result = profile_torch(model, using_half, batch_size, 10, 100)

    print(trt_result)
    print(torch_result)

` The code will then execute and report an error.

I hope to get your help. Thank you.

TrojanXu commented 4 years ago

Hi, the upstream yolov5 is changing over time. I suggest you testing with tag v3.0 of this repo and tag v3.0 of yolov5 to repro. Note that, the mentioned prerequisites in README.md should me met.

GitHubChrischen commented 4 years ago

I just met the same question

jiagh2010 commented 4 years ago

me too

TwinkleYR commented 3 years ago

Do you solve the question?

htaoruan commented 1 year ago

Do you solve the question?