深度学习
深度学习算法、框架研究
傅华涛Fu
热爱代码,热爱技术。
展开
-
Keras:获取模型的中间层/最后一层的输出结果
最近在做实验时,需要使用到模型在训练时的输出结果。有些情况下,需要用到模型中间的若干层的输出结果,我的实验中需要用到模型的最后输出结果。参考另一篇文章中的方法:python - Keras, How to get the output of each layer? - Stack Overflow但是我的实验更复杂一点,我的模型中有多个输入和多个输出,但实现起来也不是很复杂,获取模型最后一层的输出结果的代码如下:from keras import backend as Kget_lay原创 2022-04-19 14:59:47 · 3364 阅读 · 0 评论 -
AttributeError: ‘tuple‘ object has no attribute ‘type‘
我在训练深度的模型时,报了一个错:AttributeError: ‘tuple‘ object has no attribute ‘type‘但是代码是确定没错的。出现该问题的原因有很多,我寻思着可能是tensorflow的版本问题,于是我将tensorflow版本从2.2降到2.0,????,成功了。...原创 2022-01-08 23:12:17 · 3223 阅读 · 0 评论 -
创建Word2Vec模型: TypeError: __init__() got an unexpected keyword argument ‘size‘
---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-11-f65b2b409400> in <module> 15 for window_param in [1, 3, 5, 1.原创 2021-12-11 21:43:49 · 1902 阅读 · 0 评论 -
跑深度学习模型报错:Function call stack:train_function -> train_function
今天在跑自己设计的深度学习模型时出现了以下问题:InternalError: 2 root error(s) found. (0) Internal: Blas GEMM launch failed : a.shape=(12, 3), b.shape=(3, 32), m=12, n=32, k=3 [[node model/dense_3/MatMul (defined at <ipython-input-16-5a73e5716594>:10) ]] [[gradien原创 2021-10-31 13:12:26 · 4150 阅读 · 1 评论 -
深度学习保存模型save_model:UnicodeDecodeError:‘utf-8 codec can not decode byte 0x5d in position 307:invalid
我在保存训练好的深度学习模型时,出现了如上的编码错误,一开始我以为是路径问题,但是找了好几遍都没发现问题,所以觉得不是路径问题。似乎从这些提示的错误中无法找到问题所在。但是,我在过了两三天再去run模型的时候,出现了下面这个警告:WARNING:absl:Found untraced functions such as gru_cell_2_layer_call_and_return_conditional_losses, gru_cell_2_layer_call_fn, gru_ce...原创 2021-08-21 10:13:49 · 4538 阅读 · 1 评论 -
2021-08-20 22:25:59.661554: F .\tensorflow/core/kernels/conv_2d_gpu.h:1019] Non-OK-status: GpuLaunch
2021-08-20 22:25:59.661554: F .\tensorflow/core/kernels/conv_2d_gpu.h:1019] Non-OK-status: GpuLaunchKernel( SwapDimension1And2InTensor3UsingTiles<T, kNumThreads, kTileSize, kTileSize, conjugate>, total_tiles_count, kNumThreads, 0, d.stream(), input,原创 2021-08-20 22:39:30 · 601 阅读 · 0 评论 -
WARNING:tensorflow:AutoGraph could not transform <bound method TokenAndPositionEmbedding.call of <__
WARNING:tensorflow:AutoGraph could not transform <bound method TokenAndPositionEmbedding.call of <__main__.TokenAndPositionEmbedding object at 0x0000018165769888>> and will run it as-is. Please report this to the TensorFlow team. When filing th原创 2021-08-20 21:23:17 · 1183 阅读 · 1 评论 -
ImportError: cannot import name ‘CustomObjectScope‘
这是引入包的问题修改前:from keras.utils import CustomObjectScope修改后:from keras.utils.generic_utils import CustomObjectScope原创 2021-08-17 12:56:54 · 1664 阅读 · 0 评论 -
import seaborn ImportError: DLL load failed: 找不到指定的模块。
我在anaconda中import seaborn时,出现了“ImportError: DLL load failed: 找不到指定的模块。”于是我先conda uninstall scipy然后conda install scipy再重新import seabornOk,问题解决!!!原创 2021-08-15 11:12:43 · 571 阅读 · 0 评论 -
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C head
在python3.7版本中遇到上面这个问题,是numpy的版本问题。我原来的版本是1.20.0,后来升级到1.21.1,问题解决!!!原创 2021-08-15 10:57:58 · 706 阅读 · 0 评论 -
LSTM超参数调整
以下是手动优化RNN超参数时需要注意的一些情况:小心过拟合,神经网络基本在“记忆”训练数据时,就会发生过拟合。过拟合意味着你在训练数据上有很好的表现,在其他数据集上基本无用。 正则化有好处:方法包括 l1、 l2和dropout等。 要有一个单独的测试集,不要在这个测试集上训练网络。 网络越大,功能就越强,但也更容易过拟合。 不要试图从10000个示例中学习一百万个参数,参数>样例=麻烦。 数据越多越好,因为它有助于防止过度拟合。 训练要经过多个epoch(算法遍历训练数据集)。 每个原创 2020-10-18 17:00:34 · 14881 阅读 · 1 评论 -
有关卷积神经网络的文章
https://cs231n.github.io/convolutional-networks/原创 2020-10-18 16:53:37 · 118 阅读 · 0 评论 -
《动手学深度学习》网页版
https://tangshusen.me/Dive-into-DL-PyTorch/#/https://zh.d2l.ai/chapter_recurrent-neural-networks/gru.html原创 2020-10-12 19:22:14 · 1499 阅读 · 0 评论 -
GRU相关文章摘录
吴恩达深度学习笔记(115)- GRU单元介绍原创 2020-10-10 12:12:40 · 310 阅读 · 0 评论 -
LSTM相关文章摘录
详解 LSTMhttps://www.jianshu.com/p/dcec3f07d3b5原创 2020-10-09 23:20:32 · 125 阅读 · 0 评论 -
深度学习网站汇总
http://colah.github.io/原创 2020-10-08 10:33:16 · 1623 阅读 · 0 评论 -
深度学习,NLP和表示
http://colah.github.io/posts/2014-07-NLP-RNNs-Representations/原创 2020-09-24 10:29:08 · 74 阅读 · 0 评论 -
词嵌入
B站上有一个讲词嵌入的视频,我认为讲的还可以:https://www.bilibili.com/video/BV1Ki4y1x7gJ?from=search&seid=14594580491827061010将文本分解而成的单元(单词、字符或n-gram)叫做标记;将文本分解成标记的过程叫做分词。所有文本向量化过程都是应用某种弄分词方案,然后将数值向量与生成的标记相关联。这些向量组合成序列张量,被输入到深度神经网络中。将标记转换为向量的最常用最基本的方法是one-hot.原创 2020-12-15 12:22:12 · 2136 阅读 · 2 评论 -
归一化、标准化、批标准化
神经网络比较喜欢处理小数据。归一化和标准化都是将数据做线性变化,线性变化不会改变原始数据的顺序排列。归一化:将数据转换得到比较小的一个范围内,通常是[0, 1]之间。标准化:将数据转换为正态分布的标准,使得平均值为0,通常操作是将数据减去平均值再除以方差。批标准化(Batch Normalization):批标准化指的是批数据,把数据分成小批量进行随机梯度下降,而且在对每批数据进行前向传播的时候,对每一层都进行批标准化的处理。批标准化通常就是将分散的数据进行统一...原创 2020-09-08 08:49:40 · 749 阅读 · 0 评论 -
神经网络中重要的概念
1.激活函数:tanh:relu:sigmoid:2.损失函数:binary_crossentropy:categorical_crossentropy:sparse_categorical_crossentropy:3.优化器:SGD:Adam:Rmsprop:Momentumn:4.ont-hot编码(独热编码):原创 2020-08-28 15:59:08 · 391 阅读 · 0 评论 -
有关梯度消失和梯度爆炸的文章
https://www.cnblogs.com/pinking/p/9418280.html原创 2020-08-24 14:24:15 · 347 阅读 · 0 评论 -
摘录:交叉熵损失函数
https://www.jianshu.com/p/23623fe17f64原创 2020-08-23 16:11:18 · 116 阅读 · 0 评论 -
摘录:卷积神经网络为什么具有平移不变性?
卷积神经网络为什么具有平移不变性?原创 2020-08-18 21:09:13 · 259 阅读 · 0 评论 -
摘录:Graph Embedding
深度学习中不得不学的Graph Embedding方法原创 2020-08-18 10:45:10 · 71 阅读 · 0 评论 -
摘录:万物皆Embedding,从经典的word2vec到深度学习基本操作item2vec
万物皆Embedding,从经典的word2vec到深度学习基本操作item2vec原创 2020-08-18 10:42:20 · 281 阅读 · 0 评论 -
有关卷积神经网络的文章
直白介绍卷积神经网络(CNN)原创 2020-08-18 09:59:15 · 79 阅读 · 0 评论 -
sklearn 简介
sklearn 简介scikit-learn 是基于 Python 语言的机器学习工具简单高效的数据挖掘和数据分析工具 可供大家在各种环境中重复使用 建立在 NumPy ,SciPy 和 matplotlib 上 开源,可商业使用 - BSD许可证sklearn 中文文档...原创 2020-08-17 21:59:07 · 159 阅读 · 0 评论 -
两大免费云端 GPU:Colab 和 Kaggle
两大免费云端 GPU:Colab 和 Kaggle,爱学习的你究竟该如何选择?原创 2020-08-17 21:55:41 · 959 阅读 · 0 评论 -
序列填充:keras.processing.sequences.pad_sequence()
序列填充:keras.processing.sequences.pad_sequence()原创 2020-08-15 11:32:49 · 294 阅读 · 0 评论 -
单词编码: keras.processing.text.Tokenizer
单词编码: keras.processing.text.Tokenizer原创 2020-08-15 11:28:31 · 199 阅读 · 0 评论 -
有关循环神经网络的文章
https://zhuanlan.zhihu.com/p/115823190原创 2020-08-14 15:04:06 · 151 阅读 · 0 评论 -
有关深度学习的文章
https://zybuluo.com/hanbingtao/note/485480原创 2020-08-13 09:24:49 · 391 阅读 · 0 评论 -
推荐两篇关于卷积神经网络CNN的入门文章
总共有两篇文章,按顺序看,写的比较通俗易懂https://zhuanlan.zhihu.com/p/27908027https://zhuanlan.zhihu.com/p/28173972原创 2020-08-11 10:25:44 · 220 阅读 · 0 评论 -
损失函数的选择:binary_crossentropy、categorical_crossentropy、sparse_categorical_crossentropy
二分类问题: 如果是二分类问题,即最终的结果只能是两个分类中的一个,则损失函数loss使用binary_crossentropy多分类问题: 对于多分类问题,在选择损失函数loss时,主要是看数据是如何编码的: 1.如果是分类编码(one-hot编码),则使用categorical_crossentropy 我对one-hot编码的理解是:one-hot编码就是在标签向量化的时候,每个标签都是一个N维的向量(N由自己确定),其中这个向量只有一个值为1,其...原创 2020-07-31 10:38:34 · 6741 阅读 · 3 评论 -
深度学习中的‘Hello World’——MNIST问题
1.加载Keras中的mnist数据集如果是第一次加载这个数据集,则请查看我的另外一篇博客,总结了一下问题https://blog.csdn.net/fu_jian_ping/article/details/1076915872.查看数据集3.搭建神经网络架构4.准备图像数据5.准备标签6.训练网络7.测试网络...原创 2020-07-30 15:48:10 · 109 阅读 · 0 评论 -
关于第一次加载Keras中的mnist.npz数据集的问题
如果是使用下面代码(train_images, train_labels), (test_images, test_labels) = mnist.load_data()第一次下载mnist.npz数据集,将会非常慢,因为是从外国下载,而且数据量也有点大。为了解决这个问题,可以在网上将mnist.npz数据集下载下来,然后放到C:\Users\XXX\.keras\datasets目录中,这样的话,使用mnist.load_data()加载数据将会从本地加载,速度将会非常快...原创 2020-07-30 15:39:48 · 713 阅读 · 0 评论 -
更新setuptools版本:EROR: tensorboard 2.0.2 has requirement setuptools>=41.0.0,
ERROR: tensorboard 2.0.2 has requirement setuptools>=41.0.0, but you'll have setuptools 40.6.3 which is incompatible.解决方法:原创 2020-07-30 12:28:42 · 479 阅读 · 0 评论 -
更新pip版本: You are using pip version 20.1.1; however, version 20.2 is available.
WARNING: You are using pip version 20.1.1; however, version 20.2 is available.You should consider upgrading via the 'd:\python3.7\anaconda3\python.exe -m pip install --upgrade pip' command.解决方法:原创 2020-07-30 12:25:42 · 5504 阅读 · 0 评论 -
使用anaconda prompt安装TensorFlow与Keras
安装TensorFlow:查看TensorFlow是否安装成功:安装Keras并查看是否安装成功:原创 2020-07-30 12:22:18 · 336 阅读 · 0 评论 -
TensorFlow与Keras版本对应
Framework Env name (--env parameter) Description Docker Image Packages and Nvidia Settings TensorFlow 2.2 tensorflow-2.2 TensorFlow 2.2.0 + Keras 2.3.1 on Python 3.7. floydhub/tensorflow TensorFlow-2.2 TensorFlow 2.1 tensorfl原创 2020-07-30 12:15:34 · 8324 阅读 · 2 评论