-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
custom data trained model export problem. #99
Comments
@WongKinYiu how about this problem? The customed data trained model, export to onnx,output have three sigmoid layers, but the pretrained models no. |
Reparameterize the model before export may help. |
OK! Let me have a try! how about YOLOv7-tiny reparameterization? |
MY yolov7 customed model, when use the yolov7 reparameterize, it break, error as: |
could solve this problem by export.py in code, export the onnx after reparameterize ? Because if could not export the onnx correctly,then dnn openvino tensorrt could not forward. |
when i use the yolov7.pt, the pretrained model, Reparameterize, it also break, erros as: |
@WongKinYiu Could help me, to solve this problem? I can't epxort the customed model corrrectly, so i can't forward with in my item. |
255 in the script means (nc+5)*3, where nc is 80. |
I am using a custom dataset of 2 classes |
@WongKinYiu Thank you. The model export is ok.But when i forward with the model, the result is empty, could not detect any objects. But when i use the model that no reparameterization, the onnxruntime forward is ok, but the openvino、dnn and trt is not work.After reparameterization, all of them no works, detect no any objects. |
@WongKinYiu i am getting this stuff
|
@xinsuinizhuan how did you export your model? what is the command? |
also, how were you able to have names there? |
use the u5 branches, export as the yolov5. Then the onnxruntime forward is OK, But, other methods is not work. |
#114 should also work. |
@WongKinYiu Now, the problem is, customed data, train, get the model. I use the model to export the onnx by u5 branch, get the onnx model, i forward use the onnxruntime, it ok. but use the openvino and dnn and tensorrt, no objects detected, i compare with the pretrained model, it add three sigmoid layers. Then i use the https://github.com/WongKinYiu/yolov7#re-parameterization, to parameterization, then export the model by u5 brach, it no the three sigmoid layers, but all methods, onnxruntime/dnn/openvino/tensorrt, forward have no objectes detected. |
|
How about yolov7-tiny to parameterization? |
@xinsuinizhuan how did you fix this bug ? show me pls |
i wanna said vizualisation.ipynb |
The issue arises because the state_dict contains no entry/key with 'model.105.im.0.implicit' i.e. the |
For my part , ncnn applications don't work with ncnn format but with pnnx
conversion. I can't really explain in detail why but maybe you can test
more model and weight conversions ,
if you don't need to drop the ten last layers and put a focus layer, like
tensorflow-lite detection app...
Android is a world of surprises, Android Dev Too !
Enjoy !
Le ven. 23 juin 2023 à 08:36, pradan7 ***@***.***> a écrit :
… The issue arises because the state_dict contains no entry/key with
'model.105.*im*.0.implicit' i.e. the im part
—
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVRUYBSYGCF4NTJRT57ECD3XMU2OVANCNFSM53JSDXXA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I also had this problem. I would train model on custom data load it and export it to onnx. The ONNX model that was not reparametrized would produce bounding boxes and that one that was reparametrized would not produce bounding boxes. Solution is to NOT fuse model layers for the reparametrization procedure (i.e. don't use ckpt= torch.load("best.pt", map_location=device)
model = ckpt['model']
# Perform reparametrization
deploy = Model("cfg/deploy..."...)
deploy.load_state_dict(model.state_dict(), strict=False)
...
# Perform rest of export as normal |
I use my custom data trained, then i use the pt to export the onnx model:
![图片](https://user-images.githubusercontent.com/40679769/178405565-36f99712-1430-40c9-9bfb-ce13ff8657f4.png)
but the export onnx output is:
have three sigmoid layers
but when i use the pretrained model export the onnx mode, the output is:
![图片](https://user-images.githubusercontent.com/40679769/178405548-1f23fc16-adbc-4d23-9408-0af2fff7d78e.png)
so when i use the my custome trained model , C++ openvino and trt forward, the result is empty!
The text was updated successfully, but these errors were encountered: