当json结果内的id不正确,则重试检测
This commit is contained in:
parent
754bfad6e9
commit
ef2020277e
|
|
@ -489,7 +489,7 @@ def hazard_inspection(
|
||||||
if "tag_id" in obj and obj["tag_id"] < len(class_result.get("tag", [])):
|
if "tag_id" in obj and obj["tag_id"] < len(class_result.get("tag", [])):
|
||||||
tag: str = class_result["tag"][obj["tag_id"]]
|
tag: str = class_result["tag"][obj["tag_id"]]
|
||||||
else:
|
else:
|
||||||
tag: str = ""
|
continue # 重试隐患检查,直到格式正确
|
||||||
|
|
||||||
if tag not in all_tags:
|
if tag not in all_tags:
|
||||||
all_tags.append(tag)
|
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", [])):
|
if "base_id" in obj and obj["base_id"] < len(class_result.get("base", [])):
|
||||||
base = class_result["base"][obj["base_id"]]
|
base = class_result["base"][obj["base_id"]]
|
||||||
else:
|
else:
|
||||||
base = None
|
continue # 重试隐患检查,直到格式正确
|
||||||
|
|
||||||
if base not in all_bases:
|
if base not in all_bases:
|
||||||
all_bases.append(base)
|
all_bases.append(base)
|
||||||
|
|
@ -522,6 +522,7 @@ def hazard_inspection(
|
||||||
temp_obj["end_frame"] = track_info["end_frame"]
|
temp_obj["end_frame"] = track_info["end_frame"]
|
||||||
temp_obj["start_sec"] = round(track_info["start_frame"] / fps, 1) # 处理成x.x秒
|
temp_obj["start_sec"] = round(track_info["start_frame"] / fps, 1) # 处理成x.x秒
|
||||||
temp_obj["location"] = obj.get("location", "")
|
temp_obj["location"] = obj.get("location", "")
|
||||||
|
temp_obj["recommend"] = obj.get("recommend", "")
|
||||||
|
|
||||||
hazard_count += 1
|
hazard_count += 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue