def __init__(self, num_classes, cfg): super(MobileNetSSD, self).__init__() self.cfg = cfg self.num_classes = num_classes self.basenet = mobilenet() self.extras = extra(1024) NUM_INPUT_FEATURES = [512, 1024, 512, 256, 256, 128] self.detection_head = SSDDetectionOutput(NUM_INPUT_FEATURES, num_classes, cfg)
def __init__(self, cfg, size, num_classes, batch_norm=False): super(SSD_VGG, self).__init__() self.config = cfg self.num_classes = num_classes self.size = size self.enable_batchmorm = batch_norm base_layers, base_outs, base_feats = build_vgg_ssd_layers( BASE_NUM_OUTPUTS[size], BASE_OUTPUT_INDICES[size], batch_norm=batch_norm ) extra_layers, extra_outs, extra_feats = build_vgg_ssd_extra( EXTRAS_NUM_OUTPUTS[size], EXTRA_OUTPUT_INDICES[size], batch_norm=batch_norm ) self.basenet = MultiOutputSequential(base_outs, base_layers) self.extras = MultiOutputSequential(extra_outs, extra_layers) self.detection_head = SSDDetectionOutput(base_feats + extra_feats, num_classes, cfg) self.L2Norm = L2Norm(512, 20, 1e-10)