當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。