@@ -0,0 +1,1965 @@
+'''%0ACreated on Dec 19, 2016%0A%0A@author: taivu%0A'''%0Aimport tensorflow as tf%0Afrom tensorflow.contrib.slim.python.slim.nets.inception_v2 import inception_v2%0Afrom tensorflow.contrib.slim.python.slim.nets.inception_v2 import inception_v2_arg_scope%0Afrom PIL import Image%0Aimport numpy as np%0A%0A%0Adef test_program():%0A    with tf.Graph().as_default():%0A        slim = tf.contrib.slim%0A        %0A        checkpoint_dir = '/home/taivu/workspace/NudityDetection/Trained_weight'%0A        %0A        %0A        input_tensor = tf.placeholder(tf.float32, shape=(None, 224, 224, 3), name='input_image')%0A        scaled_input_tensor = tf.scalar_mul((1.0/255), input_tensor)%0A        scaled_input_tensor = tf.sub(scaled_input_tensor, 0.5)%0A        scaled_input_tensor = tf.mul(scaled_input_tensor, 2.0)%0A         %0A        arg_scope = inception_v2_arg_scope()%0A        with slim.arg_scope(arg_scope):%0A            logits, end_points = inception_v2(scaled_input_tensor, is_training = False)%0A                %0A        init = tf.global_variables_initializer()%0A        %0A        saver = tf.train.Saver(tf.global_variables())%0A        %0A        coord = tf.train.Coordinator()%0A        %0A        with tf.Session() as sess:            %0A                %0A            sess.run(init)%0A            %0A            threads = tf.train.start_queue_runners(sess, coord)%0A            %0A            ckpt = tf.train.get_checkpoint_state(checkpoint_dir)%0A            %0A            if ckpt and ckpt.model_checkpoint_path:%0A                saver.restore(sess, ckpt.model_checkpoint_path)%0A            %0A            im = Image.open('/home/taivu/workspace/NudityDetection/dog.jpeg').resize((224, 224))%0A            im = np.array(im)%0A            im = im.reshape(1, 224, 224, 3)%0A            %0A            predict_values, logit_values = sess.run(%5Bend_points%5B'Predictions'%5D, logits%5D, feed_dict=%7B%0A                input_tensor: im%7D)%0A               %0A            print(np.max(predict_values), np.max(logit_values))%0A            %0A        coord.request_stop()

TEST TRANSFER LEARNING