Created
September 16, 2020 01:21
-
-
Save kerenskybr/2c26ecb549a8e2763241d6c00ae43887 to your computer and use it in GitHub Desktop.
Function to convert the Grayscale data to RGB to match with an architecture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras import backend as K | |
def grayscale_to_rgb(images, channel_axis=-1): | |
'''Function to convert the Grayscale data | |
to RGB to match with an architecture | |
''' | |
images= K.expand_dims(images, axis=channel_axis) | |
tiling = [1] * 4 # 4 dimensions: B, H, W, C | |
tiling[channel_axis] *= 3 | |
images= K.tile(images, tiling) | |
return images |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment