Committed by
GitHub
Fixes #2172 (#2301)
Handle the case when the input audio contains no speeches.
正在显示
1 个修改的文件
包含
5 行增加
和
0 行删除
| @@ -160,6 +160,11 @@ class OfflineSpeakerDiarizationPyannoteImpl | @@ -160,6 +160,11 @@ class OfflineSpeakerDiarizationPyannoteImpl | ||
| 160 | std::vector<int32_t> cluster_labels = clustering_->Cluster( | 160 | std::vector<int32_t> cluster_labels = clustering_->Cluster( |
| 161 | &embeddings(0, 0), embeddings.rows(), embeddings.cols()); | 161 | &embeddings(0, 0), embeddings.rows(), embeddings.cols()); |
| 162 | 162 | ||
| 163 | + if (cluster_labels.empty()) { | ||
| 164 | + SHERPA_ONNX_LOGE("No speakers found in the audio samples"); | ||
| 165 | + return {}; | ||
| 166 | + } | ||
| 167 | + | ||
| 163 | int32_t max_cluster_index = | 168 | int32_t max_cluster_index = |
| 164 | *std::max_element(cluster_labels.begin(), cluster_labels.end()); | 169 | *std::max_element(cluster_labels.begin(), cluster_labels.end()); |
| 165 | 170 |
-
请 注册 或 登录 后发表评论