Evaluating on our test dataset was a good way to test the model's performance, but how do we start using the model in the real world and caption completely new photos? This is where we need some knowledge of building an end-to-end system, which takes in any image as an input and gives us a free-text natural-language caption as the output.
Here are the major components and functions for our automated caption generator:
- Caption model and metadata initializer
- Image feature extraction model initializer
- Transfer learning-based feature extractor
- Caption generator
To make this generic, we built a class that makes use of several utility functions we mentioned in the previous sections:
from keras.preprocessing import image from keras.applications.vgg16 import preprocess_input as preprocess_vgg16_input from keras.applications import vgg16 ...