-
Notifications
You must be signed in to change notification settings - Fork 544
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
AttributeError: 'NoneType' object has no attribute 'serialize' #51
Comments
Hi~ Traceback (most recent call last): |
Please refer to: http://disq.us/p/26kit21 It looks like your custom YOLOv3 model is only detecting 1 class of object. So you should modify "category_num" to 1, and 255 in "output_shapes" to 18. p.s. (1 + 5) * 3 = 18 |
Hi Jung, Thank you for the quick reply. you are correct. after change output_shapes to 18, it works. However i meet another issue as below. can you help on this? demos$ python3 trt_yolov3.py --model yolov3-416 --image --filename 002.jpg |
Have you tested your model with darknet first? Does it produce the correct result? It appears that the optimized TensorRT engine outputs -inf (infinite) and nan (not a number -> out of float32 range) with 002.jpg as the input image. |
the model is trained with pytorch and it can be used to inference with pytorch env. but have not check with darknet |
So how did you convert the pytorch model to onnx? Were you able to verify the conversion is correct? |
ohh, I just use the code in your repo. yolov3_to_onnx.py and onnx_to_tensorrt.py. |
transfer model can't be used with this repo? |
|
Hi Jung,Thank you so much for the kindly explainition. darknet model works well with your repo. |
I've added a "--category_num" command-line option to make it easier to adapt my TensorRT YOLOv3 code to custom trained models. Please check out my blog post TensorRT YOLOv3 For Custom Trained Models for details. |
Hi~
I use https://github.com/ultralytics/yolov3 to trained a 1 class model. when use onnx_to tensorrt.py, meet below error.
ubuntu:~/tensorrt_demos/yolov3_onnx$ python3 onnx_to_tensorrt.py
Loading ONNX file from path yolov3-416.onnx...
Beginning ONNX file parsing
Completed parsing of ONNX file
Building an engine; this may take a while...
[TensorRT] ERROR: ../builder/cudnnBuilderWeightConverters.cpp (555) - Misc Error in operator(): 1 (Weights are outside of fp16 range. A possible fix is to retrain the model with regularization to bring the magnitude of the weights down.)
[TensorRT] ERROR: ../builder/cudnnBuilderWeightConverters.cpp (555) - Misc Error in operator(): 1 (Weights are outside of fp16 range. A possible fix is to retrain the model with regularization to bring the magnitude of the weights down.)
Completed creating engine
Traceback (most recent call last):
File "onnx_to_tensorrt.py", line 119, in
main()
File "onnx_to_tensorrt.py", line 115, in main
_ = build_engine(onnx_file_path, engine_file_path, args.verbose)
File "onnx_to_tensorrt.py", line 99, in build_engine
f.write(engine.serialize())
AttributeError: 'NoneType' object has no attribute 'serialize'
The text was updated successfully, but these errors were encountered: