urbanecho
A ML classifier which predicts urban sound types from .wav files
671
This project regualarly maintained in Github. So please check out UrbanEcho GitHub Repoβ .
UrbanEcho is a web-based audio classification project that predicts urban sound types from .wav files. It is built with Python, scikit-learn, and Flask, and uses a RandomizedSearchCV-tuned ML pipeline trained on tabular audio features extracted from the UrbanSound8K dataset.
.wav audio file uploads via a simple web interface.Upload Page:

Prediction Result Page:

UrbanEcho/
βββ datasets/ # Datasets used for training
β βββ extracted_audio_features.csv
βββ models/ # .pkl files go here
β βββ feature_names.pkl # Not included with the repo
β βββ pipe.pkl # Not included with the repo
βββ static/ # Static files for the web app
β βββ uploads/
β βββ style.css
βββ templates/ # HTML code for front-end
β βββ index.html
β βββ result.html
βββ utils/ # Utility code for feature engineering
β βββ feature_extractor.py
βββ app.py # Flask app
βββ fit.py # Python script for training the model
βββ requirements.txt # Libraries required for this project
βββ research.ipynb # Notebook used for testing, visualization and many more
git clone https://github.com/yourusername/UrbanEcho.git
cd UrbanEcho
pip install -r requirements.txt
python app.py
.wav file and hit PredictThis is my first project where I have implemented Docker containerization. I have created a Dockerhub repositoryβ where I have pushed the docker container.
The container is built on both ARM64 and AMD64 architectures, so that it can run on almost all major computers. You can run the app easily by using the Dockerhub Image. Here's how you can do it:
Install Docker Desktopβ and sign-in
Open Terminal and run this:
docker pull bytebard101/urbanecho:latest
docker run --rm -p 5000:5000 bytebard101/urbanecho:latest
port 5000 free, you need to run in a different port. Try to run this:docker run --rm -p 5001:5000 bytebard101/urbanecho:latest
If you followed Step 2 and the command ran successfully, then DO NOT follow this step.
Check Docker Documentationβ to learn more about Docker and it's commands.
Classification report on test set:
| Class | Precision | Recall | F1-score | Support |
|---|---|---|---|---|
| 0 (air_conditioner) | 0.94 | 0.97 | 0.96 | 334 |
| 1 (car_horn) | 0.91 | 0.83 | 0.87 | 143 |
| 2 (children_playing) | 0.80 | 0.87 | 0.84 | 328 |
| 3 (dog_bark) | 0.88 | 0.84 | 0.86 | 326 |
| 4 (drilling) | 0.94 | 0.91 | 0.93 | 333 |
| 5 (engine_idling) | 0.95 | 0.95 | 0.95 | 333 |
| 6 (gun_shot) | 0.99 | 0.84 | 0.91 | 125 |
| 7 (jackhammer) | 0.91 | 0.99 | 0.95 | 334 |
| 8 (siren) | 0.94 | 0.93 | 0.94 | 307 |
| 9 (street_music) | 0.85 | 0.83 | 0.84 | 329 |
| Accuracy / Weighted avg | 0.91 | 0.91 | 0.91 | 2892 |
Single .wav predictions can show messy probabilities due to PCA and class overlap.
Model is trained on tabular features, not raw audio β deep learning could improve predictions significantly.
If models/pipe.pkl or models/feature_names.pkl are deleted, the app will retrain the model automatically (may take a few minutes).
Because of the lack of extra contributors and my lack of front-end expertise, I had to use AI tools (mostly LLM services like ChatGPTβ’, Grokβ’, Geminiβ’) in order to create a sophisticated front end for the web app. The HTML and CSS were written by those tools.
The static/style.css file is currently blank. I have used <style/> tag and inline method in HTML files to generate the style. It will be updated in future if needed.
Sakib ( ByteBard58 )
Student | Aspiring Computer Engineer | AI & ML Enthusiast
π GitHub Profile: ByteBard58β
Thank you for taking the time to review my work. I hope you enjoyed it and found it intriguing. It would mean a lot to me if you could star it on GitHub. π If you would like to contribute to this repository, please do so. It will be a great help!
If you have any questions, suggestions, or anything else youβd like to discuss, please donβt hesitate to reach out. You can find my contact information on my GitHub profile pageβ . Iβm all ears! π
Have a great day!
Content type
Image
Digest
sha256:858036ef3β¦
Size
1.3 GB
Last updated
6 months ago
docker pull bytebard101/urbanecho