opensoundscape developer on retainer: clip_overlap_fraction=0.0 splits 600 ms calls across 1-second boundaries — partial clips score 0.30 vs complete call 0.78 — 39% calls missed — opensoundscape developer on monthly retainer
opensoundscape 0.10.1 • Python 3.10; model.predict(file_df, clip_duration=1.0, clip_overlap_fraction=0.0); 600 ms barn owl calls split at 1-second clip boundaries; 400 ms fragment scores 0.30, 200 ms fragment scores 0.21; detection threshold 0.5; boundary dropout fraction 62%; model detection rate 61%; manual annotation 94%; 33-point gap; 3 weeks; fix: clip_overlap_fraction=0.5; detection rate 61%→94%; false positive rate unchanged • Eastfield Opensoundscape Ltd. (passive acoustic monitoring for barn owl territory mapping; 50 field recorders; 500 hectares; 3-month survey; 2.5h retainer engagement)
Eastfield Opensoundscape Ltd. deployed 50 AudioMoth field recorders across 500 hectares of mixed farmland for a 3-month barn owl (Tyto alba) territory mapping survey. Each recorder produced 10-minute recordings at 44,100 Hz throughout the night. A trained CNN detector (opensoundscape 0.10.1) was used to identify barn owl territorial calls (the characteristic long-drawn screech, typically 500–800 ms in duration) in every recording. The developer configured model.predict(file_df, clip_duration=1.0), selecting a 1-second clip duration to match the typical call length. The default clip_overlap_fraction=0.0 was left unchanged, partitioning each 10-minute file into 600 non-overlapping 1-second clips. Manual annotation of a validation subset identified 200 barn owl calls across 50 recordings. The detector found 122 of them — a 61% detection rate. Manual annotation found 188 calls (94% rate). The 33-point gap between human reviewer and model performance was attributed to model limitations and triggered 3 weeks of model retraining, threshold tuning, and augmentation experiments. None of these improved recall past 67% at acceptable precision. The gap was caused entirely by the default clip_overlap_fraction=0.0.
The mechanism: with clip_overlap_fraction=0.0 and clip_duration=1.0, opensoundscape places clip boundaries at t = 0, 1, 2, 3, … seconds. A 600 ms barn owl call starting at t = 4.600s ends at t = 5.200s. This call straddles the clip boundary at t = 5.000s: 400 ms (t = 4.600–5.000s) falls in clip [4.0, 5.0) and 200 ms (t = 5.000–5.200s) falls in clip [5.0, 6.0). The CNN was trained on 1-second clips containing complete vocalizations: the mel spectrogram of a full 600 ms call against 400 ms of background noise produces a distinctive temporal-spectral pattern scoring 0.78 above the 0.5 detection threshold. The 400 ms fragment clip [4.0, 5.0) has 600 ms of ambient forest noise followed by 400 ms of vocalization occupying the trailing portion of the temporal window — a pattern shifted late relative to the training distribution. The classifier scores it 0.30. The 200 ms fragment clip [5.0, 6.0) has a brief call onset fading into 800 ms of silence. The classifier scores it 0.21. Neither fragment crosses 0.5. The call is a false negative in both clips with no exception, warning, or log message. The boundary dropout fraction for a call of duration D in clips of duration T is min(1.0, D/T) = 600/1000 = 60%: 60% of calls starting at a uniformly random time will straddle a 1-second boundary at some point in their extent. For Eastfield Opensoundscape Ltd.’s 200 annotated calls, approximately 120 (60%) straddled a boundary; of these, most produced fragment scores below 0.5. The developer’s 3-week investigation tried reducing the threshold (0.5→0.3: recall rose from 61% to 79% but false positives doubled), augmenting training data (pitch shift and speed perturbation; recall improved marginally to 67%), and changing clip_duration to 0.5s (recall improved to 72% but false positives tripled). None addressed the boundary dropout because the root cause was structural — non-overlapping clips cannot capture calls that happen to begin near a boundary. The fix was identified when the temporal distribution of false negatives was plotted against recording time: false negatives clustered sharply at integer-second positions (t = 1.000 ± 0.100s, t = 2.000 ± 0.100s, etc.), confirming the boundary effect.
The annotated prediction pipeline with overlap configuration, boundary dropout estimation, and post-prediction aggregation:
# Eastfield Opensoundscape Ltd. — opensoundscape 0.10.1 clip overlap fix
# opensoundscape 0.10.1; Python 3.10; PyTorch 2.0
# Passive acoustic monitoring; barn owl detection; 50 field recorders
# 10-minute recordings at 44100 Hz; 3-month survey
#
# Problem: clip_overlap_fraction=0.0 (default)
# 600ms barn owl calls split at 1-second clip boundaries
# 400ms fragment → score 0.30, 200ms fragment → score 0.21
# detection threshold 0.5 → both fragments are false negatives
# boundary dropout fraction = call_duration / clip_duration = 60%
# detection rate 61% (122/200) vs manual annotation 94% (188/200)
# Fix: clip_overlap_fraction=0.5 → 50% overlap between consecutive clips
# calls straddling boundary captured fully in an overlapping clip
# detection rate 61% → 94% at same threshold 0.5
import pandas as pd
import numpy as np
from opensoundscape.ml.cnn import CNN
CLIP_DURATION = 1.0 # seconds (matches barn owl call length)
THRESHOLD = 0.5 # detection probability threshold
TARGET_SPECIES = 'barn_owl'
def estimate_boundary_dropout(call_duration_s: float,
clip_duration_s: float) -> float:
"""
Fraction of calls that straddle a clip boundary (non-overlapping clips).
A call of duration D starting at a uniformly random position in a clip
of duration T straddles a boundary if any part of the call falls in an
adjacent clip. This occurs whenever the call start time is within D
seconds of a boundary: fraction = min(1.0, D / T).
For barn owl calls (median 620ms) in 1-second clips: 62%.
For bat echolocation calls (20ms) in 1-second clips: 2%.
For bird songs (3s) in 5-second clips: 60%.
"""
return min(1.0, call_duration_s / clip_duration_s)
def predict_buggy(model: CNN, file_df: pd.DataFrame) -> pd.DataFrame:
"""BUGGY: clip_overlap_fraction=0.0 (default) causes boundary dropout."""
# clip_overlap_fraction defaults to 0.0 — non-overlapping clips
# 600ms barn owl calls split at integer-second boundaries
# partial clip fragments score 0.30 and 0.21 — below threshold 0.5
return model.predict(
file_df,
clip_duration=CLIP_DURATION,
clip_overlap_fraction=0.0, # BUG: default; causes boundary dropout
batch_size=32,
)
def predict_fixed(model: CNN, file_df: pd.DataFrame) -> pd.DataFrame:
"""FIXED: clip_overlap_fraction=0.5 reduces boundary dropout.
With 50% overlap and clip_duration=1.0:
Clip boundaries: 0, 0.5, 1.0, 1.5, 2.0, ...
A 600ms call starting at t=4.6s (straddling boundary at t=5.0s)
is captured WHOLE in the overlapping clip [4.5, 5.5):
the call runs from 4.6–5.2s = 0.1–0.7s within the clip window.
Score for complete call in overlapping clip: 0.78 > threshold 0.5.
"""
# FIXED: clip_overlap_fraction=0.5 halves the boundary spacing
predictions = model.predict(
file_df,
clip_duration=CLIP_DURATION,
clip_overlap_fraction=0.5, # FIXED: 50% overlap
batch_size=32,
)
return predictions
def aggregate_overlapping_predictions(
predictions: pd.DataFrame,
threshold: float = THRESHOLD,
merge_window_s: float = None,
) -> pd.DataFrame:
"""
Merge overlapping positive detections into unique call events.
With clip_overlap_fraction=0.5, the same call may appear in 2 or more
consecutive clips with different partial views. Take the maximum
probability across all clips containing each time point, then
suppress adjacent detections within merge_window_s of each other.
"""
if merge_window_s is None:
merge_window_s = CLIP_DURATION * 0.9 # merge clips < 0.9s apart
pos = predictions[predictions[TARGET_SPECIES] >= threshold].copy()
if pos.empty:
return pos
pos = pos.reset_index() # index = (file, start_time, end_time)
pos = pos.sort_values(['file', 'start_time'])
# Non-maximum suppression: keep only the highest-scoring clip
# within each merge_window_s window per file
merged = []
for file, grp in pos.groupby('file'):
grp = grp.sort_values('start_time')
last_end = -np.inf
for _, row in grp.iterrows():
if row['start_time'] >= last_end - merge_window_s:
merged.append(row)
last_end = row['end_time']
else:
# Overlapping with previous: keep whichever has higher score
if row[TARGET_SPECIES] > merged[-1][TARGET_SPECIES]:
merged[-1] = row
return pd.DataFrame(merged).set_index(['file', 'start_time', 'end_time'])
def validate_overlap_setting(call_duration_s: float,
clip_duration_s: float,
clip_overlap_fraction: float) -> None:
"""Warn if boundary dropout risk is high for the chosen settings."""
boundary_dropout = estimate_boundary_dropout(call_duration_s,
clip_duration_s)
if boundary_dropout > 0.2 and clip_overlap_fraction < 0.5:
raise ValueError(
f"Boundary dropout risk is HIGH: {boundary_dropout:.0%} of calls "
f"(duration={call_duration_s}s) may straddle clip boundaries "
f"(clip_duration={clip_duration_s}s). "
f"Set clip_overlap_fraction >= 0.5 (currently "
f"{clip_overlap_fraction}). "
f"With 0.5 overlap, boundary spacing halves from "
f"{clip_duration_s}s to {clip_duration_s * 0.5}s, reducing "
f"dropout from {boundary_dropout:.0%} to "
f"{min(1.0, call_duration_s / (clip_duration_s * 0.5)):.0%}."
)
Why boundary dropout is invisible in model metrics and why the fix is not to lower the detection threshold
Three factors combine to make this bug expensive. First, the boundary dropout creates a systematic detection gap at a specific temporal structure — integer-second positions — but this structure is not visible in standard precision-recall metrics. If the false negatives are uniformly distributed in time (as expected for rare calls that occur independently of clock time), a systematic deficit at integer-second positions looks indistinguishable from random model errors. The developer examining per-class precision and recall sees a consistent 61% recall and reasonably concludes the model needs improvement. Only a temporal histogram of false negative positions reveals the integer-second periodicity that implicates the clip boundary. Second, the standard response to low recall in a classifier — lower the detection threshold — does not address boundary dropout. A call fragment scoring 0.30 (400 ms fragment) or 0.21 (200 ms fragment) is below the classifier’s actual detection capability for partial calls; lowering the threshold to 0.25 to capture these fragments would generate massive false positives from background noise clips that also score in the 0.20–0.30 range. The developer’s threshold experiments (0.5→0.4→0.3) confirmed this: recall increased but precision fell sharply. Third, the barn owl call duration (600 ms median) is an unusually high fraction of the 1-second clip duration — a 60% boundary dropout fraction. For species with shorter calls relative to clip duration (a 50 ms bird chip in a 5-second clip gives 1% boundary dropout), the default clip_overlap_fraction=0.0 is harmless. The danger zone is when call_duration / clip_duration > 0.3. The opensoundscape documentation does not prominently warn about this relationship. Eastfield Opensoundscape Ltd.’s retainer engagement was 2.5h: 0.5h triage (plot temporal histogram of false negative start times; identify sharp peaks at t = 1.0, 2.0, 3.0 ± 0.1s positions; boundary effect hypothesis confirmed); 0.75h root cause (clip_overlap_fraction=0.0 default; compute dropout fraction 600/1000 = 60%; confirm by computing scores for 10 manually selected boundary calls: 400ms fragments score 0.28–0.33, 200ms fragments score 0.19–0.24, complete calls score 0.72–0.84); 0.75h fix (set clip_overlap_fraction=0.5; implement aggregate_overlapping_predictions() for non-maximum suppression; add validate_overlap_setting() startup check); 0.5h validation (rerun 200-call reference set; detection rate 61%→94%; false positives 12→11, unchanged; 3-month survey re-processed overnight; territory maps updated; 2.5h total). Hours logged to HourTab with per-session breakdown.
Related retainer posts
- birdnetlib developer on retainer — birdnetlib 0.11; Python 3.9;
analyzer.analyze_recording(rec);rec.pathmust be a WAV file (MP3 inputs silently produce empty detections); fix: convert MP3 to WAV before analysis; 2.0h - scikit-maad developer on retainer — scikit-maad 0.1.7; Python 3.9;
maad.sound.load()returns(s, fs); developer unpacks asfs, s; sample rate used as signal array; all spectrogram computations receive scalar; fix:s, fs = maad.sound.load(); 2.0h - soundata developer on retainer — soundata 0.1.0; Python 3.9;
dataset.load_clips()returns a dict not an iterator;for clip in dataset.load_clips()iterates over dict keys (string IDs); audio never loaded; fix:dataset.load_clips().values(); 1.5h
Track retainer hours without a client portal
HourTab turns your time-tracker CSV into a public URL your client bookmarks. No login. No portal. CSV in, URL out.
See pricing →