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

网站建设采取招标的方式北京seo外包

网站建设采取招标的方式,北京seo外包,网站建设项目甘特图,怎么删除wordpress主题题目一:(20分) 请使用Matplotlib中的折线图工具,绘制正弦和余弦函数图像,其中x的取值范围是,效果如图1所示。 要求: (1)正弦图像是蓝色曲线,余弦图像是红色曲线,线条宽度…

题目一:(20分)

请使用Matplotlib中的折线图工具,绘制正弦和余弦函数图像,其中x的取值范围是,效果如图1所示。
要求:
(1)正弦图像是蓝色曲线,余弦图像是红色曲线,线条宽度为2.5;
(2)标题为:“正/余弦函数图像”,字体颜色为黑色,大小为16;
(3)横坐标标签为:“x轴”,纵坐标标签为“y轴”,字体大小为12。
在这里插入图片描述

		图1 正/余弦函数

① 代码

import matplotlib.pyplot as plt
import numpy as np# 用于正常显示中文标签
plt.rcParams['font.sans-serif'] = 'SimHei'
# 用来正常显示负号
plt.rcParams['axes.unicode_minus'] = False
# 获取x坐标
x = np.arange(-1 * np.pi,np.pi,0.1)
# 获取y坐标
y1=np.sin(x)y2=np.cos(x)plt.plot(x,y1,label='正弦',color='b',linewidth=2.5)plt.plot(x,y2,label='余弦',color='r',linewidth=2.5)
# x,y轴的最小最大值
plt.xlim(-1*np.pi,np.pi)plt.ylim(-1.5,1.5)
# 设置x,y轴的坐标刻度
plt.xticks([-np.pi,-np.pi/2,0,np.p/2,np.pi],[r'$-\pi$',r'$-\pi/2$',r'$0$',r'$\pi/2$',r'$\pi$'])plt.yticks([-1,0,1])plt.title('正/余弦函数图像',color='black',fontsize=16)plt.xlabel('x轴',fontsize=12)plt.ylabel('y轴',fontsize=12)plt.legend()plt.show()

② 实验结果
在这里插入图片描述

题目二:(40分)

请使用Windows中的“画图”工具,手写数字0-9,对图像进行适当的裁剪和处理后,保存为MNIST数据集的格式,具体步骤与要求如下:
步骤:
(1)使用Windows中的“画图”工具,手写数字0-9,并裁剪为适当尺寸的单个数字后,保存为图像文件,如图2所示;
(2)对裁剪过的图像进行反色、二值化处理,使图像呈现为黑底白字,如图3、4所示;
(3)对图像进行缩放,变换为2828像素的二值图像,如图5所示;
(4)将处理好的图像保存为与MNIST数据集相同的多维数组形式。

拓展要求:
在白纸上用黑色的笔写数字,拍照后,转换为MNIST数据集的格式。
提示:
(1)可以使用“全能扫描王”等工具优化所拍的图像,如图6所示;
(2)尝试用笔尖不同粗细的黑色笔写数字,看看什么情况下效果最好;
(3)在二值化之前先用高斯函数处理图像,看看效果有什么不同。
(高斯函数如表1所示。)

在这里插入图片描述
图2 图像裁剪
在这里插入图片描述

图3 反色处理
在这里插入图片描述

图4 图像二值化
在这里插入图片描述

图5 28×28像素图像
手写原图像 工具优化后的图像
在这里插入图片描述

图6 手写原图与工具优化后图像的对比图
① 主要函数及参数说明
def fomatPng(i) ,初始化图片函数,i为图片

② 代码

import numpy as npimport matplotlib.pyplot as pltfrom PIL import Image# 初始化图片
def fomatPng(i):# 打开图像,返回image对象img = Image.open("D:\\ui\haohaoxuexi\\神经网络\\me\\code\\image\\%d.png" % i)# 转换图像的色彩模式为二值图像img_gary = img.convert("1")# 将图像转换为数组arr_img_gary = np.array(img_gary)# 反色处理arr_img_fanzhi = np.invert(arr_img_gary)# 将数组转换为imgimg_fanzhi = Image.fromarray(arr_img_fanzhi)# 缩放图像为28*28img_small = img_fanzhi.resize((28, 28))plt.imshow(img_fanzhi)print(np.array(img_small))arr_img_small = np.array(img_small).reshape(1, 28, 28)return arr_img_smalltrain_x = fomatPng(0)
train_y = np.array((0, ))for i in range(1, 10):# 数组拼接train_x = np.concatenate((train_x, fomatPng(i)))train_y = np.append(train_y, i)print(train_x.shape)
print(train_y.shape)for i in range(0,10):plt.subplot(2, 5, i + 1)plt.axis("off")plt.imshow(train_x[i],cmap="gray")plt.show()

③ 实验结果
在这里插入图片描述

④ 实验小结

题目三:(40分)
Fashion MNIST数据集中包含10种类别、共7万张不同商品的正面图像。在Keras中集成了Fashion MNIST数据集,被划分为训练集和测试集。
下载数据集,并完成以下要求:
要求:
(1)下载Fashion MNIST数据集,读取训练集和测试集数据,分别放在NumPy数组train_x、train_y、test_x、test_y中(train_x:训练集图像,train_y:训练集标签,test_x:测试集图像,test_y:测试集标签)
(2)编写代码段,查看训练集和测试集的样本数、形状,并查看数据集中的10类标签分别是什么。
(3)从训练集中选择前10张图像,对每张图像分别进行以下变换:转置、上下翻转、顺时针旋转10度、逆时针旋转10度、水平镜像,将图像数量由10张增加到60张,并将处理后的图像保存在多维数组train_x_aug1中。
(4)将train_x_aug1中的图像显示在10×6子图布局的画布中,其中第1列为原图,第2-6列为变换后的效果,每列图像的上方显示变换效果。全局标题为“Fashion Mnist数据增强”。字体颜色、字号、以及其他版式细节自定义,要求清晰、简洁、美观。
(5)要求(3)中,进行旋转操作时,如果要求旋转方向和角度随机,应该如何做?尝试对前10张图像完成以上变换,将结果保存在多维数组train_x_aug2中,并以清晰、美观的形式展示结果。
(6)要求(5)中,如果要求变换方式也随机选择,应该如何做?尝试对前100张图像,每张图像实现5种随机变换,并将结果保存在多维数组train_x_aug3中。随机选择其中的10张原图,把变换的结果展示出来。
拓展要求:
对图像进行缩放时,图像的像素会改变,要求对图像分别缩小10%、放大10%,缩放后图像尺寸仍保持2828,应该怎么做?
相关函数如表2所示:
表2 相关函数
序号 函数 函数功能 函数相关库
1 fashion_mnist=tf.keras.datasets.fashion_mnist 下载Fashion MNIST数据集 Keras库
2 对象名.rotate() 图像旋转度 PIL库
3 Image(类名).fromarray(obj)
将对象obj从Numpy数组格式转化为Image格式 PIL库Image类

4 对象名.tolist() 将数组或矩阵转化为列表 Numpy库
5 对象名.append(obj) 在数组或列表末尾追加新的对象obj Python内置函数
6 random(类名).choice(seq) 从指定序列seq中返回一个随机选择的元素。Seq可以是字符串,列表,元组或任何其他种类的序列 Random库

7 对象名.pad(array, pad_width, mode,constant_values ) 向array数组中以mode模式,按照pad_width指定的维度,填充constant_values指定的数值 Numpy库
① 主要函数及参数说明
1)展示图片函数:pics为图片数组,title为标题
def showPic(pics, titles):
2)显示标签函数:i为图片的下标
def get_fasion_mnist_labels(i):
3)随机变换函数:img为要变换的图片
def randomTran(img):
② 代码

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
def show(train_x, titles):plt.rcParams['font.sans-serif'] = "SimHei"   #字体设置plt.figure(figsize=(8, 15))   #画布大小设置index = 1for i in train_x:plt.subplot(10, 6, index)     #10行6列 第x个位置的图片plt.title(titles[index % 6 - 1], fontsize=6)     #取标签  取余的方式 循环输出每组图片plt.axis("off")     #关闭坐标轴plt.imshow(i)    #显示第几张图片index += 1plt.suptitle("Fashion Mnist 数据增强")plt.show()
def Choose_way(img):k = np.random.randint(0, 6, 1)    #创建一个只有0-5的随机数组 用于随机选择处理方式if k == 0:return np.array(img.transpose(Image.TRANSPOSE)).reshape(1, 28, 28)  # 转置if k == 1:return np.array(img.transpose(Image.FLIP_TOP_BOTTOM)).reshape(1, 28, 28)  # 上下翻转if k == 2:return np.array(img.rotate(-10)).reshape(1, 28, 28)  # 顺时针10度if k == 3:return np.array(img.rotate(10)).reshape(1, 28, 28)  # 逆时针10度if k == 4:return np.array(img.transpose(Image.FLIP_LEFT_RIGHT)).reshape(1, 28, 28)  # 水平镜像if k == 5:return np.array(img.transpose(Image.TRANSVERSE)).reshape(1, 28, 28)  # 上下翻转
def Show_message():print("训练集x的样本数:", len(train_x))print("训练集y的样本数:", len(train_y))print("测试集x的样本数:", len(test_x))print("测试集y的样本数:", len(test_y))print("训练集x的形状:", train_x.shape)print("训练集y的形状:", train_y.shape)print("测试集x的形状:", test_x.shape)print("测试集y的形状", test_y.shape)
def Show_label_train_y():class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag','Ankle boot']label_train_y = np.sort(train_y)  # 对数据集里面的值进行从小到大排序   无数个000 111 222 - 99999temp = -1for i in label_train_y:         #遍历  且防止输出重复的数字if i > temp:print("数据集中类标签有:",i+1, class_names[i])temp = i
def mode1():train_x_aug1 = train_x[0].reshape(1, 28, 28)for i in range(0, 10):img = Image.fromarray(train_x[i])# 第一幅图不处理,第二幅图处理if i != 0:train_x_aug1 = np.concatenate((train_x_aug1, train_x[i].reshape(1, 28, 28)))  # 将第一幅图片加入trainx_x_aug1train_x_aug1 = np.concatenate((train_x_aug1, np.array(img.transpose(Image.TRANSPOSE)).reshape(1, 28, 28)))  # 转置train_x_aug1 = np.concatenate((train_x_aug1, np.array(img.transpose(Image.FLIP_TOP_BOTTOM)).reshape(1, 28, 28)))  # 上下翻转train_x_aug1 = np.concatenate((train_x_aug1, np.array(img.rotate(-10)).reshape(1, 28, 28)))  # 顺时针10度train_x_aug1 = np.concatenate((train_x_aug1, np.array(img.rotate(10)).reshape(1, 28, 28)))  # 逆时针10度train_x_aug1 = np.concatenate((train_x_aug1, np.array(img.transpose(Image.FLIP_LEFT_RIGHT)).reshape(1, 28, 28)))  # 水平镜像titles = ['原图', '转置', '上下翻转', '顺时针旋转10度', '逆时针旋转10度', '水平镜像']show(train_x_aug1, titles)  # train_x_aug1 包含了60张图print(train_x_aug1)def mode2():train_x_aug2 = train_x[0].reshape(1, 28, 28)for i in range(0, 10):  #依次处理10幅图  内部再对每幅图处理成6种状态k = np.random.randint(-180, 180, 5)  # 旋转角度随机数img = Image.fromarray(train_x[i])if i != 0:train_x_aug2 = np.concatenate((train_x_aug2, train_x[i].reshape(1, 28, 28)))for j in range(0,5):train_x_aug2 = np.concatenate((train_x_aug2, np.array(img.rotate(k[j])).reshape(1, 28, 28)))  #循环四次添加各种角度处理后的图片titles = ['原图', '随机1', '随机2', '随机3', '随机4', '随机5']show(train_x_aug2, titles)def mode3():train_x_aug3 = train_x[0].reshape(1, 28, 28)for i in range(0, 100):img = Image.fromarray(train_x[i])  #取100张图片   每张图片随机5种处理方式if i != 0:train_x_aug3 = np.concatenate((train_x_aug3, Choose_way(img)))train_x_aug3 = np.concatenate((train_x_aug3, Choose_way(img)))train_x_aug3 = np.concatenate((train_x_aug3, Choose_way(img)))train_x_aug3 = np.concatenate((train_x_aug3, Choose_way(img)))train_x_aug3 = np.concatenate((train_x_aug3, Choose_way(img)))train_x_aug3 = np.concatenate((train_x_aug3, Choose_way(img)))r = np.random.randint(0, 100, 10)train_x_aug3_show = train_x_aug3[r[0]*6:r[0] * 6 + 6 ]for x in range(1, 10):  #在前6张图后面再加9次6张图train_x_aug3_show = np.concatenate((train_x_aug3_show, train_x_aug3[r[x] * 6:r[x] * 6 + 6]))titles = ['原图', '随机1', '随机2', '随机3', '随机4', '随机5']show(train_x_aug3_show, titles)
if __name__ == '__main__':fashion_mnist = tf.keras.datasets.fashion_mnist   #下载数据集(train_x, train_y), (test_x, test_y) = fashion_mnist.load_data()#train_x:训练集图像,train_y:训练集标签,test_x:测试集图像,test_y:测试集标签Show_message()   #  查看训练集和测试集的样本数、形状Show_label_train_y()  #查看数据集中的10类标签分别是什么  标签是放在train_y里面的#取从第一幅图开始的10张图进行处理mode1()mode2()mode3()

③ 实验结果
中间部分图省略
在这里插入图片描述

④ 实验小结


文章转载自:
http://netted.rzgp.cn
http://mashlam.rzgp.cn
http://discontentedly.rzgp.cn
http://whirlpool.rzgp.cn
http://tole.rzgp.cn
http://daresay.rzgp.cn
http://cissoid.rzgp.cn
http://cooncan.rzgp.cn
http://response.rzgp.cn
http://particularity.rzgp.cn
http://script.rzgp.cn
http://russety.rzgp.cn
http://unspeak.rzgp.cn
http://holeproof.rzgp.cn
http://africanize.rzgp.cn
http://learnable.rzgp.cn
http://viewer.rzgp.cn
http://rossiya.rzgp.cn
http://pentamer.rzgp.cn
http://cistus.rzgp.cn
http://overcover.rzgp.cn
http://squall.rzgp.cn
http://sultry.rzgp.cn
http://superfamily.rzgp.cn
http://repellance.rzgp.cn
http://autotoxin.rzgp.cn
http://tattler.rzgp.cn
http://subtorrid.rzgp.cn
http://abscondence.rzgp.cn
http://tagger.rzgp.cn
http://bath.rzgp.cn
http://avowed.rzgp.cn
http://testamur.rzgp.cn
http://recite.rzgp.cn
http://irritable.rzgp.cn
http://refrigerate.rzgp.cn
http://potholder.rzgp.cn
http://teachware.rzgp.cn
http://lispingly.rzgp.cn
http://intemerate.rzgp.cn
http://amex.rzgp.cn
http://languishingly.rzgp.cn
http://panelling.rzgp.cn
http://brawler.rzgp.cn
http://loon.rzgp.cn
http://reticule.rzgp.cn
http://perinea.rzgp.cn
http://succubus.rzgp.cn
http://noxious.rzgp.cn
http://cocainization.rzgp.cn
http://dinch.rzgp.cn
http://negligent.rzgp.cn
http://landowning.rzgp.cn
http://aphthong.rzgp.cn
http://witty.rzgp.cn
http://rageful.rzgp.cn
http://salmo.rzgp.cn
http://filo.rzgp.cn
http://diadochokinesia.rzgp.cn
http://metonymic.rzgp.cn
http://bustle.rzgp.cn
http://drily.rzgp.cn
http://precognition.rzgp.cn
http://modeless.rzgp.cn
http://sublimate.rzgp.cn
http://laubmannite.rzgp.cn
http://maurist.rzgp.cn
http://rampike.rzgp.cn
http://ruinate.rzgp.cn
http://encyclopedize.rzgp.cn
http://radiophosphorus.rzgp.cn
http://bub.rzgp.cn
http://shankaracharya.rzgp.cn
http://perforation.rzgp.cn
http://joyously.rzgp.cn
http://penis.rzgp.cn
http://bicorn.rzgp.cn
http://legibility.rzgp.cn
http://silken.rzgp.cn
http://occidentally.rzgp.cn
http://emilia.rzgp.cn
http://fanega.rzgp.cn
http://diminish.rzgp.cn
http://reticulated.rzgp.cn
http://commute.rzgp.cn
http://vexilla.rzgp.cn
http://aberdeenshire.rzgp.cn
http://hatcher.rzgp.cn
http://lingy.rzgp.cn
http://cense.rzgp.cn
http://pertly.rzgp.cn
http://hippogriff.rzgp.cn
http://flory.rzgp.cn
http://saucerize.rzgp.cn
http://fervent.rzgp.cn
http://chastely.rzgp.cn
http://mythologize.rzgp.cn
http://leninism.rzgp.cn
http://osteometrical.rzgp.cn
http://magniloquent.rzgp.cn
http://www.dt0577.cn/news/120004.html

相关文章:

  • 找做网站的人怎样申请网站
  • 网站长春网站建设收录查询 站长工具
  • 黑龙江 建设监理协会网站做竞价推广这个工作怎么样
  • 新网站如何做营销淘宝指数网址
  • 网站建设前百度搜索首页
  • 有域名 有主机 怎么建设网站百度西安分公司地址
  • 广州专业网站建设哪家公司好营销活动方案
  • 做公众号首图的设计网站app推广方案模板
  • 鄂州城乡建设委员会网站内容营销案例
  • 杭州建设工程网天津seo公司
  • 阿里云安装网站网络营销措施有哪些
  • 免费空间怎么搞网站想建立自己的网站
  • 网站开发要懂英文吗2023广州疫情最新消息今天
  • 榆林做网站电话开网站需要什么流程
  • 网站开发 前端 后端今日国内热点新闻头条事件
  • 手工做的网站宁波网站推广平台效果好
  • 建设网站模板免费下载企业网站代运营
  • 拼多多cms网站怎么做在线收录
  • 服务器如何搭建网站微信小程序开发
  • 免费电商网站建设中国大数据平台官网
  • 网站项目如何做需求分析报告怎么做网站教程
  • 做中药材生意哪个网站靠谱seo网站优化服务
  • 武汉网站建设怎么样seo软件服务
  • 网络服务者seo排名点击工具
  • 怎样打开网站制作seo优化招聘
  • 网站开发备案费用网站维护的内容有哪些
  • 学做网站的笔记本营销案例100例小故事及感悟
  • 深圳公司做网站百度官方下载
  • 怎么分享网站一元手游平台app
  • 商城集团专业网站优化公司