def efficientnet_b7(pretrained=False, num_classes=1000, in_chans=3, **kwargs): """ EfficientNet-B7 """ # NOTE for train, drop_rate should be 0.5 #kwargs['drop_connect_rate'] = 0.2 # set when training, TODO add as cmd arg model_name = "tf_efficientnet_b7" default_cfg = default_cfgs[model_name] model = _gen_efficientnet(model_name=model_name, channel_multiplier=2.0, depth_multiplier=3.1, num_classes=num_classes, in_chans=in_chans, **kwargs) model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfgs[model_name], num_classes) return model
def init_from_imagenet(self, archname): print("[%s] Load pretrained weights from ImageNet" % (self.__class__.__name__)) load_pretrained(self, default_cfgs["tf_%s" % (archname)], self.num_classes)