With nkululeko since version 1.1.3, there is the possibility to run the new feature_demo module on pre-loaded models, i.e. feature extractors.
If the extracted features of some model should be analyzed side-by-side with, e.g. some ground truth labels, you can simply specify all in a config file and run.
python -m nkululeko.feature_demo --config myConfig.ini
The config might look something like:
[EXP]
...
type = regression
[DATA]
databases = ['data']
data = ./age/test_df.csv
data.type = csv
labels = ['young', 'old']
bins = [-100000, 35, 100000]
target = age
[FEATS]
type = ['audagender']
store_format = csv
You can simply run the module feature_demo even without any initialization file, for example if you want to test the output of the agender model, you could call python like this (getting input from the local microphone):
python -m nkululeko.feature_demo --model agender --mic
and get the output:
No config file specified, using default settings
================================================================================
MICROPHONE RECORDING
================================================================================
Recording NOW for 5 seconds - speak clearly!
Recording finished!
Audio saved to temporary file: /tmp/tmpht4rf3mr.wav
Processing 1 file(s)...
DEBUG: feature_demo: running feature extraction demo, nkululeko version 1.1.3
DEBUG: feature_demo: using model: agender
Initializing agender model...
(This may take a while on first run - downloading models...)
Loading agender_agender model (this may download the model on first use)...
DEBUG: featureset: value for n_jobs is not found, using default: 8
DEBUG: featureset: value for agender.model is not found, using default: ./audmodel_agender/
DEBUG: featureset: initialized agender model
Model initialized successfully!
[1/1] Extracting features from: /tmp/tmpht4rf3mr.wav
Feature dimension: 4
Features saved to features_output.csv
================================================================================
FEATURE EXTRACTION SUMMARY
================================================================================
Total files processed: 1
Feature dimension: 4
Output shape: (1, 4)
First few rows:
feat_0 feat_1 feat_2 feat_3
/tmp/tmpht4rf3mr.wav 0.495758 -0.765581 6.437115 -4.332793
Cleaned up temporary recording file
DONE
In this case the output signifies the logits for age, female, male and child.
If you want to see all possible models, simply call
python -m nkululeko.feature_demo --help