Implementation – loading weights and inferencing with VGG-
sard/post/vgg16/ provides the weights as a dictionary of NumPy arrays. There are 16 weight values and 16 bias values corresponding to the 16 layers of VGG-16. They are saved under the keys as follows:
conv1_1_W, conv1_1_b, conv1_2_W, conv1_2_b, conv2_1_W, conv2_1_b…
First, download the file from the website and place it in the ch9/image_caption_data
folder. Now we will discuss the implementation, from loading the downloaded CNN to making predictions with the pretrained CNN we'll use. First, we will discuss how to create necessary TensorFlow variables and load them with the downloaded weights. Next, we will define an input reading pipeline to read in images as inputs to the CNN and also several preprocessing steps. Then we will define the inference operations for the CNN to get predictions for the inputs. Then we will define calculations to get the class, along with the prediction for that class which the CNN thinks that it suits the...