TensorBoardLogs
- class lib.gui.analysis.event_reader.TensorBoardLogs(logs_folder: str, is_training: bool)
Bases:
objectParse data from TensorBoard logs.
Process the input logs folder and stores the individual filenames per session.
Caches timestamp and loss data on request and returns this data from the cache.
- Parameters:
logs_folder (str) – The folder that contains the Tensorboard log files
is_training (bool) –
Trueif the events are being read whilst Faceswap is training otherwiseFalse
Attributes Summary
Sorted list of integers of available session ids.
Methods Summary
get_loss([session_id])Read the loss from the TensorBoard event logs
get_timestamps([session_id])Read the timestamps from the TensorBoard logs.
set_training(is_training)Set the internal training flag to the given is_training value.
Attributes Documentation
- session_ids
Sorted list of integers of available session ids.
Methods Documentation
- get_loss(session_id: int | None = None) dict[int, dict[str, ndarray]]
Read the loss from the TensorBoard event logs
- Parameters:
session_id (int | None) – The Session ID to return the loss for. Set to
Noneto return all session losses. DefaultNone- Returns:
The session id(s) as key, with a further dictionary as value containing the loss name and
list of loss values for each step
- Return type:
dict[int, dict[str, ndarray]]
- get_timestamps(session_id: int | None = None) dict[int, ndarray]
Read the timestamps from the TensorBoard logs.
As loss timestamps are slightly different for each loss, we collect the timestamp from the batch_loss key.
- Parameters:
session_id (int | None) – The Session ID to return the timestamps for. Set to
Noneto return all session timestamps. DefaultNone- Return type:
The session id(s) as key with list of timestamps per step as value
- set_training(is_training: bool) bool
Set the internal training flag to the given is_training value.
If a new training session is being instigated, refresh the log filenames
- Parameters:
is_training (bool) –
Trueto indicate that the logs to be read are from the currently training session otherwiseFalse- Returns:
Trueif the session that is starting training belongs to the session already loadedotherwise
False
- Return type:
bool
- get_loss(session_id: int | None = None) dict[int, dict[str, ndarray]]
Read the loss from the TensorBoard event logs
- Parameters:
session_id (int | None) – The Session ID to return the loss for. Set to
Noneto return all session losses. DefaultNone- Returns:
The session id(s) as key, with a further dictionary as value containing the loss name and
list of loss values for each step
- Return type:
dict[int, dict[str, ndarray]]
- get_timestamps(session_id: int | None = None) dict[int, ndarray]
Read the timestamps from the TensorBoard logs.
As loss timestamps are slightly different for each loss, we collect the timestamp from the batch_loss key.
- Parameters:
session_id (int | None) – The Session ID to return the timestamps for. Set to
Noneto return all session timestamps. DefaultNone- Return type:
The session id(s) as key with list of timestamps per step as value
- property session_ids: list[int]
Sorted list of integers of available session ids.
- set_training(is_training: bool) bool
Set the internal training flag to the given is_training value.
If a new training session is being instigated, refresh the log filenames
- Parameters:
is_training (bool) –
Trueto indicate that the logs to be read are from the currently training session otherwiseFalse- Returns:
Trueif the session that is starting training belongs to the session already loadedotherwise
False
- Return type:
bool