当json结果内的id不正确,则重试检测

This commit is contained in:
yueliuli 2026-04-23 16:29:17 +08:00
parent 754bfad6e9
commit ef2020277e
1 changed files with 3 additions and 2 deletions

View File

@ -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