AlibabaResearch / efficientteacher

A Supervised and Semi-Supervised Object Detection Library for YOLO Series
GNU General Public License v3.0
805 stars 147 forks source link

模型转换convert_pt_to_efficient.py:更改了类别数nc后模型转换不成功,只在nc为80时可以转换 #107

Open shy-7 opened 1 year ago

shy-7 commented 1 year ago

image

kv1830 commented 1 year ago

trainer/ssod_trainer.py 大概144行处

EMA

        if self.ema and ckpt.get('ema'):
            self.ema.ema.load_state_dict(ckpt['ema'].float().state_dict(), strict=False)

改为:

EMA

        if self.ema and ckpt.get('ema'):
            csd = intersect_dicts(ckpt['ema'].float().state_dict(), self.model.state_dict(), exclude=exclude)   #---加的就是这行
            self.ema.ema.load_state_dict(csd, strict=False)
BinXia123 commented 3 months ago

还是报错啊

Coisini-Tinkle commented 2 months ago

你用的pt是不是在coco上面训练的,这个pt应该也要自己训练吧