我不明白数组的含义是什么?数组是关于图像数据的
我得到的输出结果: 如图所示
我通过以下代码读取数据:
# function:load single batch of cifar
def load_CIFAR_batch(filename):
with open(filename, 'rb') as f:
datadict = pk.load(f,encoding='latin1')
X = datadict['data']
Y = datadict['labels']
print(X)
print(5)
X = X.reshape(10000, 3, 32, 32).transpose(0,2,3,1).astype("float")
print(X)
print(6)
Y = np.array(Y)
return X, Y
# function:load all data of cifar
def load_CIFAR10(ROOT):
xs = []
ys = []
for b in range(1,2):
f = os.path.join(ROOT, 'data_batch_%d' % (b, ))
X, Y = load_CIFAR_batch(f)
xs.append(X)
ys.append(Y)
Xtr = np.concatenate(xs)
Ytr = np.concatenate(ys)
del X, Y
Xte, Yte = load_CIFAR_batch(os.path.join(ROOT, 'test_batch'))
return Xtr, Ytr, Xte, Yte
if __name__ == "__main__":
cifar10_dir = "/home/tenglong/tenglong/cs231n/datasets/cifar-10-batches-py"
load_CIFAR10(cifar10_dir)
我得到的结果,但我不知道这是什么意思