kears fit_generator 以後,如何獲取 loss 損失的值

kears fit_generator 以後,如何獲取 loss 損失的值。
比方說,train_loss 和 val_loss 的值input

  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)generator

  求此處的 lossit

已找到方法:io

  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)class

  print(h.history)
  打印結果裏面有 loss 和 val_lossmodel

相關文章
相關標籤/搜索