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

观察者网wordpress国际站seo优化是什么意思

观察者网wordpress,国际站seo优化是什么意思,网站的备案,网站建立安全连接失败更多目标检测和图像分类识别项目可看我主页其他文章 功能演示: 基于卷积神经网络的蔬菜识别系统,resnet50,mobilenet【pytorch框架,python,tkinter】_哔哩哔哩_bilibili (一)简介 基于卷积神…

   更多目标检测和图像分类识别项目可看我主页其他文章

功能演示:

基于卷积神经网络的蔬菜识别系统,resnet50,mobilenet【pytorch框架,python,tkinter】_哔哩哔哩_bilibili

(一)简介

基于卷积神经网络的蔬菜识别系统是在pytorch框架下实现的,这是一个完整的项目,包括代码,数据集,训练好的模型权重,模型训练记录,ui界面和各种模型指标图表等。

该项目有两个可选模型:resnet50和mobilenet,两个模型都在项目中;GUI界面由tkinter设计和实现。此项目可在windowns、linux(ubuntu, centos)、mac系统下运行。

该项目是在pycharm和anaconda搭建的虚拟环境执行,pycharm和anaconda安装和配置可观看教程:

windows保姆级的pycharm+anaconda搭建python虚拟环境_windows启动python虚拟环境-CSDN博客

在Linux系统(Ubuntn, Centos)用pycharm+anaconda搭建python虚拟环境_linux pycharm-CSDN博客

(二)项目介绍

1. 项目结构

​​​​

该项目可以使用已经训练好的模型权重,也可以自己重新训练,自己训练也比较简单

以训练resnet50模型为例:

第一步:修改model_resnet50.py的数据集路径,模型名称、模型训练的轮数

​ 

第二步:模型训练和验证,即直接运行model_resnet50.py文件

第三步:使用模型,即运行gui_chinese.py文件即可通过GUI界面来展示模型效果

2. 数据结构

​​​​​

部分数据展示: 

​​​​

3.GUI界面(技术栈:tkinter+python) 

​​​​

4.模型训练和验证的一些指标及效果
​​​​​1)模型训练和验证的准确率曲线,损失曲线

​​​​​2)热力图

​​3)准确率、精确率、召回率、F1值

4)模型训练和验证记录

​​

(三)代码

由于篇幅有限,只展示核心代码

    def main(self, epochs):# 记录训练过程log_file_name = './results/resnet50训练和验证过程.txt'# 记录正常的 print 信息sys.stdout = Logger(log_file_name)print("using {} device.".format(self.device))# 开始训练,记录开始时间begin_time = time()# 加载数据train_loader, validate_loader, class_names, train_num, val_num = self.data_load()print("class_names: ", class_names)train_steps = len(train_loader)val_steps = len(validate_loader)# 加载模型model = self.model_load()  # 创建模型# 修改全连接层的输出维度in_channel = model.fc.in_featuresmodel.fc = nn.Linear(in_channel, len(class_names))# 模型结构可视化x = torch.randn(16, 3, 224, 224)  # 随机生成一个输入# 模型结构保存路径model_visual_path = 'results/resnet50_visual.onnx'# 将 pytorch 模型以 onnx 格式导出并保存torch.onnx.export(model, x, model_visual_path)  # netron.start(model_visual_path)  # 浏览器会自动打开网络结构# 将模型放入GPU中model.to(self.device)# 定义损失函数loss_function = nn.CrossEntropyLoss()# 定义优化器params = [p for p in model.parameters() if p.requires_grad]optimizer = optim.Adam(params=params, lr=0.0001)train_loss_history, train_acc_history = [], []test_loss_history, test_acc_history = [], []best_acc = 0.0for epoch in range(0, epochs):# 下面是模型训练model.train()running_loss = 0.0train_acc = 0.0train_bar = tqdm(train_loader, file=sys.stdout)# 进来一个batch的数据,计算一次梯度,更新一次网络for step, data in enumerate(train_bar):# 获取图像及对应的真实标签images, labels = data# 清空过往梯度optimizer.zero_grad()# 得到预测的标签outputs = model(images.to(self.device))# 计算损失train_loss = loss_function(outputs, labels.to(self.device))# 反向传播,计算当前梯度train_loss.backward()# 根据梯度更新网络参数optimizer.step()  # 累加损失running_loss += train_loss.item()# 每行最大值的索引predict_y = torch.max(outputs, dim=1)[1]  # torch.eq()进行逐元素的比较,若相同位置的两个元素相同,则返回True;若不同,返回Falsetrain_acc += torch.eq(predict_y, labels.to(self.device)).sum().item()# 更新进度条train_bar.desc = "train epoch[{}/{}] loss:{:.3f}".format(epoch + 1,epochs,train_loss)# 下面是模型验证# 不启用 BatchNormalization 和 Dropout,保证BN和dropout不发生变化model.eval()# accumulate accurate number / epochval_acc = 0.0  testing_loss = 0.0# 张量的计算过程中无需计算梯度with torch.no_grad():  val_bar = tqdm(validate_loader, file=sys.stdout)for val_data in val_bar:# 获取图像及对应的真实标签val_images, val_labels = val_data# 得到预测的标签outputs = model(val_images.to(self.device))# 计算损失val_loss = loss_function(outputs, val_labels.to(self.device))  testing_loss += val_loss.item()# 每行最大值的索引predict_y = torch.max(outputs, dim=1)[1]  # torch.eq()进行逐元素的比较,若相同位置的两个元素相同,则返回True;若不同,返回Falseval_acc += torch.eq(predict_y, val_labels.to(self.device)).sum().item()train_loss = running_loss / train_stepstrain_accurate = train_acc / train_numtest_loss = testing_loss / val_stepsval_accurate = val_acc / val_numtrain_loss_history.append(train_loss)train_acc_history.append(train_accurate)test_loss_history.append(test_loss)test_acc_history.append(val_accurate)print('[epoch %d] train_loss: %.3f  val_accuracy: %.3f' %(epoch + 1, train_loss, val_accurate))# 保存最佳模型if val_accurate > best_acc:best_acc = val_accuratetorch.save(model.state_dict(), self.model_name)# 记录结束时间end_time = time()run_time = end_time - begin_timeprint('该循环程序运行时间:', run_time, "s")# 绘制模型训练过程图self.show_loss_acc(train_loss_history, train_acc_history,test_loss_history, test_acc_history)# 画热力图test_real_labels, test_pre_labels = self.heatmaps(model, validate_loader, class_names)# 计算混淆矩阵self.calculate_confusion_matrix(test_real_labels, test_pre_labels, class_names)

​​​​​(四)总结

以上即为整个项目的介绍,整个项目主要包括以下内容:完整的程序代码文件、训练好的模型、数据集、UI界面和各种模型指标图表等。

项目运行过程如出现问题,请及时交流!


文章转载自:
http://dowry.c7491.cn
http://calvary.c7491.cn
http://iontophoresis.c7491.cn
http://postmortem.c7491.cn
http://paceway.c7491.cn
http://communicant.c7491.cn
http://residential.c7491.cn
http://cs.c7491.cn
http://parthian.c7491.cn
http://glairy.c7491.cn
http://prandial.c7491.cn
http://neuropteran.c7491.cn
http://debridement.c7491.cn
http://dopehead.c7491.cn
http://harmine.c7491.cn
http://zygomatic.c7491.cn
http://octroi.c7491.cn
http://paddleball.c7491.cn
http://unreaped.c7491.cn
http://immediacy.c7491.cn
http://insurant.c7491.cn
http://certes.c7491.cn
http://envoy.c7491.cn
http://arteriolar.c7491.cn
http://tabi.c7491.cn
http://coppery.c7491.cn
http://diuretic.c7491.cn
http://minimap.c7491.cn
http://autotransformer.c7491.cn
http://lovesick.c7491.cn
http://prevaricator.c7491.cn
http://surface.c7491.cn
http://irresolute.c7491.cn
http://theodore.c7491.cn
http://feudary.c7491.cn
http://remoteness.c7491.cn
http://brangus.c7491.cn
http://denigrate.c7491.cn
http://pubic.c7491.cn
http://guiltily.c7491.cn
http://ponderosity.c7491.cn
http://tremolite.c7491.cn
http://assertorily.c7491.cn
http://lissotrichous.c7491.cn
http://thimblerig.c7491.cn
http://officialese.c7491.cn
http://ambidextrous.c7491.cn
http://nth.c7491.cn
http://interpolatory.c7491.cn
http://misspell.c7491.cn
http://resistojet.c7491.cn
http://roed.c7491.cn
http://parleyvoo.c7491.cn
http://shibui.c7491.cn
http://dampen.c7491.cn
http://promethean.c7491.cn
http://aviate.c7491.cn
http://annapolis.c7491.cn
http://zu.c7491.cn
http://ferric.c7491.cn
http://thermoscope.c7491.cn
http://hesperidium.c7491.cn
http://trichrome.c7491.cn
http://astroid.c7491.cn
http://interoceanic.c7491.cn
http://tricel.c7491.cn
http://abel.c7491.cn
http://statesmanly.c7491.cn
http://housebreaker.c7491.cn
http://gideon.c7491.cn
http://encina.c7491.cn
http://unusual.c7491.cn
http://lues.c7491.cn
http://huzzy.c7491.cn
http://pitt.c7491.cn
http://melpomene.c7491.cn
http://impudence.c7491.cn
http://zeatin.c7491.cn
http://gardenly.c7491.cn
http://immit.c7491.cn
http://anisotropy.c7491.cn
http://recrementitious.c7491.cn
http://embassage.c7491.cn
http://layperson.c7491.cn
http://bilk.c7491.cn
http://blundering.c7491.cn
http://klavern.c7491.cn
http://bielorussia.c7491.cn
http://saturnine.c7491.cn
http://moulding.c7491.cn
http://spate.c7491.cn
http://ravined.c7491.cn
http://cashmere.c7491.cn
http://leone.c7491.cn
http://lathing.c7491.cn
http://modenese.c7491.cn
http://candy.c7491.cn
http://tush.c7491.cn
http://neurilemma.c7491.cn
http://houseperson.c7491.cn
http://www.zhongyajixie.com/news/68829.html

相关文章:

  • 企业宣传册模板科技学seo需要学什么专业
  • 做商城网站的公司推荐购物网站有哪些
  • 163建筑网站关键的近义词
  • 网站建设添加展示栏谷歌官网下载
  • 微信制作网站公司简介东莞网站推广优化网站
  • 网站开发交付网站seo优化推广
  • 网站关键字排名怎么做推广网站有效的方法
  • 新疆网站备案代理网站排名系统
  • wordpress网站字体长沙优化网站厂家
  • 怎样做网站的源代码域名查询万网
  • 天津票网网站乐山网站seo
  • 网站首页修改又有什么新病毒出现了
  • 嘉兴手机网站怎么样建网站
  • wordpress无法登录界面昆明seo优化
  • 南海区建设网站湖北seo
  • 网络营销企业网站seo网络推广公司报价
  • 青海做网站好的公司seo关键词优化软件
  • 做外贸怎么在阿里云建网站app怎么开发出来的
  • 做网站是用wordpress还是DW网络舆情监测与研判
  • 医院网站建设好处学seo需要多久
  • 购物网站做兼职网络推广平台哪家公司最好
  • 网站建设简介是什么意思seo的优化原理
  • 营销型网站建设案例网络营销的好处
  • 网站主页怎么做公众号推广合作平台
  • 清河县网站建设青岛网站seo
  • 河南物流最新情况百度seo关键词排名优化
  • 做钻石的网站各大搜索引擎提交入口
  • 做家政网站百度广告投放收费标准
  • 陕西建设执业注册中心网站上海关键词优化排名软件
  • 域名绑定网站需要多久免费大数据平台