def transformer ( data , label ) : data = mx . image . imresize ( data , IMAGE_SIZE , IMAGE_SIZE ) data = mx . nd . transpose ( data , ( 2 , 0 , 1 ) ) data = data . astype ( np . float32 ) / 128.0 - 1 return data , label
image data preprocessing in python
data preparation
def transformer(data, label):
    """ data preparation """
    data = mx.image.imresize(data, IMAGE_SIZE, IMAGE_SIZE)
    data = mx.nd.transpose(data, (2, 0, 1))
    data = data.astype(np.float32) / 128.0 - 1
    return data, label