For each of these images, I am running the
predict()
function of Keras with the VGG16 model. Because I excluded the last layers of the model, this function will not actually return any class predictions as it would normally do; instead we will get the output of the last layer:block5_pool (MaxPooling2D)
.These, we can use as learned features (or abstractions) of the images. Running this part of the code takes several minutes, so I save the output to a RData file (because I samples randomly, the classes you see below might not be the same as in the
sample_fruits
list above).
Read the whole thing.