Replace a fraction of eligible channels with a fill value to model missing spectral bands or unavailable sensors while retaining at least one input channel.
channels_to_dropUnique, non-negative channel indices eligible for dropout. None makes every input channel eligible. An explicit sequence must be non-empty, and every index must exist in each image-like target. Default: None.
dropout_ratioFraction of eligible channels to replace, in [0, 1]. The count is rounded to the nearest integer using decimal half-up rounding, then capped at the total number of input channels minus one. Default: 0.5.
fillValue assigned to the selected channels. Use a value in the input dtype's image range, such as 0 for missing signal. Positive and negative zero are equivalent; the sign of filled zeros is not guaranteed. Default: 0.
pProbability of applying the transform, in [0, 1]. Default: 0.5.
>>> import numpy as np
>>> import albumentations as A
>>> image = np.ones((64, 96, 10), dtype=np.float32)
>>> transform = A.ChannelDropout(
... channels_to_drop=(0, 2, 4, 6), dropout_ratio=0.5, p=1.0,
... )
>>> result = transform(image=image)["image"]
>>> assert np.count_nonzero(np.all(result == 0, axis=(0, 1))) == 2
>>> np.testing.assert_array_equal(result[..., (1, 3, 5, 7, 8, 9)], 1)