# gikexe/is_drone_or_not architecture

> Architecture diagram of the GitHub repository gikexe/is_drone_or_not, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gikexe/is_drone_or_not
- Repository: https://github.com/gikexe/is_drone_or_not

## Overview

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`](https://github.com/gikexe/is_drone_or_not/blob/main/main.py) (Main pipeline), [`audio.py`](https://github.com/gikexe/is_drone_or_not/blob/main/audio.py) (Audio utils), [`spectrogram.py`](https://github.com/gikexe/is_drone_or_not/blob/main/spectrogram.py) (Spectrogram), [`calibrate.py`](https://github.com/gikexe/is_drone_or_not/blob/main/calibrate.py) (Calibrate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core pipeline"]
  node_data_sources["Data sources<br/>config<br/>[data_sources.py]"]
  node_calibrate["Calibrate<br/>parameter fit<br/>[calibrate.py]"]
  node_spectrogram["Spectrogram<br/>feature builder<br/>[spectrogram.py]"]
  node_main["Main pipeline<br/>orchestrator<br/>[main.py]"]
  node_train["Train<br/>[train.py]"]
  node_test["Test<br/>evaluation<br/>[test.py]"]
end

subgraph group_audio_tools["Audio tools"]
  node_audio["Audio utils<br/>shared helpers<br/>[audio.py]"]
  node_audio_check["Audio check<br/>inspection tool<br/>[Audio_Check.py]"]
  node_cutv3["Cut clips<br/>slicing tool<br/>[CutV3.py]"]
  node_mixv2["Mix audio<br/>composition tool<br/>[MixV2.py]"]
  node_augmentation["Augment<br/>[Augmentation.py]"]
end

subgraph group_parquet_tools["Parquet tools"]
  node_pt_ext["Parquet extract<br/>parquet ingest<br/>[Pt_Ext_V4.py]"]
  node_merge_v3["Merge parquet<br/>parquet merge<br/>[Merge_V3.py]"]
  node_group_check["Group check<br/>dataset validation<br/>[Group_Check.py]"]
end

subgraph group_ui["Interface"]
  node_gui["GUI<br/>user interface<br/>[gui.py]"]
end

node_data_sources -->|"dataset paths"| node_calibrate
node_data_sources -->|"dataset paths"| node_main
node_data_sources -.->|"config access"| node_gui
node_calibrate -->|"calibration values"| node_spectrogram
node_main -->|"run step"| node_calibrate
node_main -->|"build features"| node_spectrogram
node_audio -->|"audio helpers"| node_calibrate
node_audio -->|"audio helpers"| node_spectrogram
node_audio -.->|"inspect"| node_audio_check
node_audio -.->|"slice"| node_cutv3
node_audio -.->|"mix"| node_mixv2
node_audio -.->|"augment"| node_augmentation
node_augmentation -.->|"expanded data"| node_spectrogram
node_cutv3 -.->|"prepared clips"| node_main
node_mixv2 -.->|"mixed data"| node_main
node_spectrogram -->|"training features"| node_train
node_train -->|"trained model"| node_test
node_gui -.->|"launch workflow"| node_main
node_gui -.->|"start training"| node_train
node_pt_ext -->|"extracted data"| node_merge_v3
node_merge_v3 -->|"merged dataset"| node_group_check
node_group_check -.->|"validated input"| node_main
node_pt_ext -.->|"alt source"| node_main

click node_data_sources "https://github.com/gikexe/is_drone_or_not/blob/main/data_sources.py"
click node_calibrate "https://github.com/gikexe/is_drone_or_not/blob/main/calibrate.py"
click node_spectrogram "https://github.com/gikexe/is_drone_or_not/blob/main/spectrogram.py"
click node_main "https://github.com/gikexe/is_drone_or_not/blob/main/main.py"
click node_train "https://github.com/gikexe/is_drone_or_not/blob/main/train.py"
click node_test "https://github.com/gikexe/is_drone_or_not/blob/main/test.py"
click node_audio "https://github.com/gikexe/is_drone_or_not/blob/main/audio.py"
click node_audio_check "https://github.com/gikexe/is_drone_or_not/blob/main/Tools/Audio_Check.py"
click node_cutv3 "https://github.com/gikexe/is_drone_or_not/blob/main/Tools/CutV3.py"
click node_mixv2 "https://github.com/gikexe/is_drone_or_not/blob/main/Tools/MixV2.py"
click node_augmentation "https://github.com/gikexe/is_drone_or_not/blob/main/Tools/Augmentation.py"
click node_pt_ext "https://github.com/gikexe/is_drone_or_not/blob/main/Tools/For_HFace_Parquets/Pt_Ext_V4.py"
click node_merge_v3 "https://github.com/gikexe/is_drone_or_not/blob/main/Tools/For_HFace_Parquets/Merge_V3.py"
click node_group_check "https://github.com/gikexe/is_drone_or_not/blob/main/Tools/For_HFace_Parquets/Group_Check.py"
click node_gui "https://github.com/gikexe/is_drone_or_not/blob/main/gui.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_data_sources,node_calibrate,node_spectrogram,node_main,node_train,node_test toneBlue
class node_audio,node_audio_check,node_cutv3,node_mixv2,node_augmentation toneAmber
class node_pt_ext,node_merge_v3,node_group_check toneMint
class node_gui toneRose
```

## Components

### Core pipeline

Local audio ML workflow from dataset configuration through calibration, features, and model lifecycle.

- [Data sources](https://github.com/gikexe/is_drone_or_not/blob/main/data_sources.py): config · Central dataset location and folder-layout configuration. · `data_sources.py`
- [Calibrate](https://github.com/gikexe/is_drone_or_not/blob/main/calibrate.py): parameter fit · Derives calibration values from raw audio before feature generation. · `calibrate.py`
- [Spectrogram](https://github.com/gikexe/is_drone_or_not/blob/main/spectrogram.py): feature builder · Transforms calibrated audio into model-ready spectrogram features. · `spectrogram.py`
- [Main pipeline](https://github.com/gikexe/is_drone_or_not/blob/main/main.py): orchestrator · Runs the local preprocessing flow across the configured dataset. · `main.py`
- [Train](https://github.com/gikexe/is_drone_or_not/blob/main/train.py): model training · Trains the classifier on generated spectrogram data. · `train.py`
- [Test](https://github.com/gikexe/is_drone_or_not/blob/main/test.py): evaluation · Evaluates or validates trained model behavior. · `test.py`

### Audio tools

Reusable preprocessing and dataset-shaping utilities for raw audio.

- [Audio utils](https://github.com/gikexe/is_drone_or_not/blob/main/audio.py): shared helpers · Low-level audio operations reused by preprocessing and feature code. · `audio.py`
- [Audio check](https://github.com/gikexe/is_drone_or_not/blob/main/Tools/Audio_Check.py): inspection tool · Checks audio integrity and dataset quality. · `Tools/Audio_Check.py`
- [Cut clips](https://github.com/gikexe/is_drone_or_not/blob/main/Tools/CutV3.py): slicing tool · Slices audio into training-sized clips. · `Tools/CutV3.py`
- [Mix audio](https://github.com/gikexe/is_drone_or_not/blob/main/Tools/MixV2.py): composition tool · Combines samples to create mixed training material. · `Tools/MixV2.py`
- [Augment](https://github.com/gikexe/is_drone_or_not/blob/main/Tools/Augmentation.py): data augmentation · Generates altered audio examples for dataset expansion. · `Tools/Augmentation.py`

### Parquet tools

Alternative dataset path for Hugging Face parquet-based inputs.

- [Parquet extract](https://github.com/gikexe/is_drone_or_not/blob/main/Tools/For_HFace_Parquets/Pt_Ext_V4.py): parquet ingest · Extracts data from parquet-based Hugging Face dataset inputs. · `Tools/For_HFace_Parquets/Pt_Ext_V4.py`
- [Merge parquet](https://github.com/gikexe/is_drone_or_not/blob/main/Tools/For_HFace_Parquets/Merge_V3.py): parquet merge · Merges parquet-derived fragments into a usable dataset. · `Tools/For_HFace_Parquets/Merge_V3.py`
- [Group check](https://github.com/gikexe/is_drone_or_not/blob/main/Tools/For_HFace_Parquets/Group_Check.py): dataset validation · Validates grouping and structure for parquet-based data. · `Tools/For_HFace_Parquets/Group_Check.py`

### Interface

User-facing entry points.

- [GUI](https://github.com/gikexe/is_drone_or_not/blob/main/gui.py): user interface · Interactive front end for running or inspecting the workflow. · `gui.py`

## Connections

- 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.
