From ef2020277e0e198dda41cc6b752f9304cfbe6aa4 Mon Sep 17 00:00:00 2001 From: yueliuli <1628111725@qq.com> Date: Thu, 23 Apr 2026 16:29:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93json=E7=BB=93=E6=9E=9C=E5=86=85?= =?UTF-8?q?=E7=9A=84id=E4=B8=8D=E6=AD=A3=E7=A1=AE=EF=BC=8C=E5=88=99?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/qwen_fun.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/qwen_fun.py b/lib/qwen_fun.py index 2e01e12..8acc5db 100644 --- a/lib/qwen_fun.py +++ b/lib/qwen_fun.py @@ -489,7 +489,7 @@ def hazard_inspection( if "tag_id" in obj and obj["tag_id"] < len(class_result.get("tag", [])): tag: str = class_result["tag"][obj["tag_id"]] else: - tag: str = "" + continue # 重试隐患检查,直到格式正确 if tag not in all_tags: all_tags.append(tag) @@ -499,7 +499,7 @@ def hazard_inspection( if "base_id" in obj and obj["base_id"] < len(class_result.get("base", [])): base = class_result["base"][obj["base_id"]] else: - base = None + continue # 重试隐患检查,直到格式正确 if base not in all_bases: all_bases.append(base) @@ -522,6 +522,7 @@ def hazard_inspection( temp_obj["end_frame"] = track_info["end_frame"] temp_obj["start_sec"] = round(track_info["start_frame"] / fps, 1) # 处理成x.x秒 temp_obj["location"] = obj.get("location", "") + temp_obj["recommend"] = obj.get("recommend", "") hazard_count += 1