dcase_models.util.evaluate_metrics

dcase_models.util.evaluate_metrics(model, data, metrics, **kwargs)[source]

Calculate metrics over files with different length

Parameters:
model : keras Model

model to get the predictions

data : tuple or KerasDataGenerator

Validation data for model evaluation (X_val, Y_val) or KerasDataGenerator

X_val : list of ndarray

Each element in list is a 3D array with the mel-spectrograms of one file. Shape of each element: (N_windows, N_hops, N_mel_bands) N_windows can be different in each file (element)

Y_val : list ndarray

Each element in the list is a 1D array with the annotations (one hot encoding). Shape of each element (N_classes,)

metrics : list

List of metrics to apply. Each element can be a metric name or a function.

Returns:
dict

Dict with the results information.

{‘annotations’ : [Y0, Y1, …],

‘predictions’ : [Yp0, Yp1, …], metrics[0]: 0.1, metrics[1]: 0.54}