Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e4b4846
性能优化
haruDT Dec 18, 2025
2a08aa6
性能优化
haruDT Dec 18, 2025
34f8b40
删除仓库根目录下的site文件夹
haruDT Dec 19, 2025
bd5eba8
新增requirements.txt文件
haruDT Dec 19, 2025
c82b068
修改README文件,新增requirements文件
haruDT Dec 19, 2025
3b507d4
修改README文件,新增requirements文件
haruDT Dec 19, 2025
6bb9e4d
Merge branch 'main' into main
haruDT Dec 19, 2025
e117740
模块重组
haruDT Dec 19, 2025
b1f4240
Merge branch 'main' of https://github.com/haruDT/nn模块重组
haruDT Dec 19, 2025
f7a8321
目标ID颜色编码
haruDT Dec 19, 2025
1d74b0a
新增实时统计面板
haruDT Dec 19, 2025
f6b0785
修复问号问题
haruDT Dec 20, 2025
80f38cf
新增实时统计面板
haruDT Dec 20, 2025
99cbf97
Merge branch 'main' into main
haruDT Dec 20, 2025
e80d7a1
新增实时统计面板
haruDT Dec 21, 2025
dae1d5a
Merge branch 'main' into main
haruDT Dec 21, 2025
7e07ea8
新增实时统计面板
haruDT Dec 21, 2025
40958b0
完成远程main分支的合并,解决代码冲突
haruDT Dec 21, 2025
20b3e8f
恢复误修改的文件
haruDT Dec 21, 2025
bb08dbe
修改相对路径
haruDT Dec 21, 2025
d935aa2
修改绝对路径
haruDT Dec 21, 2025
026b433
随机地点生成主车
haruDT Dec 21, 2025
490eb1e
随机地点生成自车
haruDT Dec 22, 2025
e2659d2
新增卫星视角跟随主车
haruDT Dec 22, 2025
18ac7ff
Merge branch 'main' into main
haruDT Dec 22, 2025
1fd8e11
使用配置文件切换视角
haruDT Dec 22, 2025
321ceb9
Merge branch 'main' into main
haruDT Dec 22, 2025
1da7a1c
优化检测范围
haruDT Dec 23, 2025
fb43939
优化检测范围
haruDT Dec 23, 2025
572858f
Merge branch 'main' into main
haruDT Dec 23, 2025
4e4dbb4
多余部分优化
haruDT Dec 24, 2025
15b527f
多余部分优化
haruDT Dec 24, 2025
f1b6c7c
修复问题
haruDT Dec 24, 2025
7ec6d5e
Merge branch 'main' into main
haruDT Dec 24, 2025
d4461de
自适应帧率
haruDT Dec 24, 2025
d74c81d
Merge branch 'main' of https://github.com/haruDT/nn
haruDT Dec 24, 2025
fd9dd9c
热重载功能
haruDT Dec 25, 2025
b630789
Merge branch 'main' into main
haruDT Dec 25, 2025
55389c0
新增识别交通标识
haruDT Dec 26, 2025
0951f33
Merge branch 'main' into main
haruDT Dec 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/tracking_car/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,13 @@ hot_reload_safe_keys:
- "yolo_imgsz_max" # YOLO输入尺寸
- "stop_speed_thresh" # 停车速度阈值
- "danger_dist_thresh" # 危险距离阈值
- "weather" # 天气设置
- "weather" # 天气设置

# ======================== 交通标志检测配置 ========================
enable_sign_detection: false # 是否启用交通标志检测

traffic_sign:
enabled: true # 检测器是否启用
show_signs: true # 是否显示检测框
enable_actions: false # 是否触发动作(警告等)
conf_threshold: 0.5 # 置信度阈值
47 changes: 46 additions & 1 deletion src/tracking_car/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,13 @@ def _draw_info_panel(self, image, track_count):
f"L: PointCloud | V: View Mode" # 添加点云提示
]

status_lines = [
f"Tracked Objects: {track_count}",
f"ESC: Exit | W: Weather | S: Screenshot",
f"P: Pause | T: Stats | M: Color Legend",
f"L: PointCloud | V: View | O: SignDetect", # 修改这一行
]

# Draw status information
font = cv2.FONT_HERSHEY_SIMPLEX
for i, line in enumerate(status_lines):
Expand Down Expand Up @@ -1312,6 +1319,10 @@ def __init__(self, config):
self.image_queue = None
self.result_queue = None

# 添加交通标志检测器
self.traffic_sign_detector = None
self.enable_sign_detection = config.get('enable_sign_detection', False)

logger.info("[OK] Tracking system initialized (Color ID encoding + Independent statistics window)")

def initialize(self):
Expand Down Expand Up @@ -1380,7 +1391,18 @@ def initialize(self):
import traceback
traceback.print_exc()
return False


if self.enable_sign_detection:
try:
from sign_detector import TrafficSignDetector
self.traffic_sign_detector = TrafficSignDetector(
config.get('traffic_sign', {})
)
logger.info("✅ 交通标志检测器已启用")
except Exception as e:
logger.warning(f"交通标志检测器初始化失败: {e}")
self.traffic_sign_detector = None

def _setup_detection_thread(self):
"""Setup detection thread"""
try:
Expand Down Expand Up @@ -1784,6 +1806,23 @@ def run(self):
if self.frame_count % 100 == 0:
self._print_status(stats_data)

# ============ 新增:交通标志检测 ============
detected_signs = []
if self.traffic_sign_detector and self.enable_sign_detection:
try:
# 检测标志
detected_signs = self.traffic_sign_detector.detect(
image,
ego_speed=self.ego_vehicle.get_velocity().length() if self.ego_vehicle else 0.0
)

# 在图像上绘制标志
if self.traffic_sign_detector.config.get('show_signs', True):
image = self.traffic_sign_detector.draw_signs(image, detected_signs)

except Exception as e:
logger.debug(f"标志检测失败: {e}")

except KeyboardInterrupt:
logger.info("[STOP] User interrupted program")
except Exception as e:
Expand Down Expand Up @@ -1860,6 +1899,12 @@ def _handle_keyboard_input(self, key):
# 新增:R键手动重载配置
elif key == ord('r') or key == ord('R'):
self._force_reload_config()

# 添加:O键切换标志检测
elif key == ord('o') or key == ord('O'):
self.enable_sign_detection = not self.enable_sign_detection
status = "开启" if self.enable_sign_detection else "关闭"
logger.info(f"🚦 交通标志检测: {status}")

def _control_frame_rate(self, current_fps):
"""自适应帧率控制(简单版)"""
Expand Down
Loading
Loading