August 2018
Intermediate to advanced
272 pages
7h 2m
English
Next, we present the function responsible for building the VGG-16 model graph in Tensorflow. VGGNet, like all the models in this chapter, was designed to classify the 1,000 classes of the Imagenet challenge, which is why this model outputs a vector of size 1,000. Obviously, this can be easily changed for your own datasets, as follows:
def build_graph(self): self.__x_ = tf.placeholder("float", shape=[None, 224, 224, 3], name='X') self.__y_ = tf.placeholder("float", shape=[None, 1000], name='Y') with tf.name_scope("model") as scope: conv1_1 = tf.layers.conv2d(inputs=self.__x_, filters=64, kernel_size=[3, 3], padding="same", activation=tf.nn.relu) conv2_1 = tf.layers.conv2d(inputs=conv1_1, filters=64, kernel_size=[3, 3], padding="same", ...