'using sklearn.utils.shuffle with images

I'm trying to use shuffle from sklearn.utils to shuffle 2 arrays at the same time but I think its not working. The shape of arrays:

    print( "class_image shape: ",class_image.shape)
    print( "class_label shape: ",class_label.shape)

class_image shape:  (550, 434, 636, 3)
class_label shape:  (550, 1)

and the shuffle code:

from sklearn.utils import shuffle
 
class_image, class_label = shuffle(class_image, class_label , random_state=0)

after that, I notice the training is not working as before, I'm not sure if "shuffle" works if the array is multi-dim.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source