使用opensmile提取音频的特征,得到特征向量,并扔进libsvm中进行分类训练测试

我们做的是从语音中识别出情感,我们先从网上下载许多视频,电影、电视剧、综艺访谈节目等等,截取其中带有表情的视频片断,再从每个视频中提取出语音单独进行识别情感。怎么从视频中提取出语音,具体见我上一篇博客从视频提取出音频

一、首先使用opensmile对音频进行处理,注意处理的音频格式必须为wav格式(其他格式并不识别),看书时候看到了下,wav格式的音频基本是属于无损音质吧,微软出的。

1、首先在网上下载opensmile,我使用的是openSMILE-2.1.0这个版本,可以去网上下载,点击打开链接

opensmile是一个在windows命令行下操作的指令,操作如下:

先切换到处理文件的目录下,cd D:\openSMILE-2.1.0\bin\Win32
再使用此命令进行处理SMILExtract_Release -C D:\openSMILE-2.1.0\config\IS09_emotion.conf -I "要处理的音频目录"如(d:/a.wav) -O "要保存特征向量的路径如(d:/a.txt)",我的命令行操作如下:SMILExtract_Release -C D:\openSMILE-2.1.0\config\IS09_emotion.conf -I d:\6.wav -O d:\6.txt 

最后得到的txt格式如下

 

@relation openSMILE_features

@attribute name string
@attribute pcm_RMSenergy_sma_max numeric
@attribute pcm_RMSenergy_sma_min numeric
@attribute pcm_RMSenergy_sma_range numeric
@attribute pcm_RMSenergy_sma_maxPos numeric
@attribute pcm_RMSenergy_sma_minPos numeric
@attribute pcm_RMSenergy_sma_amean numeric
@attribute pcm_RMSenergy_sma_linregc1 numeric
@attribute pcm_RMSenergy_sma_linregc2 numeric
@attribute pcm_RMSenergy_sma_linregerrQ numeric
@attribute pcm_RMSenergy_sma_stddev numeric
@attribute pcm_RMSenergy_sma_skewness numeric
@attribute pcm_RMSenergy_sma_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[1]_max numeric
@attribute pcm_fftMag_mfcc_sma[1]_min numeric
@attribute pcm_fftMag_mfcc_sma[1]_range numeric
@attribute pcm_fftMag_mfcc_sma[1]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[1]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[1]_amean numeric
@attribute pcm_fftMag_mfcc_sma[1]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[1]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[1]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[1]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[1]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[1]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[2]_max numeric
@attribute pcm_fftMag_mfcc_sma[2]_min numeric
@attribute pcm_fftMag_mfcc_sma[2]_range numeric
@attribute pcm_fftMag_mfcc_sma[2]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[2]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[2]_amean numeric
@attribute pcm_fftMag_mfcc_sma[2]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[2]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[2]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[2]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[2]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[2]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[3]_max numeric
@attribute pcm_fftMag_mfcc_sma[3]_min numeric
@attribute pcm_fftMag_mfcc_sma[3]_range numeric
@attribute pcm_fftMag_mfcc_sma[3]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[3]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[3]_amean numeric
@attribute pcm_fftMag_mfcc_sma[3]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[3]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[3]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[3]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[3]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[3]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[4]_max numeric
@attribute pcm_fftMag_mfcc_sma[4]_min numeric
@attribute pcm_fftMag_mfcc_sma[4]_range numeric
@attribute pcm_fftMag_mfcc_sma[4]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[4]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[4]_amean numeric
@attribute pcm_fftMag_mfcc_sma[4]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[4]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[4]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[4]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[4]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[4]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[5]_max numeric
@attribute pcm_fftMag_mfcc_sma[5]_min numeric
@attribute pcm_fftMag_mfcc_sma[5]_range numeric
@attribute pcm_fftMag_mfcc_sma[5]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[5]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[5]_amean numeric
@attribute pcm_fftMag_mfcc_sma[5]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[5]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[5]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[5]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[5]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[5]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[6]_max numeric
@attribute pcm_fftMag_mfcc_sma[6]_min numeric
@attribute pcm_fftMag_mfcc_sma[6]_range numeric
@attribute pcm_fftMag_mfcc_sma[6]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[6]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[6]_amean numeric
@attribute pcm_fftMag_mfcc_sma[6]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[6]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[6]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[6]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[6]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[6]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[7]_max numeric
@attribute pcm_fftMag_mfcc_sma[7]_min numeric
@attribute pcm_fftMag_mfcc_sma[7]_range numeric
@attribute pcm_fftMag_mfcc_sma[7]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[7]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[7]_amean numeric
@attribute pcm_fftMag_mfcc_sma[7]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[7]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[7]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[7]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[7]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[7]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[8]_max numeric
@attribute pcm_fftMag_mfcc_sma[8]_min numeric
@attribute pcm_fftMag_mfcc_sma[8]_range numeric
@attribute pcm_fftMag_mfcc_sma[8]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[8]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[8]_amean numeric
@attribute pcm_fftMag_mfcc_sma[8]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[8]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[8]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[8]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[8]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[8]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[9]_max numeric
@attribute pcm_fftMag_mfcc_sma[9]_min numeric
@attribute pcm_fftMag_mfcc_sma[9]_range numeric
@attribute pcm_fftMag_mfcc_sma[9]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[9]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[9]_amean numeric
@attribute pcm_fftMag_mfcc_sma[9]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[9]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[9]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[9]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[9]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[9]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[10]_max numeric
@attribute pcm_fftMag_mfcc_sma[10]_min numeric
@attribute pcm_fftMag_mfcc_sma[10]_range numeric
@attribute pcm_fftMag_mfcc_sma[10]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[10]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[10]_amean numeric
@attribute pcm_fftMag_mfcc_sma[10]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[10]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[10]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[10]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[10]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[10]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[11]_max numeric
@attribute pcm_fftMag_mfcc_sma[11]_min numeric
@attribute pcm_fftMag_mfcc_sma[11]_range numeric
@attribute pcm_fftMag_mfcc_sma[11]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[11]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[11]_amean numeric
@attribute pcm_fftMag_mfcc_sma[11]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[11]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[11]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[11]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[11]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[11]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma[12]_max numeric
@attribute pcm_fftMag_mfcc_sma[12]_min numeric
@attribute pcm_fftMag_mfcc_sma[12]_range numeric
@attribute pcm_fftMag_mfcc_sma[12]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma[12]_minPos numeric
@attribute pcm_fftMag_mfcc_sma[12]_amean numeric
@attribute pcm_fftMag_mfcc_sma[12]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma[12]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma[12]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma[12]_stddev numeric
@attribute pcm_fftMag_mfcc_sma[12]_skewness numeric
@attribute pcm_fftMag_mfcc_sma[12]_kurtosis numeric
@attribute pcm_zcr_sma_max numeric
@attribute pcm_zcr_sma_min numeric
@attribute pcm_zcr_sma_range numeric
@attribute pcm_zcr_sma_maxPos numeric
@attribute pcm_zcr_sma_minPos numeric
@attribute pcm_zcr_sma_amean numeric
@attribute pcm_zcr_sma_linregc1 numeric
@attribute pcm_zcr_sma_linregc2 numeric
@attribute pcm_zcr_sma_linregerrQ numeric
@attribute pcm_zcr_sma_stddev numeric
@attribute pcm_zcr_sma_skewness numeric
@attribute pcm_zcr_sma_kurtosis numeric
@attribute voiceProb_sma_max numeric
@attribute voiceProb_sma_min numeric
@attribute voiceProb_sma_range numeric
@attribute voiceProb_sma_maxPos numeric
@attribute voiceProb_sma_minPos numeric
@attribute voiceProb_sma_amean numeric
@attribute voiceProb_sma_linregc1 numeric
@attribute voiceProb_sma_linregc2 numeric
@attribute voiceProb_sma_linregerrQ numeric
@attribute voiceProb_sma_stddev numeric
@attribute voiceProb_sma_skewness numeric
@attribute voiceProb_sma_kurtosis numeric
@attribute F0_sma_max numeric
@attribute F0_sma_min numeric
@attribute F0_sma_range numeric
@attribute F0_sma_maxPos numeric
@attribute F0_sma_minPos numeric
@attribute F0_sma_amean numeric
@attribute F0_sma_linregc1 numeric
@attribute F0_sma_linregc2 numeric
@attribute F0_sma_linregerrQ numeric
@attribute F0_sma_stddev numeric
@attribute F0_sma_skewness numeric
@attribute F0_sma_kurtosis numeric
@attribute pcm_RMSenergy_sma_de_max numeric
@attribute pcm_RMSenergy_sma_de_min numeric
@attribute pcm_RMSenergy_sma_de_range numeric
@attribute pcm_RMSenergy_sma_de_maxPos numeric
@attribute pcm_RMSenergy_sma_de_minPos numeric
@attribute pcm_RMSenergy_sma_de_amean numeric
@attribute pcm_RMSenergy_sma_de_linregc1 numeric
@attribute pcm_RMSenergy_sma_de_linregc2 numeric
@attribute pcm_RMSenergy_sma_de_linregerrQ numeric
@attribute pcm_RMSenergy_sma_de_stddev numeric
@attribute pcm_RMSenergy_sma_de_skewness numeric
@attribute pcm_RMSenergy_sma_de_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[1]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[2]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[3]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[4]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[5]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[6]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[7]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[8]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[9]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[10]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[11]_kurtosis numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_max numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_min numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_range numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_maxPos numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_minPos numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_amean numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_linregc1 numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_linregc2 numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_linregerrQ numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_stddev numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_skewness numeric
@attribute pcm_fftMag_mfcc_sma_de[12]_kurtosis numeric
@attribute pcm_zcr_sma_de_max numeric
@attribute pcm_zcr_sma_de_min numeric
@attribute pcm_zcr_sma_de_range numeric
@attribute pcm_zcr_sma_de_maxPos numeric
@attribute pcm_zcr_sma_de_minPos numeric
@attribute pcm_zcr_sma_de_amean numeric
@attribute pcm_zcr_sma_de_linregc1 numeric
@attribute pcm_zcr_sma_de_linregc2 numeric
@attribute pcm_zcr_sma_de_linregerrQ numeric
@attribute pcm_zcr_sma_de_stddev numeric
@attribute pcm_zcr_sma_de_skewness numeric
@attribute pcm_zcr_sma_de_kurtosis numeric
@attribute voiceProb_sma_de_max numeric
@attribute voiceProb_sma_de_min numeric
@attribute voiceProb_sma_de_range numeric
@attribute voiceProb_sma_de_maxPos numeric
@attribute voiceProb_sma_de_minPos numeric
@attribute voiceProb_sma_de_amean numeric
@attribute voiceProb_sma_de_linregc1 numeric
@attribute voiceProb_sma_de_linregc2 numeric
@attribute voiceProb_sma_de_linregerrQ numeric
@attribute voiceProb_sma_de_stddev numeric
@attribute voiceProb_sma_de_skewness numeric
@attribute voiceProb_sma_de_kurtosis numeric
@attribute F0_sma_de_max numeric
@attribute F0_sma_de_min numeric
@attribute F0_sma_de_range numeric
@attribute F0_sma_de_maxPos numeric
@attribute F0_sma_de_minPos numeric
@attribute F0_sma_de_amean numeric
@attribute F0_sma_de_linregc1 numeric
@attribute F0_sma_de_linregc2 numeric
@attribute F0_sma_de_linregerrQ numeric
@attribute F0_sma_de_stddev numeric
@attribute F0_sma_de_skewness numeric
@attribute F0_sma_de_kurtosis numeric
@attribute class numeric

@data

'unknown',8.613028e-002,4.457909e-004,8.568449e-002,9.400000e+001,1.790000e+002,1.413534e-002,2.599991e-005,1.175635e-002,2.792935e-004,1.676904e-002,1.875081e+000,6.955588e+000,-5.201080e+000,-3.270444e+001,2.750336e+001,7.400000e+001,7.000000e+000,-1.284347e+001,2.446618e-002,-1.508213e+001,1.946430e+001,4.599247e+000,-1.389077e+000,7.275510e+000,7.637083e+000,-2.454952e+001,3.218660e+001,0.000000e+000,1.320000e+002,-8.277016e+000,-1.584911e-002,-6.826822e+000,6.653142e+001,8.200006e+000,-7.723273e-002,2.013404e+000,1.667036e+001,-1.705229e+001,3.372265e+001,6.000000e+000,1.370000e+002,-3.093050e+000,-8.937621e-002,5.084873e+000,2.974806e+001,7.230803e+000,3.654211e-001,2.401849e+000,1.693215e+001,-2.413527e+001,4.106742e+001,3.000000e+000,1.600000e+002,-1.138559e+000,-1.364119e-001,1.134313e+001,5.667429e+001,1.044857e+001,-8.252290e-001,2.629991e+000,9.365982e+000,-3.578355e+001,4.514954e+001,7.000000e+000,1.090000e+002,-7.924586e+000,-1.112503e-001,2.254813e+000,7.274343e+001,1.037598e+001,-2.480764e-001,2.237946e+000,2.202438e+001,-1.467973e+001,3.670412e+001,1.640000e+002,1.210000e+002,1.200654e+000,5.312859e-002,-3.660613e+000,5.705268e+001,8.063254e+000,5.219968e-001,2.957326e+000,1.720201e+001,-3.533815e+001,5.254015e+001,1.760000e+002,7.900000e+001,-9.396957e+000,6.252163e-002,-1.511769e+001,9.097670e+001,1.009974e+001,3.754559e-001,3.420155e+000,1.474344e+001,-2.402627e+001,3.876972e+001,5.100000e+001,7.900000e+001,-1.052214e+000,-4.522532e-002,3.085902e+000,7.179326e+001,8.807022e+000,-5.025675e-001,2.384698e+000,2.568513e+001,-1.001876e+001,3.570389e+001,9.700000e+001,6.300000e+001,6.045842e+000,-1.499712e-002,7.418078e+000,4.614032e+001,6.839214e+000,4.160298e-001,3.162690e+000,1.913883e+001,-1.163396e+001,3.077279e+001,9.300000e+001,1.610000e+002,2.409996e-001,-1.552648e-002,1.661672e+000,3.651641e+001,6.098897e+000,4.691251e-001,3.171124e+000,1.699747e+001,-1.326871e+001,3.026619e+001,1.390000e+002,7.600000e+001,1.561504e+000,-3.337406e-002,4.615230e+000,4.004443e+001,6.571668e+000,-1.054792e-001,2.144754e+000,2.681713e+001,-1.279278e+001,3.960991e+001,1.080000e+002,6.900000e+001,2.009890e+000,3.742417e-002,-1.414422e+000,5.681232e+001,7.795106e+000,8.720666e-001,3.726909e+000,2.005556e-001,0.000000e+000,2.005556e-001,9.000000e+000,4.000000e+001,5.846467e-002,-2.245758e-004,7.901336e-002,1.176059e-003,3.630905e-002,1.175793e+000,5.496212e+000,8.538411e-001,1.454746e-001,7.083665e-001,1.070000e+002,6.200000e+001,3.829384e-001,9.344087e-004,2.974400e-001,3.804322e-002,2.012623e-001,7.638077e-001,2.325817e+000,4.528705e+002,0.000000e+000,4.528705e+002,1.370000e+002,0.000000e+000,7.496270e+001,3.857209e-001,3.966924e+001,1.747035e+004,1.337539e+002,1.431717e+000,3.388437e+000,1.781311e-002,-1.385794e-002,3.167105e-002,9.100000e+001,9.700000e+001,-8.700029e-006,-4.560191e-006,4.085574e-004,2.016553e-005,4.497132e-003,4.140828e-001,5.488226e+000,5.656787e+000,-5.884430e+000,1.154122e+001,1.100000e+001,4.000000e+000,-2.971025e-002,1.406054e-003,-1.583642e-001,1.902621e+000,1.381376e+000,-2.574952e-002,8.444494e+000,4.423991e+000,-4.374485e+000,8.798476e+000,5.500000e+001,1.290000e+002,-1.577301e-002,4.934818e-003,-4.673089e-001,2.662099e+000,1.652514e+000,-7.958338e-002,3.051951e+000,3.229197e+000,-4.214190e+000,7.443387e+000,9.600000e+001,6.300000e+001,-4.872349e-002,1.083698e-003,-1.478818e-001,1.444909e+000,1.203421e+000,-4.290941e-001,3.910015e+000,3.483324e+000,-3.801741e+000,7.285065e+000,1.000000e+000,6.400000e+001,-3.896159e-002,1.035828e-003,-1.337399e-001,1.783285e+000,1.336530e+000,-4.004294e-001,3.157273e+000,5.383134e+000,-7.096016e+000,1.247915e+001,1.110000e+002,7.100000e+001,-2.596433e-002,3.531488e-003,-3.490955e-001,3.790803e+000,1.956013e+000,-7.072045e-001,4.340315e+000,5.770529e+000,-4.194497e+000,9.965027e+000,1.600000e+001,9.300000e+001,3.729764e-002,1.172566e-003,-6.999211e-002,2.417106e+000,1.555951e+000,5.472814e-001,4.530320e+000,4.211164e+000,-5.648759e+000,9.859924e+000,8.500000e+001,6.900000e+001,1.300395e-001,1.749265e-003,-3.001829e-002,3.221650e+000,1.797299e+000,-5.722198e-001,3.563195e+000,4.064130e+000,-5.190299e+000,9.254429e+000,9.600000e+001,1.380000e+002,4.906261e-002,1.834440e-003,-1.187886e-001,3.001411e+000,1.735196e+000,-3.647477e-001,3.279894e+000,4.580682e+000,-4.365251e+000,8.945932e+000,9.100000e+001,6.100000e+001,4.294804e-002,-4.687580e-004,8.583940e-002,2.693373e+000,1.641339e+000,1.509248e-001,3.260195e+000,6.154212e+000,-4.883906e+000,1.103812e+001,9.100000e+001,1.160000e+002,1.942609e-002,1.273701e-003,-9.711752e-002,3.318113e+000,1.822825e+000,1.282476e-001,3.652952e+000,5.352992e+000,-3.876575e+000,9.229567e+000,7.800000e+001,1.580000e+002,-1.612484e-002,2.709220e-004,-4.091420e-002,2.838537e+000,1.684857e+000,6.865954e-001,4.323811e+000,3.930334e+000,-4.250163e+000,8.180496e+000,9.800000e+001,1.570000e+002,3.274201e-002,-7.574088e-004,1.020449e-001,2.085863e+000,1.444812e+000,-1.433208e-001,3.416436e+000,3.088889e-002,-3.888889e-002,6.977778e-002,4.000000e+000,1.100000e+001,-1.219806e-004,-1.429289e-005,1.185819e-003,9.559943e-005,9.806924e-003,-1.022536e-001,5.459461e+000,1.258149e-001,-1.010877e-001,2.269026e-001,7.800000e+001,8.300000e+001,-1.575806e-004,-7.002620e-005,6.249817e-003,1.763548e-003,4.215902e-002,3.635183e-001,3.899049e+000,9.776050e+001,-1.026864e+002,2.004469e+002,1.060000e+002,1.220000e+002,-3.790078e-008,-2.657074e-002,2.431223e+000,1.219109e+003,3.494424e+001,3.568190e-002,5.332478e+000,?

前面的都不用管,都是一些属性值,只要提取出最后一行的数据保存下来就好了。

 

二、使用libsvm进行特征训练并测试

首先要将得到的向量化成libsvm能处理的格式,我使用的libsvm是libsvm-3.17,附上下载路径点击打开链接

格式如下:

 

0 1:0.086130 2:0.000446 3:0.085684 4:94.000000 5:179.000000 6:0.014135 7:0.000026 8:0.011756 9:0.000279 10:0.016769 11:1.875081 12:6.955588 13:-5.201080 14:-32.704440 15:27.503360 16:74.000000 17:7.000000 18:-12.843470 19:0.024466 20:-15.082130 21:19.464300 22:4.599247 23:-1.389077 24:7.275510 25:7.637083 26:-24.549520 27:32.186600 28:0.000000 29:132.000000 30:-8.277016 31:-0.015849 32:-6.826822 33:66.531420 34:8.200006 35:-0.077233 36:2.013404 37:16.670360 38:-17.052290 39:33.722650 40:6.000000 41:137.000000 42:-3.093050 43:-0.089376 44:5.084873 45:29.748060 46:7.230803 47:0.365421 48:2.401849 49:16.932150 50:-24.135270 51:41.067420 52:3.000000 53:160.000000 54:-1.138559 55:-0.136412 56:11.343130 57:56.674290 58:10.448570 59:-0.825229 60:2.629991 61:9.365982 62:-35.783550 63:45.149540 64:7.000000 65:109.000000 66:-7.924586 67:-0.111250 68:2.254813 69:72.743430 70:10.375980 71:-0.248076 72:2.237946 73:22.024380 74:-14.679730 75:36.704120 76:164.000000 77:121.000000 78:1.200654 79:0.053129 80:-3.660613 81:57.052680 82:8.063254 83:0.521997 84:2.957326 85:17.202010 86:-35.338150 87:52.540150 88:176.000000 89:79.000000 90:-9.396957 91:0.062522 92:-15.117690 93:90.976700 94:10.099740 95:0.375456 96:3.420155 97:14.743440 98:-24.026270 99:38.769720 100:51.000000 101:79.000000 102:-1.052214 103:-0.045225 104:3.085902 105:71.793260 106:8.807022 107:-0.502567 108:2.384698 109:25.685130 110:-10.018760 111:35.703890 112:97.000000 113:63.000000 114:6.045842 115:-0.014997 116:7.418078 117:46.140320 118:6.839214 119:0.416030 120:3.162690 121:19.138830 122:-11.633960 123:30.772790 124:93.000000 125:161.000000 126:0.241000 127:-0.015526 128:1.661672 129:36.516410 130:6.098897 131:0.469125 132:3.171124 133:16.997470 134:-13.268710 135:30.266190 136:139.000000 137:76.000000 138:1.561504 139:-0.033374 140:4.615230 141:40.044430 142:6.571668 143:-0.105479 144:2.144754 145:26.817130 146:-12.792780 147:39.609910 148:108.000000 149:69.000000 150:2.009890 151:0.037424 152:-1.414422 153:56.812320 154:7.795106 155:0.872067 156:3.726909 157:0.200556 158:0.000000 159:0.200556 160:9.000000 161:40.000000 162:0.058465 163:-0.000225 164:0.079013 165:0.001176 166:0.036309 167:1.175793 168:5.496212 169:0.853841 170:0.145475 171:0.708367 172:107.000000 173:62.000000 174:0.382938 175:0.000934 176:0.297440 177:0.038043 178:0.201262 179:0.763808 180:2.325817 181:452.870500 182:0.000000 183:452.870500 184:137.000000 185:0.000000 186:74.962700 187:0.385721 188:39.669240 189:17470.350000 190:133.753900 191:1.431717 192:3.388437 193:0.017813 194:-0.013858 195:0.031671 196:91.000000 197:97.000000 198:-0.000009 199:-0.000005 200:0.000409 201:0.000020 202:0.004497 203:0.414083 204:5.488226 205:5.656787 206:-5.884430 207:11.541220 208:11.000000 209:4.000000 210:-0.029710 211:0.001406 212:-0.158364 213:1.902621 214:1.381376 215:-0.025750 216:8.444494 217:4.423991 218:-4.374485 219:8.798476 220:55.000000 221:129.000000 222:-0.015773 223:0.004935 224:-0.467309 225:2.662099 226:1.652514 227:-0.079583 228:3.051951 229:3.229197 230:-4.214190 231:7.443387 232:96.000000 233:63.000000 234:-0.048723 235:0.001084 236:-0.147882 237:1.444909 238:1.203421 239:-0.429094 240:3.910015 241:3.483324 242:-3.801741 243:7.285065 244:1.000000 245:64.000000 246:-0.038962 247:0.001036 248:-0.133740 249:1.783285 250:1.336530 251:-0.400429 252:3.157273 253:5.383134 254:-7.096016 255:12.479150 256:111.000000 257:71.000000 258:-0.025964 259:0.003531 260:-0.349096 261:3.790803 262:1.956013 263:-0.707205 264:4.340315 265:5.770529 266:-4.194497 267:9.965027 268:16.000000 269:93.000000 270:0.037298 271:0.001173 272:-0.069992 273:2.417106 274:1.555951 275:0.547281 276:4.530320 277:4.211164 278:-5.648759 279:9.859924 280:85.000000 281:69.000000 282:0.130040 283:0.001749 284:-0.030018 285:3.221650 286:1.797299 287:-0.572220 288:3.563195 289:4.064130 290:-5.190299 291:9.254429 292:96.000000 293:138.000000 294:0.049063 295:0.001834 296:-0.118789 297:3.001411 298:1.735196 299:-0.364748 300:3.279894 301:4.580682 302:-4.365251 303:8.945932 304:91.000000 305:61.000000 306:0.042948 307:-0.000469 308:0.085839 309:2.693373 310:1.641339 311:0.150925 312:3.260195 313:6.154212 314:-4.883906 315:11.038120 316:91.000000 317:116.000000 318:0.019426 319:0.001274 320:-0.097118 321:3.318113 322:1.822825 323:0.128248 324:3.652952 325:5.352992 326:-3.876575 327:9.229567 328:78.000000 329:158.000000 330:-0.016125 331:0.000271 332:-0.040914 333:2.838537 334:1.684857 335:0.686595 336:4.323811 337:3.930334 338:-4.250163 339:8.180496 340:98.000000 341:157.000000 342:0.032742 343:-0.000757 344:0.102045 345:2.085863 346:1.444812 347:-0.143321 348:3.416436 349:0.030889 350:-0.038889 351:0.069778 352:4.000000 353:11.000000 354:-0.000122 355:-0.000014 356:0.001186 357:0.000096 358:0.009807 359:-0.102254 360:5.459461 361:0.125815 362:-0.101088 363:0.226903 364:78.000000 365:83.000000 366:-0.000158 367:-0.000070 368:0.006250 369:0.001764 370:0.042159 371:0.363518 372:3.899049 373:97.760500 374:-102.686400 375:200.446900 376:106.000000 377:122.000000 378:-0.000000 379:-0.026571 380:2.431223 381:1219.109000 382:34.944240 383:0.035682 384:5.332478

第一个0代表该特征向量的种类,可以自己定义,我的表情一共有七种,就定义为0,1,2,3,4,5,6这七种。
格式如下:libsvm的处理很简单,代码如下:

 

package pkg;

import java.io.IOException;

import src.*;

public class SVM {
	public static void main(String[] args) throws IOException {
		//进行特征缩放
//		String[] train={"-l","0", "-u","1","-s","training_result","training"};
//		svm_scale.main(train);
//		String[] test={"test_result","test"};
//		svm_scale.main(test);
		String[] trainArgs = {"training33"};//directory of training file
		String modelFile = svm_train.main(trainArgs);
		System.out.println("......."+modelFile);
		String[] testArgs = {"test33", modelFile, "result"};//directory of test file, model file, result file
		Double accuracy = svm_predict.main(testArgs);
		System.out.println("SVM Classification is done! The accuracy is " + accuracy);
	}
}

 

 

 

其中training33是一个存放测试集的文件,modeFile是训练之后得到的模型,test33是测试集,result是存放测试结果的

 

 

 

 

最后测试结果如下:

 

 

optimization finished, #iter = 435
nu = 0.6190058618762699
obj = -264.8696954342523, rho = -0.3560931956419671
nSV = 376, nBSV = 279
*
optimization finished, #iter = 382
nu = 0.7197531820350304
obj = -292.1362097337123, rho = 0.48854453043532936
nSV = 397, nBSV = 318
Total nSV = 1718
.......training33.model
Accuracy = 37.362637362637365% (68/182) (classification)
SVM Classification is done! The accuracy is 0.37362637362637363

准确率为37%,好低啊。

 

被老师一顿狠批,接下来就是要提高正确率了,调整惩罚系数C和核函数G,得到最优的结果。

 

你可能感兴趣的:(框架工具类)