我正在尝试使用我的2D数组数据(28x28)编程卷积自动编码器。 这是我提到的链接。 https://blog.keras.io/building-autoencoders-in-keras.html
参考和我之间的唯一差别是MNIST或我的。
问题应该是由数据拆分引起的," X_train ...,X_test ..."部分。 因为如果我使用skitlearn train_test_split算法,我一直遇到麻烦。
我知道这是什么问题。 我只是不知道如何解决它。 谢谢。
data1 = pd.read_csv("2D2828.csv")
data2 = data1.as_matrix()
X = data2.astype(np.float32)
X = Input(shape=(28, 28, 1))
ae_cnn = Conv2D(16, (3, 3), activation='relu', padding='same')(X)
ae_cnn = MaxPooling2D((2, 2), padding='same')(ae_cnn)
ae_cnn = Conv2D(8, (3, 3), activation='relu', padding='same')(ae_cnn)
ae_cnn = MaxPooling2D((2, 2), padding='same')(ae_cnn)
ae_cnn = Conv2D(8, (3, 3), activation='relu', padding='same')(ae_cnn)
encoded = MaxPooling2D((2, 2), padding='same')(ae_cnn)
ae_cnn = Conv2D(8, (3, 3), activation='relu', padding='same')(encoded)
ae_cnn = UpSampling2D((2, 2))(ae_cnn)
ae_cnn = Conv2D(8, (3, 3), activation='relu', padding='same')(ae_cnn)
ae_cnn = UpSampling2D((2, 2))(ae_cnn)
ae_cnn = Conv2D(16, (3, 3), activation='relu')(ae_cnn)
ae_cnn = UpSampling2D((2, 2))(ae_cnn)
decoded = Conv2D(1, (3, 3), activation='sigmoid', padding='same')(ae_cnn)
autoencoder = Model(X, decoded)
autoencoder.compile(optimizer='adadelta', loss='binary_crossentropy')
from keras.callbacks import TensorBoard
X_train = X[1:24
X_test = X[25:28]
autoencoder.fit(X_train, X_train,
epochs=2,
batch_size=2,