Keras 3 API 文件 / 回呼 API / RemoteMonitor

RemoteMonitor

[原始碼]

RemoteMonitor 類別

keras.callbacks.RemoteMonitor(
    root="https://127.0.0.1:9000",
    path="/publish/epoch/end/",
    field="data",
    headers=None,
    send_as_json=False,
)

用於將事件串流至伺服器的回呼。

需要 requests 程式庫。事件預設會傳送至 root + '/publish/epoch/end/'。呼叫為 HTTP POST,並帶有 data 引數,該引數是 JSON 編碼的事件資料字典。如果 send_as_json=True,則請求的內容類型將為 "application/json"。否則,序列化的 JSON 將在表單中傳送。

引數

  • root: 字串;目標伺服器的根網址。
  • path: 字串;相對於 root 的路徑,事件將傳送至該路徑。
  • field: 字串;將在其中儲存資料的 JSON 欄位。僅當酬載在表單中傳送時才使用此欄位(即當 send_as_json=False 時)。
  • headers: 字典;選用的自訂 HTTP 標頭。
  • send_as_json: 布林值;請求是否應以 "application/json" 形式傳送。