MCPcopy Create free account
hub / github.com/TPCD/DCCL / VisdomLogger

Class VisdomLogger

project_utils/visualization_utils.py:912–940  ·  view source on GitHub ↗

A generic Visdom class that works with the majority of Visdom plot types.

Source from the content-addressed store, hash-verified

910
911
912class VisdomLogger(BaseVisdomLogger):
913 '''
914 A generic Visdom class that works with the majority of Visdom plot types.
915 '''
916
917 def __init__(self, plot_type, fields=None, win=None, env=None, opts={}, port=8097, server="localhost"):
918 '''
919 Args:
920 fields: Currently unused
921 plot_type: The name of the plot type, in Visdom
922
923 Examples:
924 >>> # Image example
925 >>> img_to_use = skimage.data.coffee().swapaxes(0,2).swapaxes(1,2)
926 >>> image_logger = VisdomLogger('image')
927 >>> image_logger.log(img_to_use)
928
929 >>> # Histogram example
930 >>> hist_data = np.random.rand(10000)
931 >>> hist_logger = VisdomLogger('histogram', , opts=dict(title='Random!', numbins=20))
932 >>> hist_logger.log(hist_data)
933 '''
934 super(VisdomLogger, self).__init__(fields, win, env, opts, port, server)
935 self.plot_type = plot_type
936 self.chart = getattr(self.viz, plot_type)
937 self.viz_logger = self._viz_prototype(self.chart)
938
939 def log(self, *args, **kwargs):
940 self.viz_logger(*args, **kwargs)
941
942
943

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected