예제 #1
0
    def preprocess_one_shot(self, filename_queue):
        img0, img1, img2 = self.read_and_decode(filename_queue)
        img0 = img0 / 255.
        img1 = img1 / 255.
        img2 = img2 / 255.

        if self.is_normalize_img:
            img0 = mvn(img0)
            img1 = mvn(img1)
            img2 = mvn(img2)
        return img0, img1, img2
from utils import mvn

#--------------------------------------------------------------------------

config = config_dict('./config/config.ini')
restore_model = config['test']['restore_model']

b_img0 = tf.placeholder(tf.float32, shape=(1, None, None, 3))
b_img1 = tf.placeholder(tf.float32, shape=(1, None, None, 3))
b_img2 = tf.placeholder(tf.float32, shape=(1, None, None, 3))

#b_img0 = tf.placeholder(tf.float32, shape=(1, 384, 512, 3))
#b_img1 = tf.placeholder(tf.float32, shape=(1, 384, 512, 3))
#b_img2 = tf.placeholder(tf.float32, shape=(1, 384, 512, 3))

b_img0 = mvn(b_img0)
b_img1 = mvn(b_img1)
b_img2 = mvn(b_img2)

img_shape = tf.shape(b_img0)
h = img_shape[1]
w = img_shape[2]

new_h = tf.where(tf.equal(tf.mod(h, 64), 0), h,
                 (tf.to_int32(tf.floor(h / 64) + 1)) * 64)
new_w = tf.where(tf.equal(tf.mod(w, 64), 0), w,
                 (tf.to_int32(tf.floor(w / 64) + 1)) * 64)

batch_img0 = tf.image.resize_images(b_img0, [new_h, new_w],
                                    method=1,
                                    align_corners=True)