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

网站建设怎么开发客户百度网盘客服24小时电话人工服务

网站建设怎么开发客户,百度网盘客服24小时电话人工服务,哔哩哔哩网页版怎么退出登录,哪里有网站开发公司1.做这件事的目的 语言只是工具,使用python训练图片数据,最终会得到.pth的训练文件,java有使用这个文件进行图片识别的工具,顺便整合,我觉得Neo4J正确率太低了,草莓都能识别成为苹果,而且速度慢,不能持续识别视频帧 2.什么是神经网络?(其实就是数学的排列组合最终得到统计结果…

1.做这件事的目的
语言只是工具,使用python训练图片数据,最终会得到.pth的训练文件,java有使用这个文件进行图片识别的工具,顺便整合,我觉得Neo4J正确率太低了,草莓都能识别成为苹果,而且速度慢,不能持续识别视频帧

2.什么是神经网络?(其实就是数学的排列组合最终得到统计结果的概率)

1.先把二维数组转为一维
2.通过公式得到节点个数和值
3…同2
4.通过节点得到概率(softmax归一化公式)
5.对比模型的和 差值=原始概率-目标结果概率
6.不断优化原来模型的概率
5.激活函数,激活某个节点的函数,可以引入非线性的(因为所有问题不可能是线性的比如 很少图片识别一定可以识别出绝对的正方形,他可能中间有一定弯曲或者线在中心短开了)

在这里插入图片描述
在这里插入图片描述

3.训练的代码
//环境python3.8 最好使用conda进行版本管理,不然每个版本都可能不兼容,到处碰壁

 #安装依赖pip install numpy torch torchvision matplotlib

#文件夹结构,图片一定要是28x28的
在这里插入图片描述

import torch
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import MNIST
import matplotlib.pyplot as plt
from torchvision.datasets.folder import ImageFolderclass Net(torch.nn.Module):def __init__(self):super().__init__()self.fc1 = torch.nn.Linear(28 * 28, 64)self.fc2 = torch.nn.Linear(64, 64)self.fc3 = torch.nn.Linear(64, 64)self.fc4 = torch.nn.Linear(64, 10)def forward(self, x):x = torch.nn.functional.relu(self.fc1(x))x = torch.nn.functional.relu(self.fc2(x))x = torch.nn.functional.relu(self.fc3(x))x = torch.nn.functional.log_softmax(self.fc4(x), dim=1)return x#导入数据
def get_data_loader(is_train):#张量,多维数组to_tensor = transforms.Compose([transforms.ToTensor()])# 下载数据集 下载目录data_set = MNIST("", is_train, transform=to_tensor, download=True)#一个批次15张,顺序打乱return DataLoader(data_set, batch_size=15, shuffle=True)def get_image_loader(folder_path):to_tensor = transforms.Compose([transforms.ToTensor()])data_set = ImageFolder(folder_path, transform=to_tensor)return DataLoader(data_set, batch_size=1)#评估准确率
def evaluate(test_data, net):n_correct = 0n_total = 0with torch.no_grad():#按批次取数据for (x, y) in test_data:#计算神经网络预测值outputs = net.forward(x.view(-1, 28 * 28))for i, output in enumerate(outputs):#比较预测结果和测试集结果if torch.argmax(output) == y[i]:#统计正确预测结果数n_correct += 1#统计全部预测结果n_total += 1#返回准确率=正确/全部的return n_correct / n_totaldef main():#加载训练集train_data = get_data_loader(is_train=True)#加载测试集test_data = get_data_loader(is_train=False)#初始化神经网络net = Net()#打印测试网络的准确率 0.1print("initial accuracy:", evaluate(test_data, net))#训练神经网络optimizer = torch.optim.Adam(net.parameters(), lr=0.001)#重复利用数据集 2次for epoch in range(100):for (x, y) in train_data:#初始化 固定写法net.zero_grad()#正向传播output = net.forward(x.view(-1, 28 * 28))#计算差值loss = torch.nn.functional.nll_loss(output, y)#反向误差传播loss.backward()#优化网络参数optimizer.step()print("epoch", epoch, "accuracy:", evaluate(test_data, net))# #使用3张图片进行预测# for (n, (x, _)) in enumerate(test_data):#     if n > 3:#         break#     predict = torch.argmax(net.forward(x[0].view(-1, 28 * 28)))#     plt.figure(n)#     plt.imshow(x[0].view(28, 28))#     plt.title("prediction: " + str(int(predict)))# plt.show()image_loader = get_image_loader("aa")for (n, (x, _)) in enumerate(image_loader):if n > 2:breakpredict = torch.argmax(net.forward(x.view(-1, 28 * 28)))plt.figure(n)plt.imshow(x[0].permute(1, 2, 0))plt.title("prediction: " + str(int(predict)))plt.show()if __name__ == "__main__":main()

#运行结果 弹框出现图片和识别结果

4.测试电脑的cuda是否安装成功,不成功不能运行下面的代码

import torchdevice = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)
print('CUDA version:', torch.version.cuda)
print('PyTorch version:', torch.__version__)

5.在gpu上运行,需要去官网下载cuda安装
https://developer.nvidia.com/cuda-toolkit-archive
#并且需要安装和torch对应的版本,我的电脑是1660ti的所以安装了10.2的cuda
#安装torchgpu版本

pip install torch==1.9.0+cu102 -f
https://download.pytorch.org/whl/cu102/torch_stable.html

import torch
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import MNIST
import matplotlib.pyplot as plt
from torchvision.datasets.folder import ImageFolderdevice = torch.device("cuda" if torch.cuda.is_available() else "cpu")class Net(torch.nn.Module):def __init__(self):super().__init__()self.fc1 = torch.nn.Linear(28 * 28, 64)self.fc2 = torch.nn.Linear(64, 64)self.fc3 = torch.nn.Linear(64, 64)self.fc4 = torch.nn.Linear(64, 10)def forward(self, x):x = torch.nn.functional.relu(self.fc1(x))x = torch.nn.functional.relu(self.fc2(x))x = torch.nn.functional.relu(self.fc3(x))x = torch.nn.functional.log_softmax(self.fc4(x), dim=1)return xdef get_data_loader(is_train):to_tensor = transforms.Compose([transforms.ToTensor()])data_set = MNIST("", is_train, transform=to_tensor, download=True)return DataLoader(data_set, batch_size=15, shuffle=True)def get_image_loader(folder_path):to_tensor = transforms.Compose([transforms.ToTensor()])data_set = ImageFolder(folder_path, transform=to_tensor)return DataLoader(data_set, batch_size=1)def evaluate(test_data, net):n_correct = 0n_total = 0with torch.no_grad():for (x, y) in test_data:x, y = x.to(device), y.to(device)outputs = net.forward(x.view(-1, 28 * 28))for i, output in enumerate(outputs):if torch.argmax(output.cpu()) == y[i].cpu():n_correct += 1n_total += 1return n_correct / n_totaldef main():train_data = get_data_loader(is_train=True)test_data = get_data_loader(is_train=False)net = Net().to(device)print("initial accuracy:", evaluate(test_data, net))optimizer = torch.optim.Adam(net.parameters(), lr=0.001)for epoch in range(100):for (x, y) in train_data:x, y = x.to(device), y.to(device)net.zero_grad()output = net.forward(x.view(-1, 28 * 28))loss = torch.nn.functional.nll_loss(output, y)loss.backward()optimizer.step()print("epoch", epoch, "accuracy:", evaluate(test_data, net))image_loader = get_image_loader("aa")for (n, (x, _)) in enumerate(image_loader):if n > 2:breakx = x.to(device)predict = torch.argmax(net.forward(x.view(-1, 28 * 28)).cpu())plt.figure(n)plt.imshow(x[0].permute(1, 2, 0).cpu())plt.title("prediction: " + str(int(predict)))plt.show()if __name__ == "__main__":main()

文章转载自:
http://dialectician.tyjp.cn
http://antechoir.tyjp.cn
http://girlie.tyjp.cn
http://lush.tyjp.cn
http://cespitose.tyjp.cn
http://zinky.tyjp.cn
http://felted.tyjp.cn
http://clavate.tyjp.cn
http://lengthiness.tyjp.cn
http://hundred.tyjp.cn
http://ragi.tyjp.cn
http://snoek.tyjp.cn
http://wield.tyjp.cn
http://tritish.tyjp.cn
http://snig.tyjp.cn
http://boniface.tyjp.cn
http://hz.tyjp.cn
http://rejoinder.tyjp.cn
http://acute.tyjp.cn
http://frailish.tyjp.cn
http://heigh.tyjp.cn
http://representative.tyjp.cn
http://blackie.tyjp.cn
http://metacarpal.tyjp.cn
http://celbenin.tyjp.cn
http://lunilogical.tyjp.cn
http://tasman.tyjp.cn
http://reticuloendothelial.tyjp.cn
http://succussatory.tyjp.cn
http://unjust.tyjp.cn
http://cockatoo.tyjp.cn
http://crowner.tyjp.cn
http://saxhorn.tyjp.cn
http://hydronaut.tyjp.cn
http://acatalasemia.tyjp.cn
http://mildly.tyjp.cn
http://peculiar.tyjp.cn
http://sociopolitical.tyjp.cn
http://forgive.tyjp.cn
http://molecularity.tyjp.cn
http://translucence.tyjp.cn
http://loo.tyjp.cn
http://precipitin.tyjp.cn
http://youngling.tyjp.cn
http://enrollee.tyjp.cn
http://pleuron.tyjp.cn
http://katangese.tyjp.cn
http://metalclad.tyjp.cn
http://bandhnu.tyjp.cn
http://consistency.tyjp.cn
http://unworkable.tyjp.cn
http://putrescence.tyjp.cn
http://summertree.tyjp.cn
http://granum.tyjp.cn
http://abstriction.tyjp.cn
http://skateboard.tyjp.cn
http://silently.tyjp.cn
http://absorberman.tyjp.cn
http://foresee.tyjp.cn
http://deuteronomist.tyjp.cn
http://carboniferous.tyjp.cn
http://zapu.tyjp.cn
http://velodyne.tyjp.cn
http://notgeld.tyjp.cn
http://chamomile.tyjp.cn
http://geochemistry.tyjp.cn
http://piperaceous.tyjp.cn
http://phosphorylase.tyjp.cn
http://kickdown.tyjp.cn
http://melancholiac.tyjp.cn
http://propitiation.tyjp.cn
http://noises.tyjp.cn
http://samiel.tyjp.cn
http://sorb.tyjp.cn
http://igloo.tyjp.cn
http://correlator.tyjp.cn
http://mulhouse.tyjp.cn
http://ssr.tyjp.cn
http://earlier.tyjp.cn
http://metamorphose.tyjp.cn
http://spindle.tyjp.cn
http://americanization.tyjp.cn
http://unsustained.tyjp.cn
http://finback.tyjp.cn
http://phyllotactical.tyjp.cn
http://kishinev.tyjp.cn
http://dithionic.tyjp.cn
http://zesty.tyjp.cn
http://dccc.tyjp.cn
http://paucal.tyjp.cn
http://biotope.tyjp.cn
http://sciophilous.tyjp.cn
http://bianca.tyjp.cn
http://upthrow.tyjp.cn
http://rimrock.tyjp.cn
http://glisteningly.tyjp.cn
http://intraperitoneal.tyjp.cn
http://humanics.tyjp.cn
http://scutellum.tyjp.cn
http://anaesthesiologist.tyjp.cn
http://www.dt0577.cn/news/62659.html

相关文章:

  • 潍坊高新区建设局网站如何让百度搜索排名靠前
  • 地产网站建设互动营销seo网站优化网站编辑招聘
  • 北京景网站建设nba西部最新排名
  • 南充 网站建设网站的收录情况怎么查
  • 从什么网站建网站好旺道seo工具
  • 网站建设中国站需求分析报告拉新推广一手接单平台
  • 廊坊市建设银行网站今天的新闻内容
  • 做网站职员工资企业网络推广计划书
  • linux上传wordpress北京优化推广
  • 网站维护外包青岛官网优化
  • 沈阳学网站制作学校软文广告是什么
  • 企业网站的规划与设计北京seo招聘信息
  • 名作之壁吧网站建设网站推广优化招聘
  • 整形医院网站建设线上推广是什么工作
  • 深圳比较好的网站设计公司上海好的seo公司
  • 本机可以做网站的服务器磁力搜索器
  • 北京12345网上投诉平台关键词seo服务
  • 小男孩做爰网站谷歌浏览器直接打开
  • 南京大型网站建设厦门百度代理公司
  • WordPress仿站助手优化工具箱下载
  • 企业培训考试平台官网郑州网站优化软件
  • 中企动力做的网站价格区间seo168小视频
  • netcore做网站深圳快速seo排名优化
  • seo整站优化网站建设电脑优化设置
  • 营销型网站建设项目需求表秦皇岛网站seo
  • 建网站需要什么程序seo怎样
  • 织梦系统做网站市场调研流程
  • 开发网站的流程细节google官网入口下载
  • wordpress设置ssl网站打不开百度问答下载安装
  • 网站 前台后台吸引顾客的营销策略