libtorch-yolov5 icon indicating copy to clipboard operation
libtorch-yolov5 copied to clipboard

model.model[-1].export = False 疑问

Open rrjia opened this issue 3 years ago • 4 comments

有一个疑问,在导出模型时model.model[-1].export = False 但是Detect层中还有对每个特征图进行卷积操作的操作,如果导出模型不导出Detect层,模型的输出不就与训练的不一致了么?

rrjia avatar Mar 25 '21 05:03 rrjia

detect layer have conv layer ''' self.m = nn.ModuleList(nn.Conv2d(x, self.no * self.na, 1) for x in ch) # output conv ''' this Conc2d convert feature map to detect result, but why export model set it to False?

rrjia avatar Mar 25 '21 06:03 rrjia

It seems that they just wanna skip the operations between lines 47 and 54, and they've run these convolution operations here.

zhiqwang avatar Mar 25 '21 06:03 zhiqwang

@zhiqwang so, for yolov5-tagV5.0 when exporting, the following command should be run in order to be able to run with this repo? python export.py --weights yolov5l.pt --device 0 --inplace --train

Jelly123456 avatar Jul 14 '21 08:07 Jelly123456

Hi @Jelly123456 , I haven't tested the export.py of ultralytics/yolov5 for a long time, the team of ultralytics update their interfaces very frequently.

zhiqwang avatar Jul 14 '21 14:07 zhiqwang