From acoustic recordings to explainable UAV propeller fault detection.
AeroSense is a full-stack deep learning system for detecting UAV propeller mechanical damage from acoustic recordings.
The system combines two complementary trained PyTorch models:
- CNN classifier β identifies known propeller-damage classes.
- Convolutional autoencoder β detects acoustic anomalies through reconstruction error.
- Decision engine β combines model outputs into
NORMAL,ANOMALY, orUNKNOWN_ANOMALY. - Grad-CAM β provides frequency/time attribution from the classifier's actual gradients.
- FastAPI backend β exposes the complete inference and analytics pipeline.
- React + TypeScript frontend β provides analysis, diagnostics, history, analytics, and model monitoring.
All inference results are produced by real trained models. The application does not use simulated predictions or placeholder model outputs.
| Component | Result |
|---|---|
| CNN Test Accuracy | 96.0% |
| CNN Macro F1 | 0.961 |
| Autoencoder Test F1 | 0.928 |
| Autoencoder ROC-AUC | 0.909 |
| CNN Parameters | 106,148 |
| Autoencoder Parameters | 51,041 |
| Held-out Test Segments | 3,114 |
| Automated Tests | 38 passing |
A conventional classifier can force an abnormal acoustic signal into one of its known classes even when the signal does not confidently match anything seen during training.
AeroSense uses two complementary models:
Acoustic Recording
β
βΌ
Audio Preprocessing
β
βΌ
Log-Mel Spectrogram
β
βββββββββββββ΄ββββββββββββ
βΌ βΌ
CNN Classifier Autoencoder
β β
Fault + Confidence Reconstruction
Error
β β
βββββββββββββ¬ββββββββββββ
βΌ
Decision Engine
β
ββββββββββββββββΌβββββββββββββββ
βΌ βΌ βΌ
NORMAL ANOMALY UNKNOWN
ANOMALY
β
βΌ
Grad-CAM
β
βΌ
Diagnostic Report
This allows the system to distinguish between a known fault and an acoustically abnormal signal that does not confidently match a known fault class.
The trained models are exposed through a FastAPI backend and consumed by a React + TypeScript frontend.
The dashboard provides:
- Live model status
- Detection statistics
- Anomaly trends
- Fault distribution
- Recent predictions
The analysis workflow provides:
- Drag-and-drop WAV upload
- Audio metadata
- Real waveform visualization
- Context fields
- Live inference state
- CNN classification
- Classification confidence
- Autoencoder anomaly score
- Severity assessment
- Grad-CAM explanation
- Searchable prediction history
- Status filtering
- Device filtering
- Pagination
- Prediction details
Each prediction can be inspected through an engineering-style report containing:
- Signal information
- Predicted fault
- Confidence
- Anomaly score
- Severity
- Model attribution
- Frequency range
- Time range
- Device/environment metadata
The analytics dashboard exposes real backend aggregate data including:
- Total predictions
- Normal/anomalous distribution
- Fault distribution
- Anomaly trends
The Models page displays metadata for the models that are actually trained and active.
Untrained CRNN/Transformer architectures are not presented as deployed models.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β React + TypeScript β
β β
β Dashboard β Analyze β History β Analytics β Models β Detail β
ββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
REST / JSON
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FastAPI β
β β
β Validation β Preprocessing β Inference β Analytics β DB β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ¬ββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββ ββββββββββββββββββββ
β CNN Classifier β β Autoencoder β
β β β β
β Known faults β β Anomaly score β
βββββββββ¬βββββββββ ββββββββββ¬ββββββββββ
β β
βββββββββββββ¬βββββββββββββ
βΌ
ββββββββββββββββββ
β Decision Engineβ
βββββββββ¬βββββββββ
β
βββββββββββΌββββββββββ
βΌ βΌ βΌ
NORMAL ANOMALY UNKNOWN
ANOMALY
β
βΌ
ββββββββββββββββ
β Grad-CAM β
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β SQLite DB β
ββββββββββββββββ
Raw WAV
β
βΌ
16 kHz Mono
β
βΌ
2.0s Windows / 1.0s Hop
β
βΌ
Peak Normalization
β
βΌ
64-band Log-Mel Spectrogram
β
βΌ
Train-Split Standardization
β
βΌ
(1, 64, 126) Tensor
β
ββββββββββββββββββββββββ
βΌ βΌ
CNN Classifier Autoencoder
β β
βΌ βΌ
Fault Class Reconstruction
Confidence Error
β β
βββββββββββββ¬βββββββββββ
βΌ
Decision Engine
β
βΌ
Grad-CAM + Report
Preprocessing is implemented once in:
common/audio_features.py
common/config.py
The same implementation is used by training and inference to prevent train/inference preprocessing skew.
Source: TII UAV Propeller Anomaly Audio Dataset
Technology Innovation Institute, ICASSP 2022.
| Property | Value |
|---|---|
| Classes | normal, 1_broken, 2_broken, 3_4_broken |
| Recordings | 293 |
| Normal recordings | 78 |
1_broken recordings |
72 |
2_broken recordings |
71 |
3_4_broken recordings |
72 |
| Sample rate | 16 kHz |
| Channels | Mono |
| Format | 16-bit PCM WAV |
| Total audio | ~5.7 hours |
| Generated segments | 18,569 |
The dataset represents propeller damage severity.
It does not contain bearing faults, motor faults, or fixed-wing aircraft engine faults.
AeroSense performs the split at the recording level, rather than randomly splitting individual segments.
This prevents overlapping or adjacent segments from the same flight recording from appearing in multiple splits.
| Split | Segments |
|---|---|
| Train | 12,835 |
| Validation | 2,620 |
| Test | 3,114 |
| Total | 18,569 |
Standardization statistics are calculated using the training split only and reused during inference.
Stored in:
models/feature_stats.json
Each recording follows the same preprocessing pipeline:
WAV
β
βββ Resample β 16 kHz
βββ Convert β Mono
βββ Segment β 2.0 s windows / 1.0 s hop
βββ Peak normalize
βββ Log-Mel Spectrogram
β βββ n_mels = 64
β βββ n_fft = 1024
β βββ hop = 256
β βββ fmin = 20 Hz
β βββ fmax = 8000 Hz
β
βββ Train-split standardization
β
βΌ
(1, 64, 126)
Applied only to training data:
- Gaussian noise
- Random amplitude gain
- Circular time shifting
- Frequency masking
- Time masking
This prevents augmented samples from contaminating validation or test evaluation.
Conv2D
β
BatchNorm
β
ReLU
β
MaxPool
β
Conv2D
β
BatchNorm
β
ReLU
β
MaxPool
β
Conv2D
β
BatchNorm
β
ReLU
β
MaxPool
β
Conv2D
β
BatchNorm
β
ReLU
β
MaxPool
β
Global Average Pool
β
FC 128 β 64
β
FC 64 β 4
Parameters: 106,148
Classes:
normal
1_broken
2_broken
3_4_broken
The model is intentionally compact for the available CPU-only training environment and the relatively small number of source recordings.
Input Spectrogram
β
βΌ
Strided Conv Encoder
β
βΌ
32-D Latent Space
β
βΌ
Transposed Conv Decoder
β
βΌ
Reconstructed Spectrogram
Parameters: 51,041
The autoencoder is trained only on normal acoustic samples.
At inference:
Anomaly Score = Reconstruction MSE
A high reconstruction error indicates that the acoustic pattern differs from the normal training distribution.
Both training pipelines use:
- Adam optimizer
ReduceLROnPlateau- Early stopping
- Best-checkpoint selection
- Fixed random seed (
42) - Class-balanced cross-entropy for the CNN
- Checkpointed/resumable training
Training scripts:
training/
βββ dataset.py
βββ prepare_dataset.py
βββ train_cnn.py
βββ train_autoencoder.py
Training metadata is stored in:
models/
βββ cnn_training_log.json
βββ cnn_trainer_state.json
βββ autoencoder_training_log.json
βββ autoencoder_trainer_state.json
All reported metrics are from the held-out test split.
| Metric | Result |
|---|---|
| Accuracy | 96.0% |
| Macro F1 | 0.961 |
| Validation Macro F1 | 0.947 |
| Parameters | 106,148 |
| Average CPU inference | ~2.6 ms/segment |
predicted
normal 1_brk 2_brk 3_4_brk
true normal 808 0 1 9
1_broken 0 658 14 5
2_broken 3 7 762 31
3_4_broken 0 1 53 762
The primary confusion occurs between 2_broken and 3_4_broken, the two
adjacent damage-severity classes.
Evaluation artifact:
evaluation/results/cnn_confusion_matrix.png
The anomaly threshold is fitted using the validation set and then evaluated once on the held-out test set.
| Metric | Result |
|---|---|
| Threshold | 0.02494 |
| Precision | 0.920 |
| Recall | 0.936 |
| F1 | 0.928 |
| ROC-AUC | 0.909 |
Evaluation artifact:
evaluation/results/autoencoder_roc.png
The decision engine combines the outputs of both trained models.
Reconstruction error is below the fitted anomaly threshold and the classifier does not confidently identify a known fault.
Reconstruction error exceeds the threshold and the classifier confidently identifies a known fault.
Reconstruction error exceeds the threshold, but the classifier is not confident enough to assign a known fault class.
Known fault
β
βββ Classifier confident
β
βΌ
ANOMALY
Acoustically abnormal
β
βββ Classifier uncertain
β
βΌ
UNKNOWN_ANOMALY
The system therefore avoids forcing every abnormal signal into one of the known training classes.
AeroSense implements real Grad-CAM over the CNN's final convolutional layer.
For each analyzed recording, the backend can return:
- Grad-CAM heatmap
- Mel-spectrogram overlay
- Important frequency range
- Important time range
The attribution is computed from the trained model's actual gradients on the actual input recording.
It is not hardcoded or templated.
Implementation:
backend/app/services/explainability_service.py
The backend is built using:
- FastAPI
- Pydantic
- SQLAlchemy
- SQLite
- Uvicorn
- PyTorch
Audio Validation
β
Preprocessing
β
Model Loading
β
CNN + Autoencoder Inference
β
Decision Engine
β
Grad-CAM
β
Persistence
β
Analytics
Models are loaded through a shared model loader and reused across requests.
Base URL:
http://localhost:8000/api/v1
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
API health |
GET |
/health/model |
Model availability |
POST |
/audio/upload |
Validate/probe audio |
POST |
/audio/analyze |
Run complete inference |
GET |
/predictions |
List predictions |
GET |
/predictions/{id} |
Retrieve prediction |
DELETE |
/predictions/{id} |
Delete prediction |
GET |
/models |
Model metadata |
GET |
/models/active |
Active model versions |
GET |
/analytics/summary |
Aggregate statistics |
GET |
/analytics/fault-distribution |
Fault distribution |
GET |
/analytics/anomaly-trend |
Anomaly trends |
Swagger:
http://localhost:8000/docs
ReDoc:
http://localhost:8000/redoc
The frontend is built with:
- React
- TypeScript
- Vite
- Recharts
- Web Audio API
frontend/src/
βββ api/
β βββ client.ts
β βββ endpoints.ts
β βββ types.ts
β
βββ components/
β βββ analyze/
β βββ background/
β βββ charts/
β βββ gradcam/
β βββ layout/
β βββ ui/
β βββ waveform/
β
βββ hooks/
βββ pages/
β βββ DashboardPage.tsx
β βββ AnalyzePage.tsx
β βββ HistoryPage.tsx
β βββ PredictionDetailPage.tsx
β βββ AnalyticsPage.tsx
β βββ ModelsPage.tsx
β
βββ styles/
βββ utils/
The frontend communicates with the real /api/v1/* backend routes and does
not contain simulated inference data.
AeroSense/
β
βββ backend/
β βββ app/
β βββ api/
β β βββ routes/
β βββ core/
β βββ db/
β βββ ml/
β β βββ models/
β βββ schemas/
β βββ services/
β βββ utils/
β
βββ frontend/
β βββ src/
β βββ api/
β βββ components/
β βββ hooks/
β βββ pages/
β βββ styles/
β βββ utils/
β
βββ common/
β βββ audio_features.py
β βββ config.py
β
βββ training/
β βββ dataset.py
β βββ prepare_dataset.py
β βββ train_cnn.py
β βββ train_autoencoder.py
β
βββ evaluation/
β βββ evaluate.py
β βββ results/
β
βββ models/
β βββ aerosense_cnn_v1.pt
β βββ aerosense_autoencoder_v1.pt
β βββ feature_stats.json
β βββ registry.json
β
βββ data/
β βββ processed/
β
βββ tests/
β
βββ Dockerfile
βββ requirements.txt
βββ .env.example
βββ README.md
python -m venv .venv
.venv\Scripts\activatepython3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtWindows PowerShell:
Copy-Item .env.example .envLinux/macOS:
cp .env.example .envFrom the project root:
$env:PYTHONPATH=".;backend"
uvicorn backend.app.main:app --reload --port 8000Or:
cd backend
$env:PYTHONPATH=".;.."
uvicorn app.main:app --reload --port 8000Backend:
http://localhost:8000
Open a second terminal:
cd frontend
npm install
npm run devFrontend:
http://localhost:5173
The repository contains the complete training pipeline.
git clone https://github.com/tiiuae/UAV-Propeller-Anomaly-Audio-Dataset.gitPlace the dataset under:
data/raw/
python -m training.prepare_datasetpython -m training.train_cnn \
--epochs 12 \
--batch-size 32 \
--patience 3 \
--resume \
--time-budget-seconds 1200The training process supports resumable checkpoints.
python -m training.train_autoencoder \
--epochs 15 \
--batch-size 32 \
--patience 4 \
--resume \
--time-budget-seconds 1200python -m evaluation.evaluateResults are written to:
evaluation/results/
Run:
python -m pytest tests/ -vCurrent test suite:
38 tests β all passing.
Coverage includes:
- Audio validation
- Preprocessing
- Model architecture
- Model loading
- Decision engine
- Real inference pipeline
- Model-unavailable behavior
- Health endpoints
- Grad-CAM API behavior
- Backend integration
The inference integration tests use the actual trained checkpoints rather than mocked model outputs.
Build:
docker build -t aerosense-backend .Run:
docker run -p 8000:8000 aerosense-backendThe Docker image includes the trained model checkpoints required for inference.
The raw training dataset is excluded because it is only required for retraining.
The deployed model metadata is maintained in:
models/registry.json
The registry records information such as:
- Model name
- Version
- Architecture
- Training metadata
- Feature configuration
- Active status
- Anomaly threshold
This prevents the frontend/backend from presenting untrained architectures as active production models.
AeroSense is a working research/engineering prototype. Its limitations are explicit.
The real dataset contains:
normal
1_broken
2_broken
3_4_broken
These represent propeller-damage severity.
The system is not currently a general-purpose detector for bearing, motor, or aircraft-engine faults.
CRNN and Transformer architectures were not trained to convergence in the available CPU-only environment.
They are therefore not reported as trained models.
The dataset consists of indoor UAV recordings.
Generalization to:
- Outdoor environments
- Different UAV platforms
- Different microphones
- Different acoustic environments
has not yet been established.
Training includes noise augmentation, but a dedicated controlled SNR robustness study has not yet been completed.
MLflow is not currently integrated.
Training metadata is stored using structured JSON logs and checkpoints.
The current application processes uploaded audio recordings.
Continuous microphone streaming is not currently implemented.
- Train and benchmark CRNN architecture
- Train and benchmark Transformer architecture
- Controlled SNR/noise robustness experiments
- Expand the dataset with motor and bearing fault recordings
- Outdoor UAV testing
- Multi-UAV domain evaluation
- Microphone/domain adaptation
- Embedding-space unknown-anomaly detection
- Continuous microphone inference
- Background inference workers
- Experiment tracking
- Production deployment
- Edge-device optimization
- Python
- PyTorch
- NumPy
- SciPy
- Librosa
- scikit-learn
- FastAPI
- Pydantic
- SQLAlchemy
- SQLite
- Uvicorn
- React
- TypeScript
- Vite
- Recharts
- Web Audio API
- Pytest
- Docker
- Git
- GitHub
- REST APIs
- OpenAPI / Swagger
| Component | Status |
|---|---|
| Real UAV acoustic dataset | β |
| Leakage-safe preprocessing | β |
| CNN classifier | β Trained |
| CNN evaluation | β |
| Autoencoder | β Trained |
| Anomaly threshold fitting | β |
| Unknown anomaly decision engine | β |
| Grad-CAM explainability | β |
| FastAPI backend | β |
| Database persistence | β |
| Analytics API | β |
| React frontend | β |
| Real API integration | β |
| Automated tests | β 38 passing |
| Docker support | β |
| CRNN | β³ Future work |
| Transformer | β³ Future work |
| Continuous audio streaming | β³ Future work |
AeroSense uses the:
TII UAV Propeller Anomaly Audio Dataset
Technology Innovation Institute, ICASSP 2022.
Dataset repository:
https://github.com/tiiuae/UAV-Propeller-Anomaly-Audio-Dataset
Refer to the upstream repository for dataset licensing and attribution requirements.