File size: 484 Bytes
6512ccb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import torch
from torchmetrics.functional.audio.stoi import short_time_objective_intelligibility


# 假设 reference 和 degraded 是两个音频信号的张量
reference = torch.randn(1, 16000)  # 参考信号
degraded = torch.randn(1, 16000)   # 降质信号


# 计算 STOI 分数
stoi_score = short_time_objective_intelligibility(reference, degraded, fs=16000)

print(f"STOI 分数: {stoi_score}")


if __name__ == '__main__':
    pass