使用keras进行回归训练时跟踪准确性

时间:2019-01-07 14:10:19

标签: python machine-learning keras

我正在使用监督学习来训练自动驾驶网络...该模型基于nvidia模型。它似乎训练得很好,损失为0.044,验证损失为0.033。在我的环境中使用该模型,汽车可以很好地行驶,因此可以正常学习。但是当我添加精度指标时,精度显示为0.11,并且从未真正改变。

代码在下面。我是否没有正确监测回归的准确性?还是不理解?

def nvidia_model():
    model = Sequential()
    model.add(Convolution2D(24, 5, 5, subsample=(2, 2), input_shape=(66, 200, 3), activation='elu'))
    model.add(Convolution2D(36, 5, 5, subsample=(2, 2), activation='elu'))
    model.add(Convolution2D(48, 5, 5, subsample=(2, 2), activation='elu'))
    model.add(Convolution2D(64, 3, 3, activation='elu'))
    model.add(Convolution2D(64, 3, 3, activation='elu'))
#   model.add(Dropout(0.5))
    model.add(Flatten())
    model.add(Dense(100, activation = 'elu'))
#   model.add(Dropout(0.5))
    model.add(Dense(50, activation = 'elu'))
#   model.add(Dropout(0.5))
    model.add(Dense(10, activation = 'elu'))
#   model.add(Dropout(0.5))
    model.add(Dense(1))
    optimizer = Adam(lr=1e-3)
    model.compile(loss='mse', optimizer=optimizer, metrics=['accuracy'])
    return model

model = nvidia_model()
print(model.summary())
history = model.fit_generator(batch_generator(X_train, y_train, 100, 1),
                                  steps_per_epoch=300, 
                                  epochs=10,
                                  validation_data=batch_generator(X_valid, y_valid, 100, 0),
                                  validation_steps=200,
                                  verbose=1,
                                  shuffle = 1)

0 个答案:

没有答案