nkululeko 0.95.0__py3-none-any.whl → 0.95.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. nkululeko/autopredict/tests/__init__.py +0 -0
  2. nkululeko/autopredict/tests/test_whisper_transcriber.py +122 -0
  3. nkululeko/balance.py +222 -0
  4. nkululeko/constants.py +1 -1
  5. nkululeko/feat_extract/feats_mld.py +13 -5
  6. nkululeko/feat_extract/feats_praat.py +3 -3
  7. nkululeko/feat_extract/{feinberg_praat.py → feats_praat_core.py} +0 -2
  8. nkululeko/feat_extract/tests/__init__.py +1 -0
  9. nkululeko/feat_extract/tests/test_feats_opensmile.py +162 -0
  10. nkululeko/feat_extract/tests/test_feats_praat_core.py +507 -0
  11. nkululeko/feature_extractor.py +5 -0
  12. nkululeko/modelrunner.py +15 -48
  13. nkululeko/models/tests/test_model_knn.py +49 -0
  14. nkululeko/models/tests/test_model_mlp.py +153 -0
  15. nkululeko/models/tests/test_model_xgb.py +33 -0
  16. nkululeko/optim.py +931 -0
  17. nkululeko/predict.py +3 -2
  18. nkululeko/reporting/reporter.py +12 -0
  19. nkululeko/test_predictor.py +7 -1
  20. nkululeko/tests/__init__.py +1 -0
  21. nkululeko/tests/test_balancing.py +270 -0
  22. nkululeko/tests/test_optim.py +200 -0
  23. nkululeko/utils/util.py +5 -5
  24. nkululeko-0.95.2.dist-info/METADATA +376 -0
  25. {nkululeko-0.95.0.dist-info → nkululeko-0.95.2.dist-info}/RECORD +29 -17
  26. nkululeko/feat_extract/feats_opensmile copy.py +0 -93
  27. nkululeko-0.95.0.dist-info/METADATA +0 -76
  28. {nkululeko-0.95.0.dist-info → nkululeko-0.95.2.dist-info}/WHEEL +0 -0
  29. {nkululeko-0.95.0.dist-info → nkululeko-0.95.2.dist-info}/entry_points.txt +0 -0
  30. {nkululeko-0.95.0.dist-info → nkululeko-0.95.2.dist-info}/licenses/LICENSE +0 -0
  31. {nkululeko-0.95.0.dist-info → nkululeko-0.95.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,376 @@
1
+ Metadata-Version: 2.4
2
+ Name: nkululeko
3
+ Version: 0.95.2
4
+ Summary: Machine learning audio prediction experiments based on templates
5
+ Home-page: https://github.com/felixbur/nkululeko
6
+ Author: Felix Burkhardt
7
+ Author-email: Felix Burkhardt <fxburk@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/felixbur/nkululeko
10
+ Project-URL: Repository, https://github.com/felixbur/nkululeko
11
+ Project-URL: Documentation, https://github.com/felixbur/nkululeko
12
+ Project-URL: Issues, https://github.com/felixbur/nkululeko/issues
13
+ Keywords: machine learning,audio,emotion recognition,speech processing
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: audeer>=1.0.0
29
+ Requires-Dist: audformat>=1.3.1
30
+ Requires-Dist: audinterface>=1.0.0
31
+ Requires-Dist: audiofile>=1.0.0
32
+ Requires-Dist: audiomentations==0.31.0
33
+ Requires-Dist: audmetric>=1.0.0
34
+ Requires-Dist: audonnx>=0.7.0
35
+ Requires-Dist: confidence-intervals>=0.0.2
36
+ Requires-Dist: datasets>=2.0.0
37
+ Requires-Dist: imageio>=2.0.0
38
+ Requires-Dist: matplotlib>=3.0.0
39
+ Requires-Dist: numpy>=1.20.0
40
+ Requires-Dist: opensmile>=2.0.0
41
+ Requires-Dist: pandas>=1.0.0
42
+ Requires-Dist: praat-parselmouth>=0.4.0
43
+ Requires-Dist: scikit-learn>=1.0.0
44
+ Requires-Dist: scipy>=1.0.0
45
+ Requires-Dist: seaborn>=0.11.0
46
+ Requires-Dist: sounddevice>=0.4.0
47
+ Requires-Dist: transformers>=4.0.0
48
+ Requires-Dist: umap-learn>=0.5.0
49
+ Requires-Dist: xgboost>=1.0.0
50
+ Requires-Dist: pylatex>=1.0.0
51
+ Provides-Extra: torch
52
+ Requires-Dist: torch>=1.0.0; extra == "torch"
53
+ Requires-Dist: torchvision>=0.10.0; extra == "torch"
54
+ Requires-Dist: torchaudio>=0.10.0; extra == "torch"
55
+ Provides-Extra: torch-cpu
56
+ Requires-Dist: torch>=1.0.0; extra == "torch-cpu"
57
+ Requires-Dist: torchvision>=0.10.0; extra == "torch-cpu"
58
+ Requires-Dist: torchaudio>=0.10.0; extra == "torch-cpu"
59
+ Provides-Extra: spotlight
60
+ Requires-Dist: renumics-spotlight>=1.6.13; extra == "spotlight"
61
+ Requires-Dist: sliceguard>=0.0.35; extra == "spotlight"
62
+ Provides-Extra: tensorflow
63
+ Requires-Dist: tensorflow>=2.0.0; extra == "tensorflow"
64
+ Requires-Dist: tensorflow-hub>=0.12.0; extra == "tensorflow"
65
+ Provides-Extra: all
66
+ Requires-Dist: torch>=1.0.0; extra == "all"
67
+ Requires-Dist: torchvision>=0.10.0; extra == "all"
68
+ Requires-Dist: torchaudio>=0.10.0; extra == "all"
69
+ Requires-Dist: renumics-spotlight>=1.6.13; extra == "all"
70
+ Requires-Dist: sliceguard>=0.0.35; extra == "all"
71
+ Requires-Dist: tensorflow>=2.0.0; extra == "all"
72
+ Requires-Dist: tensorflow-hub>=0.12.0; extra == "all"
73
+ Requires-Dist: shap>=0.40.0; extra == "all"
74
+ Requires-Dist: imblearn>=0.0.0; extra == "all"
75
+ Requires-Dist: cylimiter>=0.0.1; extra == "all"
76
+ Requires-Dist: audtorch>=0.0.1; extra == "all"
77
+ Requires-Dist: splitutils>=0.0.1; extra == "all"
78
+ Dynamic: author
79
+ Dynamic: home-page
80
+ Dynamic: license-file
81
+ Dynamic: requires-python
82
+
83
+ ## Nkululeko
84
+
85
+ Nkululeko is a project to detect speaker characteristics by machine learning experiments with a high-level interface. The idea is to have a framework (based on e.g. sklearn and torch) that can be used to rapidly and automatically analyse audio data and explore machine learning models based on that data.
86
+
87
+ Some abilities that Nkululeko provides: combines acoustic features and machine learning models (including feature selection and features concatenation); performs data exploration, selection and visualization the results; finetuning; ensemble learning models; soft labeling (predicting labels with pre-trained model); and inference the model on a test set.
88
+
89
+ Nkululeko orchestrates data loading, feature extraction, and model training, allowing you to specify your experiment in a configuration file. The framework handles the process from raw data to trained model and evaluation, making it easy to run machine learning experiments without directly coding in Python.
90
+
91
+ ## Who is this for?
92
+ Nkululeko is for speech processing learners, researchers and ML practitioners focused on speaker characteristics, e.g., emotion, age, gender, or disorder detection.
93
+
94
+ ## Installation
95
+
96
+ Nkululeko requires Python 3.9 or higher with the following build status:
97
+
98
+ ![Python 3.10](https://github.com/bagustris/nkululeko/actions/workflows/py310-aud-csv.yml/badge.svg)
99
+ ![Python 3.11](https://github.com/bagustris/nkululeko/actions/workflows/py311.yml/badge.svg)
100
+ ![Python 3.12](https://github.com/bagustris/nkululeko/actions/workflows/py312.yml/badge.svg)
101
+ ![Python 3.13](https://github.com/bagustris/nkululeko/actions/workflows/py313.yml/badge.svg)
102
+
103
+ Create and activate a virtual Python environment and simply install Nkululeko:
104
+
105
+ ```bash
106
+ # using python venv
107
+ python -m venv .env
108
+ source .env/bin/activate # specify OS versions, add a separate line for Windows users
109
+ pip install nkululeko
110
+ # using uv in development mode
111
+ uv venv --python 3.12
112
+ source .venv/bin/activate
113
+ uv pip install -r requirements.txt
114
+ # or run directly using uv run after cloning
115
+ uv run python -m nkululeko.nkululeko --config examples/exp_polish_tree.ini
116
+ ```
117
+
118
+ ### Optional Dependencies
119
+
120
+ Nkululeko supports optional dependencies through extras:
121
+
122
+ ```bash
123
+ # Install with PyTorch support
124
+ pip install nkululeko[torch]
125
+
126
+ # Install with CPU-only PyTorch
127
+ pip install nkululeko[torch-cpu]
128
+
129
+ # Install with TensorFlow support
130
+ pip install nkululeko[tensorflow]
131
+
132
+ # Install all optional dependencies
133
+ pip install nkululeko[all]
134
+ ```
135
+
136
+ #### Manual Installation Options
137
+
138
+ You can also install dependencies manually:
139
+
140
+ ##### PyTorch Installation
141
+
142
+ For CPU-only installation (recommended for most users):
143
+ ```bash
144
+ pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --index-url https://download.pytorch.org/whl/cpu
145
+ ```
146
+
147
+ For GPU support (cuda 12.6):
148
+ ```bash
149
+ pip install torch torchvision torchaudio
150
+ ```
151
+
152
+ Some functionalities require extra packages to be installed, which we didn't include automatically:
153
+
154
+ * For spotlight adapter:
155
+ ```bash
156
+ pip install PyYAML # Install PyYAML first to avoid dependency issues
157
+ pip install nkululeko[spotlight]
158
+ ```
159
+
160
+ Some examples for *ini*-files (which you use to control nkululeko) are in the [examples folder](https://github.com/felixbur/nkululeko/tree/main/examples).
161
+
162
+
163
+
164
+ ## Documentation
165
+ The documentation, along with extensions of installation, usage, INI file format, and examples, can be found [nkululeko.readthedocs.io](https://nkululeko.readthedocs.io).
166
+
167
+
168
+ ## Usage
169
+
170
+ ### [ini-file values](./ini_file.md)
171
+
172
+ Basically, you specify your experiment in an ["ini" file](./ini_file.md) (e.g. *experiment.ini*) and then call one of the Nkululeko interfaces to run the experiment like this:
173
+
174
+ ```bash
175
+ python -m nkululeko.nkululeko --config experiment.ini
176
+ ```
177
+
178
+ A basic configuration looks like this:
179
+
180
+ ```ini
181
+ [EXP]
182
+ root = ./
183
+ name = exp_emodb
184
+ [DATA]
185
+ databases = ['emodb']
186
+ emodb = ./emodb/
187
+ emodb.split_strategy = speaker_split
188
+ target = emotion
189
+ labels = ['anger', 'boredom', 'disgust', 'fear']
190
+ [FEATS]
191
+ type = ['praat']
192
+ [MODEL]
193
+ type = svm
194
+ [EXPL]
195
+ model = tree
196
+ plot_tree = True
197
+ ```
198
+ Read the [Hello World example](#hello-world-example) for initial usage with Emo-DB dataset.
199
+
200
+ Here is an overview of the interfaces/modules:
201
+
202
+ All of them take *--config <my_config.ini>* as an argument.
203
+
204
+ * **nkululeko.nkululeko**: do machine learning experiments combining features and learners (e.g. opensmile with SVM)
205
+ * **nkululeko.ensemble**: [combine several nkululeko experiments](http://blog.syntheticspeech.de/2024/06/25/nkululeko-ensemble-classifiers-with-late-fusion/) and report on late fusion results
206
+ * **nkululeko.multidb**: do [multiple experiments](http://blog.syntheticspeech.de/2024/01/02/nkululeko-compare-several-databases/), comparing several databases cross and in itself
207
+ * **nkululeko.demo**: [demo the current best model](http://blog.syntheticspeech.de/2022/01/24/nkululeko-try-out-demo-a-trained-model/) on the command line
208
+ * **nkululeko.test**: predict a [given data set](http://blog.syntheticspeech.de/2022/09/01/nkululeko-how-to-evaluate-a-test-set-with-a-given-best-model/) with the current best model
209
+ * **nkululeko.explore**: perform [data exploration](http://blog.syntheticspeech.de/2023/05/11/nkululeko-how-to-visualize-your-data-distribution/)
210
+ * **nkululeko.augment**: [augment](http://blog.syntheticspeech.de/2023/03/13/nkululeko-how-to-augment-the-training-set/) the current training data
211
+ * **nkululeko.aug_train**: augment the current training data [and do a training](http://blog.syntheticspeech.de/2023/03/13/nkululeko-how-to-augment-the-training-set/) including this data
212
+ * **nkululeko.predict**: [predict features](http://blog.syntheticspeech.de/2023/08/16/nkululeko-how-to-predict-labels-for-your-data-from-existing-models-and-check-them/) like SNR, MOS, arousal/valence, age/gender, with DNN models
213
+ * **nkululeko.segment**: [segment a database](http://blog.syntheticspeech.de/2023/07/14/nkululeko-segmenting-a-database/) based on VAD (voice activity detection)
214
+ * **nkululeko.resample**: check on all [sampling rates and change](http://blog.syntheticspeech.de/2023/08/31/how-to-fix-different-sampling-rates-in-a-dataset-with-nkululeko/) to 16kHz
215
+ * **nkululeko.nkuluflag**: a convenient module to specify configuration parameters on the command line.
216
+
217
+ ## <a name="helloworld">Hello World example</a>
218
+ * NEW: [Here's a Google colab that runs this example out-of-the-box](https://colab.research.google.com/drive/1Up7t5Nn7VwDPCCEpTg2U7cpZ_PdoEgj-?usp=sharing), and here is the same [with Kaggle](https://www.kaggle.com/felixburk/nkululeko-hello-world-example)
219
+ * [I made a video to show you how to do this on Windows](https://www.youtube.com/playlist?list=PLRceVavtxLg0y2jiLmpnUfiMtfvkK912D)
220
+ * Set up Python on your computer, version >= 3.8
221
+ * Open a terminal/command line/console window
222
+ * Test python by typing ```python```, python should start with version >3 (NOT 2!). You can leave the Python Interpreter by typing *exit()*
223
+ * Create a folder on your computer for this example, let's call it `nkulu_work`
224
+ * Get a copy of the [Berlin emodb in audformat](https://zenodo.org/records/7447302/files/emodb.zip?download=1) and unpack inside the folder you just created (`nkulu_work`)
225
+ * Make sure the folder is called "emodb" and does contain the database files directly (not box-in-a-box)
226
+ * Also, in the `nkulu_work` folder:
227
+ * Create a Python environment
228
+ * ```python -m venv venv```
229
+ * Then, activate it:
230
+ * under Linux / mac
231
+ * ```source venv/bin/activate```
232
+ * under Windows
233
+ * ```venv\Scripts\activate.bat```
234
+ * if that worked, you should see a ```(venv)``` in front of your prompt
235
+ * Install the required packages in your environment
236
+ * ```pip install nkululeko```
237
+ * Repeat until all error messages vanish (or fix them, or try to ignore them)...
238
+ * Now you should have two folders in your *nkulu_work* folder:
239
+ * *emodb* and *venv*
240
+ * Download a copy of the file [exp_emodb.ini](meta/demos/exp_emodb.ini) to the current working directory (```nkulu_work```)
241
+ * Run the demo
242
+ * ```python -m nkululeko.nkululeko --config exp_emodb.ini```
243
+ * Find the results in the newly created folder exp_emodb
244
+ * Inspect ```exp_emodb/images/run_0/emodb_xgb_os_0_000_cnf.png```
245
+ * This is the main result of your experiment: a confusion matrix for the emodb emotional categories
246
+ * Inspect and play around with the [demo configuration file](meta/demos/exp_emodb.ini) that defined your experiment, then re-run.
247
+ * There are many ways to experiment with different classifiers and acoustic feature sets, [all described here](https://github.com/felixbur/nkululeko/blob/main/ini_file.md)
248
+
249
+ ## Features
250
+ The framework is targeted at the speech domain and supports experiments where different classifiers are combined with different feature extractors.
251
+
252
+ * Classifiers: Naive Bayes, KNN, Tree, XGBoost, SVM, MLP
253
+ * Feature extractors: Praat, Opensmile, openXBOW BoAW, TRILL embeddings, Wav2vec2 embeddings, audModel embeddings, ...
254
+ * Feature scaling
255
+ * Label encoding
256
+ * Binning (continuous to categorical)
257
+ * Online demo interface for trained models
258
+ * Visualization: confusion matrix, feature importance, feature distribution, epoch progression, t-SNE plot, data distribution, bias checking, uncertainty estimation
259
+
260
+ Here's a rough UML-like sketch of the framework (and [here's the real one done with pyreverse](meta/images/classes.png)).
261
+ ![sketch](meta/images/class_diagram.png)
262
+
263
+ Currently, the following linear classifiers are implemented (integrated from sklearn):
264
+ * SVM, SVR, XGB, XGR, Tree, Tree_regressor, KNN, KNN_regressor, NaiveBayes, GMM
265
+ and the following ANNs (artificial neural networks)
266
+ * MLP (multi-layer perceptron), CNN (convolutional neural network)
267
+
268
+ For visualization, besides confusion matrix, feature importance, feature distribution, t-SNE plot, data distribution (just names a few), Nkululeko can also be used for bias checking, uncertainty estimation, and epoch progression.
269
+
270
+ ### Bias checking
271
+
272
+ <details>
273
+ In some cases, you might wonder if there's bias in your data. You can try to detect this with automatically estimated speech properties by visualizing the correlation of target labels and predicted labels.
274
+
275
+ <img src="meta/images/emotion-pesq.png" width="500px"/>
276
+
277
+ </details>
278
+
279
+ ### Uncertainty
280
+
281
+ <details>
282
+ Nkululeko estimates the uncertainty of model decisions (only for classifiers) with entropy over the class probabilities or logits per sample.
283
+
284
+ <img src="meta/images/uncertainty.png" width="500px"/>
285
+
286
+ </details>
287
+
288
+ Here's [an animation that shows the progress of classification done with nkululeko](https://youtu.be/6Y0M382GjvM).
289
+
290
+ ## News
291
+
292
+ <details>
293
+
294
+ There's Felix [blog](http://blog.syntheticspeech.de/?s=nkululeko) with tutorials below:
295
+ * [Ensemble learning with Nkululeko](http://blog.syntheticspeech.de/2024/06/25/nkululeko-ensemble-classifiers-with-late-fusion/)
296
+ * [Finetune transformer-models with Nkululeko](http://blog.syntheticspeech.de/2024/05/29/nkululeko-how-to-finetune-a-transformer-model/)
297
+ * Below is a [Hello World example for Nkululeko](#helloworld) that should set you up fastly, also on [Google Colab](https://colab.research.google.com/drive/1GYNBd5cdZQ1QC3Jm58qoeMaJg3UuPhjw?usp=sharing#scrollTo=4G_SjuF9xeQf), and [with Kaggle](https://www.kaggle.com/felixburk/nkululeko-hello-world-example)
298
+ * [Thanks to deepwiki, here's an analysis of the source code](https://deepwiki.com/felixbur/nkululeko)
299
+ * [Here's a blog post on how to set up nkululeko on your computer.](http://blog.syntheticspeech.de/2021/08/30/how-to-set-up-your-first-nkululeko-project/)
300
+ * [Here's a slide presentation about nkululeko](docs/nkululeko.pdf)
301
+ * [Here's a video presentation about nkululeko](https://www.youtube.com/playlist?list=PLRceVavtxLg0y2jiLmpnUfiMtfvkK912D)
302
+ * [Here's the 2022 LREC article on nkululeko](http://felix.syntheticspeech.de/publications/Nkululeko_LREC.pdf)
303
+ * [Introduction](http://blog.syntheticspeech.de/2021/08/04/machine-learning-experiment-framework/)
304
+ * [Nkululeko FAQ](http://blog.syntheticspeech.de/2022/07/07/nkululeko-faq/)
305
+ * [How to set up your first nkululeko project](http://blog.syntheticspeech.de/2021/08/30/how-to-set-up-your-first-nkululeko-project/)
306
+ * [Setting up a base nkululeko experiment](http://blog.syntheticspeech.de/2021/10/05/setting-up-a-base-nkululeko-experiment/)
307
+ * [How to import a database](http://blog.syntheticspeech.de/2022/01/27/nkululeko-how-to-import-a-database/)
308
+ * [Comparing classifiers and features](http://blog.syntheticspeech.de/2021/10/05/nkululeko-comparing-classifiers-and-features/)
309
+ * [Use Praat features](http://blog.syntheticspeech.de/2022/06/27/how-to-use-selected-features-from-praat-with-nkululeko/)
310
+ * [Combine feature sets](http://blog.syntheticspeech.de/2022/06/30/how-to-combine-feature-sets-with-nkululeko/)
311
+ * [Classifying continuous variables](http://blog.syntheticspeech.de/2022/01/26/nkululeko-classifying-continuous-variables/)
312
+ * [Try out / demo a trained model](http://blog.syntheticspeech.de/2022/01/24/nkululeko-try-out-demo-a-trained-model/)
313
+ * [Perform cross-database experiments](http://blog.syntheticspeech.de/2021/10/05/nkululeko-perform-cross-database-experiments/)
314
+ * [Meta parameter optimization](http://blog.syntheticspeech.de/2021/09/03/perform-optimization-with-nkululeko/)
315
+ * [How to set up wav2vec embedding](http://blog.syntheticspeech.de/2021/12/03/how-to-set-up-wav2vec-embedding-for-nkululeko/)
316
+ * [How to soft-label a database](http://blog.syntheticspeech.de/2022/01/24/how-to-soft-label-a-database-with-nkululeko/)
317
+ * [Re-generate the progressing confusion matrix animation wit a different framerate](demos/plot_faster_anim.py)
318
+ * [How to limit/filter a dataset](http://blog.syntheticspeech.de/2022/02/22/how-to-limit-a-dataset-with-nkululeko/)
319
+ * [Specifying database disk location](http://blog.syntheticspeech.de/2022/02/21/specifying-database-disk-location-with-nkululeko/)
320
+ * [Add dropout with MLP models](http://blog.syntheticspeech.de/2022/02/25/adding-dropout-to-mlp-models-with-nkululeko/)
321
+ * [Do cross-validation](http://blog.syntheticspeech.de/2022/03/23/how-to-do-cross-validation-with-nkululeko/)
322
+ * [Combine predictions per speaker](http://blog.syntheticspeech.de/2022/03/24/how-to-combine-predictions-per-speaker-with-nkululeko/)
323
+ * [Run multiple experiments in one go](http://blog.syntheticspeech.de/2022/03/28/how-to-run-multiple-experiments-in-one-go-with-nkululeko/)
324
+ * [Compare several MLP layer layouts with each other](http://blog.syntheticspeech.de/2022/04/11/how-to-compare-several-mlp-layer-layouts-with-each-other/)
325
+ * [Import features from outside the software](http://blog.syntheticspeech.de/2022/10/18/how-to-import-features-from-outside-the-nkululeko-software/)
326
+ * [Export acoustic features](http://blog.syntheticspeech.de/2024/05/30/nkululeko-export-acoustic-features/)
327
+ * [Explore feature importance](http://blog.syntheticspeech.de/2023/02/20/nkululeko-show-feature-importance/)
328
+ * [Plot distributions for feature values](http://blog.syntheticspeech.de/2023/02/16/nkululeko-how-to-plot-distributions-of-feature-values/)
329
+ * [Show feature importance](http://blog.syntheticspeech.de/2023/02/20/nkululeko-show-feature-importance/)
330
+ * [Augment the training set](http://blog.syntheticspeech.de/2023/03/13/nkululeko-how-to-augment-the-training-set/)
331
+ * [Visualize clusters of acoustic features](http://blog.syntheticspeech.de/2023/04/20/nkululeko-visualize-clusters-of-your-acoustic-features/)
332
+ * [Visualize your data distribution](http://blog.syntheticspeech.de/2023/05/11/nkululeko-how-to-visualize-your-data-distribution/)
333
+ * [Check your dataset](http://blog.syntheticspeech.de/2023/07/11/nkululeko-check-your-dataset/)
334
+ * [Segmenting a database](http://blog.syntheticspeech.de/2023/07/14/nkululeko-segmenting-a-database/)
335
+ * [Predict new labels for your data from public models and check bias](http://blog.syntheticspeech.de/2023/08/16/nkululeko-how-to-predict-labels-for-your-data-from-existing-models-and-check-them/)
336
+ * [Resample](http://blog.syntheticspeech.de/2023/08/31/how-to-fix-different-sampling-rates-in-a-dataset-with-nkululeko/)
337
+ * [Get some statistics on correlation and effect-size](http://blog.syntheticspeech.de/2023/09/05/nkululeko-get-some-statistics-on-correlation-and-effect-size/)
338
+ * [Automatic generation of a latex/pdf report](http://blog.syntheticspeech.de/2023/09/26/nkululeko-generate-a-latex-pdf-report/)
339
+ * [Inspect your data with Spotlight](http://blog.syntheticspeech.de/2023/10/31/nkululeko-inspect-your-data-with-spotlight/)
340
+ * [Automatically stratify your split sets](http://blog.syntheticspeech.de/2023/11/07/nkululeko-automatically-stratify-your-split-sets/)
341
+ * [re-name data column names](http://blog.syntheticspeech.de/2023/11/16/nkululeko-re-name-data-column-names/)
342
+ * [Oversample the training set](http://blog.syntheticspeech.de/2023/11/16/nkululeko-oversample-the-training-set/)
343
+ * [Compare several databases](http://blog.syntheticspeech.de/2024/01/02/nkululeko-compare-several-databases/)
344
+ * [Tweak the target variable for database comparison](http://blog.syntheticspeech.de/2024/03/13/nkululeko-how-to-tweak-the-target-variable-for-database-comparison/)
345
+ * [How to run multiple experiments in one go](http://blog.syntheticspeech.de/2022/03/28/how-to-run-multiple-experiments-in-one-go-with-nkululeko/)
346
+ * [How to finetune a transformer-model](http://blog.syntheticspeech.de/2024/05/29/nkululeko-how-to-finetune-a-transformer-model/)
347
+ * [Ensemble (combine) classifiers with late-fusion](http://blog.syntheticspeech.de/2024/06/25/nkululeko-ensemble-classifiers-with-late-fusion/)
348
+ * [Use train, dev and test splits](https://blog.syntheticspeech.de/2025/03/31/nkululeko-how-to-use-train-dev-test-splits/)
349
+
350
+ </details>
351
+
352
+ ## License
353
+ Nkululeko can be used under the [MIT license](https://choosealicense.com/licenses/mit/).
354
+
355
+
356
+ ## Contributing
357
+ Contributions are welcome and encouraged. To learn more about how to contribute to nkululeko, please refer to the [Contributing guidelines](./CONTRIBUTING.md).
358
+
359
+ ## Citation
360
+ If you use Nkululeko, please cite the paper:
361
+
362
+ > F. Burkhardt, Johannes Wagner, Hagen Wierstorf, Florian Eyben and Björn Schuller: Nkululeko: A Tool For Rapid Speaker Characteristics Detection, Proc. Proc. LREC, 2022
363
+
364
+
365
+ ```
366
+ @inproceedings{Burkhardt:lrec2022,
367
+ title = {Nkululeko: A Tool For Rapid Speaker Characteristics Detection},
368
+ author = {Felix Burkhardt and Johannes Wagner and Hagen Wierstorf and Florian Eyben and Björn Schuller},
369
+ isbn = {9791095546726},
370
+ journal = {2022 Language Resources and Evaluation Conference, LREC 2022},
371
+ keywords = {machine learning,speaker characteristics,tools},
372
+ pages = {1925-1932},
373
+ publisher = {European Language Resources Association (ELRA)},
374
+ year = {2022},
375
+ }
376
+ ```
@@ -2,8 +2,9 @@ examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  nkululeko/__init__.py,sha256=62f8HiEzJ8rG2QlTFJXUCMpvuH3fKI33DoJSj33mscc,63
3
3
  nkululeko/aug_train.py,sha256=wpiHCJ7zsW38kumg3ypwXZe2HQrhUblAnv7P2QeJnAc,3525
4
4
  nkululeko/augment.py,sha256=3RzaxB3gRxovgJVjHXi0glprW01J7RaHhUkqotW2T3U,2955
5
+ nkululeko/balance.py,sha256=r7opXbrqAipm2euPPaOmLlA5J10p2bHQgO5kWk2x9ro,8702
5
6
  nkululeko/cacheddataset.py,sha256=XFpWZmbJRg0pvhnIgYf0TkclxllD-Fctu-Ol0PF_00c,969
6
- nkululeko/constants.py,sha256=kSkvbiOI3g6sa27nNrD9sHxZMswo_qr0qKYSc_hZQLY,39
7
+ nkululeko/constants.py,sha256=Y72AuIN-vPMiSM6a5x7LgZsG66VfmX8oZ3Lu5ZeMdgs,39
7
8
  nkululeko/demo-ft.py,sha256=iD9Pzp9QjyAv31q1cDZ75vPez7Ve8A4Cfukv5yfZdrQ,770
8
9
  nkululeko/demo.py,sha256=tu7Al2l5MCLVegkDC-NE2wcuc_YE7NRbgOlPW3yhGEs,4940
9
10
  nkululeko/demo_feats.py,sha256=BvZjeNFTlERIRlq34OHM4Z96jdDQAhB01BGQAUcX9dM,2026
@@ -12,24 +13,25 @@ nkululeko/ensemble.py,sha256=71V-rre61H3J4sh7lu-OTo4I2_g7mm_rQxwW1ARDHgY,12782
12
13
  nkululeko/experiment.py,sha256=hdFvRA7EoQz10nId9MwcbYOTz2ifYeGrFKVJOv9a88Q,38394
13
14
  nkululeko/explore.py,sha256=aDVHwuo-lkih7VZrbb_zFKg5fowSrAIcx0V9wf0SRGo,4175
14
15
  nkululeko/export.py,sha256=U-V4acxtuL6qKt6oAsVcM5TTeWogYUJ3GU-lA6rq6d4,4336
15
- nkululeko/feature_extractor.py,sha256=X6ZWDjGwUMVwnP6TkCEnw8B4xo8eWvJa1QT9-0WUuvA,4102
16
+ nkululeko/feature_extractor.py,sha256=CsKmBoxwNClRGu20ox_eCxMG4u_1OH8Y83FYw7GfUwA,4230
16
17
  nkululeko/file_checker.py,sha256=xJY0Q6w47pnmgJVK5rcAKPYBrCpV7eBT4_3YBzTx-H8,3454
17
18
  nkululeko/filter_data.py,sha256=4sGrKvMZ_hLnJPrHm_CqjDPKIRV8REWoT7nfSYGXbwo,7305
18
19
  nkululeko/fixedsegment.py,sha256=Tb92QiuiyMsOO3WRWwuGjZGibS8hbHHCrcWAXGk7g04,2868
19
20
  nkululeko/glob_conf.py,sha256=NLFh-1_I0Wdfo2EnSq1Oppx23AX6jAUpgFbk2zqZJ24,659
20
- nkululeko/modelrunner.py,sha256=mnM5JBTiTVH4BOGZBepOuwEzAgrZDmoejhpVEvzq35s,11970
21
+ nkululeko/modelrunner.py,sha256=OFN18uG84iJyjNVWjcvDpqbcBrmylziXCakUTNE2-ZQ,10530
21
22
  nkululeko/multidb.py,sha256=sO6OwJn8sn1-C-ig3thsIL8QMWHdV9SnJhDodKjeKrI,6876
22
23
  nkululeko/nkuluflag.py,sha256=PGWSmZz-PiiHLgcZJAoGOI_Y-sZDVI1ksB8p5r7riWM,3725
23
24
  nkululeko/nkululeko.py,sha256=6ALPMMIz6l0O3IRaP0q4b59ZUxpfzNqLQUqZMf5t3Zo,1976
25
+ nkululeko/optim.py,sha256=dYKj69fyeqijEY9huIBEJQh1CoFSPxTdbVekv9lQ_Gk,36706
24
26
  nkululeko/plots.py,sha256=lUxgyoriYTwdpHZvBBQ4e41v77deQrt0PcRDLJWijys,27503
25
- nkululeko/predict.py,sha256=VSF42CqJvyiwAnvoThV0oNNJLHhTRMS0cI6lICQeptc,2177
27
+ nkululeko/predict.py,sha256=PWv1Pc39lrxqqIWrYszVk5SL37dDL93CHgcruItNID8,2211
26
28
  nkululeko/resample.py,sha256=rn3-M1A-iwVGibfQNGyeYNa7briD24lIN9Szq_1uTJo,5194
27
29
  nkululeko/runmanager.py,sha256=YtGQP0UyyQTKkilncB1XYM-T8oatzGcZEOcj5SorjJw,8902
28
30
  nkululeko/scaler.py,sha256=a4lKwWT436TV4VEvqtP1uQ58Yz67XVHr1HjO5gp3xLI,5109
29
31
  nkululeko/segment.py,sha256=7UrJEwdLmh9wDL5iBwpdJyJm9dwSxidHrHt-_D2qtxw,4949
30
32
  nkululeko/syllable_nuclei.py,sha256=5w_naKxNxz66a_qLkraemi2fggM-gWesiiBPS47iFcE,9931
31
33
  nkululeko/test.py,sha256=1w624vo5KTzmFC8BUStGlLDmIEAFuJUz7J0W-gp7AxI,1677
32
- nkululeko/test_predictor.py,sha256=RPQxorj1uygLeSnAuNims5CFccXwrDwTnrIDs-gDlNQ,2859
34
+ nkululeko/test_predictor.py,sha256=i8vSaB8OOrdELoDttQVMs2Bc-fUOi2C5ANqnt32K3Zk,3064
33
35
  nkululeko/test_pretrain.py,sha256=6FZeETlWzg9Cq_sn3BFKhfH91jW26nAIDm1bJkInNNA,8463
34
36
  nkululeko/augmenting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
37
  nkululeko/augmenting/augmenter.py,sha256=TUUznEz0pe9DSMC9r7LoBckuvsJTprvypeV5-8zLn20,2846
@@ -52,6 +54,8 @@ nkululeko/autopredict/ap_text.py,sha256=zaz9qIg90-ghZhBe1ka0HoUnap6s6RyopUKoCptt
52
54
  nkululeko/autopredict/ap_valence.py,sha256=9S06SpO_zXKSpkf0InHYYXZcD9HDGoCJ6UPkn__eBAg,1027
53
55
  nkululeko/autopredict/estimate_snr.py,sha256=1k9-XadABudnsNOeFZD_Fg0E64-GUQVS7JEp82MLQS4,4995
54
56
  nkululeko/autopredict/whisper_transcriber.py,sha256=DWDvpRaV5KmUF18ojPEvxnVXm_h_nWyY-TfW2Ngd5N8,2941
57
+ nkululeko/autopredict/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
+ nkululeko/autopredict/tests/test_whisper_transcriber.py,sha256=ilas6j3OUvq_xnQCRZgytQCtyrpNU6tvG5a8kPvVKBQ,5085
55
59
  nkululeko/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
60
  nkululeko/data/dataset.py,sha256=JLbBYGniUrjwxs-HtbIyhqO3Cv-ELfpmlq7jzij4dBc,41759
57
61
  nkululeko/data/dataset_csv.py,sha256=AIbtB6pGk5BSQGIgfokZ7tEGFjmuOq5w2XumRSimVWs,4833
@@ -66,12 +70,12 @@ nkululeko/feat_extract/feats_clap.py,sha256=1tttpfm2SJmQgYm2u8eUVpDiDOpWdKqFChpY
66
70
  nkululeko/feat_extract/feats_emotion2vec.py,sha256=LnV8xEg7L7HIDqz0ulqUNoaAHBU0d5gyQPb2_32T_18,9694
67
71
  nkululeko/feat_extract/feats_hubert.py,sha256=F3vrPCkx8EimJjFWYCZ7Yg9uo1G3NjYt4UKrGIUev8k,5172
68
72
  nkululeko/feat_extract/feats_import.py,sha256=cPi4XRuRs71npB8YGXr7rYOvkeTU_oZEl3GrGncdiqY,2222
69
- nkululeko/feat_extract/feats_mld.py,sha256=5aRoYiGDm5ApoFntxAMQYPjEelXHHRBHZcAJR9dxaeI,1945
73
+ nkululeko/feat_extract/feats_mld.py,sha256=-xJMrvQx0y5df-qmEvKXpi490cRZYwIg_jNW2PHPUyI,2177
70
74
  nkululeko/feat_extract/feats_mos.py,sha256=vkH1FdXtduoU0-yjBtVccC2b_p_eyH8laRnwlL7QTVM,4136
71
- nkululeko/feat_extract/feats_opensmile copy.py,sha256=BLj5sUaBPz7vLPfNlt9LdQurSypmViqgSpPK-6aXGhQ,4029
72
75
  nkululeko/feat_extract/feats_opensmile.py,sha256=HwbGs0EaPxZ7DznQZFem8RYgyQWz02oya77uVY7KhZE,9203
73
76
  nkululeko/feat_extract/feats_oxbow.py,sha256=TRoEJx5EKZiqoPoPRibHc0vkBMoZcKlGoGNq4NbyHZw,4895
74
- nkululeko/feat_extract/feats_praat.py,sha256=jZ-XXbP3iy25QQIzA4Hrv0HxsYvJNPavoCW2FyJNKMg,3064
77
+ nkululeko/feat_extract/feats_praat.py,sha256=3j1xySKqW74USjk8DweWAajHeTcuszKCFY1htQhe1cY,3070
78
+ nkululeko/feat_extract/feats_praat_core.py,sha256=Q0OVuo5h38a860yflzRtUpy0J0w7WCg0aBLrDhIskFc,28524
75
79
  nkululeko/feat_extract/feats_snr.py,sha256=Zxwo78HLleNsziYLOj34RQUnp9I7r1yMXqjYipDOjZw,2761
76
80
  nkululeko/feat_extract/feats_spectra.py,sha256=6WhFUpB0WTutg7OFMlAw9lSwVU5OBYCDcPRxaiH-Qn8,3621
77
81
  nkululeko/feat_extract/feats_spkrec.py,sha256=o_6bdU4lIkj64S5Kdjf1iyuo1VASeYxE4XdxV94a8gE,4732
@@ -81,8 +85,10 @@ nkululeko/feat_extract/feats_wav2vec2.py,sha256=q1QzMD3KbhF2SOmxdwI7CiViRmhlFRyg
81
85
  nkululeko/feat_extract/feats_wavlm.py,sha256=O9cfc39VF5aPJRRATKb37pHT4W11i2cu5O1mY9LOjIA,4755
82
86
  nkululeko/feat_extract/feats_whisper.py,sha256=n3ESZtva7wshs8E8diBlQYa9xCH_P0UY1DncSrxz-FY,4508
83
87
  nkululeko/feat_extract/featureset.py,sha256=clcBv9rzBRW-bfw7JC_FYTjU5uUS-c0UE1XtQLYYRiE,1615
84
- nkululeko/feat_extract/feinberg_praat.py,sha256=mMin5V-Kmx24oYJT_miNFN4t-tEVEF3Cd0969xiVV0E,28573
85
88
  nkululeko/feat_extract/transformer_feature_extractor.py,sha256=LaXuW-AJZ931ttLis0J5h9N3RtiiE51BnkxJR-bubfY,5837
89
+ nkululeko/feat_extract/tests/__init__.py,sha256=pzjkYs1PNo7107jIXKa_xwdBR2SKxzkg53a9W3bvbpw,32
90
+ nkululeko/feat_extract/tests/test_feats_opensmile.py,sha256=eYjGBsH6UkuRleKzGZHNv2cXRZz2xPCw0dkTfXw5S9s,5761
91
+ nkululeko/feat_extract/tests/test_feats_praat_core.py,sha256=ntbpIrehr4D-lOvaE0hNCe-og5sN4syBGBUTuNGZpDo,20916
86
92
  nkululeko/losses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
93
  nkululeko/losses/loss_ccc.py,sha256=NOK0y0fxKUnU161B5geap6Fmn8QzoPl2MqtPiV8IuJE,976
88
94
  nkululeko/losses/loss_softf1loss.py,sha256=5gW-PuiqeAZcRgfwjueIOQtMokOjZWgQnVIv59HKTCo,1309
@@ -104,26 +110,32 @@ nkululeko/models/model_tuned.py,sha256=74c_pQUtpx_x8bM3r5ufuqhaaQxfy6KRUqirdzSac
104
110
  nkululeko/models/model_xgb.py,sha256=_VxFFP1QcoyxrwvJSrzdIwwDt85IulUWvg1BxXBgN1Y,6616
105
111
  nkululeko/models/model_xgr.py,sha256=H01FJCRgmX2unvambMs5TTCS9sI6VDB9ip9G6rVGt2c,419
106
112
  nkululeko/models/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
+ nkululeko/models/tests/test_model_knn.py,sha256=hFCJ0C0taQO-fwA7j8HcFrwCSluSb6Vg4NCQQ_zL4bc,1793
114
+ nkululeko/models/tests/test_model_mlp.py,sha256=XVvniKAtroxLRKyYGW-ew1mHuRo3_cWk4nGnXQ5aDEk,4977
107
115
  nkululeko/models/tests/test_model_svm.py,sha256=spDlZmeBKBdK4EFBpOgEkaAfGeGH9kau6CqSWOY6Uag,1856
116
+ nkululeko/models/tests/test_model_xgb.py,sha256=-Rz5YTeqUJ4Kwdh5ny31c3zxsUJXTypR4L3ItoOU7yU,1036
108
117
  nkululeko/reporting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
109
118
  nkululeko/reporting/defines.py,sha256=0vh-Tlx4fAPpk1o6mP_4x3EkIoqzYMr38IZnj-JM5z4,641
110
119
  nkululeko/reporting/latex_writer.py,sha256=NGwSIfd4nfslDkNUOSZSdqY_VDLA8634thyhe-vj1bY,1824
111
120
  nkululeko/reporting/report.py,sha256=B5eoIKMz46VKDBsi7M9u_iegzAD-E3eGCmolzSFjZ3c,1118
112
121
  nkululeko/reporting/report_item.py,sha256=drkknsyFhGviaPJNmPQtCXJmRhTSSfjNcJt0Bls6JAA,533
113
- nkululeko/reporting/reporter.py,sha256=bfRMN-8nAHAx3iWvjumQsqS-7DHdv7fgAzaUkdi-_qo,20336
122
+ nkululeko/reporting/reporter.py,sha256=e-piNtnv0QUWKs9Ha_d4CzgqJxPBG9XBm3Ru8y0ot-U,20896
114
123
  nkululeko/reporting/result.py,sha256=G63a2tHCwHhM6NBJgYzsWKWJm4Yu3r4hsCHA2Km7eHU,1073
115
124
  nkululeko/segmenting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
116
125
  nkululeko/segmenting/seg_inaspeechsegmenter.py,sha256=b3t0zdpJYofKWMyKRMtMMX91xeR-k8d5pbnNaQHcsOE,1902
117
126
  nkululeko/segmenting/seg_pyannote.py,sha256=6IPbgjnGOz9juzEKDTZN3PSipX4t6Mz-DILAx3rp5do,4216
118
127
  nkululeko/segmenting/seg_silero.py,sha256=ulodnvtRq5MLHDxy_RmAK4tJg6h1d-mPq-uCPFkGVKg,4258
128
+ nkululeko/tests/__init__.py,sha256=XzD6C-ZuewsccUwx7KzEUtUxJrRx2d7sPFViscjf1O0,30
129
+ nkululeko/tests/test_balancing.py,sha256=21110R77iTcSWKiSTxYDkJ26lxPFTlZf_ZwVjeiSh4w,10164
130
+ nkululeko/tests/test_optim.py,sha256=Hg66X3iLBz1xbiING1w5xFMI8gUSp4xCQpe5c9WDkAQ,9245
119
131
  nkululeko/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
132
  nkululeko/utils/files.py,sha256=SrrYaU7AB80MZHiV1jcB0h_zigvYLYgSVNTXV4ao38g,4593
121
133
  nkululeko/utils/stats.py,sha256=3Fyx8q8BSKYmiufT6OkRug9RATWmGrr9BaX_y8jziWo,3074
122
134
  nkululeko/utils/unzip.py,sha256=G68f5120TjwACZC3bQcneMniddnwubPbBdMc2L5KBOo,1206
123
- nkululeko/utils/util.py,sha256=b4wolRb-9eCgfUDaxedcG3ys6HwgJrO5uoYvGSvi1nc,18571
124
- nkululeko-0.95.0.dist-info/licenses/LICENSE,sha256=0zGP5B_W35yAcGfHPS18Q2B8UhvLRY3dQq1MhpsJU_U,1076
125
- nkululeko-0.95.0.dist-info/METADATA,sha256=wVnk9XYBqWK3W55yNDp7-AK8h4Xpqgd1sRuWBrDGvV8,2874
126
- nkululeko-0.95.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
127
- nkululeko-0.95.0.dist-info/entry_points.txt,sha256=lNTkFEdh6Kjo5o95ZAWf_0Lq-4ztGoAoMVSDuPtuyS0,442
128
- nkululeko-0.95.0.dist-info/top_level.txt,sha256=bf1k1YKkqcXemNX_cUgoyKqQ3_GVErPqAY-53J36jkM,19
129
- nkululeko-0.95.0.dist-info/RECORD,,
135
+ nkululeko/utils/util.py,sha256=o62TZRcxO1VflINai6ojEzSmcbXIFInNLGogSbqJgiA,18561
136
+ nkululeko-0.95.2.dist-info/licenses/LICENSE,sha256=0zGP5B_W35yAcGfHPS18Q2B8UhvLRY3dQq1MhpsJU_U,1076
137
+ nkululeko-0.95.2.dist-info/METADATA,sha256=kmIo69SGcBnb9cDhMiU8Pon3Ozkv7z0AO9ye7uWI--A,21958
138
+ nkululeko-0.95.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
139
+ nkululeko-0.95.2.dist-info/entry_points.txt,sha256=lNTkFEdh6Kjo5o95ZAWf_0Lq-4ztGoAoMVSDuPtuyS0,442
140
+ nkululeko-0.95.2.dist-info/top_level.txt,sha256=bf1k1YKkqcXemNX_cUgoyKqQ3_GVErPqAY-53J36jkM,19
141
+ nkululeko-0.95.2.dist-info/RECORD,,
@@ -1,93 +0,0 @@
1
- # opensmileset.py
2
- import os
3
-
4
- import opensmile
5
- import pandas as pd
6
-
7
- import nkululeko.glob_conf as glob_conf
8
- from nkululeko.feat_extract.featureset import Featureset
9
-
10
-
11
- class Opensmileset(Featureset):
12
- def __init__(self, name, data_df, feats_type=None, config_file=None):
13
- super().__init__(name, data_df, feats_type)
14
- self.featset = self.util.config_val("FEATS", "set", "eGeMAPSv02")
15
- try:
16
- self.feature_set = eval(f"opensmile.FeatureSet.{self.featset}")
17
- # 'eGeMAPSv02, ComParE_2016, GeMAPSv01a, eGeMAPSv01a':
18
- except AttributeError:
19
- self.util.error(f"something is wrong with feature set: {self.featset}")
20
- self.featlevel = self.util.config_val("FEATS", "level", "functionals")
21
- try:
22
- self.featlevel = self.featlevel.replace("lld", "LowLevelDescriptors")
23
- self.featlevel = self.featlevel.replace("functionals", "Functionals")
24
- self.feature_level = eval(f"opensmile.FeatureLevel.{self.featlevel}")
25
- except AttributeError:
26
- self.util.error(f"something is wrong with feature level: {self.featlevel}")
27
-
28
- def extract(self):
29
- """Extract the features based on the initialized dataset or re-open them when found on disk."""
30
- store = self.util.get_path("store")
31
- store_format = self.util.config_val("FEATS", "store_format", "pkl")
32
- storage = f"{store}{self.name}.{store_format}"
33
- extract = eval(
34
- self.util.config_val("FEATS", "needs_feature_extraction", "False")
35
- )
36
- no_reuse = eval(self.util.config_val("FEATS", "no_reuse", "False"))
37
- if extract or not os.path.isfile(storage) or no_reuse:
38
- self.util.debug("extracting openSmile features, this might take a while...")
39
- smile = opensmile.Smile(
40
- feature_set=self.feature_set,
41
- feature_level=self.feature_level,
42
- num_workers=self.n_jobs,
43
- verbose=True,
44
- )
45
- if isinstance(self.data_df.index, pd.MultiIndex):
46
- self.df = smile.process_index(self.data_df.index)
47
- self.df = self.df.set_index(self.data_df.index)
48
- else:
49
- self.df = smile.process_files(self.data_df.index)
50
- self.df.index = self.df.index.droplevel(1)
51
- self.df.index = self.df.index.droplevel(1)
52
- self.util.write_store(self.df, storage, store_format)
53
- try:
54
- glob_conf.config["DATA"]["needs_feature_extraction"] = "False"
55
- except KeyError:
56
- pass
57
- else:
58
- self.util.debug(f"reusing extracted OS features: {storage}.")
59
- self.df = self.util.get_store(storage, store_format)
60
-
61
- def extract_sample(self, signal, sr):
62
- smile = opensmile.Smile(
63
- feature_set=self.feature_set,
64
- feature_level=opensmile.FeatureLevel.Functionals,
65
- )
66
- feats = smile.process_signal(signal, sr)
67
- return feats.to_numpy()
68
-
69
- # def filter(self):
70
- # # use only the features that are indexed in the target dataframes
71
- # self.df = self.df[self.df.index.isin(self.data_df.index)]
72
- # try:
73
- # # use only some features
74
- # selected_features = ast.literal_eval(
75
- # glob_conf.config["FEATS"]["os.features"]
76
- # )
77
- # self.util.debug(f"selecting features from opensmile: {selected_features}")
78
- # sel_feats_df = pd.DataFrame()
79
- # hit = False
80
- # for feat in selected_features:
81
- # try:
82
- # sel_feats_df[feat] = self.df[feat]
83
- # hit = True
84
- # except KeyError:
85
- # pass
86
- # if hit:
87
- # self.df = sel_feats_df
88
- # self.util.debug(
89
- # "new feats shape after selecting opensmile features:"
90
- # f" {self.df.shape}"
91
- # )
92
- # except KeyError:
93
- # pass