Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 import os
00009 import logging
00010 import time
00011
00012 def create_logger(root_output_path, cfg, image_set):
00013
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