2
$\begingroup$

Suppose there is a ML network that takes grayscale images as the input. The images that I have are RGB images. So, instead of converting these RGB images to grayscale, I treat each individual colour bands as distinct inputs to the network. that is, instead of feeding RGB image A to the network, I feed the R matrix of A as the first input, followed by the G matrix and then the B matrix. This leads to 3 times more data for the network. Can this be considered as data augmentation (since we are increasing the amount of data)? If yes, what is the name of this data augmentation technique?

$\endgroup$
1
  • 1
    $\begingroup$ I doubt it has a name. In your example, how close are the separate channel images to the target population where the network will be used to make predictions? $\endgroup$ Apr 5, 2022 at 7:32

1 Answer 1

1
$\begingroup$

Neil is right, data augmentation is suppose to add data that respect the same distribution as the original data.

Grayscale is a linear combination of individual channel, therefore the single channels have different distributions (histograms) compared to their combination. And that is always gonna be the case, and unfortunately there's no work around to it, the only way would be to match the single channel histograms to the grayscale one, but then you'll end up with 3 copies of the same image.

You can easily check the differences with this code snippet.

enter image description here

import numpy as np
import skimage as sk
import matplotlib.pyplot as plt


def plot_hist():
    img = sk.data.chelsea()

    red = img[:, :, 0]
    green = img[:, :, 1]
    blue = img[:, :, 2]

    gray_crt = 0.2125 * red + 0.7154 * green + 0.0721 * blue
    gray_avg = img.mean(axis=2)

    fig, ax = plt.subplots(2, 3)

    bins = np.arange(-0.5, 255 + 1, 1)
    ax[0, 0].imshow(img)
    ax[0, 1].hist(gray_crt.flatten(), bins=bins, color="k")
    ax[0, 2].hist(gray_avg.flatten(), bins=bins, color="k")

    colors = ["r", "g", "b"]
    for c in range(img.shape[2]):
        ax[1, c].hist(img[:, :, c].flatten(), bins=bins, color=colors[c])
    plt.show()


if __name__ == "__main__":
    plot_hist()
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .