Compare commits

..

No commits in common. 'fc70493fa6d029ff9b71008b18b256c3f2ac31ce' and 'a3b08d98c6663fa35111548604b8d5f001218ba3' have entirely different histories.

@ -112,22 +112,21 @@ def visualize_results(img_path: str, detections: List[Dict[str, Any]]) -> None:
# 准备播报文本
# 地面避障
# 地面避障和高空避障的播报文本
announcement_texts = {
'front': "前方有障碍,请注意。",
'left': "左侧有障碍,请注意。",
'right': "右侧有障碍,请注意。",
'above': "上方有障碍,请注意。"
}
announcement_text1 = "前方有障碍,请注意。" # 基础播报文本
announcement_text2 = "左侧有障碍,请注意。"
announcement_text3 = "右侧有障碍,请注意。"
# 高空避障
announcement_text4 = "上方有障碍,请注意。"
# 绘制边界框和标签
for detection in detections:
label = detection['label'] # 获取障碍物的标签
label = detection['label']
bbox = detection['bbox']
# 根据障碍物的位置获取对应的播报文本
announcement_text = announcement_texts.get(label, "未知位置的障碍,请注意。")
announcer.announce(f"{announcement_text1}")
# 使用announcer进行播报
announcer.announce(announcement_text)
# 停止语音播报
announcer.stop()
# 注意这里假设bbox的格式是(x, y, w, h),你需要根据实际情况调整
x, y, w, h = map(int, bbox)

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save