A robust pipeline for multiclass audio event detection using deep learning. The system classifies audio into four classes:
- 🔫 Gunshot
- 🚗 Vehicle
- 🪓 Wood_Cutting
- ✅ NonThreat
It includes real-time alerting logic (e.g., via LoRa) and deployment-ready TensorFlow Lite models for edge devices.
org_dataset/
├── Gunshot/
│ ├── file1.wav
│ └── ...
├── Vehicle/
│ ├── file1.wav
│ └── ...
├── Wood_Cutting/
│ ├── file1.wav
│ └── ...
└── NonThreat/
├── file1.wav
└── ...
- Format: .wav files per class
- Holdout Set: A separate folder (e.g.,
realtest/) with test samples from each class
- 📊 EDA: Class distribution visualization and spectrogram previews
- 🧹 Preprocessing: Converts audio to log-mel spectrograms; ready for CNN input
- 🧠 Model:
- Data augmentation
- Batch normalization
- Dropout
- L2 regularization
- 🏋️ Training:
- Early stopping
- Learning rate reduction
- Checkpointing best model
- ✅ Evaluation: Confusion matrix & classification report
- 🛠️ Deployment: Converted to TFLite for edge inference
git clone https://github.com/yourusername/audio-event-detection.git
cd audio-event-detectionpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- tensorflow
- librosa
- numpy
- matplotlib
- scikit-learn
- Place your dataset in the structure mentioned above
- Update dataset paths in the scripts if needed
- Class Names: Update the
class_nameslist in scripts for custom classes - Alert Logic: Modify
send_lora_alert()intflite_inference_lora.py - Paths: Update dataset/model paths as per your directory setup
ConvBlock x3 (Conv2D → BatchNorm → MaxPooling)
↓
Data Augmentation (random translation, zoom)
↓
GlobalAveragePooling2D
↓
Dense Layer → Dropout
↓
Output Layer (Softmax)📸 Refer to cnn_model_architecture.png for a diagrammatic view.
- Validation Accuracy: ~96% on holdout set
- Evaluation Metrics: Confusion Matrix, Classification Report (from
test_holdout.py)
- Model File:
multiclass_model.tflite(~122 KB) - Deploy to: Raspberry Pi, microcontrollers, IoT devices
- Real-Time Detection: Included example with alerting logic
Built with 💡 using TensorFlow, Librosa, and open-source tools.