Ejemplo n.º 1
0
 def read_and_decode(self, filename_queue):
     img1_name = tf.string_join([self.img_dir, '/', filename_queue[0]])
     img2_name = tf.string_join([self.img_dir, '/', filename_queue[1]])
     img3_name = tf.string_join([self.img_dir, '/', filename_queue[2]])
     img4_name = tf.string_join([self.img_dir, '/', filename_queue[3]])
     img5_name = tf.string_join([self.img_dir, '/', filename_queue[4]])
     img1 = tf.image.decode_png(tf.read_file(img1_name), channels=3)
     img1 = tf.cast(img1, tf.float32)
     img2 = tf.image.decode_png(tf.read_file(img2_name), channels=3)
     img2 = tf.cast(img2, tf.float32)
     img3 = tf.image.decode_png(tf.read_file(img3_name), channels=3)
     img3 = tf.cast(img3, tf.float32)
     img4 = tf.image.decode_png(tf.read_file(img4_name), channels=3)
     img4 = tf.cast(img4, tf.float32)
     img5 = tf.image.decode_png(tf.read_file(img5_name), channels=3)
     img5 = tf.cast(img5, tf.float32)
     return img1, img2, img3, img4, img5
Ejemplo n.º 2
0
def make_status_message(model):
    """Makes a string `Tensor` of training status."""
    return tf.string_join([
        'Starting train step: current_image_id: ',
        tf.as_string(model.current_image_id), ', progress: ',
        tf.as_string(model.progress), ', num_blocks: {}'.format(
            model.num_blocks), ', batch_size: {}'.format(model.batch_size)
    ],
                          name='status_message')
Ejemplo n.º 3
0
    def read_and_decode_distillation(self, filename_queue):
        img1_name = tf.string_join([self.img_dir, '/', filename_queue[0]])
        img2_name = tf.string_join([self.img_dir, '/', filename_queue[1]])
        img3_name = tf.string_join([self.img_dir, '/', filename_queue[2]])
        img4_name = tf.string_join([self.img_dir, '/', filename_queue[3]])
        img5_name = tf.string_join([self.img_dir, '/', filename_queue[4]])
        img1 = tf.image.decode_png(tf.read_file(img1_name), channels=3)
        img1 = tf.cast(img1, tf.float32)
        img2 = tf.image.decode_png(tf.read_file(img2_name), channels=3)
        img2 = tf.cast(img2, tf.float32)
        img3 = tf.image.decode_png(tf.read_file(img3_name), channels=3)
        img3 = tf.cast(img3, tf.float32)
        img4 = tf.image.decode_png(tf.read_file(img4_name), channels=3)
        img4 = tf.cast(img4, tf.float32)
        img5 = tf.image.decode_png(tf.read_file(img5_name), channels=3)
        img5 = tf.cast(img5, tf.float32)

        flow_occ_fw_12_name = tf.string_join([
            self.fake_flow_occ_dir, '/flow_occ_12_fw_', filename_queue[5],
            '.png'
        ])
        flow_occ_bw_21_name = tf.string_join([
            self.fake_flow_occ_dir, '/flow_occ_21_bw_', filename_queue[5],
            '.png'
        ])
        flow_occ_fw_12 = tf.image.decode_png(tf.read_file(flow_occ_fw_12_name),
                                             dtype=tf.uint16,
                                             channels=3)
        flow_occ_fw_12 = tf.cast(flow_occ_fw_12, tf.float32)
        flow_occ_bw_21 = tf.image.decode_png(tf.read_file(flow_occ_bw_21_name),
                                             dtype=tf.uint16,
                                             channels=3)
        flow_occ_bw_21 = tf.cast(flow_occ_bw_21, tf.float32)
        flow_fw_12, occ_fw_12 = self.extract_flow_and_mask(flow_occ_fw_12)
        flow_bw_21, occ_bw_21 = self.extract_flow_and_mask(flow_occ_bw_21)

        flow_occ_fw_23_name = tf.string_join([
            self.fake_flow_occ_dir, '/flow_occ_23_fw_', filename_queue[5],
            '.png'
        ])
        flow_occ_bw_32_name = tf.string_join([
            self.fake_flow_occ_dir, '/flow_occ_32_bw_', filename_queue[5],
            '.png'
        ])
        flow_occ_fw_23 = tf.image.decode_png(tf.read_file(flow_occ_fw_23_name),
                                             dtype=tf.uint16,
                                             channels=3)
        flow_occ_fw_23 = tf.cast(flow_occ_fw_23, tf.float32)
        flow_occ_bw_32 = tf.image.decode_png(tf.read_file(flow_occ_bw_32_name),
                                             dtype=tf.uint16,
                                             channels=3)
        flow_occ_bw_32 = tf.cast(flow_occ_bw_32, tf.float32)
        flow_fw_23, occ_fw_23 = self.extract_flow_and_mask(flow_occ_fw_23)
        flow_bw_32, occ_bw_32 = self.extract_flow_and_mask(flow_occ_bw_32)

        superpix_name = tf.string_join(
            [self.superpixel_dir, '/', filename_queue[2]])
        superpixels = tf.image.decode_png(tf.read_file(superpix_name),
                                          channels=1)
        superpixels = tf.cast(superpixels, tf.int32)

        return img1, img2, img3, img4, img5, flow_fw_12, flow_bw_21, occ_fw_12, occ_bw_21, flow_fw_23, flow_bw_32, occ_fw_23, occ_bw_32, superpixels