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

导出的yolov5模型stem前有额外的mul算子 #55

Closed
1 task done
rysngl opened this issue Nov 17, 2022 · 1 comment
Closed
1 task done

导出的yolov5模型stem前有额外的mul算子 #55

rysngl opened this issue Nov 17, 2022 · 1 comment

Comments

@rysngl
Copy link

rysngl commented Nov 17, 2022

问题确认 Search before asking

  • 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

在yolov5页面下载了你们提供的yolov5_n_300e_coco预训练权重后,未修改任何配置,直接执行export脚本导出模型。用Netron打开模型结构后发现,模型并不是以stem的卷积开始的,而是在一开始的img输入后,先进行了elementwise_mul与elementwise_add。其中elementwise_mul的other输入为
type: float32[1,3,1,1]
[
[
[
[
0.003921568859368563
]
],
[
[
0.003921568859368563
]
],
[
[
0.003921568859368563
]
]
]
]
elementwise_add的输入为:
type: float32[1,3,1,1]
[
[
[
[
0
]
],
[
[
0
]
],
[
[
0
]
]
]
]
想请教下导出的模型为什么会包含这两个算子,
image_4

@nemonameless
Copy link
Collaborator

是默认导出的时候,TestReader是fuse_normalize的,意思是把NormalizeImage这个相对耗时的预处理OP放在网络中一起导出,加快端到端推理的速度。
https://github.com/PaddlePaddle/PaddleYOLO/blob/release/2.5/ppdet/modeling/architectures/meta_arch.py#L24

你可以注释掉这行或设置为False再重新导出。
https://github.com/PaddlePaddle/PaddleYOLO/blob/release/2.5/configs/yolov5/_base_/yolov5_reader.yml#L45

@rysngl rysngl closed this as completed Nov 17, 2022
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

2 participants