kears fit_generator 之后,如何获取 loss 损失的值
kears fit_generator 之后,如何获取 loss 损失的值。
比方说,train_loss 和 val_loss 的值
model = Model([model_body.input, *y_true], model_loss)
model.fit_generator(data_generator_wrap(train, BATCH_SIZE, input_shape, anchors, num_classes),
steps_per_epoch=max(1, num_train // BATCH_SIZE),
validation_data=data_generator_wrap(val, BATCH_SIZE, input_shape, anchors, num_classes),
validation_steps=max(1, num_val // BATCH_SIZE),
epochs=1,
initial_epoch=0)
求此处的 loss
已找到方法:
h = model.fit_generator(data_generator_wrap(train, BATCH_SIZE, input_shape,
anchors, num_classes),
steps_per_epoch=max(1, num_train // BATCH_SIZE),
validation_data=data_generator_wrap(val, BATCH_SIZE, input_shape, anchors, num_classes),
validation_steps=max(1, num_val // BATCH_SIZE),
epochs=1,
initial_epoch=0)
print(h.history)
打印结果里面有 loss 和 val_loss