imgaug-doc
imgaug-doc copied to clipboard
AssertionError: Expected number of channels to be three, got 3 channels with shape (512, 512, 1).
Hi, when I augment a array with shape (H, W), it is ok sometimes, but failed with the above error sometimes, too. could someone tell me how to avoid it?
@nickshawn You're probably trying to apply augmentations that expect the input image to have 3 color channels. If you have a gray-scale image as your input - which it seems like you do - then you need to make sure you don't use augmentations that work with color channels. For example, an augmenter such as AddToHueAndSaturation
would raise that error since it expects the input image to have color channels as far as I can tell.
So the solution is to use augmenters that don't work on color channels or to convert your images to RGB, augment, and then convert back (not ideal performance-wise).