优化报告生成部分代码

This commit is contained in:
yueliuli 2026-04-23 11:35:39 +08:00
parent dd973a90b3
commit c678c8b96f
1 changed files with 4 additions and 4 deletions

View File

@ -231,7 +231,7 @@ def run(vid_file: str, run_sam3: bool = True, run_inspection: bool = True, gen_r
# 获取总帧数与帧率 # 获取总帧数与帧率
cap = cv2.VideoCapture(input_video_path) cap = cv2.VideoCapture(input_video_path)
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
fps = cap.get(cv2.CAP_PROP_FPS) fps = int(cap.get(cv2.CAP_PROP_FPS))
cap.release() cap.release()
@ -287,7 +287,7 @@ def run(vid_file: str, run_sam3: bool = True, run_inspection: bool = True, gen_r
#================生成报告================= #================生成报告=================
if gen_report: if gen_report:
if result == {}: result: dict = {}
with open(f"{output_dir}/hazard_inspection.json", "r", encoding="utf-8") as f: with open(f"{output_dir}/hazard_inspection.json", "r", encoding="utf-8") as f:
result = json.load(f) result = json.load(f)