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


Python log.infov方法代码示例

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


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

示例1: log_step_message

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def log_step_message(self, step, accuracy, d_loss, g_loss, 
                         s_loss, step_time, is_train=True):
        if step_time == 0: step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Supervised loss: {s_loss:.5f} " +
                "D loss: {d_loss:.5f} " +
                "G loss: {g_loss:.5f} " +
                "Accuracy: {accuracy:.5f} "
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step = step,
                         d_loss = d_loss,
                         g_loss = g_loss,
                         s_loss = s_loss,
                         accuracy = accuracy,
                         sec_per_batch = step_time,
                         instance_per_sec = self.batch_size / step_time
                         )
               ) 
开发者ID:clvrai,项目名称:SSGAN-Tensorflow,代码行数:22,代码来源:trainer.py

示例2: log_step_message

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def log_step_message(self, step, loss, loss_g_update,
                         loss_z_update, step_time, is_train=True):
        if step_time == 0:
            step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss: {loss:.5f} " +
                "G update: {loss_g_update:.5f} " +
                "Z update: {loss_z_update:.5f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         loss=loss,
                         loss_z_update=loss_z_update,
                         loss_g_update=loss_g_update,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time
                         )
               ) 
开发者ID:clvrai,项目名称:Generative-Latent-Optimization-Tensorflow,代码行数:21,代码来源:trainer.py

示例3: train

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def train(self, dataset):
        log.infov("Training Starts!")
        pprint(self.batch_train)

        max_steps = 2500000

        output_save_step = 1000

        for s in xrange(max_steps):
            step, summary, loss, loss_pair, loss_unpair, step_time = \
                self.run_single_step(self.batch_train, dataset, step=s, is_train=True)

            if s % 10 == 0:
                self.log_step_message(step, loss, loss_pair, loss_unpair, step_time)
                self.summary_writer.add_summary(summary, global_step=step)

            if s % output_save_step == 0:
                log.infov("Saved checkpoint at %d", s)
                save_path = self.saver.save(self.session,
                                            os.path.join(self.train_dir, 'model'),
                                            global_step=step) 
开发者ID:clvrai,项目名称:Representation-Learning-by-Learning-to-Count,代码行数:23,代码来源:trainer.py

示例4: log_step_message

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def log_step_message(self, step, loss, loss_pair,
                         loss_unpair, step_time, is_train=True):
        if step_time == 0:
            step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss: {loss:.5f} " +
                "Loss pair: {loss_pair:.5f} " +
                "Loss unpair: {loss_unpair:.5f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         loss=loss,
                         loss_pair=loss_pair,
                         loss_unpair=loss_unpair,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time
                         )
               ) 
开发者ID:clvrai,项目名称:Representation-Learning-by-Learning-to-Count,代码行数:21,代码来源:trainer.py

示例5: log_step_message

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def log_step_message(self, step, p_loss, f_loss, loss, step_time, is_train=True):
        if step_time == 0: step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss: {loss:.5f} " +
                "Pixel loss: {p_loss:.5f} " +
                "Flow loss: {f_loss:.5f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         loss=loss,
                         p_loss=p_loss,
                         f_loss=f_loss,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time
                         )
               ) 
开发者ID:shaohua0116,项目名称:Multiview2Novelview,代码行数:19,代码来源:trainer.py

示例6: log_step_message

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def log_step_message(self, step, accuracy, accuracy_test, loss, step_time, is_train=True):
        if step_time == 0: step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss: {loss:.5f} " +
                "Accuracy test: {accuracy:.2f} "
                "Accuracy test: {accuracy_test:.2f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step = step,
                         loss = loss,
                         accuracy = accuracy*100,
                         accuracy_test = accuracy_test*100,
                         sec_per_batch = step_time,
                         instance_per_sec = self.batch_size / step_time
                         )
               ) 
开发者ID:shaohua0116,项目名称:Activation-Visualization-Histogram,代码行数:19,代码来源:trainer.py

示例7: train

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def train(self):
        log.infov("Training Starts!")
        pprint(self.batch_train)

        max_steps = 100000

        output_save_step = 1000

        for s in xrange(max_steps):
            step, summary, d_loss, g_loss, step_time, prediction_train, gt_train = \
                self.run_single_step(self.batch_train, step=s, is_train=True)

            if s % 10 == 0:
                self.log_step_message(step, d_loss, g_loss, step_time)

            self.summary_writer.add_summary(summary, global_step=step)

            if s % output_save_step == 0:
                log.infov("Saved checkpoint at %d", s)
                save_path = self.saver.save(self.session, os.path.join(self.train_dir, 'model'), global_step=step)
                f = h5py.File(os.path.join(self.train_dir, 'generated_'+str(s)+'.hy'), 'w')
                f['image'] = prediction_train
                f.close() 
开发者ID:shaohua0116,项目名称:DCGAN-Tensorflow,代码行数:25,代码来源:trainer.py

示例8: dump_result

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def dump_result(self, filename):
        log.infov("Dumping results into %s ...", filename)
        f = h5py.File(filename, 'w')

        merge_output_list = defaultdict(list)
        for d in tuple(self._output):
            for key in d.keys():
                merge_output_list[key].append(d[key])

        output_list = {}
        for key in merge_output_list.keys():
            stacked_output = np.stack(merge_output_list[key])
            stacked_output = np.reshape(
                    stacked_output,
                    [np.prod(stacked_output.shape[:2])] +
                    list(stacked_output.shape[2:]))
            f[key] = stacked_output
        log.info("Dumping resultsn done.") 
开发者ID:shaohua0116,项目名称:WGAN-GP-TensorFlow,代码行数:20,代码来源:evaler.py

示例9: train

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def train(self):
        log.infov("Training Starts!")
        pprint(self.batch_train)
        step = self.session.run(self.global_step)

        for s in xrange(self.config.max_training_steps):

            if s % self.config.ckpt_save_step == 0:
                log.infov("Saved checkpoint at %d", s)
                self.saver.save(self.session, os.path.join(
                    self.train_dir, 'model'), global_step=s)

            step, summary, d_loss, g_loss, step_time = \
                self.run_single_step(self.batch_train, step=s, is_train=True)

            if s % self.config.log_step == 0:
                self.log_step_message(step, d_loss, g_loss, step_time)

            if s % self.config.write_summary_step == 0:
                self.summary_writer.add_summary(summary, global_step=step) 
开发者ID:shaohua0116,项目名称:WGAN-GP-TensorFlow,代码行数:22,代码来源:trainer.py

示例10: report

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def report(self):
        # report L2 loss
        log.info("Computing scores...")
        score = {}
        score = []

        for id, pred, gt in zip(self._ids, self._predictions, self._groundtruths):
            score.append(self.compute_accuracy(pred, gt))
        avg = np.average(score)
        log.infov("Average accuracy : %.4f", avg*100) 
开发者ID:clvrai,项目名称:SSGAN-Tensorflow,代码行数:12,代码来源:evaler.py

示例11: eval_run

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def eval_run(self):
        # load checkpoint
        if self.checkpoint:
            self.saver.restore(self.session, self.checkpoint)
            log.info("Loaded from checkpoint!")

        log.infov("Start 1-epoch Inference and Evaluation")

        log.info("# of examples = %d", len(self.dataset))
        length_dataset = len(self.dataset)

        max_steps = int(length_dataset / self.batch_size) + 1
        log.info("max_steps = %d", max_steps)

        coord = tf.train.Coordinator()
        threads = tf.train.start_queue_runners(self.session,
                                               coord=coord, start=True)

        evaler = EvalManager()
        try:
            for s in xrange(max_steps):
                step, loss, step_time, batch_chunk, prediction_pred, prediction_gt = \
                    self.run_single_step(self.batch)
                self.log_step_message(s, loss, step_time)
                evaler.add_batch(batch_chunk['id'], prediction_pred, prediction_gt)

        except Exception as e:
            coord.request_stop(e)

        coord.request_stop()
        try:
            coord.join(threads, stop_grace_period_secs=3)
        except RuntimeError as e:
            log.warn(str(e))

        evaler.report()
        log.infov("Evaluation complete.") 
开发者ID:clvrai,项目名称:SSGAN-Tensorflow,代码行数:39,代码来源:evaler.py

示例12: log_step_message

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def log_step_message(self, step, accuracy, step_time, is_train=False):
        if step_time == 0: step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "batch total-accuracy (test): {test_accuracy:.2f}% " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         test_accuracy=accuracy*100,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time,
                         )
               ) 
开发者ID:clvrai,项目名称:SSGAN-Tensorflow,代码行数:15,代码来源:evaler.py

示例13: train

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def train(self):
        log.infov("Training Starts!")
        pprint(self.batch_train)
        step = self.session.run(self.global_step)

        for s in xrange(self.config.max_training_steps):

            # periodic inference
            if s % self.config.test_sample_step == 0:
                accuracy, d_loss, g_loss, s_loss, step_time = \
                    self.run_test(self.batch_test, is_train=False)
                self.log_step_message(step, accuracy, d_loss, g_loss,
                                      s_loss, step_time, is_train=False)
           
            step, accuracy, summary, d_loss, g_loss, s_loss, step_time, prediction_train, gt_train, g_img = \
                self.run_single_step(self.batch_train, step=s)

            if s % self.config.log_step == 0:
                self.log_step_message(step, accuracy,  d_loss, g_loss, s_loss, step_time)

            if s % self.config.write_summary_step == 0:
                self.summary_writer.add_summary(summary, global_step=step)

            if s % self.config.output_save_step == 0:
                log.infov("Saved checkpoint at %d", step)
                save_path = self.saver.save(self.session, os.path.join(self.train_dir, 'model'), global_step=step)
                if self.config.dump_result:
                    f = h5py.File(os.path.join(self.train_dir, 'g_img_'+str(s)+'.hdf5'), 'w')
                    f['image'] = g_img
                    f.close() 
开发者ID:clvrai,项目名称:SSGAN-Tensorflow,代码行数:32,代码来源:trainer.py

示例14: report

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def report(self):
        log.info("Computing scores...")
        total_loss = []

        for id, pred, gt in zip(self._ids, self._predictions, self._groundtruths):
            total_loss.append(self.compute_loss(pred, gt))
        avg_loss = np.average(total_loss)
        log.infov("Average loss : %.4f", avg_loss) 
开发者ID:clvrai,项目名称:Generative-Latent-Optimization-Tensorflow,代码行数:10,代码来源:evaler.py

示例15: log_step_message

# 需要导入模块: from util import log [as 别名]
# 或者: from util.log import infov [as 别名]
def log_step_message(self, step, loss, step_time, is_train=False):
        if step_time == 0: step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss (test): {loss:.5f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         loss=loss,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time,
                         )
               ) 
开发者ID:clvrai,项目名称:Generative-Latent-Optimization-Tensorflow,代码行数:15,代码来源:evaler.py


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