1 Star 0 Fork 1

wcj/ERE_pixelaug

forked from Curli Trans/ERE_pixelaug 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
utils.py 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
Curli Trans 提交于 2023-09-08 14:37 . first
import os
import time
import logging
from config import get_cfg_defaults
def prepare_config_output_and_logger(cfg_path, log_prefix):
# get config
cfg = get_cfg_defaults()
cfg.merge_from_file(cfg_path)
cfg.freeze()
# get directory to save log and model
split_cfg_path = cfg_path.split("/")
yaml_file_name = os.path.splitext(split_cfg_path[-1])[0]
output_path = os.path.join('output', yaml_file_name)
if not os.path.exists(output_path):
os.makedirs(output_path)
time_str = time.strftime('%Y-%m-%d-%H-%M')
log_file = '{}_{}.log'.format(log_prefix, time_str)
log_path = os.path.join(output_path, log_file)
save_model_path = os.path.join(output_path, yaml_file_name + "_model.pth")
save_scaled_model_path = os.path.join(output_path, yaml_file_name + "_scaled_model.pth")
# setup the logger
logging.basicConfig(filename=log_path,
format='%(message)s')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
console = logging.StreamHandler()
logging.getLogger('').addHandler(console)
return cfg, logger, output_path, save_model_path, save_scaled_model_path
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wcj6/ere_pixelaug.git
git@gitee.com:wcj6/ere_pixelaug.git
wcj6
ere_pixelaug
ERE_pixelaug
master

搜索帮助