datasets.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:Awesome-GANs 作者: kozistr 项目源码 文件源码
def pix2pix_vangogh(self):
        queue_A = tf.train.string_input_producer(tf.train.match_filenames_once(dirs['pix2pix_vangogh-A']),
                                                 num_epochs=self.epoch, shuffle=True)
        queue_B = tf.train.string_input_producer(tf.train.match_filenames_once(dirs['pix2pix_vangogh-B']),
                                                 num_epochs=self.epoch, shuffle=True)

        image_reader = tf.WholeFileReader()

        _, img_A = image_reader.read(queue_A)
        _, img_B = image_reader.read(queue_B)

        # decoding jpg images
        img_A = tf.image.decode_jpeg(img_A)
        img_B = tf.image.decode_jpeg(img_B)

        # image size : 64x64x3
        self.img_A = tf.cast(tf.reshape(img_A, shape=[None,
                                                      self.input_height,
                                                      self.input_width,
                                                      self.input_channel]), dtype=tf.float32) / 255.
        self.img_B = tf.cast(tf.reshape(img_B, shape=[None,
                                                      self.input_height,
                                                      self.input_width,
                                                      self.input_channel]), dtype=tf.float32) / 255.
        print(self.img_A.shape)
        print(self.img_B.shape)
        # min_queue_examples = self.batch_size

        # self.batch_A = tf.train.shuffle_batch([img_A],
        #                                       batch_size=self.batch_size,
        #                                       num_threads=self.num_threads,
        #                                       capacity=min_queue_examples + 3 * self.batch_size,
        #                                       min_after_dequeue=min_queue_examples)

        # self.batch_B = tf.train.shuffle_batch([img_B],
        #                                       batch_size=self.batch_size,
        #                                       num_threads=self.num_threads,
        #                                       capacity=min_queue_examples + 3 * self.batch_size,
        #                                       min_after_dequeue=min_queue_examples)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号