open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
28.47k stars 9.28k forks source link

'SSDHead' object has no attribute 'loss_cls' #11780

Open beratatmaca opened 3 weeks ago

beratatmaca commented 3 weeks ago

When I upgraded MMDet to 3.3.0, I receive the following error message while training my model. My model was working fine with the previous MMDet version (v3.0.0)

AttributeError: 'SSDHead' object has no attribute 'loss_cls'

I think the error raised here because it tries to access loss_cls object that is never created.

I think the error happens during validation loss computation. self.loss_cls object is created here, but the SSDHead does not initialize its parent class. It initializes the super-parent class directly here.

So what probably happened is that when a new detector support was introduced in this commit, it was assumed that every sub/superclass has self.loss_cls defined. However for SSD this is not the case.