yasenh / libtorch-yolov5

A LibTorch inference implementation of the yolov5
MIT License
372 stars 114 forks source link

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

Open rrjia opened 3 years ago

rrjia commented 3 years ago

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

rrjia commented 3 years ago

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?

zhiqwang commented 3 years ago

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

Jelly123456 commented 2 years ago

@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

zhiqwang commented 2 years ago

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.