How akarifrites/moodeng_is_cute works
Project’s Type and Purpose
• This project is a full-scale baseline system for an acoustic scene classification challenge. Its purpose is to train and evaluate low-complexity deep learning models that classify audio recordings under resource constraints.
• It is built with PyTorch and PyTorch Lightning, makes use of Weights & Biases for logging and experiment tracking, and includes tools for model export to ONNX and quantization.
File Structure
• Data & Dataset: The folder “dataset” (specifically dataset/dcase24.py) and “split_setup” CSV files define how the input audio data is organized, along with external dataset preparation.
• Model Components: The “models” directory is home to different network definitions – “baseline.py”, “baseline_devices.py”, “mel.py”, “mobilenet.py” – representing the neural network architectures.
• Training and Inference: Scripts such as “run_training.py”, “run_training_devices.py”, “run_inference2.py”, and “recording2.py” indicate separate pipelines for training, device-specific training, inference, and even recording-based tests.
• Checkpoints and Logs: Checkpoints are stored in directories like “DCASE24_Task1” and “lightning_logs”. Additionally, “wandb” folders track experiments.
• ONNX and Quantization: The “onnx_runtime” and “quantization” folders contain scripts for exporting the model to ONNX (with both dynamic and static quantized versions), testing ONNX, and performing quantization operations.
• Helpers and Utilities: The “helpers” folder contains utility functions (including ones related to NeSsi) that aid with parameter counting and other support tasks.
Core Components and Their Relationships
a. Data Preparation and Loading:
• Data Ingestion: The repository expects a dataset (audio files and meta-information) to be placed in a specified directory. The “dataset/dcase24.py” module handles this.
• Data Splitting: “split_setup” contains CSV files (split5.csv, split100.csv, etc.) which define the training splits.
b. Model Definition and Architecture:
• The “models” directory defines the baseline network. There is an emphasis on low-complexity architecture (with detailed parameter and MAC calculations shown in the README).
• Separate versions (e.g., baseline and mobilenet) may be defined for variations including channel-specific processing when addressing device variations.
c. Training Pipeline:
• The training loop is implemented using PyTorch Lightning (see “run_training.py” and “run_training_devices.py”), which integrates checkpoints (saved in “DCASE24_Task1” and “lightning_logs”) and logging to Weights & Biases (under “wandb”).
d. Inference and Evaluation:
• Inference scripts (e.g., “run_inference2.py”, “tools/model_infer.py”) process data post-training to generate predictions and evaluation metrics which are stored under the “predictions” folder.
e. Export and Quantization:
• Conversion of the trained model to 16-bit and even 8-bit precision is handled via the “quantization” and “onnx_runtime” folders. Here, scripts like “export_to_onnx.py” and “quantize.py” perform model export and optimization.
f. Experiment Tracking and Logging:
• The use of Weights & Biases is evident by the “wandb” directory structure, which captures logs, configurations, and training artifacts.