Acoustic Scene Classification¶
The goal of acoustic scene classification is to classify a test recording into one of predefined classes that characterizes the environment in which it was recorded — for example “outdoor market”, “busy street”, “office”.
Classification performance is measured using accuracy: the number of correctly classified segments among the total number of test segments.
Metrics¶
Main functions:
sed_eval.scene.SceneClassificationMetrics.evaluate
: Calculate intermediate values for evaluation and accumulate them.sed_eval.scene.SceneClassificationMetrics.results
: Calculate and return all metrics.sed_eval.scene.SceneClassificationMetrics.results_overall_metrics
: Calculate and return overall metrics (micro-averaged).sed_eval.scene.SceneClassificationMetrics.results_class_wise_metrics
: Calculate and return class-wise metrics.sed_eval.scene.SceneClassificationMetrics.results_class_wise_average_metrics
: Calculate and return class-wise average metrics (macro-averaged).
Function sed_eval.scene.SceneClassificationMetrics.evaluate
takes as a parameter scene lists,
use sed_eval.io.load_scene_list
to read them from a file.
Usage example to evaluate files:
Usage example to evaluate results stored in variables:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import sed_eval
import dcase_util
reference = dcase_util.containers.MetaDataContainer([
{
'scene_label': 'supermarket',
'file': 'supermarket09.wav'
},
{
'scene_label': 'tubestation',
'file': 'tubestation10.wav'
},
{
'scene_label': 'quietstreet',
'file': 'quietstreet08.wav'
},
{
'scene_label': 'office',
'file': 'office10.wav'
},
{
'scene_label': 'bus',
'file': 'bus01.wav'
},
])
estimated = dcase_util.containers.MetaDataContainer([
{
'scene_label': 'supermarket',
'file': 'supermarket09.wav'
},
{
'scene_label': 'bus',
'file': 'tubestation10.wav'
},
{
'scene_label': 'quietstreet',
'file': 'quietstreet08.wav'
},
{
'scene_label': 'park',
'file': 'office10.wav'
},
{
'scene_label': 'car',
'file': 'bus01.wav'
},
])
scene_labels = sed_eval.sound_event.util.unique_scene_labels(reference)
scene_metrics = sed_eval.scene.SceneClassificationMetrics(scene_labels)
scene_metrics.evaluate(
reference_scene_list=reference,
estimated_scene_list=estimated
)
print(scene_metrics)
|
SceneClassificationMetrics ([scene_labels]) |
|
SceneClassificationMetrics.evaluate (...[, ...]) |
Evaluate file pair (reference and estimated) |
SceneClassificationMetrics.results () |
All metrics |
SceneClassificationMetrics.results_overall_metrics () |
Overall metrics |
SceneClassificationMetrics.results_class_wise_metrics () |
Class-wise metrics |
SceneClassificationMetrics.results_class_wise_average_metrics () |
Class-wise averaged metrics |
SceneClassificationMetrics.result_report_parameters () |
Report metric parameters |
SceneClassificationMetrics.result_report_class_wise () |
Report class-wise results |
SceneClassificationMetrics.result_report_class_wise_average () |
Report class-wise averages |
SceneClassificationMetrics.reset () |
Reset internal state |