-
大小: 61.62MB文件类型: .zip金币: 1下载: 0 次发布日期: 2022-05-18
- 语言: Python
- 标签:
资源简介
简单、快速、实时、可定制的机器学习音频分类器
代码片段和文件信息
# Common functions and definitions
#
# This file defines commonly used parts for ease of programming.
# Import as follows:
#
# > from common import *
#
# Private notation(s):
# - mels = melspectrogram
#
# # Basic definitions
import warnings
warnings.simplefilter(‘ignore‘)
import numpy as np
np.warnings.filterwarnings(‘ignore‘)
np.random.seed(1001)
import sys
import shutil
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
sys.path.insert(0 str(Path.cwd()))
# # Configration
def is_handling_audio(conf):
return ‘sampling_rate‘ in conf
def test_conf(conf):
if conf.model not in [‘mobilenetv2‘ ‘alexnet‘]:
raise Exception(‘conf.model not recognized: {}‘.format(conf.model))
if conf.data_balancing not in [‘over_sampling‘ ‘under_sampling‘
‘by_generator‘ ‘dont_balance‘]:
raise Exception(‘conf.data_balancing not recognized: {}‘.format(conf.data_balancing))
def auto_complete_conf(conf):
if ‘folder‘ in conf:
conf.folder = Path(conf.folder)
conf.label2int = {l:i for i l in enumerate(conf.labels)}
conf.num_classes = len(conf.labels)
# audio auto configurations
if is_handling_audio(conf):
conf.samples = conf.sampling_rate * conf.duration
conf.rt_chunk_samples = conf.sampling_rate // conf.rt_oversamples
conf.mels_onestep_samples = conf.rt_chunk_samples * conf.rt_process_count
conf.mels_convert_samples = conf.samples + conf.mels_onestep_samples
conf.dims = (conf.n_mels 1 + int(np.floor(conf.samples/conf.hop_length)) 1)
# optional configurations
if ‘model‘ not in conf:
conf.model = ‘mobilenetv2‘
if ‘metric_save_ckpt‘ not in conf:
conf.metric_save_ckpt = ‘val_loss‘
if ‘metric_save_mode‘ not in conf:
conf.metric_save_mode=‘auto‘
if ‘logdir‘ not in conf:
conf.logdir = ‘logs‘
if ‘data_balancing‘ not in conf:
conf.data_balancing = ‘over_sampling‘
if ‘X_train‘ not in conf:
conf.X_train = ‘X_train.npy‘
conf.y_train = ‘y_train.npy‘
conf.X_test = ‘X_test.npy‘
conf.y_test = ‘y_test.npy‘
if ‘steps_per_epoch_limit‘ not in conf:
conf.steps_per_epoch_limit = None
if ‘aug_mixup_alpha‘ not in conf:
conf.aug_mixup_alpha = 1.0
if ‘samples_per_file‘ not in conf:
conf.samples_per_file = 1
if ‘eval_ensemble‘ not in conf:
conf.eval_ensemble = True # Set False if samples_per_file > 1 but ensemble is not available
if ‘what_is_sample‘ not in conf:
conf.what_is_sample = ‘log mel-spectrogram‘
if ‘use_audio_training_model‘ not in conf:
conf.use_audio_training_model = True
from config import *
auto_complete_conf(conf)
print(conf)
# # Data utilities
def load_labels(conf):
conf.labels = load_npy(conf ‘labels.npy‘)
auto_complete_conf(conf)
print(‘Labels are‘ conf.labels)
def datapath(conf filename):
return conf.folder / filename
def
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-11-19 23:58 ml-sound-classifier-master\
文件 1214 2018-11-19 23:58 ml-sound-classifier-master\.gitignore
文件 2920 2018-11-19 23:58 ml-sound-classifier-master\EXAMPLE_APPS.md
文件 1072 2018-11-19 23:58 ml-sound-classifier-master\LICENSE
文件 12207 2018-11-19 23:58 ml-sound-classifier-master\README.md
文件 1506 2018-11-19 23:58 ml-sound-classifier-master\RaspberryPi.md
目录 0 2018-11-19 23:58 ml-sound-classifier-master\apps\
目录 0 2018-11-19 23:58 ml-sound-classifier-master\apps\IF201812\
文件 7089 2018-11-19 23:58 ml-sound-classifier-master\apps\IF201812\IF201812-Preprocess.ipynb
文件 194914 2018-11-19 23:58 ml-sound-classifier-master\apps\IF201812\IF201812-Train-Eval-All.ipynb
文件 982 2018-11-19 23:58 ml-sound-classifier-master\apps\IF201812\config.py
目录 0 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\
文件 537452 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\CNN-LML-Another-Attempt-AlexNetba
文件 80754 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\CNN-LML-Preprocess-Data.ipynb
文件 5012432 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\CNN-LML-TF-Model-Conversion.ipynb
文件 123245 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\CNN-LML-Train.ipynb
文件 916187 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\CNN-LML-Visualize.ipynb
文件 589 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\README.md
文件 4164068 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\cnn-alexba
文件 7100700 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\cnn-model-laser-machine-listener.pb
文件 1027 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\config.py
文件 66 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\download.sh
文件 7296600 2018-11-19 23:58 ml-sound-classifier-master\apps\cnn-laser-machine-listener\model_ba
目录 0 2018-11-19 23:58 ml-sound-classifier-master\apps\fsdkaggle2018\
文件 5073767 2018-11-19 23:58 ml-sound-classifier-master\apps\fsdkaggle2018\FSDKaggle2018-TF-Model-Coversion.ipynb
文件 9985888 2018-11-19 23:58 ml-sound-classifier-master\apps\fsdkaggle2018\FSDKaggle2018-Visualize.ipynb
文件 1476 2018-11-19 23:58 ml-sound-classifier-master\apps\fsdkaggle2018\config.py
文件 1919 2018-11-19 23:58 ml-sound-classifier-master\apps\fsdkaggle2018\train_alexba
文件 1950 2018-11-19 23:58 ml-sound-classifier-master\apps\fsdkaggle2018\train_mobilenetv2.py
目录 0 2018-11-19 23:58 ml-sound-classifier-master\apps\fsdkaggle2018small\
文件 1477 2018-11-19 23:58 ml-sound-classifier-master\apps\fsdkaggle2018small\config.py
............此处省略32个文件信息
相关资源
- Python-PySceneDetect基于PythonOpenCV实现的视
- Python-输入输出隐马尔可夫模型IOHMM的
- Python-基于OpenCVKerasTensorFlow实现深度换
- Python-在PyTorch中关注神经机器翻译的最
- Python-PointSIFT一种类似SIFT的网络模块用
- Python-O2O优惠券使用预测的第一名解决
- Python-TensorFlow神经机翻译seq2seq教程
- Python-FastDTW的一个Python实现
- Python-人体姿势估计和跟踪的简单基线
- Python-Pytorch实现的CRAFT文本检测器
- Python-2016CCF大数据精准营销中搜狗用户
- Python-YOLOv3的PyTorch完整实现
- Python-人群计数相关资源列表
- Python-那些值得读的深度学习论文集合
- Python-利用深度学习预测比特币价格
- Python-基于卷积神经网络的Keras音频分
- Python-PySpark编程最佳实践指南
- Python-TensorFlow语义分割组件
- Python-机器学习完全课程
- Python-Glyce用于汉字表示的字形向量
- Python-RNNoiseRNN音频噪声抑制学习
- Python-Keras实现实时语义分割的深层神
- Python-手势识别使用在TensorFlow中卷积神
- Python-Keras实现的DeepSpeech端到端语音识
- Python-FastFCN用于语义分割的RethinkingD
- Python-使用RNN股市预测
- Python-使用最新版本的tensorflow实现se
- Python-人工智能和基于机器学习的机器
- Python-用TensorFlow实现神经网络实体关系
- Python-单目3D人体姿态检测
评论
共有 条评论