How gikexe/is_drone_or_not works
1. What this repository does
- This is an end-to-end audio classification pipeline for detecting whether a recording contains a drone or not.
- The project is organized as a local, file-based workflow: raw audio datasets are prepared, calibrated, converted into spectrograms, and then used to train a model.
2. Primary data source boundary
- data_sources.py is the central place where dataset locations are configured.
- The README specifies the expected on-disk layout: dataset/(train and val)/(drone and no_drone).
- This means the repo is not tightly coupled to a single dataset format; the main requirement is a folder hierarchy with class-separated audio files.
3. Calibration stage
- calibrate.py is the first processing step after pointing the system at the dataset.
- Its role appears to be extracting calibration values from the raw audio collection, and the README explicitly says those results are then copied into spectrogram.py.
- Architecturally, this is a parameter-estimation boundary: raw data is analyzed once to derive constants used later in feature generation.
4. Spectrogram generation stage
- spectrogram.py is the feature-engineering layer.
- It likely transforms calibrated audio into spectrogram-based inputs for machine learning.
- The README indicates that calibration outputs are manually fed into this module, so this file is the bridge between raw waveforms and model-ready tensors/features.
5. Main pipeline orchestration
- main.py is the entry point for the processing pipeline after configuration is set.
- Based on the README, it likely drives spectrogram generation across the dataset and prepares the processed training material.
- This file sits above the lower-level audio utilities and below training.
6. Model training subsystem
- train.py is the learning stage where the classifier is trained on the generated spectrogram data.
- The repository separates feature generation from training, which keeps preprocessing reproducible and lets the model consume a stable prepared dataset.
- test.py likely supports evaluation or quick validation of the trained model.
7. Audio processing utilities
- audio.py appears to contain reusable low-level audio helpers used by multiple stages.
- Tools/Audio_Check.py, Tools/CutV3.py, Tools/MixV2.py, and Tools/Augmentation.py suggest a set of preprocessing utilities for:
- inspecting audio integrity,
- slicing clips,
- mixing samples,
- augmenting training data.
- These tools are likely used to expand, clean, or normalize the dataset before spectrogram generation.
8. Dataset engineering for Hugging Face parquet data
- Tools/For_HFace_Parquets/ contains a second data-preparation path aimed at Hugging Face-style parquet datasets.
- Pt_Ext_V4.py, Merge_V3.py, and Group_Check.py imply extraction, merging, and validation steps for parquet-based dataset handling.
- This is a distinct ingestion boundary from the folder-based dataset layout described in the README.
9. GUI layer
- gui.py indicates there is a user-facing interface, likely for running or inspecting parts of the pipeline without using the command line.
- Given the rest of the repo, the GUI is probably a convenience layer over the same calibration/preprocessing/training workflow rather than a separate system.
10. Overall data flow
- The main flow is: dataset folders or parquet source → calibration → spectrogram generation → model training → evaluation/testing.
- The pipeline keeps raw audio, derived calibration parameters, and spectrogram features as separate stages, which is important for diagramming boundaries and data dependencies.
11. Key architectural constraint
- The project depends on a manually synchronized configuration step: calibration results must be copied into spectrogram.py.
- That means part of the system’s behavior is parameterized outside code execution, so configuration management is a meaningful architectural element.
12. External context
- The README references the Hugging Face dataset geronimobasso/drone-audio-detection-samples, so dataset acquisition may come from Hugging Face, but the core processing remains local.
- The repo itself appears focused on offline audio ML rather than serving an API or real-time inference service.
Main entry points: main.py Main pipeline · audio.py Audio utils · spectrogram.py Spectrogram · calibrate.py Calibrate
Components 15
Core pipeline
Local audio ML workflow from dataset configuration through calibration, features, and model lifecycle.
- Data sources · Central dataset location and folder-layout configuration.
data_sources.py - Calibrate · Derives calibration values from raw audio before feature generation.
calibrate.py - Spectrogram · Transforms calibrated audio into model-ready spectrogram features.
spectrogram.py - Main pipeline · Runs the local preprocessing flow across the configured dataset.
main.py - Train · Trains the classifier on generated spectrogram data.
train.py - Test · Evaluates or validates trained model behavior.
test.py
Audio tools
Reusable preprocessing and dataset-shaping utilities for raw audio.
- Audio utils · Low-level audio operations reused by preprocessing and feature code.
audio.py - Audio check · Checks audio integrity and dataset quality.
Tools/Audio_Check.py - Cut clips · Slices audio into training-sized clips.
Tools/CutV3.py - Mix audio · Combines samples to create mixed training material.
Tools/MixV2.py - Augment · Generates altered audio examples for dataset expansion.
Tools/Augmentation.py
Parquet tools
Alternative dataset path for Hugging Face parquet-based inputs.
- Parquet extract · Extracts data from parquet-based Hugging Face dataset inputs.
Tools/For_HFace_Parquets/Pt_Ext_V4.py - Merge parquet · Merges parquet-derived fragments into a usable dataset.
Tools/For_HFace_Parquets/Merge_V3.py - Group check · Validates grouping and structure for parquet-based data.
Tools/For_HFace_Parquets/Group_Check.py
Interface
User-facing entry points.
- GUI · Interactive front end for running or inspecting the workflow.
gui.py
Connections 23
- Data sources → Calibrate: dataset paths · Calibration reads configured dataset locations.
- Data sources → Main pipeline: dataset paths · Main pipeline uses the same dataset configuration.
- Data sources → GUI: config access · GUI can surface or reuse the shared dataset configuration.
- Calibrate → Spectrogram: calibration values · Calibration outputs parameterize spectrogram generation.
- Main pipeline → Calibrate: run step · Main may launch calibration as part of preprocessing.
- Main pipeline → Spectrogram: build features · Main drives spectrogram generation across the dataset.
- Audio utils → Calibrate: audio helpers · Shared audio primitives support calibration logic.
- Audio utils → Spectrogram: audio helpers · Shared audio primitives support feature generation.
- Audio utils → Audio check: inspect · Inspection tool relies on core audio utilities.
- Audio utils → Cut clips: slice · Clip cutting is built on audio helper routines.
- Audio utils → Mix audio: mix · Audio mixing uses shared low-level operations.
- Audio utils → Augment: augment · Augmentation builds on reusable audio processing.
- Augment → Spectrogram: expanded data · Augmented clips feed feature generation.
- Cut clips → Main pipeline: prepared clips · Cut audio can feed the main preprocessing flow.
- Mix audio → Main pipeline: mixed data · Mixed samples can feed the preprocessing flow.
- Spectrogram → Train: training features · Training consumes generated spectrogram features.
- Train → Test: trained model · Evaluation uses the trained classifier.
- GUI → Main pipeline: launch workflow · GUI can trigger the preprocessing pipeline.
- GUI → Train: start training · GUI can initiate training runs.
- Parquet extract → Merge parquet: extracted data · Parquet extraction feeds merge step.
- Merge parquet → Group check: merged dataset · Merged parquet data is validated for grouping.
- Group check → Main pipeline: validated input · Validated parquet data can feed the main workflow.
- Parquet extract → Main pipeline: alt source · Alternative parquet ingestion path can supply the pipeline.