The retraining of Inception v3 differs from the VGG16, as we use the softmax activation layer for the output with tf.losses.softmax_cross_entropy() as the loss function.
- First define the placeholders:
is_training = tf.placeholder(tf.bool,name='is_training')x_p = tf.placeholder(shape=(None, image_height, image_width, 3 ), dtype=tf.float32, name='x_p')y_p = tf.placeholder(shape=(None,coco.n_classes), dtype=tf.int32, name='y_p')
- Next, load the model:
with slim.arg_scope(inception.inception_v3_arg_scope()): logits,_ = inception.inception_v3(x_p, num_classes=coco.n_classes, is_training=True )probabilities = tf.nn.softmax(logits)
- Next, define functions to restore the variables ...