Skip to content

Commit

Permalink
Merge pull request #449 from desh2608/ami_bug_fix
Browse files Browse the repository at this point in the history
Fixed bug in preparing supervisions
  • Loading branch information
pzelasko authored Nov 4, 2021
2 parents c42b181 + a095fcf commit 9b6e3e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lhotse/recipes/ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from collections import defaultdict
from pathlib import Path
from typing import Dict, List, NamedTuple, Optional, Union
from lhotse.qa import fix_manifests

from tqdm.auto import tqdm

Expand Down Expand Up @@ -477,7 +478,9 @@ def prepare_supervision_ihm(
def prepare_supervision_other(
audio: RecordingSet, annotations: Dict[str, List[AmiSegmentAnnotation]]
) -> SupervisionSet:
annotation_by_id = {(key[0]): annot for key, annot in annotations.items()}
annotation_by_id = defaultdict(list)
for key, value in annotations.items():
annotation_by_id[key[0]].extend(value)

segments = []
for recording in audio:
Expand Down Expand Up @@ -603,6 +606,7 @@ def prepare_ami(
audio_part.to_json(output_dir / f"recordings_{part}.json")
supervision_part.to_json(output_dir / f"supervisions_{part}.json")

audio_part, supervision_part = fix_manifests(audio_part, supervision_part)
validate_recordings_and_supervisions(audio_part, supervision_part)

# Combine all manifests into one dictionary
Expand Down

0 comments on commit 9b6e3e4

Please sign in to comment.