model = Sequential()
model.add(Conv2D(filters = 6, kernel_size = 5, strides = 1, activation = 'relu', input_shape = (32,32,3)))
model.add(MaxPooling2D(pool_size = 2, strides = 2))
model.add(Conv2D(filters = 16, kernel_size = 5,strides = 1, activation = 'relu',input_shape = (14,14,6)))
model.add(MaxPooling2D(pool_size = 2, strides = 2))
#Flatten
model.add(Flatten())
model.add(Dense(units = 120, activation = 'relu'))
model.add (Плотный (единицы = 84, активация = 'relu'))
#Output Layer
model.add(Dense(units = 24, activation = 'softmax'))
# Compile the model with the optimizer:
model.compile(optimizer=indian, loss='categorical_crossentropy', metrics=['accuracy'])
Обучение сети:
epochs = 10 ; batchsize = 32
mod_h = model.fit(Xtrain, yTrain, batch_size=batchsize,
эпох = эпох, validation_data= (xtest, ytest), shuffle = True, многословно = 1)
model.summary()
ОШИБКА ВЫВОДА ПОКАЗЫВАЕТ
ValueError: Tensor("conv2d_1/kernel:0", shape=(5, 5, 3, 6), dtype=float32_ref) must be from the same graph as Tensor("sub:0", shape=(), dtype=float32).