mirror of
https://github.com/clearml/clearml
synced 2025-04-26 17:30:20 +00:00
Improve support for tensorboard.summarywriter.addscalars binding
This commit is contained in:
parent
f5f13658c3
commit
edc237dad4
@ -43,8 +43,8 @@ sdk {
|
||||
subsampling: 0
|
||||
}
|
||||
|
||||
# Support plot-per-graph fully matching Tensorboard behavior (i.e. if this is set to False, each series should have its own graph)
|
||||
tensorboard_auto_group_scalars: True
|
||||
# Support plot-per-graph fully matching Tensorboard behavior (i.e. if this is set to True, each series should have its own graph)
|
||||
tensorboard_single_series_per_graph: False
|
||||
}
|
||||
|
||||
network {
|
||||
|
@ -271,14 +271,17 @@ class EventTrainsWriter(object):
|
||||
|
||||
def _add_scalar(self, tag, step, scalar_data):
|
||||
default_title = tag if not self._logger._get_tensorboard_auto_group_scalars() else 'Scalars'
|
||||
title, series = self.tag_splitter(tag, num_split_parts=1,
|
||||
default_title=default_title, logdir_header='series_last')
|
||||
title, series = self.tag_splitter(
|
||||
tag, num_split_parts=1, default_title=default_title, logdir_header='series_last'
|
||||
)
|
||||
|
||||
step = self._fix_step_counter(title, series, step)
|
||||
tag = self._get_add_scalars_event_tag(default_title)
|
||||
group = config.get('metrics.tensorboard_auto_group_scalars', True)
|
||||
|
||||
possible_title = None if group else tag
|
||||
possible_tag = tag if group else None
|
||||
series_per_graph = self._logger._get_tensorboard_single_series_per_graph()
|
||||
|
||||
possible_title = tag if series_per_graph else None
|
||||
possible_tag = None if series_per_graph else tag
|
||||
|
||||
title = title + possible_title if possible_title else title
|
||||
series = possible_tag or series
|
||||
@ -1096,6 +1099,7 @@ class PatchTensorFlowEager(object):
|
||||
img_data_np=img_data_np,
|
||||
max_keep_images=kwargs.get('max_images'))
|
||||
|
||||
|
||||
class PatchKerasModelIO(object):
|
||||
__main_task = None
|
||||
__patched_keras = None
|
||||
|
@ -32,8 +32,9 @@
|
||||
quality: 87
|
||||
subsampling: 0
|
||||
}
|
||||
# Support plot-per-graph fully matching Tensorboard behavior (i.e. if this is set to False, each series should have its own graph)
|
||||
tensorboard_auto_group_scalars: True
|
||||
|
||||
# Support plot-per-graph fully matching Tensorboard behavior (i.e. if this is set to True, each series should have its own graph)
|
||||
tensorboard_single_series_per_graph: False
|
||||
}
|
||||
|
||||
network {
|
||||
|
@ -11,7 +11,7 @@ from .backend_interface.task import Task as _Task
|
||||
from .backend_interface.task.development.worker import DevWorker
|
||||
from .backend_interface.task.log import TaskHandler
|
||||
from .backend_interface.util import mutually_exclusive
|
||||
from .config import running_remotely, get_cache_dir
|
||||
from .config import running_remotely, get_cache_dir, config
|
||||
from .debugging.log import LoggerRoot
|
||||
from .errors import UsageError
|
||||
from .storage import StorageHelper
|
||||
@ -31,6 +31,7 @@ class Logger(object):
|
||||
"""
|
||||
SeriesInfo = SeriesInfo
|
||||
_tensorboard_logging_auto_group_scalars = False
|
||||
_tensorboard_single_series_per_graph = config.get('metrics.tensorboard_single_series_per_graph', False)
|
||||
|
||||
def __init__(self, private_task):
|
||||
"""
|
||||
@ -518,6 +519,14 @@ class Logger(object):
|
||||
"""
|
||||
cls._tensorboard_logging_auto_group_scalars = group_scalars
|
||||
|
||||
@classmethod
|
||||
def tensorboard_single_series_per_graph(cls, single_series=False):
|
||||
"""
|
||||
If `single_series` set to True, we generate a separate graph (plot) for each Tensorboard scalar series
|
||||
Default is False: Tensorboard scalar series will be grouped according to their title
|
||||
"""
|
||||
cls._tensorboard_logging_single_series_per_graphs = single_series
|
||||
|
||||
@classmethod
|
||||
def _remove_std_logger(cls):
|
||||
StdStreamPatch.remove_std_logger()
|
||||
@ -568,7 +577,7 @@ class Logger(object):
|
||||
self._start_task_if_needed()
|
||||
|
||||
def _report_image_plot_and_upload(self, title, series, iteration, path=None, matrix=None, max_image_history=None,
|
||||
delete_after_upload=False):
|
||||
delete_after_upload=False):
|
||||
"""
|
||||
Report an image, upload its contents, and present in plots section using plotly
|
||||
|
||||
@ -691,3 +700,11 @@ class Logger(object):
|
||||
default is False: Tensorboard scalars without title will have title/series with the same tag
|
||||
"""
|
||||
return cls._tensorboard_logging_auto_group_scalars
|
||||
|
||||
@classmethod
|
||||
def _get_tensorboard_single_series_per_graph(cls):
|
||||
"""
|
||||
:return: return True if we generate a separate graph (plot) for each Tensorboard scalar series
|
||||
default is False: Tensorboard scalar series will be grouped according to their title
|
||||
"""
|
||||
return cls._tensorboard_single_series_per_graph
|
||||
|
Loading…
Reference in New Issue
Block a user