Spaces:
Running
Running
#!/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 | |