Created
March 7, 2019 19:16
-
-
Save mrafayaleem/267231661c4d035fc398d165ae1e9435 to your computer and use it in GitHub Desktop.
This file contains 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
# Create a chained transformer that resizes, crops and normalizes each image in the dataframe | |
transformer = ChainedPreprocessing( | |
[RowToImageFeature(), ImageResize(256, 256), ImageCenterCrop(224, 224), | |
ImageChannelNormalize(123.0, 117.0, 104.0), ImageMatToTensor(), ImageFeatureToTensor()]) | |
# Load pre-trained Resnet-50 that was downloaded earlier and give the column to pick features from | |
preTrainedNNModel = NNModel(Model.loadModel(model_path), transformer) \ | |
.setFeaturesCol("image") \ | |
.setPredictionCol("embedding") | |
# Print all layers in Resnet-50 | |
for layer in preTrainedNNModel.model.layers: | |
print(layer.name()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment