当前位置: 首页>>代码示例>>Python>>正文


Python visdom.Visdom方法代码示例

本文整理汇总了Python中visdom.Visdom方法的典型用法代码示例。如果您正苦于以下问题:Python visdom.Visdom方法的具体用法?Python visdom.Visdom怎么用?Python visdom.Visdom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在visdom的用法示例。


在下文中一共展示了visdom.Visdom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(
        self,
        viz=None,
        loss_window=None,
        loss_window_rolling=None,
        prediction_2d=None,
        layer_window_01=None,
        layer_window_02=None,
        weight_window_01=None,
        weight_window_02=None,
    ):
        if viz is None:
            self.viz = Visdom()
        else:
            self.viz = viz
        self.loss_window = loss_window
        self.loss_window_rolling = loss_window_rolling
        self.prediction_2d = prediction_2d
        self.layer_window_01 = layer_window_01
        self.layer_window_02 = layer_window_02
        self.weight_window_01 = weight_window_01
        self.weight_window_02 = weight_window_02 
开发者ID:uptake,项目名称:numpynet,代码行数:24,代码来源:visualize.py

示例2: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, plot_type, fields=None, win=None, env=None, opts={}):
        '''
            Args:
                fields: Currently unused
                plot_type: The name of the plot type, in Visdom
            Examples:
                >>> # Image example
                >>> img_to_use = skimage.data.coffee().swapaxes(0,2).swapaxes(1,2)
                >>> image_logger = VisdomLogger('image')
                >>> image_logger.log(img_to_use)
                >>> # Histogram example
                >>> hist_data = np.random.rand(10000)
                >>> hist_logger = VisdomLogger('histogram', , opts=dict(title='Random!', numbins=20))
                >>> hist_logger.log(hist_data)
        '''
        super(VisdomLogger, self).__init__(fields, win, env, opts)
        self.plot_type = plot_type
        self.chart = getattr(self.viz, plot_type)
        self.viz_logger = self._viz_prototype(self.chart) 
开发者ID:tonysy,项目名称:Deep-Feature-Flow-Segmentation,代码行数:21,代码来源:visdomlogger.py

示例3: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, args):
        self.args = args
        # ------------------------------------------------Dataset---------------------------------------------- #
        self.data = BenchmarkDataset(root=args.dataset_path, npoints=args.point_num, uniform=True, class_choice=args.class_choice)
        self.dataLoader = torch.utils.data.DataLoader(self.data, batch_size=args.batch_size, shuffle=True, pin_memory=True, num_workers=4)
        print("Training Dataset : {} prepared.".format(len(self.data)))
        # ----------------------------------------------------------------------------------------------------- #

        # -------------------------------------------------Module---------------------------------------------- #
        self.G = Generator(batch_size=args.batch_size, features=args.G_FEAT, degrees=args.DEGREE, support=args.support).to(args.device)
        self.D = Discriminator(batch_size=args.batch_size, features=args.D_FEAT).to(args.device)             
        
        self.optimizerG = optim.Adam(self.G.parameters(), lr=args.lr, betas=(0, 0.99))
        self.optimizerD = optim.Adam(self.D.parameters(), lr=args.lr, betas=(0, 0.99))

        self.GP = GradientPenalty(args.lambdaGP, gamma=1, device=args.device)
        print("Network prepared.")
        # ----------------------------------------------------------------------------------------------------- #

        # ---------------------------------------------Visualization------------------------------------------- #
        self.vis = visdom.Visdom(port=args.visdom_port)
        assert self.vis.check_connection()
        print("Visdom connected.")
        # ----------------------------------------------------------------------------------------------------- # 
开发者ID:seowok,项目名称:TreeGAN,代码行数:26,代码来源:train.py

示例4: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, visdom_port=None, log_dir=None, use_nsml=False):
        self.use_nsml = use_nsml
        if use_nsml:
            self.vis = nsml.Visdom(visdom=visdom)
            self.last = None #python -m visdom.server
        elif VISDOM and visdom_port:
            self.vis = visdom.Visdom(port=visdom_port)
            if not self.vis.check_connection():
                print('No visdom server found on port {}. set visdom_port = None'.format(visdom_port))
                self.vis = None
        else:
            self.vis = None
        self.use_visdom = use_nsml or visdom_port
        self.use_tensorboard = True if TENSORBOARD and log_dir is not None else False

        if not use_nsml and self.use_tensorboard:
            self.writer = tf.summary.FileWriter(log_dir) 
开发者ID:clovaai,项目名称:ext_portrait_segmentation,代码行数:19,代码来源:Tensor_logger.py

示例5: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, opt):
        self.opt = opt
        self.display_id = opt.display_id
        self.use_html = opt.isTrain
        self.win_size = opt.display_winsize
        self.name = opt.name
        if self.display_id > 0:
            import visdom
            self.vis = visdom.Visdom(port = opt.display_port, env=opt.name)
            self.display_single_pane_ncols = opt.display_single_pane_ncols

        if self.use_html:
            self.web_dir = os.path.join(opt.checkpoints_dir, opt.name, 'web')
            self.img_dir = os.path.join(self.web_dir, 'images')
            print('create web directory %s...' % self.web_dir)
            util.mkdirs([self.web_dir, self.img_dir])
            self.log_name = os.path.join(opt.checkpoints_dir, opt.name, 'loss_log.txt')
            with open(self.log_name, "a") as log_file:
                now = time.strftime("%c")
                log_file.write('================ Training Loss (%s) ================\n' % now)

    # |visuals|: dictionary of images to display or save 
开发者ID:Hangz-nju-cuhk,项目名称:Talking-Face-Generation-DAVS,代码行数:24,代码来源:visualizer.py

示例6: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, opt):
        # self.opt = opt
        self.display_id = opt.display_id
        self.use_html = opt.isTrain and not opt.no_html
        self.win_size = opt.display_winsize
        self.name = opt.name
        self.opt = opt
        self.saved = False
        if self.display_id > 0:
            import visdom
            self.vis = visdom.Visdom(port=opt.display_port)

        if self.use_html:
            self.web_dir = os.path.join(opt.checkpoints_dir, opt.name, 'web')
            self.img_dir = os.path.join(self.web_dir, 'images')
            print('create web directory %s...' % self.web_dir)
            util.mkdirs([self.web_dir, self.img_dir])
        self.log_name = os.path.join(opt.checkpoints_dir, opt.name, 'loss_log.txt')
        with open(self.log_name, "a") as log_file:
            now = time.strftime("%c")
            log_file.write('================ Training Loss (%s) ================\n' % now) 
开发者ID:aayushbansal,项目名称:Recycle-GAN,代码行数:23,代码来源:visualizer.py

示例7: get_writer

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def get_writer(self, log_dir=None, visdom=False, visdom_params=None):
        """
        Get a SummaryWriter for the given directory (or the default writer if the directory is not given).
        If you are getting a `SummaryWriter` for a custom directory, it is your responsibility to close
        it using `close_writer`.

        Args:
            log_dir (str): the (optional) directory
            visdom (bool): If true, return VisdomWriter, if false return tensorboard SummaryWriter
            visdom_params (VisdomParams): Visdom parameter settings object, uses default if None

        Returns:
            the `SummaryWriter` or `VisdomWriter`
        """
        if log_dir is None:
            self.writer = get_writer(self.log_dir, self, visdom=visdom, visdom_params=visdom_params)
            return self.writer
        else:
            return get_writer(log_dir, self, visdom=visdom, visdom_params=visdom_params) 
开发者ID:pytorchbearer,项目名称:torchbearer,代码行数:21,代码来源:tensor_board.py

示例8: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, plot_type, fields=None, win=None, env=None, opts={}, port=8097, server="localhost"):
        '''
            Args:
                fields: Currently unused
                plot_type: The name of the plot type, in Visdom

            Examples:
                >>> # Image example
                >>> img_to_use = skimage.data.coffee().swapaxes(0,2).swapaxes(1,2)
                >>> image_logger = VisdomLogger('image')
                >>> image_logger.log(img_to_use)

                >>> # Histogram example
                >>> hist_data = np.random.rand(10000)
                >>> hist_logger = VisdomLogger('histogram', , opts=dict(title='Random!', numbins=20))
                >>> hist_logger.log(hist_data)
        '''
        super(VisdomLogger, self).__init__(fields, win, env, opts, port, server)
        self.plot_type = plot_type
        self.chart = getattr(self.viz, plot_type)
        self.viz_logger = self._viz_prototype(self.chart) 
开发者ID:pytorch,项目名称:tnt,代码行数:23,代码来源:visdomlogger.py

示例9: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, env_name, file_path, device):
        self._file_path = file_path
        self.device = device
        self._env_name = env_name
        self._target_dir = check_path(self._file_path, True)
        self._env_path = check_path(self.device['web_env_dir'], True)
        self._env_dir = self._env_path / (self._env_name + '.json')

        self._win_box = {}

        from visdom import Visdom

        self._viz = Visdom(port=self.device['web_port'], env=self._env_name, server=self.device['web_host'],
                           raise_exceptions=True)

        self._mode = None
        self._flush_epoch = 5
        self._flush_id = 0 
开发者ID:yolomax,项目名称:person-reid-lib,代码行数:20,代码来源:torch_visdom.py

示例10: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(
        self, server: str, port: str, env: str = "main", title_suffix: str = ""
    ) -> None:
        """
        Args:
            server: host name of the visdom server
            port: port of visdom server, such as 8097
            env: environment of visdom
            title_suffix: suffix that will be appended to the title
        """
        super().__init__()
        if not visdom_available:
            raise RuntimeError("Visdom is not installed, cannot use VisdomHook")

        self.server: str = server
        self.port: str = port
        self.env: str = env
        self.title_suffix: str = title_suffix

        self.metrics: Dict = {}
        self.visdom: Visdom = Visdom(self.server, self.port) 
开发者ID:facebookresearch,项目名称:ClassyVision,代码行数:23,代码来源:visdom_hook.py

示例11: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, server='http://localhost', env='main', contour_layout=None):
        super(VisPlotter, self).__init__()
        self.vis = visdom.Visdom(server=server, env=env)

        self.color_list = ['Jet', 'RdBu']

        if contour_layout:
            self.contour_confg = dict(colorscale='Jet',
                                      type=u'contour',
                                      contours=dict(coloring='lines'),
                                      **contour_layout)
        else:
             self.contour_confg = dict(colorscale='Jet',
                                       type=u'contour',
                                       contours=dict(coloring='lines'))

        self.contour_layout = dict(xaxis={'title': 'z1'},
                                   yaxis={'title': 'z2'}) 
开发者ID:jxhe,项目名称:vae-lagging-encoder,代码行数:20,代码来源:plotter.py

示例12: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, opt):
        # self.opt = opt
        self.display_id = opt.display_id
        self.use_html = opt.isTrain and not opt.no_html
        self.win_size = opt.display_winsize
        self.name = opt.name
        if self.display_id > 0:
            import visdom
            self.vis = visdom.Visdom()

        if self.use_html:
            self.web_dir = os.path.join(opt.checkpoints_dir, opt.name, 'web')
            self.img_dir = os.path.join(self.web_dir, 'images')
            print('create web directory %s...' % self.web_dir)
            util.mkdirs([self.web_dir, self.img_dir])


    # |visuals|: dictionary of images to display or save 
开发者ID:zhengqili,项目名称:MegaDepth,代码行数:20,代码来源:visualizer.py

示例13: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, opt):
        # self.opt = opt
        self.display_id = opt.display_id
        self.use_html = opt.is_train and not opt.no_html
        self.win_size = opt.display_winsize
        self.name = opt.exp_name
        self.log_path = os.path.join(opt.expr_dir, 'train_log.txt')

        if self.display_id > 0:
            import visdom
            self.vis = visdom.Visdom(port=opt.display_port,
                                     env=opt.exp_name)

        if self.use_html:
            self.web_dir = os.path.join(opt.expr_dir,'web')
            self.img_dir = os.path.join(self.web_dir, 'images')
            print('create web directory %s...' % self.web_dir)
            util.mkdirs([self.web_dir, self.img_dir])

    # |visuals|: dictionary of images to display or save 
开发者ID:Xiaoming-Yu,项目名称:DMIT,代码行数:22,代码来源:visualizer.py

示例14: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, opt):
        # self.opt = opt
        self.display_id = opt.display_id
        self.use_html = 0
        self.win_size = opt.display_winsize
        self.name = opt.name
        if self.display_id > 0:
            import visdom
            self.vis = visdom.Visdom(env='%d' % self.display_id)

        if self.use_html:
            self.web_dir = os.path.join(opt.checkpoints_dir, opt.name, 'web')
            self.img_dir = os.path.join(self.web_dir, 'images')
            print('create web directory %s...' % self.web_dir)
            util.mkdirs([self.web_dir, self.img_dir])


    # |visuals|: dictionary of images to display or save 
开发者ID:lijx10,项目名称:USIP,代码行数:20,代码来源:visualizer.py

示例15: __init__

# 需要导入模块: import visdom [as 别名]
# 或者: from visdom import Visdom [as 别名]
def __init__(self, opt):
        self.opt = opt
        self.name = opt.exp_id
        self.use_visdom = opt.use_visdom
        self.use_html = opt.use_html
        self.win_size = opt.display_winsize
        self.log_name = ''
        if self.use_visdom:
            import visdom
            self.vis = visdom.Visdom(env=opt.vis_env)

        if self.use_html:
            self.web_dir = os.path.join(opt.exp_dir, 'web')
            self.img_dir = os.path.join(self.web_dir, 'images')
            print('=> create web directory %s...' % self.web_dir)
            util.mkdirs([self.web_dir, self.img_dir]) 
开发者ID:zhiqiangdon,项目名称:CU-Net,代码行数:18,代码来源:visualizer.py


注:本文中的visdom.Visdom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。