v03 args yaml update 02

This commit is contained in:
13339479676 2022-01-16 07:58:53 +08:00
parent cee8a944a6
commit a7a521bc1a
3 changed files with 18 additions and 4 deletions

View File

@ -14,6 +14,7 @@ from utils.ows_path import increment_path
from utils.hotkeyjudge import hotkey_judge
from utils.frame_opt import frame_opt
from utils.log import is_logSuffix, log_management
from utils.args_yaml import argsYaml
def parse_args(known=False):
@ -75,9 +76,7 @@ def webcam_opencv(args, device_index=0, quit_key="q", pause_key="p", is_autoSave
logTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) # 日志时间
log_management(f'{logTime}\n', logName, logMode) # 记录日志时间
# 脚本参数
with open('./args.yaml', 'w') as f:
yaml.safe_dump(vars(args), f, sort_keys=False) # 脚本参数yaml保存
argsYaml(args) # 脚本参数
time_list = [1, 60, 3600] # 时间参数列表

15
utils/args_yaml.py Normal file
View File

@ -0,0 +1,15 @@
# 脚本参数管理
# 创建人:曾逸夫
# 创建时间2022-01-16
import yaml
import sys
ROOT_PATH = sys.path[0] # 项目根目录
# 脚本参数
def argsYaml(args):
with open(f'{ROOT_PATH}/args.yaml', 'w') as f:
yaml.safe_dump(vars(args), f, sort_keys=False) # 脚本参数yaml保存

View File

@ -1,4 +1,4 @@
# OpenCV Webcam Script v0.3
# 日志管理
# 创建人:曾逸夫
# 创建时间2022-01-14