AlexNet's second augmentation changes the colour and intensity of each training image. PCA is run once, on the RGB values of all pixels in the training set. Then, each time an image is used, one random multiple of each principal component is added to every pixel of that image. Implement it.
rgb_pca(images)
images has shape (N, H, W, 3). Treat every pixel of every image as one RGB sample, compute the 3 x 3 covariance with np.cov(..., rowvar=False) and decompose it with np.linalg.eigh.(eigvals, eigvecs): eigenvalues sorted in descending order (shape (3,)) and the matching eigenvectors as the columns of a 3 x 3 array.color_shift(eigvals, eigvecs, alphas)
augment(image, eigvals, eigvecs, rng, std=0.1)
rng.normal(0.0, std, size=3), once for the whole image, and return image + color_shift(...) as floats, shape unchanged. No clipping.