type=str, default='0') args = parser.parse_args() hyper_params['dbTrain'] = args.dbTrain hyper_params['dbEval'] = args.dbEval hyper_params['outDir'] = args.outDir hyper_params['nb_gpus'] = args.nb_gpus hyper_params['device'] = args.devices # Set GPU os.environ['CUDA_VISIBLE_DEVICES'] = hyper_params['device'] # Set output folder output_folder = hyper_params['outDir'] make_dir(output_folder) # Set logger logger = logging.getLogger('main') logger.setLevel(logging.DEBUG) fh = logging.FileHandler(os.path.join(output_folder, 'log.txt')) fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.INFO) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') fh.setFormatter(formatter) ch.setFormatter(formatter) logger.addHandler(fh) logger.addHandler(ch)
parser.add_argument('--graphName', required=True, help='writen graph name, net.pbtxt', type=str) args = parser.parse_args() hyper_params['cktDir'] = args.cktDir hyper_params['dbTest'] = args.dbTest hyper_params['outDir'] = args.outDir hyper_params['device'] = args.device hyper_params['lossId'] = args.lossId hyper_params['graphName'] = args.graphName # Set GPU os.environ['CUDA_VISIBLE_DEVICES'] = hyper_params['device'] # out img dir out_img_dir = os.path.join(hyper_params['outDir'], 'out_img') make_dir(out_img_dir) # Set logger logger = logging.getLogger('main') logger.setLevel(logging.DEBUG) fh = logging.FileHandler(os.path.join(hyper_params['outDir'], 'log.txt')) fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') fh.setFormatter(formatter) ch.setFormatter(formatter) logger.addHandler(fh) logger.addHandler(ch) # Training preparation