eecn / ncnn-android-yolov8-pose

30 stars 5 forks source link

请问如果要自己转onnx需要改head.py中pose哪部分呢 #2

Closed ZXB6 closed 5 months ago

ZXB6 commented 5 months ago

我参照了segment def forward(self, x): """Perform forward pass through YOLO model and return predictions.""" bs = x[0].shape[0] # batch size kpt = torch.cat([self.cv4i.view(bs, self.nk, -1) for i in range(self.nl)], -1) # (bs, 173, hw) x = self.detect(self, x) if self.training: return x, kpt pred_kpt = self.kpts_decode(bs, kpt) return torch.cat([x, kpt], 1).permute(0,2,1) if self.export else (torch.cat([x[0], kpt], 1), (x[1], kpt)) 但是还是不行,想请教一下大佬

eecn commented 5 months ago

因为ncnn有不支持的算子吗,所以要修改是吗?

ZXB6 commented 5 months ago

大佬,我想请问一下。如果我想用您的这个项目跑自己重新转的pose模型,需要对网络部分做哪些修改啊。因为我也不是很懂,detect和segment我是参照飞哥的对C2f和detect的forward进行了修改。

eecn commented 5 months ago

进行代码改变一般主要是为了算子兼容。 可以参考这里 https://github.com/triple-Mu/yolov8/tree/triplemu/model-only 对modules.py中forward_export的修改,参见这博客https://zhuanlan.zhihu.com/p/622596922

ZXB6 commented 5 months ago

好的谢谢大佬,感谢您能回复,谢谢