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