Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: bert-base-multilingual-cased
|
| 3 |
+
tags:
|
| 4 |
+
- persian-nlp
|
| 5 |
+
- text-classification
|
| 6 |
+
- traffic-crash-detection
|
| 7 |
+
- crash-type-classification
|
| 8 |
+
- bert
|
| 9 |
+
- information-extraction
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
language:
|
| 12 |
+
- fa
|
| 13 |
+
pipeline_tag: text-classification
|
| 14 |
+
inference: false
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# BERT-Crashtype-Classification
|
| 18 |
+
|
| 19 |
+
**Fine-tuned BERT for classifying Persian social media texts into 9 crash types.**
|
| 20 |
+
|
| 21 |
+
📄 **Paper:** [Extracting traffic crash information from social media: an LLM-based approach](https://doi.org/10.1080/19427867.2026.2681104) – *Transportation Letters* (2026)
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## 🎯 What it does
|
| 26 |
+
Classifies a given Persian social media text into one of **9 types of traffic crashes**.
|
| 27 |
+
|
| 28 |
+
### 🏷️ Crash Types (9 Classes)
|
| 29 |
+
1. `vehicle with two-wheeled vehicle`
|
| 30 |
+
2. `Two-wheeled vehicle–pedestrian`
|
| 31 |
+
3. `vehicle with fixed object or ran off road`
|
| 32 |
+
4. `rollover or fall`
|
| 33 |
+
5. `multiple car`
|
| 34 |
+
6. `vehicle–animal`
|
| 35 |
+
7. `vehicle–pedestrian`
|
| 36 |
+
8. `vehicle with single other vehicle`
|
| 37 |
+
9. `two-wheeled vehicle with two-wheeled vehicle`
|
| 38 |
+
|
| 39 |
+
## ⚙️ Fine-tuning
|
| 40 |
+
- **Base Model:** `bert-base-multilingual-cased`
|
| 41 |
+
- **Data:** Proprietary Persian social media crash dataset (Damavand County, Iran)
|
| 42 |
+
|
| 43 |
+
## 📊 Performance
|
| 44 |
+
| Task | Metric | Score |
|
| 45 |
+
|------|--------|-------|
|
| 46 |
+
| Crash Type Classification (9 classes) | Accuracy | **89.7%** |
|
| 47 |
+
|
| 48 |
+
## 🚀 Quick Start
|
| 49 |
+
```python
|
| 50 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 51 |
+
|
| 52 |
+
model = AutoModelForSequenceClassification.from_pretrained("crash-information-extraction/BERT-Crashtype-Classification")
|
| 53 |
+
tokenizer = AutoTokenizer.from_pretrained("crash-information-extraction/BERT-Crashtype-Classification")
|
| 54 |
+
|
| 55 |
+
text = "تصادف دو خودرو در اتوبان"
|
| 56 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 57 |
+
outputs = model(**inputs)
|
| 58 |
+
predicted_class = outputs.logits.argmax().item()
|
| 59 |
+
# predicted_class is an integer from 0 to 8
|