pliers.extractors.AudiosetLabelExtractor¶
- class pliers.extractors.AudiosetLabelExtractor(hop_size=0.1, top_n=None, labels=None, weights_path=None, **yamnet_kwargs)[source]¶
Bases:
AudioExtractor
Extract probability of 521 audio event classes based on AudioSet corpus using a YAMNet architecture. Code available at: https://github.com/tensorflow/models/tree/master/research/audioset/yamnet
Args: hop_size (float): size of the audio segment (in seconds) on which label
extraction is performed.
- top_n (int): specifies how many of the highest label probabilities are
returned. If None, all labels (or those passed to the labels argument) are returned. Top_n and labels are mutually exclusive.
- labels (list): specifies subset of labels for which probabilities
are to be returned. If None, all labels (or top_n) are returned. The full list of labels is available in the audioset/yamnet repository (see yamnet_class_map.csv).
- weights_path (optional): full path to model weights file. If not provided,
weights from pretrained YAMNet module are used.
- yamnet_kwargs (optional): Optional named arguments that modify input
parameters for the model (see params.py file in yamnet repository)
- transform(stim, *args, **kwargs)¶
Executes the transformation on the passed stim(s).
- Parameters
One or more stimuli to process. Must be one of:
A string giving the path to a file that can be read in as a Stim (e.g., a .txt file, .jpg image, etc.)
A Stim instance of any type.
An iterable of stims, where each element is either a string or a Stim.
validation (str) –
String specifying how validation errors should be handled. Must be one of:
’strict’: Raise an exception on any validation error
’warn’: Issue a warning for all validation errors
’loose’: Silently ignore all validation errors
args – Optional positional arguments to pass onto the internal _transform call.
kwargs – Optional positional arguments to pass onto the internal _transform call.