def __init__(self, input_size, backend_path): input_image = Input(shape=(input_size, input_size, 3)) mobilenet = MobileNet(input_shape=(224, 224, 3), include_top=False) mobilenet.load_weights(MOBILENET_BACKEND_PATH) x = mobilenet(input_image) self.feature_extractor = Model(input_image, x)
def __init__(self, input_size): input_image = Input(shape=input_size) mobilenet = MobileNet(input_shape=input_size, include_top=False) if input_size[2] == 3: try: print("Loading pretrained weights: " + MOBILENET_BACKEND_PATH) mobilenet.load_weights(MOBILENET_BACKEND_PATH) except: print("Unable to load backend weights. Using a fresh model") else: print('pre trained weights are available just for RGB network.') x = mobilenet(input_image) self.feature_extractor = Model(input_image, x, name='MobileNet_backend')