小编Pec*_*ans的帖子

神经网络在一个时代之后变得扁平化

我正在使用keras创建一个卷积神经网络,试图将图像分为两个不同的类,并且由于某种原因,在第一个时代之后,准确性永远不会改变.

使用Keras之后to_categorical()我的标签看起来像:

[[0.  1.]
[1.  0.]
[1.  0.]
[0.  1.]]
Run Code Online (Sandbox Code Playgroud)

我的模型的代码是:

model = Sequential()
model.add(Conv2D(filters=32, kernel_size=[5, 5], strides=1, padding='same', activation='relu', input_shape=(imageSize, imageSize, 3)))
model.add(MaxPooling2D())
model.add(Conv2D(filters=64, kernel_size=[5, 5], strides=1, padding='same', activation='relu'))
model.add(MaxPooling2D())
model.add(Flatten())
model.add(Dense(2))
sgd = SGD()  # Use stochastic gradient descent for now
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])

model.summary()

counter = 0
# Train one cycle at a time so we can shuffle data inbetween
for x in range(trainingEpochs):

    counter += 1
    print()  # New line
    print('Epoch ' + str(counter)) …
Run Code Online (Sandbox Code Playgroud)

python machine-learning python-3.x keras tensorflow

2
推荐指数
1
解决办法
3387
查看次数

标签 统计

keras ×1

machine-learning ×1

python ×1

python-3.x ×1

tensorflow ×1