Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0f9b297
1
lj2302 Dec 18, 2025
5a338a4
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 18, 2025
5808e48
1
lj2302 Dec 18, 2025
541c063
无人车动态障碍物避障算法
lj2302 Dec 19, 2025
369b66f
Merge remote-tracking branch 'origin/main'
lj2302 Dec 19, 2025
426fe49
提交选题
lj2302 Dec 19, 2025
d58a1bb
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 19, 2025
3cabf9e
删除多余的.idea文件,更改项目名
lj2302 Dec 19, 2025
c924f07
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 19, 2025
5a2c700
创建 requirements.txt,列出依赖库(numpy、torch、opencv 等)
lj2302 Dec 19, 2025
cf8b30b
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 19, 2025
0d378c6
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 19, 2025
0f21da3
[env] add requirements.txt for dependencies
lj2302 Dec 19, 2025
7c93572
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 19, 2025
47aac2b
Mergebranch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 19, 2025
253c385
[env] add requirements.txt for dependencies
lj2302 Dec 19, 2025
25a85db
[data] create data_loader.py skeleton
lj2302 Dec 19, 2025
8bc6c8a
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 19, 2025
83da6df
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 19, 2025
5aba4cc
[data] create data_loader.py skeleton
lj2302 Dec 19, 2025
fdf5378
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 19, 2025
4ad68fc
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 20, 2025
b810224
[data] implement image loading function
lj2302 Dec 20, 2025
e577267
Merge branch 'main' into main
lj2302 Dec 20, 2025
ff12afc
[data] implement image loading function
lj2302 Dec 20, 2025
ba39e3f
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 20, 2025
a11507c
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 20, 2025
f035164
[data] implement image loading function
lj2302 Dec 21, 2025
70be789
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 21, 2025
81a8d90
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 21, 2025
26d2d28
[data] implement image loading function
lj2302 Dec 21, 2025
b73684c
rge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 21, 2025
007c7f2
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 21, 2025
46c748b
tMerge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 21, 2025
ddb58fc
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 21, 2025
0253ecd
[data] create data module with dataset base class and image loading f…
lj2302 Dec 21, 2025
ce8b265
[data] create data module with dataset base class and image loading f…
lj2302 Dec 21, 2025
fb3d477
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 21, 2025
cc68945
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 22, 2025
717d3f8
[data] implement image loading function
lj2302 Dec 22, 2025
2fb3e2b
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 22, 2025
11d002c
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 22, 2025
21be098
[data] implement image loading function
lj2302 Dec 22, 2025
4b845a1
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 22, 2025
75c8c56
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 22, 2025
78f834a
[data] create data/ directory and data_loader.py skeleton
lj2302 Dec 22, 2025
dd3411d
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 22, 2025
9ba1569
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 22, 2025
21891ee
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 23, 2025
5696af8
修改README.md文件
lj2302 Dec 23, 2025
47604f8
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 23, 2025
18618fe
[data] create data/ directory and data/data_loader.py skeleton
lj2302 Dec 23, 2025
f01541c
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 24, 2025
b766990
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 24, 2025
603bcb6
修改README.m文件
lj2302 Dec 24, 2025
62cb1b1
Merge branch 'main' of https://github.com/lj2302/nn2
lj2302 Dec 24, 2025
180a8ab
修改README.m文件
lj2302 Dec 24, 2025
f9c5f72
数据模块 - 实现图像读取功能
lj2302 Dec 25, 2025
b2a0f89
Merge branch 'OpenHUTB:main' into main
lj2302 Dec 25, 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
Empty file added data/__init__.py
Empty file.
41 changes: 41 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"

#Specify inspection profile for code analysis
profile:
name: qodana.starter

#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>

#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>

#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

# Quality gate. Will fail the CI/CD pipeline if any condition is not met
# severityThresholds - configures maximum thresholds for different problem severities
# testCoverageThresholds - configures minimum code coverage on a whole project and newly added code
# Code Coverage is available in Ultimate and Ultimate Plus plans
#failureConditions:
# severityThresholds:
# any: 15
# critical: 5
# testCoverageThresholds:
# fresh: 70
# total: 50

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-<linter>:2025.2
30 changes: 30 additions & 0 deletions src/Car_Perception_Automatic_Sensing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Python 相关
__pycache__/
*.pyc
*.pyo
*.pyd
.venv/
env/
*.env

# PyCharm 相关
.idea/
*.iml
*.iws
*.ipr
out/

# 项目无关目录/文件
../../.idea/

# 数据与模型(后续会用到)
data/raw/
data/kitti/
*.npy
*.pth
train/checkpoints/
infer/results/

# OS 相关
.DS_Store
Thumbs.db
30 changes: 28 additions & 2 deletions src/Car_Perception_Automatic_Sensing/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
无人车 无人车动态障碍物避障算法 无人车动态障碍物避障的核心目标是:在实时感知环境中移动障碍物(行人和车辆)的基础上,快速规划出无碰撞、平滑且符合运动学约束的安全路径
环境:python3.13
# Car_Perception_Automatic_Sensing
自动驾驶环境感知自动感知系统,支持车辆、行人、车道线等目标的检测与分割。

## 功能模块
- 数据加载与预处理(支持 KITTI/Waymo 数据集)
- 深度学习模型搭建(CNN/Transformer 骨干网络)
- 模型训练与验证
- 推理可视化与结果导出##
- 目录结构
Car_Perception_Automatic_Sensing/
- ├── data/
- ├── model/
- ├── loss/
- ├── train/ # 训练脚本目录
- ├── infer/ # 推理脚本目录
- ├── utils/ # 工具类目录
- ├── test/ # 测试用例目录
- ├── requirements.txt # 依赖配置
- └── README.md # 项目文档

## 环境要求
Python >= 3.8,PyTorch >= 2.0.0

## 快速开始
1. 克隆仓库
2. 安装依赖
3. 准备数据集
4. 运行训练脚本
Empty file.
80 changes: 80 additions & 0 deletions src/Car_Perception_Automatic_Sensing/data/data_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"""
数据加载器核心模块
支持自动驾驶数据集的加载、样本管理与批次分发
"""
import os
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader
from typing import Optional, List


class AutoDriveDataset(Dataset):
"""自动驾驶感知数据集基类(所有自定义数据集需继承此类)"""
def __init__(self, data_root: str, split: str = "train", transform: Optional[object] = None):
self.data_root = os.path.abspath(data_root)
self.split = split
self.transform = transform
self.sample_paths: List[str] = [] # 存储所有样本路径
self._load_sample_paths() # 加载样本列表

def _load_sample_paths(self):
"""加载样本路径(抽象方法,子类实现)"""
raise NotImplementedError("请在子类中实现 _load_sample_paths 方法")

def __len__(self) -> int:
"""返回样本总数"""
return len(self.sample_paths)

def __getitem__(self, idx: int):
"""获取单个样本(抽象方法,子类实现)"""
raise NotImplementedError("请在子类中实现 __getitem__ 方法")


def build_dataloader(
dataset: Dataset,
batch_size: int,
shuffle: bool = True,
num_workers: int = 4,
drop_last: bool = False
) -> DataLoader:
"""构建PyTorch DataLoader(跨系统兼容)"""
# Windows系统默认关闭多进程
if os.name == "nt":
num_workers = 0

return DataLoader(
dataset=dataset,
batch_size=batch_size,
shuffle=shuffle,
num_workers=num_workers,
pin_memory=True,
drop_last=drop_last
)


if __name__ == "__main__":
# 框架测试
pass
# 新增导入
import cv2
from typing import Tuple

# 在 AutoDriveDataset 类中新增方法
def _load_image(self, img_rel_path: str) -> Tuple[np.ndarray, Tuple[int, int, int]]:
"""
读取图像并转换为RGB格式
:param img_rel_path: 图像相对路径(基于data_root)
:return: (RGB图像数组, 图像形状(h, w, c))
"""
img_abs_path = os.path.join(self.data_root, img_rel_path)
# 路径校验
if not os.path.exists(img_abs_path):
raise FileNotFoundError(f"图像不存在:{img_abs_path}")
# 读取图像(忽略透明通道)
img_bgr = cv2.imread(img_abs_path, cv2.IMREAD_COLOR)
if img_bgr is None:
raise ValueError(f"无法读取图像(损坏/格式不支持):{img_abs_path}")
# BGR转RGB
img_rgb = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)
return img_rgb, img_rgb.shape
40 changes: 40 additions & 0 deletions src/Car_Perception_Automatic_Sensing/data/preprocess.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""数据预处理工具:归一化、标准化"""
import numpy as np


def normalize_image(img: np.ndarray, target_range: tuple = (0, 1)) -> np.ndarray:
"""
图像像素值归一化到指定范围
:param img: 输入图像(np.ndarray, uint8/float32)
:param target_range: 目标范围,默认(0,1)
:return: 归一化后的图像(float32)
"""
img_float = img.astype(np.float32)
min_val = img_float.min()
max_val = img_float.max()
# 避免除零
if max_val - min_val < 1e-6:
return np.zeros_like(img_float) + target_range[0]
# 归一化计算
normalized = (img_float - min_val) / (max_val - min_val)
normalized = normalized * (target_range[1] - target_range[0]) + target_range[0]
return normalized


def standardize_image(img: np.ndarray, mean: list = None, std: list = None) -> np.ndarray:
"""
图像标准化(减均值、除标准差)
:param img: 输入RGB图像(np.ndarray, (h,w,3))
:param mean: 通道均值,默认ImageNet均值
:param std: 通道标准差,默认ImageNet标准差
:return: 标准化后的图像
"""
if mean is None:
mean = [0.485, 0.456, 0.406]
if std is None:
std = [0.229, 0.224, 0.225]

img_float = img.astype(np.float32) / 255.0 # 先归一化到0-1
for i in range(3):
img_float[..., i] = (img_float[..., i] - mean[i]) / std[i]
return img_float
73 changes: 0 additions & 73 deletions src/Car_Perception_Automatic_Sensing/data_loader.py

This file was deleted.

Empty file.
Empty file added src/__init__.py
Empty file.
Loading