91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 12KB
    文件類型: .zip
    金幣: 2
    下載: 2 次
    發布日期: 2021-06-17
  • 語言: Python
  • 標簽:

資源簡介

基于卷積神經網絡的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

評論

共有 條評論