当前位置: 首页 > ds >正文

CNN处理图片

In [5]:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import tensorflow as tf

import matplotlib.pyplot as plt

import numpy as np




# 平滑均值滤波
#KaTeX parse error: Expected 'EOF', got '_' at position 14: \text {filter_̲{arg}=np.}.full (shape=[3, \text {(shape=[3,} (shape=[3,, 3, 1, 1], fill_value=1 / 9)

# # 高斯平滑滤波
f i l t e r a r g = n p . filter_arg=np. filterarg=np. . a r r a y ( [ [ 1 / 16 , 2 / 16 , .array([[1/16,2/16, .array([[1/16,2/16, / / / / / /,[2/16,4/16,2/16],[1/16,2/16,1/16]]).reshape([3,3,1,1​
pic3=tf. \text {pic3=tf.} pic3=tf..constant(pic2, dt ype=tf \text {ype=tf} ype=tf.float32)

KaTeX parse error: Expected 'EOF', got '_' at position 14: \text {filter_̲{arg}}=\text {t….constant(filter_arg, dtype=tf.float32)

# 卷积
KaTeX parse error: Expected 'EOF', got '_' at position 11: \text {pic_̲{cnn}}=\text {t….nn.conv2d(pic3, fil t e r = f i l t e r a r g , ter=filter_arg, ter=filterarg, strides = = =[1, 1, 1, 1], padding=‘SAME’)



with tf.Session() as sess:
KaTeX parse error: Expected 'EOF', got '_' at position 25: …c4=sess.run(pic_̲{cnn})} print(pic4.shape)
plt.imshow(pic4.transpose([3,1,2,0]).reshape([582,1024,3]).astype(np.uint8)/255)
# 图片灰度化处理
s = − 1 ) s=-1) s=1).astype(np.uin # plt.show()
pic = = = plt.imread(‘./欧式.jpg’)
pic2 = = = pic.reshape([1, 582, 1024, 3]).transpose([3,1,2,0])
# plt.imshow(pic4.transpose( [ 3 , 1 , 2 , 0 ] [3,1,2,0] [3,1,2,0]).reshape((582,1024,3)).mean(axi

(3, 582, 1024, 1)

In [3]:1plt.imshow(pic)

Out[3]: <matplotlib.image.AxesImage at 0x1d088552198>

http://www.xdnf.cn/news/5240.html

相关文章:

  • 关于 OpenGL 的上下文、线程和共享上下文之间的关系
  • Dive into LVGL (1) —— How LVGL works from top to down
  • 期货反向跟单—数据分析误区(二)盘手排名
  • 60分钟示范课设计-《Python循环语句的奥秘与应用进阶》
  • 第J7周:对于ResNeXt-50算法的思考
  • 网上商城系统
  • 【嵌入式系统设计师(软考中级)】第二章:嵌入式系统硬件基础知识——⑤电源及电路设计
  • 全国青少年信息素养大赛 Python编程挑战赛初赛 内部集训模拟试卷四及详细答案解析
  • 解决librechat 前端界面没有google gemini 2.5模型的选项
  • 【c语言】动态内存管理
  • 各种注解含义及使用
  • 心 光 -中小企实战运营和营销工作室博客
  • 微机控制高温扭转试验机
  • 关于AI 大数据模型的基础知识 杂记
  • 数字化与信息化的关系
  • 4.3 Thymeleaf案例演示:图书管理
  • 军事目标无人机视角坦克检测数据集VOC+YOLO格式4003张1类别
  • 44.辐射发射整改简易摸底测试方法
  • 企业名录搜索软件哪家好?
  • 6.01 Python中打开usb相机并进行显示
  • 动态创建链表(头插法、尾插法)
  • RISC-V CLINT、PLIC及芯来ECLIC中断机制分析 —— RISC-V中断机制(一)
  • Linux探秘坊-------12.库的制作与原理
  • java-----------------多态
  • 跨平台编码规范文档
  • c++:标准模板库 STL(Standard Template Library)
  • 【Go底层】http标准库服务端实现原理
  • 设计模式-迭代器模式
  • 【MySQL数据库】--SQLyog创建数据库+python连接
  • 26考研——中央处理器_CPU 的功能和基本结构(5)