-
Dataset: Vietnam Traffic Signs
-
The model is based on YOLOv8-medium architecture
-
This project is designed with strong potential for future development and improvement.
-
This shit is so peak
Traffic-Sign-Detection/
│
├── src/
│ ├── core/
│ │ └── utils.py
│ │
│ ├── training/
│ │ ├── train.py
│ │ └── config.py
│ │
│ ├── weight/
│ │ └── all_weight/
│ │ ├── trainX
│ │ │ ├── best.pt
│ │ │ └── last.pt
│ │ │
│ │ └── yolov8m.pt
│ │
│ ├── pipeline/
│ │ ├── predict.py
│ │ ├── real_time_predict.py
│ │ ├── real_time_predict_smooth_advanced.py
│ │ └── real_time_predict_nlp_hybrid.py
│ │
│ └── sort.py
│
├── data/
│ ├── dataset/
│ ├── input/
│ ├── output/
│ └── real_time_output/
│
├── assets/
├── runs/
├── .env
├── requirements.txt
└── README.md
git clone https://github.com/HoanBuCon/Traffic-Sign-Detection
cd Traffic-Sign-Detectionpython -m venv venv
# Activate virtual environment
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windowspip install -r requirements.txt- Dataset layout (YOLO format):
- Images:
dataset/images/train,dataset/images/val,dataset/images/test - Labels:
dataset/labels/train,dataset/labels/val,dataset/labels/test
- Images:
- If your images/labels are flat under
dataset/, split into train/val:# From repo root python -m src.split_dataset - Dataset YAML (auto-detected):
- Preferred:
data/dataset/data.yaml(current setup) - Fallbacks:
data/data.yaml, then repo-rootdata.yaml - Override via env var:
$env:DATA_YAML = "data/dataset/data.yaml"
- Preferred:
- Folders are auto-created at runtime; no manual setup needed:
input/(for your images),output/(predictions underoutput/predictX/{images,json}),real_time_output/(saved videos),all_weight/(trained weights organized astrainX/).
- Place any test images you want to run in
input/.
- Instead of retraining the model from scratch, you can use our pre-trained YOLOv8 weights trained on a 12-class traffic sign dataset available here:
- 👉 Download Pre-trained Weight (Google Drive)
.\Traffic-Sign-Detection\weight\all_weight:
Traffic-Sign-Detection/
└── src/
└── weight/
├── all_weight/ ← (PLACE HERE)
│ └── trainX
│ ├── best.pt
│ └── last.pt
│
└── yolov8m.pt
data.yaml file in the correct path as specified in section 4️⃣ Prepare dataset and config, and paste the following content:
- 📁 Path:
.\Traffic-Sign-Detection\data\dataset\data.yaml
Traffic-Sign-Detection/
└── data/
└── dataset/
└── data.yaml ← (PLACE HERE)
- 📄
data.yaml
train: ./train/images
val: ./val/images
test: ./test/images
nc: 12
names: ['i.423.b', 'p.102', 'p.106.b', 'p.130', 'p.131.a', 'r.308.b', 'sus', 'w.201.a', 'w.203.c', 'w.207.b', 'w.207.c', 'w.209']
descriptions: [
'Đường kẻ dành cho người đi bộ', # i.423.b
'Cấm đi ngược chiều', # p.102
'Cấm xe tải trên N tấn', # p.106.b
'Cấm dừng và đỗ xe', # p.130
'Cấm đỗ xe', # p.131.a
'Tuyến đường cầu vượt cắt qua', # r.308.b
'TEXT SIGN', # sus
'Cảnh báo khúc cua nguy hiểm bên trái', # w.201.a
'Cảnh báo đường hẹp', # w.203.c
'Cảnh báo giao nhau với đường không ưu tiên bên phải', # w.207.b
'Cảnh báo giao nhau với đường không ưu tiên bên trái', # w.207.c
'Cảnh báo đến khu vực đèn tín hiệu giao thông' # w.209
]
roboflow:
workspace: traffic-sign-detection-hzj9m
project: traffic-sign-detection-e1j1v
version: 4
license: CC BY 4.0
url: https://universe.roboflow.com/traffic-sign-detection-hzj9m/traffic-sign-detection-e1j1v/dataset/4- Ensure you have a valid dataset YAML. The project auto-detects in this order:
data/dataset/data.yamlor.yml, thendata/data.yamlor.yml, then repo root. You can override with env varDATA_YAML. - Open Terminal and run this script from the repo root using module mode:
python -m src.training.train- Place the traffic signs images you want to detect into the 📁
inputfolder:.\Traffic-Sign-Detection\data\input - Open Terminal and run the detection script from the repo root:
python -m src.pipeline.predict- Open Terminal and run the script for basic real-time detection:
python -m src.pipeline.real_time_predict- Make sure you have placed
sort.pyin thesrcdirectory. - Open Terminal and run the script for advanced real-time detection with SORT:
python -m src.pipeline.real_time_predict_smooth_advanced-
This option enables real-time traffic sign detection combined with NLP-based semantic analysis using the Vintern model hosted on Hugging Face.
-
⚙️ Setup Instructions
-
Create a
.envfile in the project’s root directory. -
Go to Hugging Face Tokens and generate a new Access Token.
-
Add your token to the
.envfile as follows:HF_TOKEN=your_huggingface_token_here
- Open Terminal and run the script for advanced real-time detection with NLP Model:
python -m src.pipeline.real_time_predict_nlp_hybrid- Detected images:
.\Traffic-Sign-Detection\data\output - Detected videos:
.\Traffic-Sign-Detection\data\real_time_output - Trained weights:
.\Traffic-Sign-Detection\weight\all_weight
- Thank you for checking out our project! Feel free to explore, improve, or contribute 🚀
|
|
Project Report (PDF) |
|
|
Project Report (Word) |
|
|
Project Presentation (PPTX) |