Created
June 18, 2019 04:20
-
-
Save netsatsawat/92b78caca064814ec2fe72fd471ada41 to your computer and use it in GitHub Desktop.
For loading pretrained feature extractor - Malaria dataset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
feature_extractor_url = "https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/feature_vector/3" | |
def feature_extractor(x): | |
feature_extractor_module = hub.Module(feature_extractor_url) | |
return feature_extractor_module(x) | |
IMAGE_SIZE = hub.get_expected_image_size(hub.Module(feature_extractor_url)) | |
print('Expected size : %s' % IMAGE_SIZE) | |
# Expected size : [224, 224] | |
features_extractor_layer = layers.Lambda(feature_extractor, input_shape=IMAGE_SIZE+[3]) | |
features_extractor_layer.trainable = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment