[英]How can we find Python layer log message in Caffe library?
Caffe庫支持自定義Python層。 為了調試該層,一種解決方案是在日志文件中輸出一些內部變量,這是我所做的:
class MyLayer(caffe.Layer):
def setup(self,bottom, top):
import logging
logging.info("hello the world")
在示例中,我想向日志文件中寫入一些字符串“ hello the world”。
定義Python層后,我們可以使用“咖啡訓練”程序啟動訓練。 但是,我在Caffe日志文件中找不到Python層日志信息(在Unbuntu中,它位於/tmp/caffe_username.log.INFO_date)。 有任何想法嗎? 謝謝。
我相信您應該像其他Caffe一樣使用Google日志記錄glog
庫。 看這個例子 :
import glog
#Simple L1 loss layer
class L1LossLayer(caffe.Layer):
...
def forward(self, bottom, top):
top[0].data[...] = ...
glog.info('Loss is %f' % top[0].data[0])
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.