Audora is an end-to-end educational and diagnostic application designed to show how a Convolutional Neural Network (CNN) processes, abstracts, and classifies audio signals. The system takes raw audio files, converts them into 2D Mel Spectrograms, feeds them through a custom residual convolutional network, and visualizes both the intermediate feature activation maps and the final predictions.
The codebase is split into two primary components:
- Core Deep Learning & Inference Serverless Backend (
model.py,train.py,main.py) powered by PyTorch, Torchaudio, and Modal. - Interactive Visualizer Frontend (
audio-cnn-visualization/) built using Next.js (TypeScript, React, Tailwind CSS, shadcn/ui).
-
Audio Standardization:
- Multi-channel inputs are average-mixed to mono.
- Inputs are resampled to 44,100 Hz.
-
Feature Extraction:
- The waveform is transformed into a Mel Spectrogram using a sample rate of 22,050 Hz, FFT window size of 1024, hop length of 512, and 128 Mel bands.
- Sound pressure levels are converted to decibels (
AmplitudeToDB).
-
Activation Visualization:
- For an intermediate layer output of shape
[batch_size, channels, height, width], the server calculates the mean across the channel dimension:$$A(x, y) = \frac{1}{C}\sum_{c=1}^{C} F(c, x, y)$$ where $A(x, y)$ is the aggregated 2D activation intensity at coordinates $(x, y)$, $C$ is the channel count, and $F(c, x, y)$ is the feature map activation at channel $c$. - This down-samples high-dimensional features into a singular 2D grid per block, mapping relative activation intensities directly to CSS color scales.
- For an intermediate layer output of shape
- Python 3.10+
- Node.js v18+ and
npm - A Modal account (for model training and inference hosting)
Install the local dependencies (preferably in a virtual environment):
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtAuthenticate with Modal:
modal setupTo run model training on the Modal cloud:
modal run train.pyThis downloads the ESC-50 dataset directly into the cloud volume, runs training for 100 epochs using an A10G GPU, logs results via TensorBoard, and saves the best model checkpoint to the esc-model Modal volume.
To deploy the inference server:
modal deploy main.pyThis exposes a production-ready HTTP POST endpoint.
Navigate to the frontend application:
cd audio-cnn-visualizationInstall packages:
npm installStart the local development server:
npm run dev- Dataset: ESC-50 (Environmental Sound Classification, 2000 5-second recordings).
- Architecture: Deep Residual CNN (customized ResNet).
-
Optimization: AdamW optimizer (
$lr=0.0005$ , weight decay$= 0.01$ ), OneCycleLR scheduler ($max_lr = 0.002$ ), Label Smoothing (0.1) on Cross-Entropy Loss. - Augmentations: Time & Frequency masking (SpecAugment) + Mixup ($Beta(0.2, 0.2)$).
- Target Metric: Validation accuracy evaluated on Fold 5 (standard out-of-fold benchmark).