资源简介
基于卷积神经网络的Keras音频分类器
代码片段和文件信息
‘‘‘
Author: Scott H. Hawley
based on paper
A SOFTWARE frameWORK FOR MUSICAL DATA AUGMENTATION
Brian McFee Eric J. Humphrey and Juan P. Bello
https://bmcfee.github.io/papers/ismir2015_augmentation.pdf
This script can either be called as a standalone to operate on sound files (e.g. .wav)
or it can be imported & called from elsewhere e.g. prep_data.py.
If you plan on using prep_data.py then don‘t call this as a standalong. just let prep_data
do its thing unless you really want to hear what the augmented data files sound like.
‘‘‘
from __future__ import print_function
import numpy as np
import librosa
from random import getrandbits
import sys getopt os
#from scipy.signal import resample # too slow
def random_onoff(): # randomly turns on or off
return bool(getrandbits(1))
# returns a list of augmented audio data stereo or mono
def augment_data(y sr n_augment = 0 allow_speedandpitch = True allow_pitch = True
allow_speed = True allow_dyn = True allow_noise = True allow_timeshift = True tab=““):
mods = [y] # always returns the original as element zero
length = y.shape[0]
for i in range(n_augment):
print(tab+“augment_data: “i+1“of“n_augment)
y_mod = y
count_changes = 0
# change speed and pitch together
if (allow_speedandpitch) and random_onoff():
length_change = np.random.uniform(low=0.9high=1.1)
speed_fac = 1.0 / length_change
print(tab+“ resample length_change = “length_change)
tmp = np.interp(np.arange(0len(y)speed_fac)np.arange(0len(y))y)
#tmp = resample(yint(length*lengt_fac)) # signal.resample is too slow
minlen = min( y.shape[0] tmp.shape[0]) # keep same length as original;
y_mod *= 0 # pad with zeros
y_mod[0:minlen] = tmp[0:minlen]
count_changes += 1
# change pitch (w/o speed)
if (allow_pitch) and random_onoff():
bins_per_octave = 24 # pitch increments are quarter-steps
pitch_pm = 4 # +/- this many quarter steps
pitch_change = pitch_pm * 2*(np.random.uniform()-0.5)
print(tab+“ pitch_change = “pitch_change)
y_mod = librosa.effects.pitch_shift(y sr n_steps=pitch_change bins_per_octave=bins_per_octave)
count_changes += 1
# change speed (w/o pitch)
if (allow_speed) and random_onoff():
speed_change = np.random.uniform(low=0.9high=1.1)
print(tab+“ speed_change = “speed_change)
tmp = librosa.effects.time_stretch(y_mod speed_change)
minlen = min( y.shape[0] tmp.shape[0]) # keep same length as original;
y_mod *= 0 # pad with zeros
y_mod[0:minlen] = tmp[0:minlen]
count
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-05-06 16:14 audio-classifier-keras-cnn-master\
文件 18 2019-05-06 16:14 audio-classifier-keras-cnn-master\.gitignore
文件 1069 2019-05-06 16:14 audio-classifier-keras-cnn-master\LICENSE
文件 261 2019-05-06 16:14 audio-classifier-keras-cnn-master\README.md
目录 0 2019-05-06 16:14 audio-classifier-keras-cnn-master\Samples\
文件 151 2019-05-06 16:14 audio-classifier-keras-cnn-master\Samples\__delete-this-file-and-add-sound-files__.txt
文件 6307 2019-05-06 16:14 audio-classifier-keras-cnn-master\augment_data.py
文件 10089 2019-05-06 16:14 audio-classifier-keras-cnn-master\eval_network.py
文件 1848 2019-05-06 16:14 audio-classifier-keras-cnn-master\preprocess_data.py
文件 8633 2019-05-06 16:14 audio-classifier-keras-cnn-master\train_network.py
相关资源
- Python-DeepMoji模型的pyTorch实现
- Python-使用DeepFakes实现YouTube视频自动换
- Python-一系列高品质的动漫人脸数据集
- Python-Insightface人脸检测识别的最小化
- Python-自然场景文本检测PSENet的一个
- Python-在特征金字塔网络FPN的Pytorch实现
- Python-PyTorch实时多人姿态估计项目的实
- Python-用PyTorch10实现FasterRCNN和MaskRCNN比
- Python-心脏核磁共振MRI图像分割
- Python-基于YOLOv3的行人检测
- Python-RLSeq2Seq用于SequencetoSequence模型的
- Python-PyTorch对卷积CRF的参考实现
- Python-高效准确的EAST文本检测器的一个
- Python-pytorch实现的人脸检测和人脸识别
- Python-UNet用于医学图像分割的嵌套UN
- Python-TensorFlow弱监督图像分割
- Python-基于tensorflow实现的用textcnn方法
- Python-Keras实现Inceptionv4InceptionResnetv1和
- Python-pytorch中文手册
- Python-FastSCNN的PyTorch实现快速语义分割
- Python-滑动窗口高分辨率显微镜图像分
- Python-使用MovieLens数据集训练的电影推
- Python-机器学习驱动的Web应用程序防火
- Python-subpixel利用Tensorflow的一个子像素
-
Python-汉字的神经风格转移Neuralst
y - Python-神经网络模型能够从音频演讲中
- Python-深度增强学习算法的PyTorch实现策
- Python-基于深度学习的语音增强使用
- Python-基于知识图谱的红楼梦人物关系
- Python-STGAN用于图像合成的空间变换生
评论
共有 条评论