语音情绪识别

做一个记录,方便理清思路

示例代码复现

我按照fastai的指导,第一步完成训练任务的所有步骤,首先我在fastai论坛里找了一个示例

Emotion Detection from Voice Clips
Hey guys ! I trained a neural net to detect emotions from voice clips without relying on the content of the speech.It is able to identify the emotions with an accuracy of 83 %. I converted the sound clips into spectogram and then applied the methods we apply for image classification problems on it. The notebooks for it can be found here. I also wrote a blog regarding it which can be found here. Any suggestions for improvements are welcome !

我按照帖子下载了RAVDESS Dataset数据集,但是在下载TESS Dataset数据集时发现老是下载失败,于是我决定先用RAVDESS Dataset数据集进行实验.

我的示例代码中文件是这样命名的

1710491684576.png

为了方便处理数据,让我的文件结构和示例代码中相同,我决定用chatgpt写一个bash脚本

ChatGPT
A conversational AI system that listens, learns, and challenges

1710500055885.png

看起来还不错

接下来我发现示例代码是3年前的项目,很多地方版本不兼容了,与其花时间去修改,不如自己按照示例代码的思路实现快捷.

我怀疑示例代码中的文件已经是图片文件了,刚开始的思路错了,现在在借助fastaudio库处理音频

! [ -e /content ] && pip install -Uqq fastbook # fastai

一个逆天的错误

fastai库直接处理音频不易,决定写脚本转换音频为彩色频谱图,把音频问题直接转换为图片分类问题,结果看起来还不错

1710570355692.png

1710570390571.png

这样子之前的示例代码也就没了意义,图像分类是我已经很熟悉的.最后的结果是这样的

1710592282943.png

代码

Google Colaboratory

bash脚本

数据集

sorted_data3 - Google Drive

huggingface space

Voice Emotion Detection - a Hugging Face Space by orlco
Discover amazing ML apps made by the community

Read more

fastai14-Resnet

卷积神经网络有这样两个问题 * 我们需要大量的步长为 2 的层来使我们的网格在最后变成 1×1 * 无法在除我们最初训练的尺寸之外的任何尺寸的图像上工作 全卷积网络 | fully convolutional networks def avg_pool(x): return x.mean((2,3)) 前面正常卷积, 剩下的直接求平均 def block(ni, nf): return ConvLayer(ni, nf, stride=2) def get_model(): return nn.Sequential( block(3, 16), block(16, 32), block(32, 64), block(64, 128)

By kamado nezuko

pt命令行做种

发布种子各站点都有教程, 奈何使用的qb下载器为qbittorrent-nox, 没有直接生成torrent文件的选项, google发现可以使用transmission-cli命令行生成torrent 安装 sudo apt install transmission-cli 生成torrent种子 transmission-create -p -o path/to/example.torrent --tracker tracker_announce_url --piecesize 2048 path/to/file_or_directory * -p: 私有种子,不使用 DHT * -o: 生成 torrent 文件路径 * -t: tracker 地址 * -s: 每个文件块大小(参考下表) 文件大小 文件块大小 0 GB - 0.5 GB

By kamado nezuko