Пример #1
0
 def _map_fn(img):
     if n_channels == 1:
         img = tf.image.rgb_to_grayscale(img)
     img = tf.image.resize(img, [load_size, load_size])
     img = tl.center_crop(img, size=crop_size)
     img = tf.clip_by_value(img, 0, 255) / 127.5 - 1
     return img
Пример #2
0
 def map_fn_(img, label):
     img = tf.image.resize(img, [load_size, load_size])
     img = tl.center_crop(img, size=crop_size)
     img = tf.clip_by_value(img, 0, 255) / 127.5 - 1
     label = (label + 1) // 2
     return img, label