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

cannot able to generate wts file for custom train model yolov5n #9

Open
Kr-Sheshank opened this issue Jan 11, 2024 · 0 comments
Open

Comments

@Kr-Sheshank
Copy link

I was trying to convert the custom trained model into wts file but it is not working. using the below command
python3 gen_wts.py -w yolov5s.pt -o yolov5s.wts
It is showing following error

Traceback (most recent call last):
File "gen_wts.py", line 43, in
delattr(model.model[-1], 'anchor_grid') # model.model[-1] is detect layer
File "/home/cnhi/models/TRT/TRT_env_2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1685, in delattr
super().delattr(name)
AttributeError: anchor_grid

If we comment out the line it shows the next error
delattr(model.model[-1], 'anchor_grid') # model.model[-1] is detect layer
Traceback (most recent call last):
File "gen_wts.py", line 46, in
model.model[-1].register_buffer("strides", model.model[-1].stride)
File "/home/cnhi/models/TRT/TRT_env_2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 523, in register_buffer
raise KeyError("attribute '{}' already exists".format(name))
KeyError: "attribute 'strides' already exists"

If comment this line also it is generating wts file but while converting wts to engine it is showing error
missing strides

But when I tried to converted the pretrained coco yolov5n model it get converted into wts and in engine and working fine.

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