create_logger.py
Go to the documentation of this file.
00001 # --------------------------------------------------------
00002 # Deformable Convolutional Networks
00003 # Copyright (c) 2017 Microsoft
00004 # Licensed under The Apache-2.0 License [see LICENSE for details]
00005 # Written by Bin Xiao
00006 # --------------------------------------------------------
00007 
00008 import os
00009 import logging
00010 import time
00011 
00012 def create_logger(root_output_path, cfg, image_set):
00013     # set up logger
00014     if not os.path.exists(root_output_path):
00015         os.makedirs(root_output_path)
00016     assert os.path.exists(root_output_path), '{} does not exist'.format(root_output_path)
00017 
00018     cfg_name = os.path.basename(cfg).split('.')[0]
00019     config_output_path = os.path.join(root_output_path, '{}'.format(cfg_name))
00020     if not os.path.exists(config_output_path):
00021         os.makedirs(config_output_path)
00022 
00023     image_sets = [iset for iset in image_set.split('+')]
00024     final_output_path = os.path.join(config_output_path, '{}'.format('_'.join(image_sets)))
00025     if not os.path.exists(final_output_path):
00026         os.makedirs(final_output_path)
00027 
00028     log_file = '{}_{}.log'.format(cfg_name, time.strftime('%Y-%m-%d-%H-%M'))
00029     head = '%(asctime)-15s %(message)s'
00030     logging.basicConfig(filename=os.path.join(final_output_path, log_file), format=head)
00031     logger = logging.getLogger()
00032     logger.setLevel(logging.INFO)
00033 
00034     return logger, final_output_path
00035 


rail_object_detector
Author(s):
autogenerated on Sat Jun 8 2019 20:26:29