def __init__(self, model='inception_v3', weights='imagenet', include_top=False, pooling=None, n_channels=None, clf_head_dense_dim=1024):
    " Creates ImageNet base model for featurization or classification and corresponding image\n            preprocessing function\n                :param model: options are xception, inception_v3, and mobilenet_v2\n                :param weights: 'imagenet' or filepath\n                :param include_top: whether to include original ImageNet classification head with 1000 classes\n                :param pooling: 'avg', 'max', or None\n                :param n_channels: number of channels to keep if performing featurization\n                :param clf_head_dense_dim: dimension of dense layer before softmax classification (only applies\n                    if `include_top` is false)\n        "
    self.include_top = include_top
    self.n_channels = n_channels
    self.pooling = pooling
    self.clf_head_dense_dim = clf_head_dense_dim
    if (model == 'xception'):
        self.model = xception.Xception(weights=weights, include_top=include_top, pooling=pooling)
        self.preprocess = xception.preprocess_input
        self.target_size = (299, 299)
        if include_top:
            self.decode = xception.decode_predictions
        else:
            self.output_dim = ((n_channels if n_channels else 2048) * (1 if pooling else (10 ** 2)))
    elif (model == 'inception_v3'):
        self.model = inception_v3.InceptionV3(weights=weights, include_top=include_top, pooling=pooling)
        self.preprocess = inception_v3.preprocess_input
        self.target_size = (299, 299)
        if include_top:
            self.decode = inception_v3.decode_predictions
        else:
            self.output_dim = ((n_channels if n_channels else 2048) * (1 if pooling else (8 ** 2)))
    elif (model == 'mobilenet_v2'):
        self.model = mobilenetv2.MobileNetV2(weights=weights, include_top=include_top, pooling=pooling)
        self.preprocess = mobilenetv2.preprocess_input
        self.target_size = (244, 244)
        if include_top:
            self.decode = mobilenetv2.decode_predictions
        else:
            self.output_dim = ((n_channels if n_channels else 1280) * (1 if pooling else (7 ** 2)))
    else:
        raise Exception('model option not implemented')
Creates ImageNet base model for featurization or classification and corresponding image
preprocessing function
    :param model: options are xception, inception_v3, and mobilenet_v2
    :param weights: 'imagenet' or filepath
    :param include_top: whether to include original ImageNet classification head with 1000 classes
    :param pooling: 'avg', 'max', or None
    :param n_channels: number of channels to keep if performing featurization
    :param clf_head_dense_dim: dimension of dense layer before softmax classification (only applies
        if `include_top` is false)
def __init__(self, model='inception_v3', weights='imagenet', include_top=False, pooling=None, n_channels=None, clf_head_dense_dim=1024):
    " Creates ImageNet base model for featurization or classification and corresponding image\n            preprocessing function\n                :param model: options are xception, inception_v3, and mobilenet_v2\n                :param weights: 'imagenet' or filepath\n                :param include_top: whether to include original ImageNet classification head with 1000 classes\n                :param pooling: 'avg', 'max', or None\n                :param n_channels: number of channels to keep if performing featurization\n                :param clf_head_dense_dim: dimension of dense layer before softmax classification (only applies\n                    if `include_top` is false)\n        "
    self.include_top = include_top
    self.n_channels = n_channels
    self.pooling = pooling
    self.clf_head_dense_dim = clf_head_dense_dim
    if (model == 'xception'):
        self.model = xception.Xception(weights=weights, include_top=include_top, pooling=pooling)
        self.preprocess = xception.preprocess_input
        self.target_size = (299, 299)
        if include_top:
            self.decode = xception.decode_predictions
        else:
            self.output_dim = ((n_channels if n_channels else 2048) * (1 if pooling else (10 ** 2)))
    elif (model == 'inception_v3'):
        self.model = inception_v3.InceptionV3(weights=weights, include_top=include_top, pooling=pooling)
        self.preprocess = inception_v3.preprocess_input
        self.target_size = (299, 299)
        if include_top:
            self.decode = inception_v3.decode_predictions
        else:
            self.output_dim = ((n_channels if n_channels else 2048) * (1 if pooling else (8 ** 2)))
    elif (model == 'mobilenet_v2'):
        self.model = mobilenetv2.MobileNetV2(weights=weights, include_top=include_top, pooling=pooling)
        self.preprocess = mobilenetv2.preprocess_input
        self.target_size = (244, 244)
        if include_top:
            self.decode = mobilenetv2.decode_predictions
        else:
            self.output_dim = ((n_channels if n_channels else 1280) * (1 if pooling else (7 ** 2)))
    else:
        raise Exception('model option not implemented')