How bits-bytes-nn/sound-anomaly-detection-with-autoencoders works
Project type and purpose
• This is a machine-learning research/data-analysis project for unsupervised anomaly detection on industrial machine sounds (based on the MIMII dataset).
• It uses exploratory data analysis (EDA) and trains two model classes—autoencoders (AE) and variational autoencoders (VAE)—to spot anomalous audio patterns.
File structure
• Top level:
• exploratory_data_analysis.ipynb
• modeling_with_ae.ipynb
• modeling_with_vae.ipynb
• z3_modeling_with_autoencoders-Copy1.ipynb
• img/ (static results and figures)
• utils/ (reusable Python modules)
• utils/ modules:
• sound_utils.py (audio ingestion & preprocessing)
• measuring_performance.py (performance metrics & confusion/ROC)
• misc.py (helper functions, threshold searches)
• No web/frontend or database—this is purely a local/compute pipeline running in Jupyter.
README for additional insights
• Contains rich visual artifacts for each pipeline stage: waveform → STFT → spectrogram → mel-spectrogram → multi-frame batching.
• Shows downstream results: loss curves, reconstruction‐error distributions, threshold tuning, confusion matrices, ROC/PR curves.
• References external dataset and baseline repos; implies that data ingestion is from a local MIMII snapshot.
a. Main components:
1. Data Ingestion & Storage
2. Audio Preprocessing (sound_utils.py)
3. Feature Extraction (STFT, mel-spectrogram frames)
4. Dataset Module (batch framing code in misc.py)
5. Model Training & Validation
– AE (modeling_with_ae.ipynb)
– VAE (modeling_with_vae.ipynb)
6. Performance Measurement (measuring_performance.py)
7. Visualization & Reporting (img/ outputs, notebook plots)
b. Relationships / data flow:
• Raw WAV files → preprocessing → feature tensors → train/test splits → model training → reconstruction errors → threshold search → performance metrics → final visualizations.
• Notebooks orchestrate pipeline steps, calling functions from utils/.
c. Architectural patterns:
• Modular pipeline: clear separation of concerns (preprocessing vs. modeling vs. evaluation).
• Notebook-driven orchestration—each notebook encapsulates a stage.
• Utility library (utils/) shared across notebooks.
d. Key technologies/frameworks:
• Python 3.x, Jupyter
• librosa (audio transforms)
• numpy / scipy / pandas
• PyTorch or TensorFlow/Keras (unsupervised models)
• Matplotlib/Seaborn (visualizations)
Essential architectural elements
• Every notebook as a separate component, linked to the shared utils library.
• MIMII dataset as an external dependency/provider.
• Detail the two parallel model-training branches (AE vs. VAE) converging into the performance module.
• Feedback loop of threshold tuning back into performance measurement.