# 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