python了解集合网络如何创建具有卷积层的特性。
文章目录
- 简介
- 特征提取(Feature Extraction)
- 卷积过滤(Filter with Convolution)
- Weights(权重)
- 激活(Activations)
- 用ReLU检测
- 示例 – 应用卷积和ReLU
- 结论
In [1]:
import numpy as npfrom itertools import productdef show_kernel(kernel, label=True, digits=None, text_size=28):# Format kernelkernel = np.array(kernel)if digits is not None:kernel = kernel.round(digits)# Plot kernelcmap = plt.get_cmap('Blues_r')plt.imshow(kernel, cmap=cmap)rows, cols = kernel.shapethresh = (kernel.max()+kernel.min())/2# Optionally, add value labelsif label:for i, j in product(range(rows), range(cols)):val = kernel[i, j]color = cmap(0) if val > thresh else cmap(