toandaominh1997 / EfficientDet.Pytorch

Implementation EfficientDet: Scalable and Efficient Object Detection in PyTorch
MIT License
1.44k stars 306 forks source link

Training from scratch? redundant 'is_training'? freeze BN in training? #101

Open yichengsu opened 4 years ago

yichengsu commented 4 years ago

Q1: https://github.com/toandaominh1997/EfficientDet.Pytorch/blob/master/models/efficientdet.py#L33-L53

        self.backbone = EfficientNet.from_pretrained(MODEL_MAP[network])
        ...
        for m in self.modules():
            if isinstance(m, nn.Conv2d):
                n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
                m.weight.data.normal_(0, math.sqrt(2. / n))
            elif isinstance(m, nn.BatchNorm2d):
                m.weight.data.fill_(1)
                m.bias.data.zero_()

Why use a pretrained model and then reset all the parameters? Training from scratch?

Q2: self.is_training = is_training? nn.Module already has a 'training' attribute. In your code, is_training is almost as same as 'training'.

Q3: https://github.com/toandaominh1997/EfficientDet.Pytorch/blob/master/train.py#L102 model.module.freeze_bn() freeze BN in training? Are you serious?