首页 > 编程知识 正文

日志消息级别,手机日志消息采集是什么

时间:2023-05-05 04:59:36 阅读:271856 作者:3300

在tensorflow中有函数可以直接log打印,这个跟ROS系统中打印函数差不多。

TensorFlow使用五个不同级别的日志消息。 按照上升的顺序,它们是DEBUG,INFO,WARN,ERROR和FATAL。 当您在任何这些级别配置日志记录时,TensorFlow将输出与该级别相对应的所有日志消息以及所有级别的严重级别。 例如,如果设置了ERROR的日志记录级别,则会收到包含ERROR和FATAL消息的日志输出,如果设置了一个DEBUG级别,则会从所有五个级别获取日志消息。 # 默认情况下,TENSFlow在WARN的日志记录级别进行配置,但是在跟踪模型训练时,您需要将级别调整为INFO,这将提供适合操作正在进行的其他反馈。

下面给出例子:

from __future__ import print_functionimport tensorflow as tffrom preprocessing import preprocessing_factoryimport readerimport modelimport timeimport ostf.app.flags.DEFINE_string('loss_model', 'vgg_16', 'The name of the architecture to evaluate. ' 'You can view all the support models in nets/nets_factory.py')tf.app.flags.DEFINE_integer('image_size', 256, 'Image size to train.')tf.app.flags.DEFINE_string("model_file", "models.ckpt", "")tf.app.flags.DEFINE_string("image_file", "a.jpg", "")FLAGS = tf.app.flags.FLAGSdef main(_): # Get image's height and width. height = 0 width = 0 with open(FLAGS.image_file, 'rb') as img: with tf.Session().as_default() as sess: if FLAGS.image_file.lower().endswith('png'): image = sess.run(tf.image.decode_png(img.read())) else: image = sess.run(tf.image.decode_jpeg(img.read())) height = image.shape[0] width = image.shape[1] tf.logging.info('Image size: %dx%d' % (width, height))if __name__=='__main__': print("caoakfa") tf.logging.set_verbosity(tf.logging.INFO) tf.app.run()

运行结果为:



版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。