Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 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
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
100 changes: 70 additions & 30 deletions src/tracking_car/config.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,101 @@
# config.yaml - 完整配置示例
# ======================== CARLA连接配置 ========================
host: "localhost"
port: 2000
num_npcs: 20
img_width: 640
img_height: 480
conf_thres: 0.5
iou_thres: 0.3
max_age: 5
min_hits: 3
yolo_model: "yolov8n.pt"
yolo_imgsz_max: 320
timeout: 20.0

# ======================== 传感器配置 ========================
# 增大分辨率和视野,提升远距离检测能力
img_width: 1280 # ↑ 从640提升到1280,让远处车辆更清晰
img_height: 960 # ↑ 从480提升到960
fov: 110 # ↑ 从90提升到110,扩大视野范围
sensor_tick: 0.05
use_lidar: true # 保持LiDAR开启,用于距离验证

# ======================== LiDAR配置 ========================
lidar_channels: 32
lidar_range: 100.0
lidar_points_per_second: 500000

# ======================== 检测模型配置 ========================
# 关键优化:降低阈值,增大输入尺寸
yolo_model: "yolov8n.pt" # 可选:换成 yolov8m.pt 效果更好
conf_thres: 0.25 # ↓ 从0.5降低到0.25,检测更多远处目标
iou_thres: 0.3 # 保持
device: "cuda" if torch.cuda.is_available() else "cpu"
yolo_imgsz_max: 640 # ↑ 从320提升到640,提升小目标检测能力
yolo_iou: 0.45
yolo_quantize: false

# ======================== 跟踪算法配置 ========================
max_age: 5
min_hits: 3
kf_dt: 0.05
max_speed: 50.0

# ======================== 可视化配置 ========================
window_width: 1280
window_height: 720
smooth_alpha: 0.2
fps_window_size: 15
display_fps: 30

# ======================== 轨迹历史配置 ========================
track_history_len: 20
track_line_width: 2
track_alpha: 0.6
stop_speed_thresh: 1.0

# ======================== 行为分析配置 ========================
# 针对远距离检测调整参数
stop_speed_thresh: 0.8 # ↓ 降低停车速度阈值
stop_frames_thresh: 5
overtake_speed_ratio: 1.5
overtake_dist_thresh: 50.0
lane_change_thresh: 0.5
overtake_dist_thresh: 60.0 # ↑ 增大超车距离阈值
lane_change_thresh: 0.4
brake_accel_thresh: 2.0
turn_angle_thresh: 15.0
danger_dist_thresh: 10.0
danger_dist_thresh: 15.0 # ↑ 增大危险距离阈值,适应更远检测
predict_frames: 10
default_weather: "clear"
auto_adjust_detection: true
use_lidar: true
lidar_channels: 32
lidar_range: 100.0
lidar_points_per_second: 500000
fuse_lidar_vision: true

# ======================== 天气与NPC配置 ========================
default_weather: "clear" # 使用清晰天气,有利于远距离检测
num_npcs: 20

# ======================== 性能优化配置 ========================
auto_adjust_detection: true # 自动调整检测参数
smooth_alpha: 0.2
fps_window_size: 15

# ======================== 传感器融合配置 ========================
fuse_lidar_vision: true # 启用传感器融合

# ======================== 数据记录配置 ========================
record_data: true
record_dir: "track_records"
record_format: "csv"
record_fps: 10
save_screenshots: false

# ======================== 3D可视化配置 ========================
use_3d_visualization: true
pcd_view_size: 800

# 检测框样式配置
det_box_color: [255, 0, 0] # 蓝色框
# ======================== 检测框样式配置 ========================
det_box_color: [255, 0, 0] # 蓝色框
det_box_thickness: 2
det_label_bg_color: [0, 0, 0] # 黑色背景
det_label_bg_color: [0, 0, 0] # 黑色背景
det_label_text_color: [255, 255, 255] # 白色文字
det_label_font_scale: 0.5
det_label_padding: 5

# ======================== 视角控制配置 ========================
view:
default_mode: "satellite" # 默认视角模式: satellite, behind, first_person
satellite_height: 50.0 # 卫星视角高度(米)
behind_distance: 10.0 # 后方视角距离(米)
first_person_height: 1.6 # 第一人称视角高度(米)
default_mode: "satellite" # 默认视角模式
satellite_height: 50.0 # 卫星视角高度
behind_distance: 10.0 # 后方视角距离
first_person_height: 1.6 # 第一人称视角高度

# ======================== 新增:远距离检测专用配置 ========================
far_detection:
enabled: true # 启用远距离检测模式
min_confidence: 0.2 # 远距离目标最低置信度
min_pixel_size: 15 # 最小检测像素尺寸(宽或高)
scale_factor: 1.5 # 图像缩放因子用于小目标检测
enable_multi_scale: true # 启用多尺度检测
4 changes: 2 additions & 2 deletions src/tracking_car/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def setup(self):

# 设置相机位置(车顶前方)
camera_transform = carla.Transform(
carla.Location(x=2.0, z=1.8),
carla.Rotation(pitch=-10) # 略微向下倾斜
carla.Location(x=2.5, z=2.5),
carla.Rotation(pitch=-5) # 略微向下倾斜
)

# 生成相机
Expand Down
Loading