Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,73 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
# Positive Transfer Of The Whisper Speech Transformer To Human And Animal Voice Activity Detection
|
5 |
+
We proposed **WhisperSeg**, utilizing the Whisper Transformer pre-trained for Automatic Speech Recognition (ASR) for both human and animal Voice Activity Detection (VAD). For more details, please refer to our paper:
|
6 |
+
> [**Positive Transfer of the Whisper Speech Transformer to Human and Animal Voice Activity Detection**](https://doi.org/10.1101/2023.09.30.560270)
|
7 |
+
>
|
8 |
+
> Nianlong Gu, Kanghwi Lee, Maris Basha, Sumit Kumar Ram, Guanghao You, Richard H. R. Hahnloser <br>
|
9 |
+
> University of Zurich and ETH Zurich
|
10 |
+
|
11 |
+
*Accepted to the 2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP 2024)*
|
12 |
+
|
13 |
+
|
14 |
+
The model "nccratliri/whisperseg-animal-vad-ct2" is the Ctranslate2 version of "nccratliri/whisperseg-animal-vad". It can only be used for faster inference. For finetuning the model, use "nccratliri/whisperseg-animal-vad" instead.
|
15 |
+
|
16 |
+
The "xxx-ct2" model need to be loaded by WhisperSegmenterFast (instead of WhisperSegmenter)
|
17 |
+
|
18 |
+
## Usage
|
19 |
+
### Clone the GitHub repo and install dependencies
|
20 |
+
```bash
|
21 |
+
git clone https://github.com/nianlonggu/WhisperSeg.git
|
22 |
+
cd WhisperSeg; pip install -r requirements.txt
|
23 |
+
```
|
24 |
+
|
25 |
+
Then in the folder "WhisperSeg", run the following python script:
|
26 |
+
```python
|
27 |
+
from model import WhisperSegmenterFast
|
28 |
+
import librosa
|
29 |
+
import json
|
30 |
+
segmenter = WhisperSegmenterFast( "nccratliri/whisperseg-animal-vad-ct2", device="cuda" )
|
31 |
+
|
32 |
+
sr = 32000
|
33 |
+
spec_time_step = 0.0025
|
34 |
+
|
35 |
+
audio, _ = librosa.load( "data/example_subset/Zebra_finch/test_adults/zebra_finch_g17y2U-f00007.wav",
|
36 |
+
sr = sr )
|
37 |
+
## Note if spec_time_step is not provided, a default value will be used by the model.
|
38 |
+
prediction = segmenter.segment( audio, sr = sr, spec_time_step = spec_time_step )
|
39 |
+
print(prediction)
|
40 |
+
```
|
41 |
+
{'onset': [0.01, 0.38, 0.603, 0.758, 0.912, 1.813, 1.967, 2.073, 2.838, 2.982, 3.112, 3.668, 3.828, 3.953, 5.158, 5.323, 5.467], 'offset': [0.073, 0.447, 0.673, 0.83, 1.483, 1.882, 2.037, 2.643, 2.893, 3.063, 3.283, 3.742, 3.898, 4.523, 5.223, 5.393, 6.043], 'cluster': ['zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0', 'zebra_finch_0']}
|
42 |
+
|
43 |
+
Visualize the results of WhisperSeg:
|
44 |
+
```python
|
45 |
+
from audio_utils import SpecViewer
|
46 |
+
spec_viewer = SpecViewer()
|
47 |
+
spec_viewer.visualize( audio = audio, sr = sr, min_frequency= min_frequency, prediction = prediction,
|
48 |
+
window_size=8, precision_bits=1
|
49 |
+
)
|
50 |
+
```
|
51 |
+
![vis](https://github.com/nianlonggu/WhisperSeg/blob/master/assets/res_zebra_finch_adults_prediction_only.png?raw=true)
|
52 |
+
|
53 |
+
Run it in Google Colab:
|
54 |
+
<a href="https://colab.research.google.com/github/nianlonggu/WhisperSeg/blob/master/docs/WhisperSeg_Voice_Activity_Detection_Demo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
|
55 |
+
For more details, please refer to the GitHub repository: https://github.com/nianlonggu/WhisperSeg
|
56 |
+
|
57 |
+
## Citation
|
58 |
+
When using our code or models for your work, please cite the following paper:
|
59 |
+
```
|
60 |
+
@INPROCEEDINGS{10447620,
|
61 |
+
author={Gu, Nianlong and Lee, Kanghwi and Basha, Maris and Kumar Ram, Sumit and You, Guanghao and Hahnloser, Richard H. R.},
|
62 |
+
booktitle={ICASSP 2024 - 2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
|
63 |
+
title={Positive Transfer of the Whisper Speech Transformer to Human and Animal Voice Activity Detection},
|
64 |
+
year={2024},
|
65 |
+
volume={},
|
66 |
+
number={},
|
67 |
+
pages={7505-7509},
|
68 |
+
keywords={Voice activity detection;Adaptation models;Animals;Transformers;Acoustics;Human voice;Spectrogram;Voice activity detection;audio segmentation;Transformer;Whisper},
|
69 |
+
doi={10.1109/ICASSP48485.2024.10447620}}
|
70 |
+
```
|
71 |
+
|
72 |
+
## Contact
|
73 |