lufficc / SSD

High quality, fast, modular reference implementation of SSD in PyTorch
MIT License
1.52k stars 384 forks source link

adding CoordConv on ssd #171

Closed 91dana closed 3 years ago

91dana commented 4 years ago

Hi @lufficc

I've trained the model using my own custom dataset and it worked perfect. Thank you for your work!

I wanted to enhance the result so I'm trying to add CoordConv on ssd.

I added CoordConv in class SSDDetector() like follow:

def forward(self, images, targets=None):
    images = self.coordConv(images)

It worked well and I also tried to add CoordConv right after backbone, before box_head like this:

def forward(self, images, targets=None):
    images = self.coordConv(images)
    features = self.backbone(images)
    # for i, feature in enumerate(features):
    #     if feature.shape[1] == 256:
    #         features[i] = self.coordConv256(feature)
    #     elif feature.shape[1] == 512:
    #         features[i] = self.coordConv512(feature)
    #     elif feature.shape[1] == 1024:
    #         features[i] = self.coordConv1024(feature)
    detections, detector_losses = self.box_head(features, targets)

but the training results were nan.

Is it a weird idea to add CoordConv right after backbone?

What position do you recommend to add CoordConv in ssd?

Thank you in advance :P