Align behavioral event annotation protocol

This commit is contained in:
Xin Wang
2026-09-14 23:43:28 +08:00
parent 06b5e6c385
commit 2f9ccfad88
3 changed files with 123 additions and 129 deletions
+13 -10
View File
@@ -422,18 +422,21 @@ def derive_protocol_candidates(utterances: Sequence[Utterance], clips: Sequence[
reason="short raw wearer pause without sustained competing other takeover; merged into the existing floor episode",
), ("WEARER_RESUME", frame, ()))
# A1: open an opportunity at a non-wearer release and pair it with the
# subsequent floor-level wearer entry only if no competing other onset
# or wearer activity intervenes. Long silence alone does not invalidate
# the opportunity. Unpaired floor onsets are retained as controls.
# A1: anchor the observed floor-level wearer entry, then retrieve the
# most recent preceding non-wearer release. Keep the pair only if no
# competing other onset or wearer activity intervenes. Long silence
# alone does not invalidate the opportunity. Unpaired floor onsets are
# retained as controls.
paired_floor_onsets: set[int] = set()
for release in other_rows:
opportunity_frame = release.dense_end_frame_exclusive
onset_frame = next(
(value for value in floor_onsets if value >= opportunity_frame), None
)
if onset_frame is None:
for onset_frame in floor_onsets:
releases = [
row for row in other_rows
if row.dense_end_frame_exclusive <= onset_frame
]
release = max(releases, key=lambda row: row.dense_end_frame_exclusive, default=None)
if release is None:
continue
opportunity_frame = release.dense_end_frame_exclusive
wearer_silent = (
opportunity_frame == onset_frame
or _all_state(