vak.datasets.frame_classification.metadata.Metadata#
- class vak.datasets.frame_classification.metadata.Metadata(dataset_csv_filename, input_type: str, frame_dur, audio_format=None, spect_format=None)[source]#
Bases:
objectA dataclass that represents metadata associated with a dataset that was generated by
vak.core.prep.prep().- dataset_csv_filename#
Name of csv file representing the source files in the dataset. Csv file will be located in root of directory representing dataset, so only the filename is given.
- Type:
- input_type#
The modality of the input data “frames”, either audio signals or spectrograms. One of {‘audio’, ‘spect’}.
- Type:
- frame_dur#
Duration of a frame, i.e., a single sample in audio or a single timebin in a spectrogram.
- Type:
- __init__(dataset_csv_filename, input_type: str, frame_dur, audio_format=None, spect_format=None) None#
Method generated by attrs for class Metadata.
Methods
__init__(dataset_csv_filename, input_type, ...)Method generated by attrs for class Metadata.
from_dataset_path(dataset_path)from_path(json_path)Load dataset metadata from a json file.
is_valid_frame_dur(attribute, value)is_valid_input_type(attribute, value)to_json(dataset_path)Dump dataset metadata to a json file.
Attributes
audio_formatspect_formatMETADATA_JSON_FILENAME- classmethod from_path(json_path: str | Path) Metadata[source]#
Load dataset metadata from a json file.
Class method that returns an instance of
FrameClassificationDatatsetMetadata.- Parameters:
json_path (string, pathlib.Path) – Path to a ‘metadata.json’ file created by
vak.core.prep.prep()when generating a dataset.- Returns:
metadata – Instance of
FrameClassificationDatatsetMetadatawith metadata loaded from json file.- Return type:
vak.datasets.frame_classification.FrameClassificationDatatsetMetadata
- to_json(dataset_path: str | Path) None[source]#
Dump dataset metadata to a json file.
This method is called by
vak.core.prep.prep()after it generates a dataset and then creates an instance ofFrameClassificationDatatsetMetadatawith metadata about that dataset.- Parameters:
dataset_path (string, pathlib.Path) – Path to root of a directory representing a dataset generated by
vak.core.prep.prep(). where ‘metadata.json’ file should be saved.