Skip to content

Updating feature extractor for handling special arg idx is complicated #82

Description

@hagenw

As shown in the docs, we can handle models that have different heads for different sexes, e.g.

def f0(signal, sampling_rate, idx, gender, f0_range):
    # extract mean f0 using a gender adapted range
    y = librosa.yin(
        signal,
        fmin=f0_range[gender[idx]][0],
        fmax=f0_range[gender[idx]][1],
        sr=sampling_rate,
    ).mean()
    return y, gender[idx]

interface = audinterface.Feature(
    ['f0', 'gender'],
    process_func=f0,
    process_func_args={
        'gender': gender,
        'f0_range': f0_range,
    },
)

The problem is that the gender argument is not really static but depends on the input data.
To update it you would need to create a new Feature object for each new database, which is not what we want for ONNX models, or you could update the process_func_args, which is ok, but they are hidden under interface.process.process_func_args.

So maybe we update the documentation by showing an example how to update them?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions