[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"tool-JunshengFu--vehicle-detection":3,"similar-JunshengFu--vehicle-detection":57},{"id":4,"github_repo":5,"name":6,"description_en":7,"description_zh":8,"ai_summary_zh":8,"readme_en":9,"readme_zh":10,"quickstart_zh":11,"use_case_zh":12,"hero_image_url":13,"owner_login":14,"owner_name":15,"owner_avatar_url":16,"owner_bio":17,"owner_company":18,"owner_location":19,"owner_email":20,"owner_twitter":21,"owner_website":22,"owner_url":23,"languages":24,"stars":29,"forks":30,"last_commit_at":31,"license":32,"difficulty_score":33,"env_os":34,"env_gpu":35,"env_ram":36,"env_deps":37,"category_tags":46,"github_topics":48,"view_count":51,"oss_zip_url":21,"oss_zip_packed_at":21,"status":52,"created_at":53,"updated_at":54,"faqs":55,"releases":56},5453,"JunshengFu\u002Fvehicle-detection","vehicle-detection","Created vehicle detection pipeline with two approaches: (1) deep neural networks (YOLO framework) and (2) support vector machines ( OpenCV + HOG).","vehicle-detection 是一个专为自动驾驶场景设计的开源车辆检测系统，旨在通过单目摄像头实时识别道路上的车辆。它主要解决了自动驾驶中“如何准确感知周围车辆”这一核心问题，并提供了高速公路（含车道偏离预警）和城市道路两种驾驶场景的演示效果。\n\n该项目非常适合计算机视觉开发者、自动驾驶研究人员以及希望深入理解目标检测算法的学生使用。其最大的技术亮点在于同时实现了两种截然不同的检测方案供用户对比学习：一是基于传统机器学习的线性支持向量机（SVM），结合方向梯度直方图（HOG）特征与滑动窗口技术；二是基于深度学习的前沿方案，采用了高效的 YOLO（You Only Look Once）框架。这种双轨并行的设计不仅让使用者能直观比较传统算法与神经网络在精度和速度上的差异，还提供了完整的代码流水线，涵盖从数据校准、特征提取到热力图过滤异常检测值的全过程。无论是想夯实基础算法原理，还是探索前沿深度学习应用，vehicle-detection 都是一个极佳的实践参考项目。","# **Vehicle Detection for Autonomous Driving** \n\n## Objective\n\n#### A demo of Vehicle Detection System: a monocular camera is used for detecting vehicles. \n\n\n#### [**(1) Highway Drive (with Lane Departure Warning)**](https:\u002F\u002Fyoutu.be\u002FBrh9-uab7Qs) (Click to see the full video)\n\n[![gif_demo1][demo1_gif]](https:\u002F\u002Fyoutu.be\u002FBrh9-uab7Qs)\n\n#### [**(2) City Drive (Vehicle Detection only)**](https:\u002F\u002Fyoutu.be\u002F2wOxK86LcaM) (Click to see the full video)\n[![gif_demo2][demo2_gif]](https:\u002F\u002Fyoutu.be\u002F2wOxK86LcaM)\n\n---\n\n### Code & Files\n\n#### 1. My project includes the following files\n\n* [main.py](main.py) is the main code for demos\n* [svm_pipeline.py](svm_pipeline.py) is the car detection pipeline with SVM\n* [yolo_pipeline.py](yolo_pipeline.py) is the car detection pipeline with a deep net [YOLO (You Only Look Once)](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1506.02640.pdf)\n* [visualization.py](visualizations.py) is the function for adding visalization\n\n---\nOthers are the same as in the repository of [Lane Departure Warning System](https:\u002F\u002Fgithub.com\u002FJunshengFu\u002Fautonomous-driving-lane-departure-warning):\n* [calibration.py](calibration.py) contains the script to calibrate camera and save the calibration results\n* [lane.py](model.h5) contains the lane class \n* [examples](examples) folder contains the sample images and videos\n\n\n#### 2. Dependencies & my environment\n\nAnaconda is used for managing my [**dependencies**](https:\u002F\u002Fgithub.com\u002Fudacity\u002FCarND-Term1-Starter-Kit).\n* You can use provided [environment-gpu.yml](environment-gpu.yml) to install the dependencies.\n* OpenCV3, Python3.5, tensorflow, CUDA8  \n* OS: Ubuntu 16.04\n\n#### 3. How to run the code\n\n(1) Download weights for YOLO\n\nYou can download the weight from [here](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F0B5WIzrIVeL0WS3N2VklTVmstelE\u002Fview?usp=sharing&resourcekey=0-QkNPlJWkA9QsD6dHAmHXRw) and save it to\nthe [weights](weights) folder.\n\n(2) If you want to run the demo, you can simply run:\n```sh\npython main.py\n```\n\n#### 4. Release History\n\n* 0.1.1\n    * Fix two minor bugs and update the documents\n    * Date 18 April 2017\n\n* 0.1.0\n    * The first proper release\n    * Date 31 March 2017\n\n---\n\n### **Two approaches: Linear SVM vs Neural Network**\n\n### 1. Linear SVM Approach\n`svm_pipeline.py` contains the code for the svm pipeline.\n\n**Steps:**\n\n* Perform a Histogram of Oriented Gradients (HOG) feature extraction on a labeled training set of images and train a classifier Linear SVM classifier\n* A color transform is applied to the image and append binned color features, as well as histograms of color, to HOG feature vector. \n* Normalize your features and randomize a selection for training and testing.\n* Implement a sliding-window technique and use SVM classifier to search for vehicles in images.\n* Run pipeline on a video stream and create a heat map of recurring detections frame by frame to reject outliers and follow detected vehicles.\n* Estimate a bounding box for detected vehicles.\n\n[\u002F\u002F]: # (Image References)\n[image1]: .\u002Fexamples\u002Fcar_not_car.png\n[image2]: .\u002Fexamples\u002Fhog_1.png\n[image2-1]: .\u002Fexamples\u002Fhog_2.png\n[image3]: .\u002Fexamples\u002Fsearch_windows.png\n[image4]: .\u002Fexamples\u002Fheat_map1.png\n[image5]: .\u002Fexamples\u002Fheat_map2.png\n[image6]: .\u002Fexamples\u002Flabels_map.png\n[image7]: .\u002Fexamples\u002Fsvn_1.png\n[image8]: .\u002Fexamples\u002Fyolo_1.png\n[image_yolo1]: .\u002Fexamples\u002Fyolo1.png\n[image_yolo2]: .\u002Fexamples\u002Fyolo2.png\n[video1]: .\u002Fproject_video.mp4\n[demo1_gif]: .\u002Fexamples\u002Fdemo1.gif\n[demo2_gif]: .\u002Fexamples\u002Fdemo2.gif\n\n#### 1.1 Extract Histogram of Oriented Gradients (HOG) from training images\nThe code for this step is contained in the function named `extract_features` and codes from line 464 to 552 in `svm_pipeline.py`. \n If the SVM classifier exist, load it directly. \n \n Otherwise, I started by reading in all the `vehicle` and `non-vehicle` images, around 8000 images in each category.  These datasets are comprised of \n images taken from the [GTI vehicle image database](http:\u002F\u002Fwww.gti.ssr.upm.es\u002Fdata\u002FVehicle_database.html) and \n [KITTI vision benchmark suite](http:\u002F\u002Fwww.cvlibs.net\u002Fdatasets\u002Fkitti\u002F).\n Here is an example of one of each of the `vehicle` and `non-vehicle` classes:\n\n![alt text][image1]\n\n\nI then explored different color spaces and different `skimage.hog()` parameters (`orientations`, `pixels_per_cell`, and `cells_per_block`).  I grabbed random images from each of the two classes and displayed them to get a feel for what the `skimage.hog()` output looks like.\n\nHere is an example using the `RGB` color space and HOG parameters of `orientations=9`, `pixels_per_cell=(8, 8)` and `cells_per_block=(2, 2)`:\n\n![alt text][image2]\n![alt text][image2-1]\n \nTo optimize the HoG extraction, I **extract the HoG feature for the entire image only once**. Then the entire HoG image\nis saved for further processing. (see line 319 to 321 in  `svm_pipeline.py`)\n\n#### 1.2 Final choices of HOG parameters, Spatial Features and Histogram of Color.\n\nI tried various combinations of parameters and choose the final combination as follows \n(see line 16-27 in `svm_pipeline.py`):\n* `YCrCb` color space\n* orient = 9  # HOG orientations\n* pix_per_cell = 8 # HOG pixels per cell\n* cell_per_block = 2 # HOG cells per block, which can handel e.g. shadows\n* hog_channel = \"ALL\" # Can be 0, 1, 2, or \"ALL\"\n* spatial_size = (32, 32) # Spatial binning dimensions\n* hist_bins = 32    # Number of histogram bins\n* spatial_feat = True # Spatial features on or off\n* hist_feat = True # Histogram features on or off\n* hog_feat = True # HOG features on or off\n\nAll the features are **normalized** by line 511 to 513 in `svm_pipeline.py`, which is a critical step. Otherwise, classifier \nmay have some bias toward to the features with higher weights.\n#### 1.3. How to train a classifier\nI randomly select 20% of images for testing and others for training, and a linear SVM is used as classifier (see line\n520 to 531 in `svm_pipeline.py`)\n\n#### 1.4 Sliding Window Search\nFor this SVM-based approach, I use two scales of the search window (64x64 and 128x128, see line 41) and search only between \n[400, 656] in y axis (see line 32 in `svm_pipeline.py`). I choose 75% overlap for the search windows in each scale (see \nline 314 in `svm_pipeline.py`). \n\nFor every window, the SVM classifier is used to predict whether it contains a car nor not. If yes, save this window (see \nline 361 to 366 in `svm_pipeline.py`). In the end, a list of windows contains detected cars are obtianed.\n\n![alt text][image3]\n\n#### 1.5 Create a heat map of detected vehicles\nAfter obtained a list of windows which may contain cars, a function named `generate_heatmap` (in line 565 in \n`svm_pipeline.py`) is used to generate a heatmap. Then a threshold is used to filter out the false positives.\n\n![heatmap][image4]\n![heatmap][image5]\n\n#### 1.6 Image vs Video implementation\n**For image**, we could directly use the result from the filtered heatmap to create a bounding box of the detected \nvehicle. \n\n**For video**, we could further utilize neighbouring frames to filter out the false positives, as well as to smooth \nthe position of bounding box. \n* Accumulate the heatmap for N previous frame.  \n* Apply weights to N previous frames: smaller weights for older frames (line 398 to 399 in `svm_pipeline.py`).\n* I then apply threshold and use `scipy.ndimage.measurements.label()` to identify individual blobs in the heatmap.  \n* I then assume each blob corresponded to a vehicle and constructe bounding boxes to cover the area of each blob detected.  \n\n\n#### Example of test image\n\n![alt text][image7]\n\n---\n\n\n### 2. Neural Network Approach (YOLO)\n`yolo_pipeline.py` contains the code for the yolo pipeline. \n\n[YOLO](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1506.02640.pdf) is an object detection pipeline baesd on Neural Network. Contrast to prior work on object detection with classifiers \nto perform detection, YOLO frame object detection as a regression problem to spatially separated bounding boxes and\nassociated class probabilities. A single neural network predicts bounding boxes and class probabilities directly from\nfull images in one evaluation. Since the whole detection pipeline is a single network, it can be optimized end-to-end\ndirectly on detection performance.\n\n![alt text][image_yolo2]\n\nSteps to use the YOLO for detection:\n* resize input image to 448x448\n* run a single convolutional network on the image\n* threshold the resulting detections by the model’s confidence\n\n![alt text][image_yolo1]\n\n`yolo_pipeline.py` is modified and integrated based on this [tensorflow implementation of YOLO](https:\u002F\u002Fgithub.com\u002Fgliese581gg\u002FYOLO_tensorflow).\nSince the \"car\" is known to YOLO, I use the precomputed weights directly and apply to the entire input frame.\n\n#### Example of test image\n![alt text][image8]\n\n---\n\n### Discussion\nFor the SVM based approach, the accuray is good, but the speed (2 fps) is an problem due to the fact of sliding window approach \nis time consuming! We could use image downsampling, multi-threads, or GPU processing to improve the speed. But, there are probably\na lot engineering work need to be done to make it running real-time. Also, in this application, I limit the vertical searching \nrange to control the number of searching windows, as well as avoid some false positives (e.g. cars on the tree).\n\nFor YOLO based approach, it achieves real-time and the accuracy are quite satisfactory. Only in some cases, it may failure to\n detect the small car thumbnail in distance. My intuition is that the original input image is in resolution of 1280x720, and it needs to be downscaled\n to 448x448, so the car in distance will be tiny and probably quite distorted in the downscaled image (448x448). In order to \n correctly identify the car in distance, we might need to either crop the image instead of directly downscaling it, or retrain \n the network.\n","# **自动驾驶中的车辆检测**\n\n## 目标\n\n#### 车辆检测系统的演示：使用单目摄像头进行车辆检测。\n\n\n#### 【(1) 高速公路行驶（带车道偏离预警）】(点击观看完整视频) [https:\u002F\u002Fyoutu.be\u002FBrh9-uab7Qs](https:\u002F\u002Fyoutu.be\u002FBrh9-uab7Qs)\n\n[![gif_demo1][demo1_gif]](https:\u002F\u002Fyoutu.be\u002FBrh9-uab7Qs)\n\n#### 【(2) 城市道路行驶（仅车辆检测）】(点击观看完整视频) [https:\u002F\u002Fyoutu.be\u002F2wOxK86LcaM](https:\u002F\u002Fyoutu.be\u002F2wOxK86LcaM)\n[![gif_demo2][demo2_gif]](https:\u002F\u002Fyoutu.be\u002F2wOxK86LcaM)\n\n---\n\n### 代码与文件\n\n#### 1. 我的项目包含以下文件\n\n* [main.py](main.py) 是演示的主要代码\n* [svm_pipeline.py](svm_pipeline.py) 是基于 SVM 的车辆检测流水线\n* [yolo_pipeline.py](yolo_pipeline.py) 是基于深度神经网络 YOLO（You Only Look Once）的车辆检测流水线\n* [visualization.py](visualizations.py) 是用于添加可视化效果的函数\n\n---\n其他文件与【车道偏离预警系统】仓库中的内容相同：[https:\u002F\u002Fgithub.com\u002FJunshengFu\u002Fautonomous-driving-lane-departure-warning](https:\u002F\u002Fgithub.com\u002FJunshengFu\u002Fautonomous-driving-lane-departure-warning)：\n* [calibration.py](calibration.py) 包含校准相机并保存校准结果的脚本\n* [lane.py](model.h5) 包含车道类\n* [examples](examples) 文件夹中包含示例图像和视频\n\n\n#### 2. 依赖项与开发环境\n\n我使用 Anaconda 来管理我的【**依赖项**】(https:\u002F\u002Fgithub.com\u002Fudacity\u002FCarND-Term1-Starter-Kit)。\n* 您可以使用提供的 [environment-gpu.yml](environment-gpu.yml) 来安装依赖项。\n* OpenCV3、Python3.5、TensorFlow、CUDA8  \n* 操作系统：Ubuntu 16.04\n\n#### 3. 如何运行代码\n\n(1) 下载 YOLO 的权重文件\n\n您可以从[这里](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F0B5WIzrIVeL0WS3N2VklTVmstelE\u002Fview?usp=sharing&resourcekey=0-QkNPlJWkA9QsD6dHAmHXRw)下载权重文件，并将其保存到 [weights](weights) 文件夹中。\n\n(2) 如果您想运行演示，只需执行：\n```sh\npython main.py\n```\n\n#### 4. 版本历史\n\n* 0.1.1\n    * 修复了两个小 bug 并更新了文档\n    * 日期：2017年4月18日\n\n* 0.1.0\n    * 第一个正式版本\n    * 日期：2017年3月31日\n\n---\n\n### **两种方法：线性 SVM 对比神经网络**\n\n### 1. 线性 SVM 方法\n`svm_pipeline.py` 包含 SVM 流水线的代码。\n\n**步骤：**\n\n* 对带有标签的训练图像集进行方向梯度直方图（HOG）特征提取，并训练一个线性 SVM 分类器。\n* 对图像应用颜色变换，将量化后的颜色特征以及颜色直方图附加到 HOG 特征向量中。\n* 归一化特征，并随机划分训练集和测试集。\n* 实现滑动窗口技术，使用 SVM 分类器在图像中搜索车辆。\n* 在视频流上运行流水线，逐帧生成重复检测的热力图，以剔除异常值并跟踪已检测到的车辆。\n* 为检测到的车辆估计边界框。\n\n[\u002F\u002F]: # (图片引用)\n[image1]: .\u002Fexamples\u002Fcar_not_car.png\n[image2]: .\u002Fexamples\u002Fhog_1.png\n[image2-1]: .\u002Fexamples\u002Fhog_2.png\n[image3]: .\u002Fexamples\u002Fsearch_windows.png\n[image4]: .\u002Fexamples\u002Fheat_map1.png\n[image5]: .\u002Fexamples\u002Fheat_map2.png\n[image6]: .\u002Fexamples\u002Flabels_map.png\n[image7]: .\u002Fexamples\u002Fsvn_1.png\n[image8]: .\u002Fexamples\u002Fyolo_1.png\n[image_yolo1]: .\u002Fexamples\u002Fyolo1.png\n[image_yolo2]: .\u002Fexamples\u002Fyolo2.png\n[video1]: .\u002Fproject_video.mp4\n[demo1_gif]: .\u002Fexamples\u002Fdemo1.gif\n[demo2_gif]: .\u002Fexamples\u002Fdemo2.gif\n\n#### 1.1 从训练图像中提取方向梯度直方图（HOG）\n此步骤的代码包含在名为 `extract_features` 的函数中，位于 `svm_pipeline.py` 的第 464 至 552 行。\n如果 SVM 分类器已经存在，则直接加载它。\n\n否则，我首先读取所有“车辆”和“非车辆”图像，每类约 8000 张。这些数据集由 [GTI 车辆图像数据库](http:\u002F\u002Fwww.gti.ssr.upm.es\u002Fdata\u002FVehicle_database.html) 和 [KITTI 视觉基准套件](http:\u002F\u002Fwww.cvlibs.net\u002Fdatasets\u002Fkitti\u002F) 提供。以下是“车辆”和“非车辆”类别的各一张示例：\n\n![alt text][image1]\n\n\n随后，我探索了不同的颜色空间以及 `skimage.hog()` 的不同参数（方向数、每个单元格的像素数和每个块的单元格数）。我从两类中随机选取了一些图像并显示出来，以便了解 `skimage.hog()` 输出的样子。\n\n以下是一个使用 RGB 颜色空间，且 HOG 参数为 `orientations=9`、`pixels_per_cell=(8, 8)` 和 `cells_per_block=(2, 2)` 的示例：\n\n![alt text][image2]\n![alt text][image2-1]\n \n为了优化 HOG 提取，我**仅对整张图像提取一次 HOG 特征**，然后将整个 HOG 图像保存下来以供后续处理。（参见 `svm_pipeline.py` 第 319 至 321 行）\n\n#### 1.2 最终选定的 HOG 参数、空间特征和颜色直方图\n\n我尝试了多种参数组合，并最终选择了如下组合（参见 `svm_pipeline.py` 第 16 至 27 行）：\n* YCrCb 颜色空间\n* orient = 9  # HOG 方向数\n* pix_per_cell = 8 # 每个单元格的像素数\n* cell_per_block = 2 # 每个块的单元格数，可处理阴影等问题\n* hog_channel = \"ALL\" # 可选 0、1、2 或 \"ALL\"\n* spatial_size = (32, 32) # 空间分箱的尺寸\n* hist_bins = 32    # 直方图的箱数\n* spatial_feat = True # 是否启用空间特征\n* hist_feat = True # 是否启用颜色直方图特征\n* hog_feat = True # 是否启用 HOG 特征\n\n所有特征均在 `svm_pipeline.py` 第 511 至 513 行进行**归一化**处理，这是至关重要的一步。否则，分类器可能会对权重较高的特征产生偏差。\n#### 1.3 如何训练分类器\n我随机选择 20% 的图像作为测试集，其余用于训练，并使用线性 SVM 作为分类器（参见 `svm_pipeline.py` 第 520 至 531 行）。\n\n#### 1.4 滑动窗口搜索\n对于这种基于 SVM 的方法，我使用两种尺度的搜索窗口（64x64 和 128x128，参见第 41 行），并且只在 y 轴的 [400, 656] 范围内进行搜索（参见 `svm_pipeline.py` 第 32 行）。我为每个尺度的搜索窗口设置了 75% 的重叠率（参见 `svm_pipeline.py` 第 314 行）。\n\n对于每一个窗口，使用 SVM 分类器预测其中是否包含车辆。如果是，则保存该窗口（参见 `svm_pipeline.py` 第 361 至 366 行）。最终，我们得到一个包含检测到的车辆窗口的列表。\n\n![alt text][image3]\n\n#### 1.5 创建检测到的车辆热力图\n在获得可能包含车辆的窗口列表后，使用名为 `generate_heatmap` 的函数（位于 `svm_pipeline.py` 第 565 行）生成热力图，然后通过阈值过滤掉误报。\n\n![heatmap][image4]\n![heatmap][image5]\n\n#### 1.6 图像与视频实现\n**对于图像**，我们可以直接利用过滤后的热力图结果来绘制检测到的车辆的边界框。\n\n**对于视频**，我们还可以进一步利用相邻帧来过滤误报，并平滑边界框的位置。\n* 累积前 N 帧的热力图。\n* 为前 N 帧赋予权重：较早的帧权重较小（参见 `svm_pipeline.py` 第 398 至 399 行）。\n* 然后应用阈值，并使用 `scipy.ndimage.measurements.label()` 来识别热力图中的各个斑块。\n* 假设每个斑块对应一辆车，构建边界框以覆盖每个检测到的斑块区域。\n\n\n#### 测试图像示例\n\n![alt text][image7]\n\n---\n\n\n### 2. 神经网络方法（YOLO）\n`yolo_pipeline.py` 包含 YOLO 流水线的代码。\n\n[YOLO](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1506.02640.pdf) 是一种基于神经网络的目标检测流水线。与以往使用分类器进行目标检测的工作不同，YOLO 将目标检测视为一个回归问题，直接预测空间分离的边界框及其对应的类别概率。单个神经网络可以在一次推理中直接从完整图像中预测边界框和类别概率。由于整个检测流水线是一个单一的网络，因此可以针对检测性能进行端到端优化。\n\n![alt text][image_yolo2]\n\n使用 YOLO 进行检测的步骤：\n* 将输入图像调整为 448x448 大小。\n* 对图像运行单个卷积神经网络。\n* 根据模型的置信度阈值筛选检测结果。\n\n![alt text][image_yolo1]\n\n`yolo_pipeline.py` 是基于这个 [YOLO 的 TensorFlow 实现](https:\u002F\u002Fgithub.com\u002Fgliese581gg\u002FYOLO_tensorflow) 修改和集成的。由于 YOLO 已知“车辆”这一类别，我直接使用预计算的权重，并将其应用于整个输入帧。\n\n#### 测试图像示例\n![alt text][image8]\n\n---\n\n### 讨论\n对于基于支持向量机的方法，准确率不错，但速度较慢（2帧\u002F秒），这是由于滑动窗口策略本身较为耗时所致。我们可以通过图像下采样、多线程处理或使用GPU加速来提升速度。不过，要实现实时运行，可能还需要进行大量的工程化工作。此外，在这个应用场景中，我限制了垂直方向的搜索范围，以控制搜索窗口的数量，并避免一些误检（例如将树上的车辆误判为目标）。\n\n对于基于YOLO的方法，它能够达到实时性，且准确率也相当令人满意。不过，在某些情况下，可能会漏检远处的小型车缩略图。我的直觉是，原始输入图像的分辨率为1280×720，而模型需要将其缩放到448×448，因此远处的车辆在缩放后的图像中会变得非常小，并且可能出现较大的形变。为了更准确地识别远处的车辆，我们可以考虑对图像进行裁剪而非直接下采样，或者重新训练网络。","# Vehicle Detection 快速上手指南\n\n本指南旨在帮助开发者快速部署并运行基于单目摄像头的车辆检测系统。该项目提供了两种检测方案：传统的线性 SVM（滑动窗口）和基于深度学习的 YOLO 神经网络。\n\n## 环境准备\n\n在开始之前，请确保你的开发环境满足以下要求：\n\n*   **操作系统**: Ubuntu 16.04 (推荐) 或其他 Linux 发行版\n*   **编程语言**: Python 3.5+\n*   **核心依赖**:\n    *   OpenCV 3\n    *   TensorFlow\n    *   CUDA 8 (如需 GPU 加速)\n*   **包管理工具**: Anaconda (强烈推荐使用 Conda 管理依赖)\n\n> **注意**：本项目依赖较多，建议使用项目提供的 `environment-gpu.yml` 文件来构建隔离环境，以避免版本冲突。\n\n## 安装步骤\n\n### 1. 克隆项目\n首先获取源代码：\n```bash\ngit clone \u003Crepository_url>\ncd vehicle-detection\n```\n\n### 2. 创建 Conda 环境\n使用项目提供的配置文件安装所有必要的依赖包。如果你拥有支持 CUDA 的 GPU，请使用 GPU 版本配置：\n\n```bash\nconda env create -f environment-gpu.yml\n```\n\n激活环境：\n```bash\nconda activate carnd-term1\n# 或者根据 yml 文件中定义的实际名称激活\n```\n\n### 3. 下载 YOLO 权重文件\n若需使用 YOLO 神经网络方案，必须预先下载训练好的权重文件。\n\n*   **下载地址**: [Google Drive Link](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F0B5WIzrIVeL0WS3N2VklTVmstelE\u002Fview?usp=sharing&resourcekey=0-QkNPlJWkA9QsD6dHAmHXRw)\n*   **存放路径**: 将下载的文件放入项目根目录下的 `weights` 文件夹中。\n\n> **国内加速提示**: 如果无法访问 Google Drive，可尝试使用国内镜像站或第三方加速工具下载该文件。\n\n## 基本使用\n\n项目包含两个主要的检测流水线脚本：\n*   `svm_pipeline.py`: 基于 HOG 特征和线性 SVM 的传统检测方法。\n*   `yolo_pipeline.py`: 基于 YOLO 深度神经网络的实时检测方法。\n\n### 运行演示 Demo\n\n最简单的运行方式是执行主程序 `main.py`，它将加载默认配置并运行演示视频。\n\n```bash\npython main.py\n```\n\n### 自定义运行\n\n如果你想单独测试某种算法或处理特定视频，可以直接调用对应的管道脚本。例如，仅运行 YOLO 检测：\n\n```bash\npython yolo_pipeline.py\n```\n\n或者运行 SVM 检测流程：\n\n```bash\npython svm_pipeline.py\n```\n\n### 输出说明\n程序运行后，将在控制台输出检测日志，并生成带有车辆标注框（Bounding Box）的视频文件或图像序列。\n*   **SVM 方案**: 速度较慢（约 2 FPS），适合离线分析或对实时性要求不高的场景。\n*   **YOLO 方案**: 可实现实时检测，精度较高，但在远距离小目标检测上可能受限于输入分辨率缩放。","某自动驾驶初创团队正在开发城市道路辅助驾驶系统，急需在单目摄像头方案中实现高可靠性的实时车辆感知。\n\n### 没有 vehicle-detection 时\n- **误报率极高**：传统图像处理难以区分阴影、路牌与真实车辆，导致系统频繁发出错误警报，干扰驾驶员判断。\n- **检测速度滞后**：人工编写的滑动窗口搜索算法计算量巨大，在高清视频流中无法维持实时帧率，造成感知延迟。\n- **环境适应性差**：缺乏深度学习模型的泛化能力，一旦遇到夜间、雨天或复杂城市背景，检测效果急剧下降甚至失效。\n- **开发周期漫长**：团队需从零构建特征提取（如 HOG）到分类器训练的全流程，耗费数周时间调试参数且效果不稳定。\n\n### 使用 vehicle-detection 后\n- **精准识别目标**：利用 YOLO 深度神经网络或优化的 SVM+HOG 流水线，能准确框选车辆并过滤背景噪声，大幅降低误报。\n- **实时流畅运行**：预置的高效推理管道在 GPU 加速下可处理高清视频流，确保车道偏离预警等功能的毫秒级响应。\n- **鲁棒性显著增强**：基于大规模数据集（如 KITTI）训练的模型，在城市拥堵、光照变化等复杂场景下依然保持高检出率。\n- **快速落地部署**：直接复用成熟的 `yolo_pipeline.py` 或 `svm_pipeline.py` 代码模块，将核心感知功能的开发时间从数周缩短至数天。\n\nvehicle-detection 通过提供双轨并行的成熟检测方案，帮助团队以最低成本突破了自动驾驶感知系统的实时性与准确性瓶颈。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FJunshengFu_vehicle-detection_0ccc93ee.png","JunshengFu","Junsheng Fu","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FJunshengFu_43424241.png","Technical Expert at Zenseact\r\n","Zenseact","Gothenburg, Sweden","junsheng.fu@yahoo.com",null,"junshengfu.github.io","https:\u002F\u002Fgithub.com\u002FJunshengFu",[25],{"name":26,"color":27,"percentage":28},"Python","#3572A5",100,676,243,"2026-03-19T06:15:13","GPL-3.0",4,"Linux (Ubuntu 16.04)","需要 NVIDIA GPU (用于 TensorFlow GPU 版本)，需安装 CUDA 8","未说明",{"notes":38,"python":39,"dependencies":40},"建议使用 Anaconda 管理依赖，可通过提供的 environment-gpu.yml 文件安装。运行 YOLO 模型前需手动下载权重文件并保存至 weights 文件夹。该项目包含两种检测方案：基于线性 SVM 的滑动窗口方法（速度较慢，约 2fps）和基于 YOLO 的深度学习的方法（可实现实时检测）。","3.5",[41,42,43,44,45],"opencv3","tensorflow","scikit-learn (SVM)","scipy","numpy",[47],"图像",[6,49,50],"svm","yolov1",2,"ready","2026-03-27T02:49:30.150509","2026-04-08T17:36:24.339416",[],[],[58,70,78,86,95,104],{"id":59,"name":60,"github_repo":61,"description_zh":62,"stars":63,"difficulty_score":64,"last_commit_at":65,"category_tags":66,"status":52},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[67,68,47,69],"Agent","开发框架","数据工具",{"id":71,"name":72,"github_repo":73,"description_zh":74,"stars":75,"difficulty_score":64,"last_commit_at":76,"category_tags":77,"status":52},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[68,47,67],{"id":79,"name":80,"github_repo":81,"description_zh":82,"stars":83,"difficulty_score":51,"last_commit_at":84,"category_tags":85,"status":52},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[68,47,67],{"id":87,"name":88,"github_repo":89,"description_zh":90,"stars":91,"difficulty_score":64,"last_commit_at":92,"category_tags":93,"status":52},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[94,47,67,68],"语言模型",{"id":96,"name":97,"github_repo":98,"description_zh":99,"stars":100,"difficulty_score":64,"last_commit_at":101,"category_tags":102,"status":52},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[68,47,67,103],"视频",{"id":105,"name":106,"github_repo":107,"description_zh":108,"stars":109,"difficulty_score":51,"last_commit_at":110,"category_tags":111,"status":52},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",85013,"2026-04-06T11:09:19",[47,69,103,112,67,113,94,68,114],"插件","其他","音频"]