diff --git a/python/caffe/__init__.py b/python/caffe/__init__.py index fbe7112e868..74caf3fc802 100644 --- a/python/caffe/__init__.py +++ b/python/caffe/__init__.py @@ -1,6 +1,19 @@ +# Suppress GLOG output for python bindings +# unless explicitly requested in environment +import os +if 'GLOG_minloglevel' not in os.environ: + # Hide INFO and WARNING, show ERROR and FATAL + os.environ['GLOG_minloglevel'] = '2' + _unset_glog_level = True +else: + _unset_glog_level = False + from .pycaffe import Net, SGDSolver from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver from .proto.caffe_pb2 import TRAIN, TEST from .classifier import Classifier from .detector import Detector from . import io + +if _unset_glog_level: + del os.environ['GLOG_minloglevel']