I am trying to make a layer which flips an image in the horizontal axis and then adds this image to the batch dimension. The code is as follows:
class FlipLayer(keras.layers.Layer):
def __init__(self, input_layer):
super(FlipLayer, self).__init__()
def get_output_shape(self, input_shape):
return (2 * input_shape[0],) + input_shape[1:]
def get_output(self, input):
return keras.layers.Concatenate([
input,
flipim(input)
], axis=0)
Where 'flipim' is just a function flipping the numpy array in the desired axis. Keras does not give any error when compiling the model using this function, however it isn't doing anything. When I use this layer as my last layer and check the output, it is still the same size in the batch dimension compared to the previous layer.