def __init__(self, checkpoint_path):
layers = 50
num_blocks = [3, 4, 6, 3]
self.inference = lambda images, is_train : inference(images,
is_training=is_train,
num_classes=NUM_AGES*2,
num_blocks=num_blocks,
bottleneck=True)
self.x = tf.placeholder(tf.uint8, shape=(256,256,3), name='input_image')
self.crops = fixed_crops(self.x)
self.logits = self.inference(self.crops, is_train=False)
self.pred = tf.nn.softmax(self.logits, name='prediction')
# Restore saved weights
restore_variables = tf.trainable_variables() \
+ tf.moving_average_variables()
self.saver = tf.train.Saver(restore_variables)
self.sess = tf.Session()
self.saver.restore(self.sess, checkpoint_path)
#self.sess.run(tf.initialize_variables([var for var \
# in tf.all_variables() if var not in restore_variables]))
评论列表
文章目录