Skip to content

Commit

Permalink
adding 3 channels to tiled data
Browse files Browse the repository at this point in the history
  • Loading branch information
taxe10 committed Jan 30, 2024
1 parent 1cae0fd commit 89ff012
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/helper_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,15 @@ def data_preprocessing(data, target_shape, data_type):
'''
if data_type != 'tiled':
img = tf.io.read_file(data)
if data_type == 'tif':
if data_type != 'tif':
img = tf.io.decode_image(img, channels=3, expand_animations = False)
else:
img_tmp = tfio.experimental.image.decode_tiff(img)
r, g, b = img_tmp[:, :, 0], img_tmp[:, :, 1], img_tmp[:, :, 2]
img = tf.stack([r, g, b], axis=-1)
else:
img = tf.expand_dims(data, axis=-1)
img = tf.repeat(img, repeats=3, axis=-1)
img = tf.image.resize(img, tf.constant(target_shape))
img = img / 255.
return img

0 comments on commit 89ff012

Please sign in to comment.