Case Study: Classifying Urban Noise with Machine Learning and Deep Learning
Comparing Random Forest, SVM and a lightweight CNN for recognising car horns, jackhammers and sirens — the CNN reached 97.1% accuracy. Published at IEEE Smart Mobility 2026.
- deep learning
- cnn
- audio
- smart cities
- ieee
A noise meter can tell you that a street is loud. It cannot tell you why. This project asks whether a small, efficient model can listen to a short clip and name the source — a car horn, a jackhammer or a siren — so a city can respond to the right problem. I led the work with Maryam Alblooshi and Khalid Elgazzar, and it was published at the 2026 IEEE International Conference on Smart Mobility.
- 97.1%
- CNN test accuracy — best of the three models
- 3
- Models compared: Random Forest, SVM, CNN
- 210
- Balanced audio clips, 70 per class
- 3
- Sound classes: car horn, jackhammer, siren
- 23
- Hand-crafted features for the classical models
- 128 × 64
- Mel-spectrogram input for the CNN
Why classify noise, not just measure it
Long-term exposure to environmental noise is linked by the World Health Organization to heart disease, poor sleep and reduced concentration, and cities like Dubai are growing quickly. Traditional monitoring reports a single loudness level, which mixes every source together. Knowing what is making the noise — traffic, construction or emergency vehicles — is what lets a city target the right fix, and it is the job a network of smart acoustic sensors needs to do automatically.
The data
The study uses UrbanSound8K, a public benchmark of 8,732 labelled clips of up to four seconds across ten everyday city sounds. We picked three sources that are common in traffic and very different acoustically, and took a balanced sample of 70 clips from each so no class could dominate. The small, balanced set deliberately mimics what a low-power street sensor would be trained on. Clips were split 80/20 into training and test sets with a fixed random seed so the results can be reproduced.
The three sound classes
| Class | Typical source | What makes it recognisable |
|---|---|---|
| Car horn | Traffic | Short, tonal bursts with strong harmonics |
| Jackhammer | Construction | Repetitive impacts spread across a wide band of frequencies |
| Siren | Emergency vehicles | A tone that sweeps up and down in pitch |
Two ways to describe a sound
Classical models need a sound turned into a short list of numbers, while a CNN can learn directly from an image of the sound. We built one representation for each.
Input features per model
| Random Forest & SVM | CNN | |
|---|---|---|
| Representation | 23-number feature vector | Mel-spectrogram image |
| Contents | 20 MFCCs, Chroma, Spectral Centroid, Spectral Rolloff | 128 mel frequency bands converted to decibels |
| Size | 23 values per clip | 128 × 64 per clip |
| Scaling | Standardised to zero mean, unit variance | Normalised per clip |
End-to-end pipeline
One audio clip goes down two paths: hand-crafted features for the classical models, and a mel-spectrogram image for the CNN. All three models are scored the same way.
Audio signal
Input clip from UrbanSound8K
Pre-processing
Noise reduction, normalisation, framing and windowing
Feature extraction
MFCCs, Chroma, spectral features
Mel-spectrogram
128 mel bands, 128 × 64 frames
Classification models
Random Forest
SVM
CNN
Evaluation & results
Accuracy, precision, recall, F1, confusion matrix
- 1
Load and trim the audio
Read each clip with Librosa at its native sample rate and keep a short window; corrupted files are dropped.
- 2
Extract features
Compute the 23 hand-crafted features for the classical models and the mel-spectrogram for the CNN.
- 3
Train three classifiers
Random Forest, an RBF-kernel SVM and a lightweight two-block CNN, all with a fixed seed of 42.
- 4
Evaluate on held-out clips
Compare accuracy, per-class precision, recall and F1, and confusion matrices on clips the models never saw.
- 5
Try it live
A Gradio demo in the notebook classifies any uploaded .wav file with each of the three models.
Model settings
As described in the paper. The CNN was kept small on purpose so it could run on an edge device.
| Model | Configuration |
|---|---|
| Random Forest | 150 trees, max depth 20, min samples split 4 |
| SVM | RBF kernel, C = 10, γ = scale |
| CNN | 2 conv blocks (16 and 32 filters, 3×3, ReLU, 2×2 max-pool) → 64-unit dense layer, 40% dropout → 3-class softmax; Adam, batch size 32 |
Results
Test accuracy by model
Accuracy on the held-out test clips, as reported in the paper.
- CNN97.1
- Random Forest91.4
- SVM88.6
Bar length = % accuracy
The CNN came out on top at 97.1%. Learning features directly from the spectrogram captured patterns — such as the sweep of a siren — that a fixed list of averages smooths away. The Random Forest was a strong runner-up at 91.4% with a macro F1 of 0.92, and it is far cheaper to run, which makes it attractive for very constrained hardware. The SVM, at 88.6%, struggled most where classes overlap.
Where the models get it right — and wrong
Confusion matrices from the saved notebook run on the held-out test clips (14 car horn, 8 jackhammer, 13 siren). Hammer = jackhammer.
Random Forest
32 of 35 correct
CNN
34 of 35 correct
Rows = actual class, columns = predicted class. The diagonal holds correct predictions; darker cells hold a larger share of that row. Hover a cell for details.
Per-class scores
Precision, recall and F1 from the same notebook run.
| Model | Class | Precision | Recall | F1 |
|---|---|---|---|---|
| Random Forest | Car horn | 0.93 | 0.93 | 0.93 |
| Random Forest | Jackhammer | 0.89 | 1.00 | 0.94 |
| Random Forest | Siren | 0.92 | 0.85 | 0.88 |
| CNN | Car horn | 1.00 | 1.00 | 1.00 |
| CNN | Jackhammer | 0.89 | 1.00 | 0.94 |
| CNN | Siren | 1.00 | 0.92 | 0.96 |
Limitations
- The models were trained and tested on a small, balanced subset of three classes, so the results may not carry over to all ten UrbanSound8K classes.
- A single hold-out split was used instead of the dataset's ten cross-validation folds.
- No data augmentation was applied, and with so little data the very high CNN accuracy may partly reflect overfitting.
What I learned
A small CNN can beat carefully engineered features even on a tiny dataset — but a strong classical baseline is what makes that result meaningful, and the Random Forest stays a practical choice when every milliwatt counts. The honest next steps are clear: train on all ten classes, use the official cross-validation folds, add augmentation such as time-shifting and background noise, and test the model on a real street-level sensor in Dubai.
Tools
| Area | Tools |
|---|---|
| Audio processing | Librosa |
| Classical models | scikit-learn (Random Forest, SVM) |
| Deep learning | TensorFlow / Keras |
| Analysis | pandas, NumPy, Matplotlib, Seaborn |
| Demo | Gradio |
Citation
N. Nour, M. Alblooshi and K. Elgazzar, “Urban Noise Monitoring and Classification Using Machine Learning and Deep Learning,” 2026 IEEE International Conference on Smart Mobility (SM), Al Alamein City, Egypt, 2026. DOI: 10.1109/SM69703.2026.11614142.