优化报告生成部分代码
This commit is contained in:
parent
dd973a90b3
commit
c678c8b96f
|
|
@ -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,9 +287,9 @@ 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)
|
||||||
|
|
||||||
with open(f"知识库/rule.json", "r", encoding="utf-8") as f:
|
with open(f"知识库/rule.json", "r", encoding="utf-8") as f:
|
||||||
rule_definitions = json.load(f)
|
rule_definitions = json.load(f)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue