2、卷积和ReLU激活函数

python了解集合网络如何创建具有卷积层的特性。

文章目录

  • 简介
  • 特征提取(Feature Extraction)
  • 卷积过滤(Filter with Convolution)
  • Weights(权重)
  • 激活(Activations)
  • 用ReLU检测
  • 示例 - 应用卷积和ReLU
  • 结论

In [1]:

import numpy as np
from itertools import product

def show_kernel(kernel, label=True, digits=None, text_size=28):
    # Format kernel
    kernel = np.array(kernel)
    if digits is not None:
        kernel = kernel.round(digits)

    # Plot kernel
    cmap = plt.get_cmap('Blues_r')
    plt.imshow(kernel, cmap=cmap)
    rows, cols = kernel.shape
    thresh = (kernel.max()+kernel.min())/2
    # Optionally, add value labels
    if label:
        for i, j in product(range(rows), range(cols)):
            val = kernel[i, j]
            color = cmap(0) if val > thresh else cmap(

你可能感兴趣的:(计算机视觉,计算机视觉,人工智能)