loading an image from cifar-10 dataset

后端 未结 3 1550
南方客
南方客 2020-12-20 17:03

I am using cifar-10 dataset for my training my classifier. I have downloaded the dataset and tried to display am image from the dataset. I have used the following code:

3条回答
  •  抹茶落季
    2020-12-20 17:57

    Since Python uses the default C-like indexing order (row-major order), it can be forced to work in column-major order:

    import numpy as np
    import matplotlib.pyplot as plt
    
    # I assume you have loaded your data into x_train (see some tutorial)
    
    data = x_train[0, :] # get a row data
    data = np.reshape(data, (32,32,3), order='F' ) # Fortran-like indexing order
    plt.imshow(data)
    

提交回复
热议问题