Phearith commited on
Commit
ceccb67
·
1 Parent(s): 4f5acff

Initial commit: YOLOv8 traffic sign detection model

Browse files
Files changed (3) hide show
  1. README.md +124 -1
  2. best_yolov8m.pt +3 -0
  3. data.yaml +47 -0
README.md CHANGED
@@ -1,3 +1,126 @@
 
 
 
 
1
  ---
2
- license: mit
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Traffic Sign Detection Model
2
+
3
+ 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).
4
+
5
  ---
6
+
7
+ ## It suitable for :
8
+ - **Computer Vision Learning**
9
+ - **Academic and research projects**
10
+ - **Autonomous driving prototypes**
11
+
12
  ---
13
+
14
+ ## Model Details
15
+
16
+ - **Model type:** YOLO / PyTorch
17
+ - **Task:** Object detection (traffic signs)
18
+ - **Dataset:** German Traffic Sign Recognition Benchmarks
19
+ - **Input:** Images (RGB)
20
+ - **Output:** Bounding boxes + class labels
21
+ - **Framework:** PyTorch
22
+ - **License:** MIT
23
+
24
+ ---
25
+
26
+ ## Dataset
27
+ 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',
28
+ 'RoadNarrowRight', 'RoadWork', 'TrafficSignals', 'Pedestrians', 'ChildrenCrossing','BicyclesCrossing', 'AheadOnly', 'WildAnimals', 'TurnLeftAhead'
29
+
30
+ ---
31
+
32
+ ## Repository Structure
33
+ traffic_sign_model/
34
+ ├── model.pt # Model training
35
+ ├── config.yaml # Model configuration
36
+ ├── README.md # Documentation
37
+
38
+
39
+ ---
40
+ ## Install dependencies
41
+
42
+ ```bash
43
+ python -m venv venv
44
+ venv\Scripts\activate
45
+ source venv/bin/activate
46
+ pip install ultralytics
47
+ pip install opencv-python
48
+ pip install huggingface_hub
49
+ ```
50
+ ---
51
+ ## Loading the model
52
+ ```bash
53
+ model = YOLO("yolov8m.pt")
54
+ results = model.train(
55
+ data="/kaggle/input/traffic-sign-detection/dataset/data.yaml",
56
+ epochs=50,
57
+ imgsz=1280,
58
+ batch=10,
59
+ mixup=0.1,
60
+ copy_paste=0.15,
61
+ amp=True,
62
+ workers=2,
63
+ patience=15,
64
+ name="yolov8m_traffic_1280"
65
+ )
66
+ ```
67
+
68
+ ## Image Detection
69
+ ```bash
70
+ import cv2
71
+ from ultralytics import YOLO
72
+
73
+ model = YOLO("./traffic_sign_model/best_yolov8m.pt")
74
+
75
+ image = cv2.imread("./image.png")
76
+
77
+ results = model(image)
78
+
79
+ annotated_frame = results[0].plot()
80
+
81
+ cv2.imshow("YOLOv8 Detection Results", annotated_frame)
82
+ cv2.waitKey(0)
83
+ cv2.destroyAllWindows()
84
+
85
+ ```
86
+ ## Real-Time Camera Detection
87
+ ```bash
88
+ from ultralytics import YOLO
89
+ import cv2
90
+
91
+ model = YOLO("./traffic_sign_model/best_yolov8m.pt")
92
+ cap = cv2.VideoCapture(0)
93
+ if not cap.isOpened():
94
+ print("Cannot open the webcame")
95
+ exit()
96
+
97
+ while True:
98
+ ret, frame = cap.read()
99
+ if not ret:
100
+ break
101
+
102
+ results = model.predict(source=frame, conf=0.6)
103
+ annotated_frame = results[0].plot()
104
+
105
+ cv2.imshow("YOLO webcame test", annotated_frame)
106
+
107
+ if cv2.waitKey(1) & 0xFF == ord('q'):
108
+ break
109
+ cap.release()
110
+ cv2.destroyAllWindows()
111
+ ```
112
+
113
+ ---
114
+ ## References
115
+ [1] Ultralytics, "YOLO Documentation," [Online]. Available: https://docs.ultralytics.com/. [Accessed: Dec. 16, 2025].
116
+
117
+ [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
118
+
119
+ [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
120
+
121
+ [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
122
+
123
+ [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
124
+
125
+ [6] Kaggle, "German Traffic Sign Recognition Benchmark (GTSRB) Dataset," 2019. [Online]. Available: https://www.kaggle.com/datasets/meowmeowmeowmeowmeow/gtsrb-german-traffic
126
+
best_yolov8m.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd2b7646f31b5e1600e3d24ba27241925ed648908853d216a43b0892c1850392
3
+ size 52045522
data.yaml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Path to dataset images
3
+ path: /kaggle/input/traffic-sign-detection/dataset
4
+ train: ./images/train/
5
+ val: ./images/val/
6
+ test: ./images/test
7
+
8
+ # Number of classes
9
+ nc: 33
10
+
11
+ # Class names (GTSRB-style example list you can adjust if needed)
12
+ names:
13
+ [
14
+ 'TurnRightAhead',
15
+ 'NoPassingTrucks',
16
+ 'DangerousCurveLeft',
17
+ 'Yield',
18
+ 'SpeedLimit60',
19
+ 'EndNoPassingByTrucks',
20
+ 'EndNoPassing',
21
+ 'RoundaboutMandatory',
22
+ 'KeepLeft',
23
+ 'NoPassing',
24
+ 'KeepRight',
25
+ 'RightOfWayCrossing',
26
+ 'PriorityRoad',
27
+ 'GoStraightOrLeft',
28
+ 'Stop',
29
+ 'NoVehicles',
30
+ 'VehiclesOver3.5TonsProhibited',
31
+ 'NoEntry',
32
+ 'GeneralCaution',
33
+ 'GoStraightOrRight',
34
+ 'DangerousCurveRight',
35
+ 'DoubleCurve',
36
+ 'BumpyRoad',
37
+ 'SlipperyRoad',
38
+ 'RoadNarrowRight',
39
+ 'RoadWork',
40
+ 'TrafficSignals',
41
+ 'Pedestrians',
42
+ 'ChildrenCrossing',
43
+ 'BicyclesCrossing',
44
+ 'AheadOnly',
45
+ 'WildAnimals',
46
+ 'TurnLeftAhead'
47
+ ]