0
我正在做一个机器学习项目来识别手写数字。实际上,我只是想向MNIST添加更多的数据集,但我无法这样做。将数据添加到MNIST数据集
我做了以下内容:
n_samples = len(mnist.data)
x = mnist.data.reshape((n_samples, -1))# array of feature of 64 pixel
y = mnist.target # Class label from 0-9 as there are digits
img_temp_train=cv2.imread('C:/Users/amuly/Desktop/Soap/crop/2.jpg',0)
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2)
#Now I want to add the img_temp_train to my dataset for training.
X_train=np.append(X_train,img_temp_train.reshape(-1))
y_train=np.append(y_train,[4.0])
训练后的长度为:
- 43904784(X_train)
- 56001(y_train)
但它应该是56001对彼此而言。
不工作,因为X_train.shape是(56000,784),而img_temp_train.shape是(784) – Amul123
更新。 (在第一个例子中忘了包含'axis = 0')。 –