Advanced Configurations
1. Sensitivity Control
It allows users to adjust the sensitivity so that it can be customized depending on target sounds and user scenarios. If you find that tags are not being detected frequently, try increasing the sensitivity. Conversely, if there are too many false detections, consider lowering the sensitivity.
- When disabled, all sounds follow the default sensitivity(‘Normal’) .
- When enabled, target sound follows adjusted sensitivity levels from ‘Very Low’ to ‘Very High’.
import cochl.sense as sense
api_config = sense.APIConfig(
sensitivity=sense.SensitivityConfig(
# default sensitivity applied to all tags not specified in `by_tags`
default=sense.SensitivityScale.LOW,
by_tags={
"Baby_cry": sense.SensitivityScale.VERY_LOW,
"Gunshot": sense.SensitivityScale.HIGH,
},
),
)
client = sense.Client(
"YOUR_API_PROJECT_KEY",
api_config=api_config,
)
2. Result Summary
It summarizes the prediction result by aggregating consecutive windows, returning the time and length of the detected tag. The ‘interval margin’ is a parameter that treats the unrecognized window between tags as part of the recognized ones and it affects all sound tags. If you want to specify a different interval margin for specific sound tags, you can use the ‘by_tags’ option.
print(result.events.to_summarized_result(
interval_margin=2,
by_tags={"Baby_cry": 5, "Gunshot": 3}
))
# At 0.0-1.0s, [Baby_cry] was detected