许可证: cc-by-4.0
管道标签: 音频分类
标签:
该模型已通过PytorchModelHubMixin集成推送到Hub:
- 代码: https://github.com/facebookresearch/audiobox-aesthetics
- 论文: https://huggingface.co/papers/2502.05139
--- 以下README内容复制自 https://github.com/facebookresearch/audiobox-aesthetics
audiobox-aesthetics

统一的语音、音乐和声音自动质量评估。
安装
- 通过pip安装
pip install audiobox_aesthetics
- 直接从源码安装
此仓库需要Python 3.9和Pytorch 2.2或更高版本。要安装,可以克隆此仓库并运行:
pip install -e .
预训练模型
使用
如何通过CLI运行预测:
- 创建一个jsonl文件,格式如下
{"path":"/path/to/a.wav"}
{"path":"/path/to/b.flac"}
...
{"path":"/path/to/z.wav"}
或者如果你只想预测特定时间戳的美学评分
{"path":"/path/to/a.wav", "start_time":0, "end_time": 5}
{"path":"/path/to/b.flac", "start_time":3, "end_time": 10}
并将其保存为input.jsonl
- 运行以下命令
audio-aes input.jsonl --batch-size 100 > output.jsonl
如果你还没有下载检查点,脚本会自动尝试下载。否则,你可以通过--ckpt /path/to/checkpoint.pt
提供路径。
如果你有SLURM,运行以下命令
audio-aes input.jsonl --batch-size 100 --remote --array 5 --job-dir $HOME/slurm_logs/ --chunk 1000 > output.jsonl
请根据你的节点调整CPU和GPU设置,使用--slurm-gpu, --slurm-cpu
。
- 输出文件将包含与
input.jsonl
相同数量的行。每行包含4个预测轴的JSON格式字典。查看下表获取更多信息:
轴名称 |
全称 |
CE |
内容享受度 |
CU |
内容有用性 |
PC |
制作复杂度 |
PQ |
制作质量 |
输出行示例:
{"CE": 5.146, "CU": 5.779, "PC": 2.148, "PQ": 7.220}
-
(额外)如果你只想提取一个轴(例如CE),使用jq
工具处理输出文件:
jq '.CE' output.jsonl > output-aes_ce.txt
如何从Python脚本或解释器运行预测
- 从文件路径推断
from audiobox_aesthetics.infer import initialize_predictor
predictor = initialize_predictor()
predictor.forward([{"path":"/path/to/a.wav"}, {"path":"/path/to/b.flac"}])
- 从torch张量推断
from audiobox_aesthetics.infer import initialize_predictor
predictor = initialize_predictor()
wav, sr = torchaudio.load("/path/to/a.wav")
predictor.forward([{"path":wav, "sample_rate": sr}])
评估数据集
我们发布了包含4个美学评分轴的评估数据集。
这里,我们展示一个如何读取并将每个注释重新映射到实际音频文件的示例。
{
"data_path": "/your_path/LibriTTS/train-clean-100/1363/139304/1363_139304_000011_000000.wav",
"Production_Quality": [8.0, 8.0, 8.0, 8.0, 8.0, 9.0, 8.0, 5.0, 8.0, 8.0],
"Production_Complexity": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
"Content_Enjoyment": [8.0, 6.0, 8.0, 5.0, 8.0, 8.0, 8.0, 6.0, 8.0, 6.0],
"Content_Usefulness": [8.0, 6.0, 8.0, 7.0, 8.0, 9.0, 8.0, 6.0, 10.0, 7.0]
}
- 从data_path识别数据集名称。在示例中,它是LibriTTS。
- 将"/your_path/"替换为你下载的LibriTTS目录。
- 每个轴包含10个由不同人类注释者评分的分数。
data_path |
URL |
LibriTTS |
https://openslr.org/60/ |
cv-corpus-13.0-2023-03-09 |
https://commonvoice.mozilla.org/en/datasets |
EARS |
https://sp-uhh.github.io/ears_dataset/ |
MUSDB18 |
https://sigsep.github.io/datasets/musdb.html |
musiccaps |
https://www.kaggle.com/datasets/googleai/musiccaps |
(audioset) unbalanced_train_segments |
https://research.google.com/audioset/dataset/index.html |
PAM |
https://zenodo.org/records/10737388 |
许可证
audiobox-aesthetics的大部分内容根据CC-BY 4.0许可证授权,如LICENSE文件所示。
然而,项目的部分内容根据不同的许可证条款提供:https://github.com/microsoft/unilm根据MIT许可证授权。
引用
如果你觉得这个仓库有用,请引用以下BibTeX条目。
@article{tjandra2025aes,
title={Meta Audiobox Aesthetics: Unified Automatic Quality Assessment for Speech, Music, and Sound},
author={Andros Tjandra and Yi-Chiao Wu and Baishan Guo and John Hoffman and Brian Ellis and Apoorv Vyas and Bowen Shi and Sanyuan Chen and Matt Le and Nick Zacharov and Carleigh Wood and Ann Lee and Wei-Ning Hsu},
year={2025},
url={https://arxiv.org/abs/2502.05139}
}
致谢
部分模型代码复制自https://github.com/microsoft/unilm/tree/master/wavlm。