tlemagueresse
commited on
Commit
·
672b0df
1
Parent(s):
eaba0c2
Update read me
Browse files
README.md
CHANGED
|
@@ -20,19 +20,30 @@ tags:
|
|
| 20 |
An efficient model to detect chainsaw activity in forest soundscapes using spectral and cepstral audio features. The model is designed for environmental conservation and is based on a LightGBM classifier, capable of low-energy inference on both CPU and GPU devices. This repository provides the complete code and configuration for feature extraction, model implementation, and deployment.
|
| 21 |
|
| 22 |
## Installation
|
|
|
|
| 23 |
You can install and use the model in two different ways:
|
|
|
|
| 24 |
### Option 1: Clone the repository
|
|
|
|
| 25 |
To download the entire repository containing the code, model, and associated files, follow these steps:
|
| 26 |
-
|
|
|
|
| 27 |
git clone https://huggingface.co/tlmk22/QuefrencyGuardian
|
| 28 |
cd QuefrencyGuardian
|
| 29 |
pip install -r requirements.txt
|
| 30 |
```
|
|
|
|
| 31 |
Once installed, you can directly import the files into your existing project and use the model.
|
|
|
|
|
|
|
|
|
|
| 32 |
### Option 2: Dynamically load from the Hub
|
|
|
|
| 33 |
If you only want to download the required files to use the model (without cloning the full repository), you can use the `hf_hub_download` function provided by Hugging Face. This method downloads only what is necessary directly from the Hub.
|
|
|
|
| 34 |
Here's an example:
|
| 35 |
-
|
|
|
|
| 36 |
from huggingface_hub import hf_hub_download
|
| 37 |
import importlib.util
|
| 38 |
|
|
@@ -58,8 +69,10 @@ result = model.predict("path/to/audio.wav")
|
|
| 58 |
map_labels = {0: "chainsaw", 1: "environment"}
|
| 59 |
print(f"Prediction Result: {map_labels[result[0]]}")
|
| 60 |
```
|
|
|
|
| 61 |
Depending on your needs, you can either clone the repository for a full installation or use Hugging Face's dynamic download functionalities for lightweight and direct usage.
|
| 62 |
|
|
|
|
| 63 |
|
| 64 |
## Model Overview
|
| 65 |
|
|
@@ -67,26 +80,35 @@ Depending on your needs, you can either clone the repository for a full installa
|
|
| 67 |
|
| 68 |
The model uses:
|
| 69 |
- **Spectrogram Features**
|
| 70 |
-
- **Cepstral Features**: Calculated as the FFT of the log spectrogram between [`f_min`-`f_max`] in a filtered quefrency range
|
| 71 |
-
- **Time Averaging**: Both feature sets are averaged
|
|
|
|
|
|
|
| 72 |
|
| 73 |
### LightGBM Model
|
| 74 |
|
| 75 |
-
The model is a **binary classifier** (chainsaw vs environment) trained on the `rfcx/frugalai` dataset.
|
| 76 |
Key model parameters are included in `model/lgbm_params.json`.
|
| 77 |
|
|
|
|
|
|
|
| 78 |
## Usage
|
| 79 |
|
| 80 |
Two example scripts demonstrating how to use the repository or the model downloaded from Hugging Face are available in the `examples` directory.
|
| 81 |
|
|
|
|
|
|
|
| 82 |
### Performance
|
| 83 |
|
| 84 |
- **Accuracy**: Achieved 95% on the test set with a 4.5% FPR at the default threshold during the challenge, where this model won first place.
|
| 85 |
-
- **Environmental Impact**: Inference energy consumption was measured at **0.21 Wh**, tracked using CodeCarbon. This metric is dependent on the challenge's infrastructure, as the code was
|
|
|
|
|
|
|
| 86 |
|
| 87 |
### License
|
| 88 |
|
| 89 |
-
This project is licensed under the [Creative Commons Attribution Non-Commercial 4.0 International](https://creativecommons.org/licenses/by-nc/4.0/).
|
|
|
|
| 90 |
|
| 91 |
---
|
| 92 |
|
|
@@ -98,11 +120,9 @@ The model was trained and evaluated on the [Rainforest Connection (RFCx) Frugal
|
|
| 98 |
- `0`: Chainsaw
|
| 99 |
- `1`: Environment
|
| 100 |
|
|
|
|
|
|
|
| 101 |
## Limitations
|
| 102 |
|
| 103 |
- **Audio Length**: The classifier is designed for 1 to 3 seconds of audio sampled at either 12 kHz or 24 kHz.
|
| 104 |
-
- **Environmental Noise**: The model might misclassify if recordings are noisy or machinery similar to chainsaws is present.
|
| 105 |
-
|
| 106 |
-
---
|
| 107 |
-
|
| 108 |
-
This README serves as the primary documentation for Hugging Face and provides an overview of the model's purpose, data requirements, and usage.
|
|
|
|
| 20 |
An efficient model to detect chainsaw activity in forest soundscapes using spectral and cepstral audio features. The model is designed for environmental conservation and is based on a LightGBM classifier, capable of low-energy inference on both CPU and GPU devices. This repository provides the complete code and configuration for feature extraction, model implementation, and deployment.
|
| 21 |
|
| 22 |
## Installation
|
| 23 |
+
|
| 24 |
You can install and use the model in two different ways:
|
| 25 |
+
|
| 26 |
### Option 1: Clone the repository
|
| 27 |
+
|
| 28 |
To download the entire repository containing the code, model, and associated files, follow these steps:
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
git clone https://huggingface.co/tlmk22/QuefrencyGuardian
|
| 32 |
cd QuefrencyGuardian
|
| 33 |
pip install -r requirements.txt
|
| 34 |
```
|
| 35 |
+
|
| 36 |
Once installed, you can directly import the files into your existing project and use the model.
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
### Option 2: Dynamically load from the Hub
|
| 41 |
+
|
| 42 |
If you only want to download the required files to use the model (without cloning the full repository), you can use the `hf_hub_download` function provided by Hugging Face. This method downloads only what is necessary directly from the Hub.
|
| 43 |
+
|
| 44 |
Here's an example:
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
from huggingface_hub import hf_hub_download
|
| 48 |
import importlib.util
|
| 49 |
|
|
|
|
| 69 |
map_labels = {0: "chainsaw", 1: "environment"}
|
| 70 |
print(f"Prediction Result: {map_labels[result[0]]}")
|
| 71 |
```
|
| 72 |
+
|
| 73 |
Depending on your needs, you can either clone the repository for a full installation or use Hugging Face's dynamic download functionalities for lightweight and direct usage.
|
| 74 |
|
| 75 |
+
---
|
| 76 |
|
| 77 |
## Model Overview
|
| 78 |
|
|
|
|
| 80 |
|
| 81 |
The model uses:
|
| 82 |
- **Spectrogram Features**
|
| 83 |
+
- **Cepstral Features**: Calculated as the FFT of the log spectrogram between [`f_min`-`f_max`] in a filtered quefrency range [`fc_min`-`fc_max`].
|
| 84 |
+
- **Time Averaging**: Both feature sets are averaged across the entire audio clip for robustness in noisy settings (Welch methodology).
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
|
| 88 |
### LightGBM Model
|
| 89 |
|
| 90 |
+
The model is a **binary classifier** (chainsaw vs environment) trained on the `rfcx/frugalai` dataset.
|
| 91 |
Key model parameters are included in `model/lgbm_params.json`.
|
| 92 |
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
## Usage
|
| 96 |
|
| 97 |
Two example scripts demonstrating how to use the repository or the model downloaded from Hugging Face are available in the `examples` directory.
|
| 98 |
|
| 99 |
+
---
|
| 100 |
+
|
| 101 |
### Performance
|
| 102 |
|
| 103 |
- **Accuracy**: Achieved 95% on the test set with a 4.5% FPR at the default threshold during the challenge, where this model won first place.
|
| 104 |
+
- **Environmental Impact**: Inference energy consumption was measured at **0.21 Wh**, tracked using CodeCarbon. This metric is dependent on the challenge's infrastructure, as the code was executed within a Docker container provided by the platform.
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
|
| 108 |
### License
|
| 109 |
|
| 110 |
+
This project is licensed under the [Creative Commons Attribution Non-Commercial 4.0 International](https://creativecommons.org/licenses/by-nc/4.0/).
|
| 111 |
+
You are free to share and adapt the work for non-commercial purposes, provided attribution is given.
|
| 112 |
|
| 113 |
---
|
| 114 |
|
|
|
|
| 120 |
- `0`: Chainsaw
|
| 121 |
- `1`: Environment
|
| 122 |
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
## Limitations
|
| 126 |
|
| 127 |
- **Audio Length**: The classifier is designed for 1 to 3 seconds of audio sampled at either 12 kHz or 24 kHz.
|
| 128 |
+
- **Environmental Noise**: The model might misclassify if recordings are noisy or if machinery similar to chainsaws is present.
|
|
|
|
|
|
|
|
|
|
|
|