File size: 4,327 Bytes
ceccb67 4f5acff ceccb67 4f5acff ceccb67 946a0ec ceccb67 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | # Traffic Sign Detection Model
This repository contains a deep learning model for **traffic sign detection**. The model is trained to detect and classify traffic signs in real-time, suitable for applications like autonomous driving and advanced driver assistance systems (ADAS).
---
## It suitable for :
- **Computer Vision Learning**
- **Academic and research projects**
- **Autonomous driving prototypes**
---
## Model Details
- **Model type:** YOLO / PyTorch
- **Task:** Object detection (traffic signs)
- **Dataset:** German Traffic Sign Recognition Benchmarks
- **Input:** Images (RGB)
- **Output:** Bounding boxes + class labels
- **Framework:** PyTorch
- **License:** MIT
---
## Dataset
The model was train on German Traffic Sign Recognition Benchmarks (GTSRB) that contain 43 class include with all the images and the all the label. And we filter some sign on the GTSRB and the overall of the filtering contain 33 class. There are 'TurnRightAhead', 'NoPassingTrucks', 'DangerousCurveLeft', 'Yield', 'SpeedLimit60' 'EndNoPassingByTrucks', 'EndNoPassing', 'RoundaboutMandatory', 'KeepLeft', 'NoPassing','KeepRight', 'RightOfWayCrossing', 'PriorityRoad', 'GoStraightOrLeft', 'Stop', 'NoVehicles', 'VehiclesOver3.5TonsProhibited', 'NoEntry', 'GeneralCaution','GoStraightOrRight', 'DangerousCurveRight', 'DoubleCurve', 'BumpyRoad', 'SlipperyRoad',
'RoadNarrowRight', 'RoadWork', 'TrafficSignals', 'Pedestrians', 'ChildrenCrossing','BicyclesCrossing', 'AheadOnly', 'WildAnimals', 'TurnLeftAhead'
---
## Repository Structure
traffic_sign_model/
βββ model.pt # Model training
βββ config.yaml # Model configuration
βββ README.md # Documentation
---
## Install dependencies
```bash
python -m venv venv
venv\Scripts\activate
source venv/bin/activate
pip install ultralytics
pip install opencv-python
pip install huggingface_hub
```
---
## Loading the model
```bash
model = YOLO("yolov8m.pt")
results = model.train(
data="/kaggle/input/traffic-sign-detection/dataset/data.yaml",
epochs=30,
imgsz=1280,
batch=10,
mixup=0.1,
copy_paste=0.15,
amp=True,
workers=2,
patience=15,
name="yolov8m_traffic_1280"
)
```
## Image Detection
```bash
import cv2
from ultralytics import YOLO
model = YOLO("./traffic_sign_model/best_yolov8m.pt")
image = cv2.imread("./image.png")
results = model(image)
annotated_frame = results[0].plot()
cv2.imshow("YOLOv8 Detection Results", annotated_frame)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
## Real-Time Camera Detection
```bash
from ultralytics import YOLO
import cv2
model = YOLO("./traffic_sign_model/best_yolov8m.pt")
cap = cv2.VideoCapture(0)
if not cap.isOpened():
print("Cannot open the webcame")
exit()
while True:
ret, frame = cap.read()
if not ret:
break
results = model.predict(source=frame, conf=0.6)
annotated_frame = results[0].plot()
cv2.imshow("YOLO webcame test", annotated_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
```
---
## References
[1] Ultralytics, "YOLO Documentation," [Online]. Available: https://docs.ultralytics.com/. [Accessed: Dec. 16, 2025].
[2] R. Kumar, A. Gupta, and D. Rajeswari, "Traffic Sign Detection Using YOLOv8," TIUTIC Journal, vol. 7, Art. no. 10, 2019. [Online]. Available: https://tiutic.org/pdf/volume/Vol_7/Vol7_Article_10.pdf
[3] M. Serna and A. Ruichek, "Traffic Signs Classification by Deep Learning for Advanced Driving Assistance Systems," 2019. [Online]. Available: https://www.researchgate.net/publication/335006038
[4] Y. Wu, Y. Tian, and J. Liu, "Traffic Sign Detection Based on Convolutional Neural Networks," 2013. [Online]. Available: https://xlhu.cn/papers/Wu13.pdf
[5] A. Bochkovskiy, C. Y. Wang, and H. Y. M. Liao, "The Mapillary Traffic Sign Dataset for Detection and Classification on a Global Scale," in Proc. European Conf. on Computer Vision (ECCV), 2020. [Online]. Available: https://www.ecva.net/papers/eccv_2020/papers_ECCV/papers/123680069.pdf
[6] Kaggle, "German Traffic Sign Recognition Benchmark (GTSRB) Dataset," 2019. [Online]. Available: https://www.kaggle.com/datasets/meowmeowmeowmeowmeow/gtsrb-german-traffic
|