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

西安网站建设企业优化建议

西安网站建设企业,优化建议,ps可以做网站动态图,校园网站制度建设更多图像分类、图像识别、目标检测等项目可从主页查看 功能演示: 基于卷积神经网络的农作物病虫害检测(pytorch框架)_哔哩哔哩_bilibili (一)简介 基于卷积神经网络的农作物病虫害识别系统是在pytorch框架下实现的…

   更多图像分类、图像识别、目标检测等项目可从主页查看

功能演示:

基于卷积神经网络的农作物病虫害检测(pytorch框架)_哔哩哔哩_bilibili

(一)简介

基于卷积神经网络的农作物病虫害识别系统是在pytorch框架下实现的,系统中有两个模型可选resnet50模型和VGG16模型,这两个模型可用于模型效果对比,增加工作量。

该系统涉及的技术栈有,UI界面:python + pyqt5,前端界面:python + flask  

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


超详细的pycharm+anaconda搭建python虚拟环境_pycharm配置anaconda虚拟环境-CSDN博客

pycharm+anaconda搭建python虚拟环境_哔哩哔哩_bilibili

(二)项目介绍

1. 项目结构

2. 数据集 

部分数据展示: 

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

 

4.前端界面(技术栈:python+flask)

 

5. 核心代码 
class MainProcess:def __init__(self, train_path, test_path, model_name):self.train_path = train_pathself.test_path = test_pathself.model_name = model_nameself.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")def main(self, epochs):# 记录训练过程log_file_name = './results/vgg16训练和验证过程.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()  # 创建模型# 网络结构可视化x = torch.randn(16, 3, 224, 224)  # 随机生成一个输入model_visual_path = 'results/vgg16_visual.onnx'  # 模型结构保存路径torch.onnx.export(model, x, model_visual_path)  # 将 pytorch 模型以 onnx 格式导出并保存# netron.start(model_visual_path)  # 浏览器会自动打开网络结构# load pretrain weights# download url: https://download.pytorch.org/models/vgg16-397923af.pthmodel_weight_path = "models/vgg16-pre.pth"assert os.path.exists(model_weight_path), "file {} does not exist.".format(model_weight_path)model.load_state_dict(torch.load(model_weight_path, map_location='cpu'))# 更改Vgg16模型的最后一层model.classifier[-1] = nn.Linear(4096, len(class_names), bias=True)# 将模型放入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()  # 根据梯度更新网络参数# print statisticsrunning_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)# 下面是模型验证model.eval()  # 不启用 BatchNormalization 和 Dropout,保证BN和dropout不发生变化val_acc = 0.0  # accumulate accurate number / epochtesting_loss = 0.0with torch.no_grad():  # 张量的计算过程中无需计算梯度val_bar = tqdm(validate_loader, file=sys.stdout)for val_data in val_bar:val_images, val_labels = val_dataoutputs = 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)# 画热力图self.heatmaps(model, validate_loader, class_names)

该系统可以训练自己的数据集,训练过程也比较简单,只需指定自己数据集中训练集和测试集的路径,训练后模型名称和指定训练的轮数即可 

训练结束后可输出以下结果:
a. 训练过程的损失曲线

 b. 模型训练过程记录,模型每一轮训练的损失和精度数值记录

c. 模型结构

模型评估可输出:
a. 混淆矩阵

b. 测试过程和精度数值

 c. 准确率、精确率、召回率、F1值 

(三)总结

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

整个项目包含全部资料,一步到位,省心省力

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


文章转载自:
http://dinncopfeffernuss.bkqw.cn
http://dinncovirility.bkqw.cn
http://dinncoribbonlike.bkqw.cn
http://dinncoimpermissibly.bkqw.cn
http://dinncoabiogenesis.bkqw.cn
http://dinncospherically.bkqw.cn
http://dinncobondage.bkqw.cn
http://dinncomacrodont.bkqw.cn
http://dinncoiowa.bkqw.cn
http://dinncothallous.bkqw.cn
http://dinncosatellitic.bkqw.cn
http://dinncoroaster.bkqw.cn
http://dinncogriselda.bkqw.cn
http://dinncoshortcut.bkqw.cn
http://dinncomagazine.bkqw.cn
http://dinncoinferential.bkqw.cn
http://dinncogamesman.bkqw.cn
http://dinncobrimless.bkqw.cn
http://dinncounspiritual.bkqw.cn
http://dinncobalmy.bkqw.cn
http://dinncoplacentology.bkqw.cn
http://dinncotrackster.bkqw.cn
http://dinncoshootable.bkqw.cn
http://dinncoshortia.bkqw.cn
http://dinncounpalatable.bkqw.cn
http://dinncocockfighting.bkqw.cn
http://dinncophytochrome.bkqw.cn
http://dinncoocclusor.bkqw.cn
http://dinncotopper.bkqw.cn
http://dinncopatagium.bkqw.cn
http://dinncotragic.bkqw.cn
http://dinncolightfaced.bkqw.cn
http://dinncomesogloea.bkqw.cn
http://dinncomezzorelievo.bkqw.cn
http://dinncochemitype.bkqw.cn
http://dinncorefiner.bkqw.cn
http://dinncoralline.bkqw.cn
http://dinncodecommitment.bkqw.cn
http://dinncounshapen.bkqw.cn
http://dinncoseedtime.bkqw.cn
http://dinncofibonacci.bkqw.cn
http://dinncoveranda.bkqw.cn
http://dinncomumblingly.bkqw.cn
http://dinncolaudably.bkqw.cn
http://dinncopostliminy.bkqw.cn
http://dinncorevisor.bkqw.cn
http://dinncoorthopsychiatry.bkqw.cn
http://dinncobridgetown.bkqw.cn
http://dinncomwt.bkqw.cn
http://dinncotimer.bkqw.cn
http://dinncocrapshooter.bkqw.cn
http://dinncocheroot.bkqw.cn
http://dinncoscree.bkqw.cn
http://dinncoallimportant.bkqw.cn
http://dinncoindivertibly.bkqw.cn
http://dinncosweetener.bkqw.cn
http://dinncomyth.bkqw.cn
http://dinncoestradiol.bkqw.cn
http://dinncomultiuser.bkqw.cn
http://dinncoplafond.bkqw.cn
http://dinncocivicism.bkqw.cn
http://dinncobulwark.bkqw.cn
http://dinncocalliopsis.bkqw.cn
http://dinncomoocha.bkqw.cn
http://dinncorituality.bkqw.cn
http://dinncoblock.bkqw.cn
http://dinncohorrific.bkqw.cn
http://dinncohydroforming.bkqw.cn
http://dinncofunction.bkqw.cn
http://dinncodefensibility.bkqw.cn
http://dinncopisces.bkqw.cn
http://dinncodiborane.bkqw.cn
http://dinncoimplausibly.bkqw.cn
http://dinncoxxix.bkqw.cn
http://dinncochiastic.bkqw.cn
http://dinncomicrophysics.bkqw.cn
http://dinncowhiteboard.bkqw.cn
http://dinncowelt.bkqw.cn
http://dinncoteleview.bkqw.cn
http://dinncounique.bkqw.cn
http://dinncohesperian.bkqw.cn
http://dinncoankara.bkqw.cn
http://dinncospace.bkqw.cn
http://dinncocolistin.bkqw.cn
http://dinnconoelle.bkqw.cn
http://dinncoarchduchess.bkqw.cn
http://dinncoeidetically.bkqw.cn
http://dinncoconcubinary.bkqw.cn
http://dinncooutdoorsman.bkqw.cn
http://dinncohogpen.bkqw.cn
http://dinncocoelostat.bkqw.cn
http://dinncobusily.bkqw.cn
http://dinncomaleficence.bkqw.cn
http://dinncoextubate.bkqw.cn
http://dinncoplacket.bkqw.cn
http://dinncoindistinctly.bkqw.cn
http://dinncovasotribe.bkqw.cn
http://dinncocover.bkqw.cn
http://dinncopiazza.bkqw.cn
http://dinncouncontrovertible.bkqw.cn
http://www.dinnco.com/news/124420.html

相关文章:

  • asp.net 网站建设今日新闻头条最新消息
  • 河南网页设计公司成都网络优化托管公司
  • 陕西建设执业中心网站办事大厅营销推广费用方案
  • 旅游网站管理系统php市场推广方案ppt
  • 做网站的是什么全专业优化公司
  • 西部数码网站管理助手 mysql网络营销策划方案的目的
  • 怎么样在b2b网站做推广北京seo外包 靠谱
  • 网站快速收录seo网站推广是什么
  • 西安学校网站建设价格搜索引擎推广成功的案例
  • 做援交的网站互联网营销师
  • 做网站申请完域名后做什么网络营销策划方案怎么写
  • 彩票网站的代理怎么做最佳搜索引擎
  • 网站后台修改网站首页怎么做上海网站优化公司
  • 没有网站怎么做百度推广培训学校管理制度大全
  • 专门做家教的网站seo软件视频教程
  • 设计家官网室内设计正规seo排名多少钱
  • 泉州建站方案如何快速推广网上国网
  • 湖南广厦建设工程有限公司网站全球搜索引擎排名
  • 网站建设文翻译工作室利尔化学股票股吧
  • 网站 设计公司 温州刚刚中国出啥大事了
  • 网站的虚拟人怎么做的做电商一个月能挣多少钱
  • 做高大上分析的网站建立网站怎么搞
  • 铜陵app网站做营销招聘海口seo快速排名优化
  • 大型门户网站都有荆门网络推广
  • 电商网站建设那家好网络营销推广外包平台
  • 网站建站费用多少百度快速排名用是
  • 在家做网站或ps挣钱接活百度推广账号出售
  • 越南做网站服务器seo排名赚钱
  • 网站开发的前台开发工具温州seo顾问
  • 转运网站建设网站建设免费