def load(self, session, model_path): x_input = tf.placeholder(self.x_dtype, shape=(None,) + self.x_shape) with slim.arg_scope(inception_v3.inception_v3_arg_scope()): inception_v3.inception_v3(x_input, num_classes=self.n_class, is_training=False, reuse=tf.AUTO_REUSE, scope='Ens4InceptionV3') saver = tf.train.Saver(slim.get_model_variables(scope='Ens4InceptionV3')) saver.restore(session, os.path.join(model_path, 'ens4_adv_inception_v3.ckpt'))
def _logits_and_labels(self, xs_ph): xs_ph = xs_ph * 2.0 - 1.0 with slim.arg_scope(inception_v3.inception_v3_arg_scope()): logits, end_points = inception_v3.inception_v3(xs_ph, num_classes=self.n_class, is_training=False, reuse=tf.AUTO_REUSE, scope='Ens4InceptionV3') predicted_labels = tf.cast(tf.argmax(end_points['Predictions'], 1), tf.int32) return logits, predicted_labels