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