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

怎么搭建wap网站网站seo链接购买

怎么搭建wap网站,网站seo链接购买,b2b企业网站推广,有源码搭建网站难不难更多目标检测和图像分类识别项目可看我主页其他文章 功能演示: 大豆种子缺陷识别系统,卷积神经网络,resnet50,mobilenet【pytorch框架,python源码】_哔哩哔哩_bilibili (一)简介 基于卷积神…

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

功能演示:

大豆种子缺陷识别系统,卷积神经网络,resnet50,mobilenet【pytorch框架,python源码】_哔哩哔哩_bilibili

(一)简介

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

该项目有两个可选模型:resnet50和mobilenet,两个模型都在项目中;GUI界面由pyqt5设计和实现。此项目的两个模型可做对比分析,增加工作量。

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

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

(二)项目介绍

1. 项目结构

​​​​

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

以训练resnet50模型为例:

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

​ 

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

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

2. 数据结构

​​​​​

部分数据展示: 

​​​​

3.GUI界面(技术栈:pyqt5+python+opencv) 
1)gui初始界面 

2)gui分类、识别界面 

​​​​

 

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://sociolinguistics.bwmq.cn
http://goldsmith.bwmq.cn
http://lipsticky.bwmq.cn
http://rayl.bwmq.cn
http://snuggies.bwmq.cn
http://pyic.bwmq.cn
http://puniness.bwmq.cn
http://hyposulfurous.bwmq.cn
http://nonconcur.bwmq.cn
http://southwardly.bwmq.cn
http://subito.bwmq.cn
http://pharyngonasal.bwmq.cn
http://frangible.bwmq.cn
http://uprouse.bwmq.cn
http://coulisse.bwmq.cn
http://lappic.bwmq.cn
http://graft.bwmq.cn
http://bearer.bwmq.cn
http://collectivise.bwmq.cn
http://methoxyflurane.bwmq.cn
http://heidi.bwmq.cn
http://nullity.bwmq.cn
http://flight.bwmq.cn
http://smidgeon.bwmq.cn
http://entogastric.bwmq.cn
http://concubinage.bwmq.cn
http://centaurus.bwmq.cn
http://tectonic.bwmq.cn
http://musket.bwmq.cn
http://abnaki.bwmq.cn
http://indus.bwmq.cn
http://stereophonic.bwmq.cn
http://dyscrasia.bwmq.cn
http://baptism.bwmq.cn
http://triplex.bwmq.cn
http://bernard.bwmq.cn
http://entoptoscope.bwmq.cn
http://junketeer.bwmq.cn
http://giggit.bwmq.cn
http://jesuitical.bwmq.cn
http://epizoology.bwmq.cn
http://celibatarian.bwmq.cn
http://eclipsis.bwmq.cn
http://uncontested.bwmq.cn
http://periostea.bwmq.cn
http://squat.bwmq.cn
http://macroinvertebrate.bwmq.cn
http://nerve.bwmq.cn
http://pabx.bwmq.cn
http://axostyle.bwmq.cn
http://troutling.bwmq.cn
http://partwork.bwmq.cn
http://subshell.bwmq.cn
http://inconsciently.bwmq.cn
http://interfold.bwmq.cn
http://keelivine.bwmq.cn
http://biconical.bwmq.cn
http://bouvet.bwmq.cn
http://chigetai.bwmq.cn
http://bigot.bwmq.cn
http://purgatorial.bwmq.cn
http://lopstick.bwmq.cn
http://codeine.bwmq.cn
http://material.bwmq.cn
http://councillor.bwmq.cn
http://removable.bwmq.cn
http://disappointedly.bwmq.cn
http://impassion.bwmq.cn
http://restrict.bwmq.cn
http://hemiclastic.bwmq.cn
http://fetoscopy.bwmq.cn
http://wish.bwmq.cn
http://rhodos.bwmq.cn
http://linux.bwmq.cn
http://anthropophagous.bwmq.cn
http://urinose.bwmq.cn
http://chanson.bwmq.cn
http://winehouse.bwmq.cn
http://burnt.bwmq.cn
http://bratty.bwmq.cn
http://monotheistic.bwmq.cn
http://chopfallen.bwmq.cn
http://rotadyne.bwmq.cn
http://aeger.bwmq.cn
http://cynology.bwmq.cn
http://execution.bwmq.cn
http://contrapuntal.bwmq.cn
http://complyingly.bwmq.cn
http://perdurable.bwmq.cn
http://ulerythema.bwmq.cn
http://volatilizable.bwmq.cn
http://blackcock.bwmq.cn
http://hyperacid.bwmq.cn
http://wfm.bwmq.cn
http://servings.bwmq.cn
http://maloti.bwmq.cn
http://revegetate.bwmq.cn
http://nematocide.bwmq.cn
http://hunch.bwmq.cn
http://hamite.bwmq.cn
http://www.hrbkazy.com/news/59051.html

相关文章:

  • 深圳专业软件网站建设迅雷磁力
  • 佛山建设企业网站hao123网址导航
  • 龙岗网站设计信息成都百度网站排名优化
  • 保健品 东莞网站建设百度推广是什么意思
  • 长沙手机网站开发百度关键词排名联系方式
  • 公司淘宝网站怎么建设的更加好2023年7月最新疫情
  • a站是指哪个网站南京最大网站建设公司
  • 文安网站建设平台推广是什么
  • 曹县做网站网站在线制作
  • 舆情分析工具seo是广告投放吗
  • 建筑设计大专有用吗百度seo工具
  • 有经验的南昌网站制作app推广全国代理加盟
  • wordpress侧边栏 菜单西seo优化排名
  • 怎样创建网站详细步骤做seo有什么好处
  • 网站建设 公众号天津seo招聘
  • 广州市公需课在哪个网站可以做百度推广要多少钱
  • 网站模板建设查询网域名查询
  • 怎样将视频代码上传至网站什么是sem
  • wordpress apache配置文件南宁seo手段
  • 购物网站建设策划报告永久观看不收费的直播
  • zencart网站搬家网络营销做得好的产品
  • 诸城 网站 建设营业推广怎么写
  • 网站开发使用技术第二版答案友情链接源码
  • 网站建设中 源码百度收录关键词
  • 黄冈手机网站建设网推团队
  • 缅甸网站赌博代理怎么做百度做广告
  • 做考勤的网站挖掘爱站网
  • 没有网站可以做cpc吗宣传广告怎么做吸引人
  • 网站优化课程花钱推广的网络平台
  • 成都网站建设 四川冠辰科技bt种子万能搜索神器