FisayoF commited on
Commit
ed2020b
·
verified ·
1 Parent(s): 908b0df

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +58 -1
README.md CHANGED
@@ -1,3 +1,60 @@
1
- ---
2
  license: mit
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  license: mit
2
+ library_name: pytorch
3
+ tags:
4
+ - audio-classification
5
+ - spectrogram
6
+ - cnn
7
+ - pytorch
8
  ---
9
+
10
+ # Drone / Helicopter / Background Audio Classifier
11
+
12
+ A small convolutional neural network, written and trained from scratch in PyTorch, that classifies spectrogram images of audio into three classes: **background**, **helicopter** and **drone**. Developed from work at Ministry of Defence hackathons (Sandhurst) and deployed independently in 2026.
13
+
14
+ ## Classes (output index order)
15
+
16
+ | Index | Class |
17
+ |---|---|
18
+ | 0 | background |
19
+ | 1 | helicopter |
20
+ | 2 | drone |
21
+
22
+ ## Model
23
+
24
+ - **Input:** single-channel (grayscale) spectrogram image, 480 x 640 pixels, pixel values scaled to 0-1.
25
+ - **Architecture:** two convolutional layers (64 then 128 filters, 3x3 kernels), each followed by ReLU and 2x2 max pooling, then one linear layer to 3 classes. Output is log-probabilities (`log_softmax`), so apply `exp` to get probabilities.
26
+ - **Code:** the architecture is in `model.py` (`CnnNet`) and a minimal inference example is in `predict.py`.
27
+ - **Weights:** `weightsfilefromspectrogram.pth` (PyTorch `state_dict`).
28
+
29
+ ## Data
30
+
31
+ - 297 spectrogram images: 101 background, 99 helicopter, 97 drone.
32
+ - Spectrograms were generated from [source audio: where the recordings came from, and the tool or settings used to convert them].
33
+ - Random 60/20/20 train/validation/test split (`random_state=42`), about 178 / 59 / 60 images.
34
+
35
+ ## Training
36
+
37
+ - Framework: PyTorch, trained on Google Colab.
38
+ - Loss: negative log-likelihood. Optimiser: SGD, learning rate 0.001, momentum 0.5, batch size 4, 115 epochs.
39
+ - The checkpoint with the best validation accuracy was kept.
40
+
41
+ ## Results (60 held-out test spectrograms)
42
+
43
+ - Test accuracy: [xx.x]%
44
+ - Weighted F1: [0.xx] (precision [0.xx], recall [0.xx])
45
+ - Per-class one-vs-rest ROC-AUC: helicopter 1.00, drone 0.97, background 0.96
46
+
47
+ ## Limitations
48
+
49
+ - Small dataset, and a small test set (60 images), so these figures are indicative rather than precise.
50
+ - Training loss is very low while validation accuracy is lower, which suggests overfitting. No data augmentation or regularisation was used.
51
+ - The split is random at image level. [State whether all spectrograms come from separate recordings. If some share a source recording, say so: near-duplicate clips in train and test would inflate the scores, and splitting by recording is the planned next step.]
52
+ - Not tested on recordings from new environments, microphones or noise conditions.
53
+ - A baseline model for demonstration. Not for safety-critical use.
54
+
55
+ ## Usage
56
+
57
+ ```python
58
+ from predict import predict
59
+ print(predict("example_spectrogram.png"))
60
+ ```