
TensorFlow
文章平均质量分 87
阑珊珊珊
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【Callbacks】tensorflow 2.x Callbacks
CallbacksWe can customize callbacks to i) control the printer, e.g., print keys of logs, loss values, 2) achieve early stoping, 3) update learning rate in different epoches.code: refer to: https://www.tensorflow.org/guide/keras/custom_callback?import t原创 2020-07-14 16:31:18 · 305 阅读 · 0 评论 -
【MHA】之 Attention Mask (with back & forward trace) / Causal Mask (with back trace)
文章目录1. Attention Mask or Causal Mask2. Causal Mask (with n_backtrce)3. Attention Mask with backstrace and forwardtrace4. Customized Mask在multihead attention 中可添加attention mask,对输入进行范围限定,如因果mask (causal mask):即可限定只看当前点前面的数据,不可看该点之后的数据.从矩阵上看,causal mask类似原创 2021-11-20 13:55:14 · 4915 阅读 · 0 评论 -
【语音降噪】Denoiser(Pytorch)
文章目录ReferenceGit CloneInstallationDenoisingTrainL1 -> SiSNRReference【Denoiser Github主页】https://github.com/facebookresearch/denoiser#4-denoising【Denoiser论文】Real Time Speech Enhancement in the Waveform Domain: https://arxiv.org/pdf/2006.12847.pdfGit C原创 2021-07-10 13:48:31 · 4681 阅读 · 3 评论 -
【损失函数】Keras Loss Function
文章目录ReferanceSNR (Signal-to-Noise Ratio)Si-SNR (Scale invariant Signal-to-Noise Ratio)PIT (Permutation Invariant Training)uPIT (utterance-level PIT)uPIT-SiSNR损失函数,也是模型训练中非常重要的一块。常见损失函数:语音分离: uPIT-SiSNR语音增强:l1, mseReferance关于uPIT Si-SNR https://blo原创 2021-07-01 11:26:07 · 5003 阅读 · 3 评论 -
【python读写wav文件】torchaudio/tf.audio读写/重采样wav文件、调整dBFS、以SNR混合音频
文章目录ref1. 读取wav文件 (-->pcm)torchaudiotensorflow.audio2. 保存pcm数据为wav文件torchaudiotensorflow.audio3. 重采样torchaudiotensorflow.audio4. 调整语音dBFS5. 以一定SNR混合语音6. pcm切分7. pcm-->mfcc在此,总结tensorflow和pytorch中读取wav文件(生成pcm数据),以及重采样、调整dBFS、以SNR混合音频等常见wav语音文件处理程序。原创 2021-06-05 14:58:24 · 1871 阅读 · 0 评论 -
【语音降噪】Conformer 模型结构(TensorFlow2)
import mathimport collectionsimport tensorflow as tffrom tensorflow import kerasfrom tensorflow.keras.layers import LayerNormalization, SeparableConv1D, ReLU, Dense, Dropout, BatchNormalization, \ Lambda, Add, Conv1D, Masking, Layer, Inputfrom原创 2021-05-29 18:37:45 · 1984 阅读 · 0 评论 -
【语音分离】SpeechBrain 之 SepFormer (TensorFlow 2.4.0)
文章目录Debug with pytorch基于TF2的SepFormertf.data.datasetloss (SI-SNR)Debug with pytorch在重写sepformer之前,可对原pytorch版本的模型进行debug,查看其所有的模型层及参数等。主要基于train.py进行debug,方式有:在speechbrain.lobes.dual_path.py的相关模块,如SepformerWrapper中的Encoder,SBTransformerBlock,Dual_Path_原创 2021-05-29 18:29:20 · 1369 阅读 · 0 评论 -
【卷积】分类:因果、depthwise、pointwise、空洞、转置卷积等
文章目录Conv1D因果卷积空洞卷积因果空洞卷积SeparableConv1DConv2D单通道与多通道 卷积单卷积核与多卷积核 卷积DepthwiseConv2DPointwise ConvolutionSeparableConv2D空洞卷积Conv2DTranspose常见的卷积有:因果、depthwise、pointwise、空洞、转置卷积等,如何区分它们呢?首先卷积可以分为一维卷积和二维卷积Conv1DConv2D还可包括Conv1DTranspose, Conv2DTranspo原创 2021-03-26 17:46:37 · 1155 阅读 · 0 评论 -
【卷积】Conv与Depthwise Seperable Conv
参考卷积计算方式:https://zhuanlan.zhihu.com/p/268179286Depthwise卷积与Pointwise卷积:https://zhuanlan.zhihu.com/p/80041030卷积ref: https://zhuanlan.zhihu.com/p/268179286单通道单卷积核单通道多卷积核多通道单卷积核多通道多卷积核2. Conv3. Depthwise Seperable Convref: https://zhuanlan.zhihu.co原创 2021-03-01 18:57:12 · 1980 阅读 · 0 评论 -
【Eager & Graph Execution】EagerTensor与Tensor,tf.function / tf.py_function / tf.numpy_function
Tensorflow 的执行方式可分为:Eager executionGraph execution, 也叫静态图执行方式Graph execution早于Eager execution:在TensorFlow v1.5之前,tensorflow都是通过计算图将计算的定义和执行分隔开, 这是一种声明式(declaretive)的编程模型。这种静态图的执行模式最主要的特点是快速。但是在debug时非常不方便,无法类似于对编译好的Python语言程序调用,也无法对其进行内部的调试。因此有了Eage原创 2021-02-01 19:07:40 · 6558 阅读 · 2 评论 -
【卷积】一维/二维、因果、空洞卷积
1. 二维卷积1.1. 定义1.2 使用示例2. 一维卷积2.1 定义2.2 使用示例3. 一维因果卷积3.1 定义3.2 使用示例4. 空洞卷积4.1 定义4.2 使用示例原创 2021-01-29 12:11:23 · 7832 阅读 · 7 评论 -
【keras模型查看】(卷积层、池化层、全连接层、Batchnorm层)参数个数、乘法次数
文章目录1. 卷积层1.1 输入参数1.2 输出维数1.2.1 padding=valid1.2.2 padding=same1.3 参数个数乘法次数1. 卷积层1.1 输入参数卷积的输入参数:指需要做卷积的输入图像/音频等,它要求是一个Tensor,具有[batch, in_height, in_width, in_channels]这样的shape,具体图片的含义是[训练时一个batch的图片数量, 图片高度, 图片宽度, 图像通道数],注意这是一个4维的Tensor,要求类型为float32和原创 2021-01-07 18:16:38 · 4225 阅读 · 1 评论 -
【keras模型查看】模型结构、模型参数、每层输入/输出
文章目录查看keras模型结构查看keras模型参数查看keras模型每层输出查看keras模型结构# 查看模型层及参数deepxi.model.summary()# 将模型结构保存为图片model_img_name = args.ver + '-' + args.network_type + '.png'keras.utils.plot_model(deepxi.model, model_img_name, show_shapes=True)查看keras模型参数# 给定keras模型原创 2020-12-05 10:14:52 · 15715 阅读 · 1 评论 -
【模型函数】之 Activation 和 Softmax
文章目录激活函数 Activation functionsSigmoidTanhReluLinearSoftmax激活函数 Activation functions解决非线性问题。SigmoidTanhReluLinearReference:常见的激活函数: https://zhuanlan.zhihu.com/p/70810466Softmaxsoftmax用于多分类过程中,它将多个神经元的输出,映射到(0,1)区间内,可以看成概率来理解,从而来进行多分类!...原创 2020-11-28 16:24:21 · 4425 阅读 · 0 评论 -
【Keras模型量化】之量化感知训练 Quantization Aware Training(tfmot)
文章目录Quantization aware training 简介ReferenceAPI兼容性使用示例实际遇到问题Quantization aware training 简介Quantization aware training 即 量化感知训练,主要是使用tfmot.quantization.keras.quantize_model。相较于训练后量化(可参考之前的博客:),没那么易于使用,但量化感知训练在模型准确率方面的表现通常更好。个人理解:不是针对参数进行量化,而是在构建模型后,针对模型结原创 2020-11-28 15:10:42 · 3041 阅读 · 0 评论 -
【Keras模型量化】之 Fake Quant(tf.quantization)
Fake Quant 简介为什么要做模型量化:Deep learning models are typically trained with floating point data but they can quantized into integers during inference without any loss of performance (i.e. accuracy).量化什么:Quantizing models includes quantizing both the weights a原创 2020-11-28 14:41:11 · 3824 阅读 · 2 评论 -
【keras模型量化】之 训练后量化 Post-Training Quantization(TFLite)
文章目录tflite概述生成tflite生成方式Converting a SavedModel to a TensorFlow Lite model.Converting a tf.Keras model to a TensorFlow Lite model.Converting ConcreteFunctions to a TensorFlow Lite model.示例说明未量化的keras model直接生成tflite未量化的模型保存文件(.pb)生成tflite模型量化量化方式Quantizati原创 2020-09-24 14:07:03 · 5875 阅读 · 0 评论 -
深度学习-入门
文章目录1. What & Why: 什么是深度学习,为什么要用深度学习?常见类型常见应用2. How: 模型训练过程搭建模型3. Where: 存在问题过拟合与欠拟合正则dropoutearly stopping模型复杂度太高/模型太大模型压缩模型量化模型剪枝训练收敛太慢梯度optimizer1. What & Why: 什么是深度学习,为什么要用深度学习?计算机以类人脑的方式构建“神经网络”,通常包括输入层、中间层/隐藏层、输出层。这些隐藏层即“深度”:从”输入层“到”输出层“所经历原创 2020-08-27 16:31:33 · 610 阅读 · 0 评论 -
【模型参数】tensorflow1.x (slim) 和tensorflow2.x (keras) 的查看模型参数方式
文章目录tensorflow1.x (slim)1. 查看模型所有参数 / 指定参数:2. 查看ckpt保存的所有模型参数 / 指定参数tensorflow2.x (keras)1. 查看模型所有参数 / 指定参数:2. 查看ckpt保存的所有模型参数 / 指定参数tensorflow1.x (slim)1. 查看模型所有参数 / 指定参数:tf.trainable_variables()sess.run(variable_names)import tensorflow as tf # v 1.原创 2020-08-21 11:19:13 · 1566 阅读 · 1 评论 -
Batch normalization Folding
Why Batch normalizationThe idea behind “batch norm” is that neural network layers work best when the data is clean. Ideally, the input to a layer has an average value of 0 and not too much variance. This should sound familiar to anyone who’s done any mach原创 2020-07-15 19:10:43 · 554 阅读 · 0 评论 -
【模型保存和载入】Tensorflow 2.x: save and load keras model, and their customization
文章目录A keras model contains:基本save和load模型方法:保存全部模型SavedModel类型(默认)H5类型(SavedModel的轻量级)SavedModel和H5比较:仅保存模型结构architecture仅保存模型权值weightsA keras model contains:architecture, which specifyies what layers the model contain, and how they’re connected.weights原创 2020-07-15 14:02:36 · 887 阅读 · 0 评论