I tried using
ImageClassifierData.from_arrays(path="mnist/digit-recognizer/", trn=(X_train, y_train.values), val=(X_valid, y_valid.values),classes=y_train.unique(), test=test)
to train but I got a strange key error every time of a different number.
The documentation of from_array has the dimensions of the mnist dataset.
trn: a tuple of training data matrix and target label/classification array (e.g.
trn=(x,y)wherexhas theshape of(5000, 784)andyhas the shape of(5000,))
Then I read @dydt 's comment about missing color channels so I added the lines.
X_train = X_train.values.reshape(-1, 28, 28)
X_valid = X_valid.values.reshape(-1, 28, 28)
test = test.values.reshape(-1, 28, 28)
and expanded color channels by
X_train = np.stack((X_train,) * 3, axis=-1)
test = np.stack((test,) * 3, axis=-1)
X_valid = np.stack((X_valid,) * 3, axis=-1)
I get a dimension error.
Given groups=1, weight[64, 3, 7, 7], so expected input[64, 28, 28, 3] to have 3 channels, but got 28 channels instead
And if I remove reshape I get dimension error.
Expected 4D tensor as input, got 3D tensor instead.
Has anybody got this working with from_arrays? Should I stick to downloading images?