Nkululeko: how to only extract features

With nkululeko since version 1.1.3, there is the possibility to run the demo module on pre-loaded models, i.e. feature extractors.
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

Leave a Reply

Your email address will not be published. Required fields are marked *