From fcc9c89eaba9a4e36c54958aeedeec7ab3756cd7 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期一, 13 二月 2023 17:43:31 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR add
---
funasr/datasets/large_datasets/dataset.py | 7 +++++--
egs/alimeeting/diarization/sond/README.md | 21 ++++++++++++++++++++-
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/egs/alimeeting/diarization/sond/README.md b/egs/alimeeting/diarization/sond/README.md
index 8bef142..b36210c 100644
--- a/egs/alimeeting/diarization/sond/README.md
+++ b/egs/alimeeting/diarization/sond/README.md
@@ -1,5 +1,24 @@
+# Get Started
+To use this example, please execute the first stage of run.sh first to obtain the prepared data and pre-trained models:
+```shell
+sh run.sh --stage 0 --stop_stage 0
+```
+Then, you can execute unit_test.py to check the correctness of code:
+```shell
+python unit_test.py
+# you will get the results:
+[{'key': 'R8002_M8002_MS802-S0000_0000000_0001600', 'value': 'spk1 [(0.0, 8.88), (10.72, 11.92), (12.64, 15.2)]\nspk2 [(8.8, 9.76)]\nspk3 [(9.6, 10.96), (15.12, 15.68)]\nspk4 [(11.12, 12.72)]'}]
+[{'key': 'R8002_M8002_MS802-S0000_0000000_0001600', 'value': 'spk1 [(0.0, 8.88), (10.72, 11.92), (12.64, 15.2)]\nspk2 [(8.8, 9.76)]\nspk3 [(9.6, 10.96), (15.12, 15.68)]\nspk4 [(11.12, 12.72)]'}]
+[{'key': 'R8002_M8002_MS802-S0000_0000000_0001600', 'value': 'spk1 [(0.0, 8.88), (10.72, 11.92), (12.64, 15.2)]\nspk2 [(8.8, 9.76)]\nspk3 [(9.6, 10.88), (15.12, 15.68)]\nspk4 [(11.12, 12.72)]'}]
+[{'key': 'test0', 'value': 'spk1 [(0.0, 8.88), (10.64, 15.2)]\nspk2 [(8.88, 9.84)]\nspk3 [(9.6, 11.04), (15.12, 15.68)]\nspk4 [(11.2, 11.76)]'}]
+```
+You can also execute run.sh to reproduce the diarization performance reported in [1]
+```shell
+sh run.sh --stage 1 --stop_stage 2
+```
+
# Results
-You will get a DER about 4.21%, which is reported in [1], Table 6, line "SOND Oracle Profile".
+After executing "run.sh", you will get a DER about 4.21%, which is reported in [1], Table 6, line "SOND Oracle Profile".
# Reference
[1] Speaker Overlap-aware Neural Diarization for Multi-party Meeting Analysis, Zhihao Du, Shiliang Zhang,
diff --git a/funasr/datasets/large_datasets/dataset.py b/funasr/datasets/large_datasets/dataset.py
index 55b0678..2123737 100644
--- a/funasr/datasets/large_datasets/dataset.py
+++ b/funasr/datasets/large_datasets/dataset.py
@@ -1,9 +1,10 @@
import os
import random
-import soundfile
+import numpy
from functools import partial
import torch
+import torchaudio
import torch.distributed as dist
from kaldiio import ReadHelper
from torch.utils.data import IterableDataset
@@ -117,7 +118,9 @@
sample_dict["key"] = key
elif data_type == "sound":
key, path = item.strip().split()
- mat, sampling_rate = soundfile.read(path)
+ waveform, sampling_rate = torchaudio.load(path)
+ waveform = waveform.numpy()
+ mat = waveform[0]
sample_dict[data_name] = mat
sample_dict["sampling_rate"] = sampling_rate
if data_name == "speech":
--
Gitblit v1.9.1