【python实现卷积神经网络】上采样层upSampling2D实现
代码来源:https://github.com/eriklindernoren/ML-From-Scratch
卷积神经网络中卷积层Conv2D(带stride、padding)的具体实现:https://www.cnblogs.com/xiximayou/p/12706576.html
激活函数的实现(sigmoid、softmax、tanh、relu、leakyrelu、elu、selu、softplus):https://www.cnblogs.com/xiximayou/p/12713081.html
损失函数定义(均方误差、交叉熵损失):https://www.cnblogs.com/xiximayou/p/12713198.html
优化器的实现(SGD、Nesterov、Adagrad、Adadelta、RMSprop、Adam):https://www.cnblogs.com/xiximayou/p/12713594.html
卷积层反向传播过程:https://www.cnblogs.com/xiximayou/p/12713930.html
全连接层实现:https://www.cnblogs.com/xiximayou/p/12720017.html
批量归一化层实现:https://www.cnblogs.com/xiximayou/p/12720211.html
池化层实现:https://www.cnblogs.com/xiximayou/p/12720324.html
padding2D实现:https://www.cnblogs.com/xiximayou/p/12720454.html
Flatten层实现:https://www.cnblogs.com/xiximayou/p/12720518.html
class UpSampling2D(Layer):
""" Nearest neighbor up sampling of the input. Repeats the rows and
columns of the data by size[0] and size[1] respectively.
Parameters:
-----------
size: tuple
(size_y, size_x) - The number of times each axis will be repeated.
"""
def __init__(self, size=(2,2), input_shape=None):
self.prev_shape = None
self.trainable = True
self.size = size
self.input_shape = input_shape def forward_pass(self, X, training=True):
self.prev_shape = X.shape
# Repeat each axis as specified by size
X_new = X.repeat(self.size[0], axis=2).repeat(self.size[1], axis=3)
return X_new def backward_pass(self, accum_grad):
# Down sample input to previous shape
accum_grad = accum_grad[:, :, ::self.size[0], ::self.size[1]]
return accum_grad def output_shape(self):
channels, height, width = self.input_shape
return channels, self.size[0] * height, self.size[1] * width
核心就是numpy.repeat()函数。
【python实现卷积神经网络】上采样层upSampling2D实现的更多相关文章
- 【python实现卷积神经网络】Dropout层实现
代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...
- 【python实现卷积神经网络】激活层实现
代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...
- 【python实现卷积神经网络】padding2D层实现
代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...
- 【python实现卷积神经网络】Flatten层实现
代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...
- 【python实现卷积神经网络】开始训练
代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...
- 【python实现卷积神经网络】定义训练和测试过程
代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...
- 基于Python的卷积神经网络和特征提取
基于Python的卷积神经网络和特征提取 用户1737318发表于人工智能头条订阅 224 在这篇文章中: Lasagne 和 nolearn 加载MNIST数据集 ConvNet体系结构与训练 预测 ...
- 【python实现卷积神经网络】批量归一化层实现
代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...
- 【python实现卷积神经网络】卷积层Conv2D反向传播过程
代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...
随机推荐
- vue one one
目录 Vue 渐进式 JavaScript 框架 一.走进Vue 1.what -- 什么是Vue 2.why -- 为什么要学习Vue 3.special -- 特点 4.how -- 如何使用Vu ...
- JSP(三)----EL表达式
## EL表达式 1.概念:Expression alnguage 表达式语言 2.作用:替换和简化JSP页面中java代码的编写 3.语法:${表达式} 4.注意: * jsp默认支持EL表 ...
- CF codeforces A. New Year Garland【Educational Codeforces Round 79 (Rated for Div. 2)】
A. New Year Garland time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 深度学习论文TOP10,2019一季度研究进展大盘点
9012年已经悄悄过去了1/3. 过去的100多天里,在深度学习领域,每天都有大量的新论文产生.所以深度学习研究在2019年开了怎样一个头呢? Open Data Science对第一季度的深度学习研 ...
- re模块——正则表达式
import re re.findall('\w','abc123_8()-=') \w:字母数字下划线 \W:非数字字母下划线 \s:空白字符 \S:非空字符 \d:整数数字 \D:非整数数字 \A ...
- WePY框架 input,checkbox-group,radio-group等change 一般处理方法
布局搞定了,接下来就是数据处理方面了 form表单中常用标签,绑定change方法: 方法的具体实现 根据打印出来e的结果可以看到,e指代当前标签对象,包含属性方法等 从detail中可以获取多选框选 ...
- Python python对象 range
""" range(stop) -> range object range(start, stop[, step]) -> range object Retu ...
- 利用sqlmap进行Access和Mysql注入
sqlmap将检测结果保存到C:\Users\Administrator.sqlmap\output (windows) linux:(/root/.sqlmap/output) Access注入 1 ...
- 15.自动部署web工程
用maven自动部署web工程 在pom.xml中写入以下: <build> <!--最终名称,进入网页时有http://localhost:8080/xxx/--> < ...
- Python中的编码及操作文件
------------恢复内容开始------------ 1,字符编码 ASCII 用1个字符来表示所有的英文字母和特殊符号 GB2313(GBK)用2个字符来表示英文字母及中文字符,且决定如果 ...