简介 通过卷积我们可以提取图片的轮廓 可以进行图片平滑处理 可以处理彩色图片 黑白图片处理 导包 import numpy as np import tensorflow as tf import matplotlib . pyplot as plt % matplotlib inline 原图 flower = plt . imread ( './flower.png' ) flower . shape plt . imshow ( flower , cmap = plt . cm . gray ) data = flower . reshape ( 1 , 332 , 444 , 1 ) # 浮雕效果 卷积核 filter_ = np . array ( [ [ - 1 , - 1 , 0 ] , [ - 1 , 0 , 1 ] , [ 0 , 1 , 1 ] ] ) . reshape ( 3 , 3 , 1 , 1 ) # neural network # KNN ----> nearest neighbors # CNN ---->convolution neural network:卷积神经网络 conv = tf . nn . conv2d ( input = data , filter = filter_ , strides = [ 1 , 1 , 1 , 1 ]