Python tensorboard.FileWriter() Examples
The following are 13
code examples of tensorboard.FileWriter().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorboard
, or try the search function
.
Example #1
Source File: trainer.py From StackGAN-Pytorch with MIT License | 6 votes |
def __init__(self, output_dir): if cfg.TRAIN.FLAG: self.model_dir = os.path.join(output_dir, 'Model') self.image_dir = os.path.join(output_dir, 'Image') self.log_dir = os.path.join(output_dir, 'Log') mkdir_p(self.model_dir) mkdir_p(self.image_dir) mkdir_p(self.log_dir) self.summary_writer = FileWriter(self.log_dir) self.max_epoch = cfg.TRAIN.MAX_EPOCH self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL s_gpus = cfg.GPU_ID.split(',') self.gpus = [int(ix) for ix in s_gpus] self.num_gpus = len(self.gpus) self.batch_size = cfg.TRAIN.BATCH_SIZE * self.num_gpus torch.cuda.set_device(self.gpus[0]) cudnn.benchmark = True # ############# For training stageI GAN #############
Example #2
Source File: trainer.py From multiple-objects-gan with MIT License | 6 votes |
def __init__(self, output_dir): if cfg.TRAIN.FLAG: self.model_dir = os.path.join(output_dir, 'Model') self.image_dir = os.path.join(output_dir, 'Image') self.log_dir = os.path.join(output_dir, 'Log') mkdir_p(self.model_dir) mkdir_p(self.image_dir) mkdir_p(self.log_dir) self.summary_writer = FileWriter(self.log_dir) self.max_epoch = cfg.TRAIN.MAX_EPOCH self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL self.max_objects = 4 s_gpus = cfg.GPU_ID.split(',') self.gpus = [int(ix) for ix in s_gpus] self.num_gpus = len(self.gpus) self.batch_size = cfg.TRAIN.BATCH_SIZE torch.cuda.set_device(self.gpus[0]) cudnn.benchmark = True # ############# For training stageI GAN #############
Example #3
Source File: trainer.py From multiple-objects-gan with MIT License | 6 votes |
def __init__(self, output_dir): if cfg.TRAIN.FLAG: self.model_dir = os.path.join(output_dir, 'Model') self.image_dir = os.path.join(output_dir, 'Image') self.log_dir = os.path.join(output_dir, 'Log') mkdir_p(self.model_dir) mkdir_p(self.image_dir) mkdir_p(self.log_dir) self.summary_writer = FileWriter(self.log_dir) self.max_epoch = cfg.TRAIN.MAX_EPOCH self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL self.max_objects = 3 s_gpus = cfg.GPU_ID.split(',') self.gpus = [int(ix) for ix in s_gpus] self.num_gpus = len(self.gpus) self.batch_size = cfg.TRAIN.BATCH_SIZE torch.cuda.set_device(self.gpus[0]) cudnn.benchmark = True # ############# For training stageI GAN #############
Example #4
Source File: trainer.py From multiple-objects-gan with MIT License | 6 votes |
def __init__(self, output_dir): if cfg.TRAIN.FLAG: self.model_dir = os.path.join(output_dir, 'Model') self.image_dir = os.path.join(output_dir, 'Image') self.log_dir = os.path.join(output_dir, 'Log') mkdir_p(self.model_dir) mkdir_p(self.image_dir) mkdir_p(self.log_dir) self.summary_writer = FileWriter(self.log_dir) self.max_epoch = cfg.TRAIN.MAX_EPOCH self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL s_gpus = cfg.GPU_ID.split(',') self.gpus = [int(ix) for ix in s_gpus] self.num_gpus = len(self.gpus) self.batch_size = cfg.TRAIN.BATCH_SIZE torch.cuda.set_device(self.gpus[0]) cudnn.benchmark = True # ############# For training stageI GAN #############
Example #5
Source File: blah.py From Recipe2ImageGAN with MIT License | 6 votes |
def __init__(self, output_dir, data_loader, imsize): if cfg.TRAIN.FLAG: self.model_dir = os.path.join(output_dir, 'Model') self.image_dir = os.path.join(output_dir, 'Image') self.log_dir = os.path.join(output_dir, 'Log') mkdir_p(self.model_dir) mkdir_p(self.image_dir) mkdir_p(self.log_dir) self.summary_writer = FileWriter(self.log_dir) s_gpus = cfg.GPU_ID.split(',') self.gpus = [int(ix) for ix in s_gpus] self.num_gpus = len(self.gpus) torch.cuda.set_device(self.gpus[0]) cudnn.benchmark = True self.batch_size = cfg.TRAIN.BATCH_SIZE * self.num_gpus self.max_epoch = cfg.TRAIN.MAX_EPOCH self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL self.data_loader = data_loader self.num_batches = len(self.data_loader)
Example #6
Source File: blah.py From Recipe2ImageGAN with MIT License | 6 votes |
def __init__(self, output_dir, data_loader, imsize): if cfg.TRAIN.FLAG: self.model_dir = os.path.join(output_dir, 'Model') self.image_dir = os.path.join(output_dir, 'Image') self.log_dir = os.path.join(output_dir, 'Log') mkdir_p(self.model_dir) mkdir_p(self.image_dir) mkdir_p(self.log_dir) self.summary_writer = FileWriter(self.log_dir) s_gpus = cfg.GPU_ID.split(',') self.gpus = [int(ix) for ix in s_gpus] self.num_gpus = len(self.gpus) torch.cuda.set_device(self.gpus[0]) cudnn.benchmark = True self.batch_size = cfg.TRAIN.BATCH_SIZE * self.num_gpus self.max_epoch = cfg.TRAIN.MAX_EPOCH self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL self.data_loader = data_loader self.num_batches = len(self.data_loader)
Example #7
Source File: test_logging.py From tensorboard with Apache License 2.0 | 6 votes |
def test_event_logging(): logdir = './experiment/' summary_writer = FileWriter(logdir) scalar_value = 1.0 s = scalar('test_scalar', scalar_value) summary_writer.add_summary(s, global_step=1) summary_writer.close() assert os.path.isdir(logdir) assert len(os.listdir(logdir)) == 1 summary_writer = FileWriter(logdir) scalar_value = 1.0 s = scalar('test_scalar', scalar_value) summary_writer.add_summary(s, global_step=1) summary_writer.close() assert os.path.isdir(logdir) assert len(os.listdir(logdir)) == 2 # clean up. shutil.rmtree(logdir)
Example #8
Source File: trainer.py From StackGAN-v2 with MIT License | 6 votes |
def __init__(self, output_dir, data_loader, imsize): if cfg.TRAIN.FLAG: self.model_dir = os.path.join(output_dir, 'Model') self.image_dir = os.path.join(output_dir, 'Image') self.log_dir = os.path.join(output_dir, 'Log') mkdir_p(self.model_dir) mkdir_p(self.image_dir) mkdir_p(self.log_dir) self.summary_writer = FileWriter(self.log_dir) s_gpus = cfg.GPU_ID.split(',') self.gpus = [int(ix) for ix in s_gpus] self.num_gpus = len(self.gpus) torch.cuda.set_device(self.gpus[0]) cudnn.benchmark = True self.batch_size = cfg.TRAIN.BATCH_SIZE * self.num_gpus self.max_epoch = cfg.TRAIN.MAX_EPOCH self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL self.data_loader = data_loader self.num_batches = len(self.data_loader)
Example #9
Source File: trainer.py From StackGAN-v2 with MIT License | 6 votes |
def __init__(self, output_dir, data_loader, imsize): if cfg.TRAIN.FLAG: self.model_dir = os.path.join(output_dir, 'Model') self.image_dir = os.path.join(output_dir, 'Image') self.log_dir = os.path.join(output_dir, 'Log') mkdir_p(self.model_dir) mkdir_p(self.image_dir) mkdir_p(self.log_dir) self.summary_writer = FileWriter(self.log_dir) s_gpus = cfg.GPU_ID.split(',') self.gpus = [int(ix) for ix in s_gpus] self.num_gpus = len(self.gpus) torch.cuda.set_device(self.gpus[0]) cudnn.benchmark = True self.batch_size = cfg.TRAIN.BATCH_SIZE * self.num_gpus self.max_epoch = cfg.TRAIN.MAX_EPOCH self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL self.data_loader = data_loader self.num_batches = len(self.data_loader)
Example #10
Source File: Logger.py From DeeperInverseCompositionalAlgorithm with MIT License | 5 votes |
def __init__(self, logging_dir, logfile_name, print_freq = 10): self.log_dir = logging_dir self.print_freq = print_freq if not os.path.isdir(logging_dir): os.makedirs(logging_dir) self.summary_writer = tensorboard.FileWriter(logdir=logging_dir) # standard logger to print to terminal logfile = osp.join(logging_dir,'log.txt') stdout = Logger(logfile) sys.stdout = stdout
Example #11
Source File: test_scalar.py From tensorboard with Apache License 2.0 | 5 votes |
def test_log_scalar_summary(): logdir = './experiment/scalar' writer = FileWriter(logdir) for i in range(10): s = scalar('scalar', i) writer.add_summary(s, i+1) writer.flush() writer.close()
Example #12
Source File: test_histogram.py From tensorboard with Apache License 2.0 | 5 votes |
def test_log_histogram_summary(): logdir = './experiment/histogram' writer = FileWriter(logdir) for i in range(10): mu, sigma = i * 0.1, 1.0 values = np.random.normal(mu, sigma, 10000) # larger for better looking. hist = summary.histogram('discrete_normal', values) writer.add_summary(hist, i+1) writer.flush() writer.close()
Example #13
Source File: test_image.py From tensorboard with Apache License 2.0 | 5 votes |
def test_log_image_summary(): logdir = './experiment/image' writer = FileWriter(logdir) path = 'http://yann.lecun.com/exdb/mnist/' (train_lbl, train_img) = read_data( path+'train-labels-idx1-ubyte.gz', path+'train-images-idx3-ubyte.gz') for i in range(10): tensor = np.reshape(train_img[i], (28, 28, 1)) im = summary.image('mnist/'+str(i), tensor) # in this case, images are grouped under `mnist` tag. writer.add_summary(im, i+1) writer.flush() writer.close()