經(jīng)典的深度學(xué)習(xí)網(wǎng)絡(luò)AlexNet使用數(shù)據(jù)擴充(Data Augmentation)的方式擴大數(shù)據(jù)集,取得較好的分類效果。在深度學(xué)習(xí)的圖像領(lǐng)域中,通過平移、 翻轉(zhuǎn)、加噪等方法進行數(shù)據(jù)擴充。但是,在音頻(Audio)領(lǐng)域中,如何進行數(shù)據(jù)擴充呢?
音頻的數(shù)據(jù)擴充,主要有以下四種方式:
音頻剪裁(Clip)
音頻旋轉(zhuǎn)(Roll)
音頻調(diào)音(Tune)
音頻加噪(Noise)
音頻解析基于librosa音頻庫;矩陣操作基于scipy和numpy科學(xué)計算庫。
以下是Python的實現(xiàn)方式
01
音頻剪裁
import librosa
from scipy.io import wavfile y, sr = librosa.load("../data/love_illusion.mp3")
# 讀取音頻print y.shape, sr wavfile.write("../data/love_illusion_20s.mp3", sr, y[20 * sr:40 * sr])
# 寫入音頻
02
音頻旋轉(zhuǎn)
import cv2
import librosa
from scipy.io import wavfile y, sr = librosa.load("../data/raw/love_illusion_20s.mp3")
# 讀取音頻ly = len(y) y_tune = cv2.resize(y, (1, int(len(y) * 1.2))).squeeze() lc = len(y_tune) - ly y_tune = y_tune[int(lc / 2):int(lc / 2) + ly]print y.shape, sr wavfile.write("../data/raw/xxx_tune.mp3", sr, y_tune)
# 寫入音頻
03
音頻調(diào)音
import cv2
import librosa
from scipy.io import wavfile y, sr = librosa.load("../data/raw/love_illusion_20s.mp3")
# 讀取音頻ly = len(y) y_tune = cv2.resize(y, (1, int(len(y) * 1.2))).squeeze() lc = len(y_tune) - ly y_tune = y_tune[int(lc / 2):int(lc / 2) + ly]print y.shape, sr wavfile.write("../data/raw/xxx_tune.mp3", sr, y_tune)
# 寫入音頻
04
音頻加噪
import librosa
from scipy.io import wavfile
import numpy as np
y, sr = librosa.load("../data/raw/love_illusion_20s.mp3")
# 讀取音頻wn = np.random.randn(len(y)) y = np.where(y != 0.0, y + 0.02 * wn, 0.0)
# 噪聲不要添加到0上!print y.shape, sr wavfile.write("../data/raw/love_illusion_20s_w.mp3", sr, y)
# 寫入音頻
-
音頻
+關(guān)注
關(guān)注
30文章
3042瀏覽量
83451 -
python
+關(guān)注
關(guān)注
56文章
4827瀏覽量
86761
原文標題:Python音頻的數(shù)據(jù)擴充
文章出處:【微信號:machinelearningai,微信公眾號:機器學(xué)習(xí)算法與人工智能】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。
發(fā)布評論請先 登錄
請問問手機與電腦之間在沒有網(wǎng)絡(luò)的情況下如何進行數(shù)據(jù)傳輸!
串口通信中外設(shè)與開發(fā)板串口通信是如何進行數(shù)據(jù)傳輸?shù)模?/a>
STM32 USART串口是如何進行數(shù)據(jù)處理的呢
PC機的串口調(diào)試助手與STM32是如何進行數(shù)據(jù)收發(fā)的
什么是信號處理?如何進行數(shù)字信號處理呢?
數(shù)據(jù)庫教程之如何進行數(shù)據(jù)庫設(shè)計

在風格遷移中如何進行數(shù)據(jù)增強
藍牙m(xù)idi和藍牙音頻或者藍牙audio有什么區(qū)別呢

e絡(luò)盟大幅擴充PUI Audio產(chǎn)品系列以強化音頻產(chǎn)品組合

評論