Keras 3 API 文档 / KerasCV / / 增强层 / 通道置乱层

通道置乱层

[source]

ChannelShuffle class

keras_cv.layers.ChannelShuffle(groups=3, seed=None, **kwargs)

Shuffle channels of an input image.

Input shape

3D (unbatched) or 4D (batched) tensor with shape: (..., height, width, channels), in "channels_last" format

Output shape

3D (unbatched) or 4D (batched) tensor with shape: (..., height, width, channels), in "channels_last" format

Arguments

  • groups: Number of groups to divide the input channels, defaults to 3.
  • seed: Integer. Used to create a random seed.

Example

(images, labels), _ = keras.datasets.cifar10.load_data()
channel_shuffle = ChannelShuffle(groups=3)
augmented_images = channel_shuffle(images)