卷积神经网络与TensorFlow识别应用详解
卷积神经网络(CNN)基础
在CNN中,卷积层是核心组件之一。卷积操作通过将过滤器与图像的各个区域进行元素级乘法,然后求和得到一个单一值作为输出。以下是卷积操作的关键代码:
# Element-wise multiplication between the current region and the filter.
curr_result = curr_region * conv_filter
conv_sum = numpy.sum(curr_result)
result[r, c] = conv_sum
卷积层处理完输入后,会返回特征图。这些特征图将作为后续层的输入。
接下来是ReLU层,它对卷积层输出的每个特征图应用ReLU激活函数。该函数的实现如下:
def relu(feature_map):
# Preparing the output of the ReLU activation function.
relu_out = numpy.zeros(feature_map.shape)
for map_num in range(feature_map.shape[-1]):
for r in numpy.arange(0,feature_map.shape[0]):
for c in numpy.arange(0, feature_map.shape[1]):
超级会员免费看
订阅专栏 解锁全文
1238

被折叠的 条评论
为什么被折叠?



