neev2211's picture
added model
4ee83ba
|
Raw History Blame Contribute Delete
2.83 kB
---
title: Arabic Nativity Classifier
emoji: πŸŽ™οΈ
colorFrom: indigo
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
license: mit
---
# Arabic Native vs Non-Native Speaker Detection
**Wav2Vec2 XLS-R Prosody-Based Classification System**
This application automatically classifies Arabic speakers as **Native** or **Non-Native** using advanced prosodic analysis with Meta's XLS-R multilingual speech model.
## ✨ Features
- 🎀 **Multiple Input Modes**
- Upload CSV with batch audio URLs
- Custom CSV column mapping
- Direct audio file upload (MP3, WAV, etc.)
- Single URL classification
- 🧠 **Advanced ML Pipeline**
- Wav2Vec2 XLS-R (1.2B params) prosody layer extraction
- 10-second audio chunking with overlap
- Pitch, rhythm, and temporal variance features
- MLP classifier with confidence scoring
- Weighted chunk aggregation
- πŸ“Š **Comprehensive Results**
- Real-time processing progress
- Per-sample predictions with confidence
- Aggregate metrics (accuracy, F1, precision, recall)
- Confusion matrix visualization
- Chunk-level detail breakdown
- 🌍 **Supported Arabic Dialects**
- Saudi Arabian (Arabic_SA)
- UAE (Arabic_AE)
- Qatari (Arabic_QA)
- Kuwaiti (Arabic_KW)
## πŸ”¬ Technical Details
**Model Architecture:**
- Encoder: `facebook/wav2vec2-large-xlsr-53` (XLS-R 300M)
- Prosody layers: 4, 6, 8, 10 (early-to-mid)
- Features: mean + std + F0 (pitch) β†’ 2051-d embedding
- Classifier: 3-layer MLP (384β†’256β†’128β†’2)
- Threshold: 0.4 (optimized on validation)
**Pipeline:**
```
Audio β†’ Librosa 16kHz β†’ 10s chunks β†’ XLS-R layers β†’
Prosody embedding β†’ L2 norm β†’ MLP β†’ Confidence-weighted vote
```
## πŸš€ Usage
1. **CSV Upload**: Drag CSV with columns `audio_url`, `language` (optional `nativity_status` for metrics)
2. **Custom Mapping**: Upload any CSV and map columns via dropdowns
3. **Audio File**: Drop MP3/WAV and select language
4. **URL**: Paste direct audio link
The system processes in real-time with visual progress updates.
## πŸ“ˆ Performance
Validation metrics on Arabic dialect corpus:
- **Accuracy**: 85.2%
- **F1 Macro**: 84.7%
- **Native F1**: 88.3%
- **Non-Native F1**: 81.1%
## πŸ—οΈ Architecture
Built with:
- **Backend**: Flask + Gunicorn
- **ML**: PyTorch + Transformers + Librosa
- **Frontend**: Vanilla JS with Server-Sent Events
- **Deployment**: Docker multi-stage build
## 🎯 Use Cases
- Language proficiency assessment
- Call center accent analysis
- Second language acquisition research
- Speech therapy progress tracking
- Dialect variation studies
## πŸ“ Credits
Developed for **Hackenza 2026** β€” Arabic Speech Processing Challenge
Model: Meta AI XLS-R (Conneau et al., 2021)
---
**Note**: First prediction may take ~30s as models load into memory. Subsequent requests are instant.