dcase_util.processors.OneHotEncodingProcessor

class dcase_util.processors.OneHotEncodingProcessor(label_list=None, focus_field='scene_label', time_resolution=1.0, length_frames=1, length_seconds=None, allow_unknown_labels=False, **kwargs)[source]

One hot encoding processor

Constructor

Parameters
label_listlist

List of labels in correct order

focus_fieldstr

Field from the meta data item to be used in encoding

time_resolutionfloat > 0.0

Time resolution used when converting event into event roll.

length_framesint

Length of encoded segment in frames

length_secondsfloat > 0.0

Length of encoded segment in seconds

allow_unknown_labelsbool

Allow unknown labels in the decoding. If False, labels not in the given label_list will produce an error. Default value False

__init__(label_list=None, focus_field='scene_label', time_resolution=1.0, length_frames=1, length_seconds=None, allow_unknown_labels=False, **kwargs)[source]

Constructor

Parameters
label_listlist

List of labels in correct order

focus_fieldstr

Field from the meta data item to be used in encoding

time_resolutionfloat > 0.0

Time resolution used when converting event into event roll.

length_framesint

Length of encoded segment in frames

length_secondsfloat > 0.0

Length of encoded segment in seconds

allow_unknown_labelsbool

Allow unknown labels in the decoding. If False, labels not in the given label_list will produce an error. Default value False

Methods

__init__([label_list, focus_field, ...])

Constructor

delimiter([exclude_delimiters])

Use csv.sniffer to guess delimiter for CSV file

detect_file_format([filename])

Detect file format from extension

empty()

Check if file is empty

exists()

Checks that file exists

get_file_information()

Get file information, filename

get_processing_chain_item()

Get processing chain item with current Processor data.

is_package([filename])

Determine if the file is compressed package.

load([filename])

Load file

log([level])

Log container content

process([data, label, focus_field, ...])

Encode metadata

save([filename])

Save file

show([mode, indent, visualize])

Print container content

to_html([indent])

Get container information in a HTML formatted string

to_string([ui, indent])

Get container information in a string

validate_format()

Validate file format

Attributes

bytes

File size in bytes

input_type

Input data type

logger

Logger instance

md5

Checksum for file.

output_type

Output data type

valid_formats

Valid file formats