lyuwenyu / RT-DETR

[CVPR 2024] Official RT-DETR (RTDETR paddle pytorch), Real-Time DEtection TRansformer, DETRs Beat YOLOs on Real-time Object Detection. 🔥 🔥 🔥
Apache License 2.0
2.59k stars 299 forks source link

RT-DETR主干网络预训练模型 #96

Open JianyuChenyyds opened 1 year ago

JianyuChenyyds commented 1 year ago

如果想给RT-DETR换detection库的ppdet里的主干的话,主干网络的预训练权重在哪下载(backbone里没给出链接),是否可以用clas库里的预训练权重

JianyuChenyyds commented 1 year ago

Traceback (most recent call last): File "tools/train.py", line 209, in main() File "tools/train.py", line 205, in main run(FLAGS, cfg) File "tools/train.py", line 145, in run trainer = Trainer(cfg, mode='train') File "F:\RT-DETR\PaddleDetection-develop\ppdet\engine\trainer.py", line 115, in init self.model = create(cfg.architecture) File "F:\RT-DETR\PaddleDetection-develop\ppdet\core\workspace.py", line 255, in create cls_kwargs.update(cls.from_config(config, kwargs)) File "F:\RT-DETR\PaddleDetection-develop\ppdet\modeling\architectures\detr.py", line 58, in from_config neck = create(cfg['neck'], kwargs) if cfg['neck'] else None File "F:\RT-DETR\PaddleDetection-develop\ppdet\core\workspace.py", line 292, in create return cls(**cls_kwargs) File "F:\RT-DETR\PaddleDetection-develop\ppdet\modeling\transformers\hybrid_encoder.py", line 205, in init self._reset_parameters() File "F:\RT-DETR\PaddleDetection-develop\ppdet\modeling\transformers\hybrid_encoder.py", line 212, in _reset_parameters self.eval_size[1] // stride, self.eval_size[0] // stride, TypeError: unsupported operand type(s) for //: 'int' and 'NoneType'

JianyuChenyyds commented 1 year ago

Traceback (most recent call last): File "tools/train.py", line 209, in main() File "tools/train.py", line 205, in main run(FLAGS, cfg) File "tools/train.py", line 145, in run trainer = Trainer(cfg, mode='train') File "F:\RT-DETR\PaddleDetection-develop\ppdet\engine\trainer.py", line 115, in init self.model = create(cfg.architecture) File "F:\RT-DETR\PaddleDetection-develop\ppdet\core\workspace.py", line 255, in create cls_kwargs.update(cls.from_config(config, kwargs)) File "F:\RT-DETR\PaddleDetection-develop\ppdet\modeling\architectures\detr.py", line 58, in from_config neck = create(cfg['neck'], kwargs) if cfg['neck'] else None File "F:\RT-DETR\PaddleDetection-develop\ppdet\core\workspace.py", line 292, in create return cls(cls_kwargs) File "F:\RT-DETR\PaddleDetection-develop\ppdet\modeling\transformers\hybrid_encoder.py", line 205, in init** self._reset_parameters() File "F:\RT-DETR\PaddleDetection-develop\ppdet\modeling\transformers\hybrid_encoder.py", line 212, in _reset_parameters self.eval_size[1] // stride, self.eval_size[0] // stride, TypeError: unsupported operand type(s) for //: 'int' and 'NoneType'

出现这种问题怎么办

lyuwenyu commented 1 year ago

stride是None 看下你用的那个backbone有没有out_shape这个属性吧

JianyuChenyyds commented 1 year ago

stride是None 看下你用的那个backbone有没有out_shape这个属性吧

我是直接用的ppdet里面的主干,有out_shape

JianyuChenyyds commented 1 year ago

stride是None 看下你用的那个backbone有没有out_shape这个属性

好像是out_shape里面没有stride

lyuwenyu commented 1 year ago

可以自己手动加一下

JianyuChenyyds commented 1 year ago

可以自己手动加一下

一个是这种: @property def out_shape(self): return [ShapeSpec(channels=c) for c in self._out_channels] 一个是这种: @property def out_shape(self): return [ ShapeSpec( channels=self._out_channels[i], stride=self._out_strides[i]) for i in self.return_idx ]

JianyuChenyyds commented 1 year ago

可以自己手动加一下

一个是这种: @property def out_shape(self): return [ShapeSpec(channels=c) for c in self._out_channels] 一个是这种: @property def out_shape(self): return [ ShapeSpec( channels=self._out_channels[i], stride=self._out_strides[i]) for i in self.return_idx ] 可以直接加个stride=self._out_strides[i],然后再把for循环里的self._out_channels改成len(self._out_channels)吗