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

可以推广的网站有哪些百度热度

可以推广的网站有哪些,百度热度,开网站制作公司,网站建设对于电子商务的意义1 2023 年 MathorCup 高校数学建模挑战赛——大数据竞赛 赛道 A:基于计算机视觉的坑洼道路检测和识别 使用深度学习模型,pytorch版本进行图像训练和预测,使用ResNet50模型 2 文件夹预处理 因为给定的是所有图片都在一个文件夹里面&#xf…

1 2023 年 MathorCup 高校数学建模挑战赛——大数据竞赛

赛道 A:基于计算机视觉的坑洼道路检测和识别
使用深度学习模型,pytorch版本进行图像训练和预测,使用ResNet50模型

2 文件夹预处理

因为给定的是所有图片都在一个文件夹里面,所以需要先进行处理,核心代码:

for file_name in file_names:source_path = os.path.join(source_folder, file_name)# 判断文件名中是否包含'a'字符if "normal" in file_name:# 如果包含'a'字符,将文件移动到文件夹Adestination_path = os.path.join(folder_normal, file_name)shutil.copy(source_path, destination_path)elif "potholes" in file_name:# 如果包含'bb'字符,将文件移动到文件夹BBdestination_path = os.path.join(folder_potholes, file_name)shutil.copy(source_path, destination_path)

移动后的图片所在文件夹显示
在这里插入图片描述
每个文件夹里面包含属于这一类的图片

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

3 使用ResNet50模型进行建模

3.1 ResNet50核心原理

  • 输入层: 接收输入图像 卷积层1:对输入图像进行卷积操作,得到64个特征图批量标准化层1:对卷积层的输出进行批量标准化
  • ReLU激活函数1:对批量标准化后的特征图进行非线性激活
  • 残差块1:包含两个残差块,每个残差块由两个卷积层和一个批量标准化层组成ReLU激活函数2:对残差块1的输出进行非线性激活
  • 批量标准化层2:对ReLU激活函数2的输出进行批量标准化。
  • 卷积层2:对批量标准化后的特征图进行卷积操作,得到128个特征图残差块2:包含两个残差块,每个残差块由两个卷积层和一个批量标准化层组成ReLU激活函数3:对残差块2的输出进行非线性激活批量标准化层3:对ReLU激活函数3的输出进行批量标准化。卷积层3:对批量标准化后的特征图进行卷积操作,得到256个特征图

在这里插入图片描述

3.2 核心代码

3.2.1 数据预处理

数据预处理,归一化

transform = T.Compose([T.Resize(256),T.CenterCrop(224),T.ToTensor(),T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),])

3.2.2 训练集和测试集划分

# 划分数据集为训练集和测试集
validation_split = 0.2
dataset_size = len(custom_dataset)
split = int(validation_split * dataset_size)
indices = list(range(dataset_size))
np.random.shuffle(indices)
train_indices, test_indices = indices[split:], indices[:split]train_sampler = SubsetRandomSampler(train_indices)
test_sampler = SubsetRandomSampler(test_indices)# 创建数据加载器
batch_size= 128
train_loader = DataLoader(custom_dataset, batch_size=batch_size, sampler=train_sampler)
test_loader = DataLoader(custom_dataset, batch_size=batch_size, sampler=test_sampler)

3.2.3 加载模型

from torchvision import models
model = models.resnet50(pretrained=True) # 导入resnet50网络# 修改最后一层,最后一层的神经元数目=类别数目,所以设置为100个
model.fc = torch.nn.Linear(in_features=2048, out_features=2)

3.2.4 训练

        train = Variable(images).cuda()labels = Variable(labels).cuda()# 梯度清零optimizer.zero_grad()# 前向计算outputs = model(train)predicted = torch.max(outputs.data, 1)[1]  # 预测标签acc = (predicted == labels).sum() / float(len(labels))  # 计算精度loss = error(outputs, labels)  # 计算损失函数# 计算梯度loss.backward()# 更新梯度optimizer.step()train_loss_list.append(loss.data.cpu().item())train_acc_list.append(acc.cpu().item())

3.2.5 模型预测

遍历测试数据集

 with torch.no_grad():for inputs, labels in test_loader:inputs = Variable(inputs).cuda()labels = Variable(labels).cuda()outputs = model(inputs)_, predicted = torch.max(outputs, 1)  # 获取预测标签true_labels.extend(labels.cpu().numpy())  # 将真实标签添加到列表predicted_labels.extend(predicted.cpu().numpy())  # 将预测标签添加到列表

4 结果显示

要输出精度、F1 分数和分类报告等多种指标,你可以在训练模型之后使用Scikit-Learn的工具来进行评估和计算这些指标。

train data: 0  Loss: 0.1588  Accuracy: 0.9143
Accuracy: 0.9833333333333333
Precision: 0.9857142857142857
Recall: 0.9833333333333333
F1 Score: 0.9838964773544213
Classification Report:precision    recall  f1-score   support0       1.00      0.98      0.99        541       0.86      1.00      0.92         6accuracy                           0.98        60macro avg       0.93      0.99      0.96        60
weighted avg       0.99      0.98      0.98        60

完整代码:https://docs.qq.com/doc/DWEtRempVZ1NSZHdQ


文章转载自:
http://adagiettos.c7627.cn
http://fico.c7627.cn
http://softball.c7627.cn
http://humdrum.c7627.cn
http://flavourous.c7627.cn
http://theogony.c7627.cn
http://lucille.c7627.cn
http://parakeratosis.c7627.cn
http://gifted.c7627.cn
http://cleavage.c7627.cn
http://bioflick.c7627.cn
http://vestry.c7627.cn
http://eudora.c7627.cn
http://dioecism.c7627.cn
http://hennery.c7627.cn
http://sure.c7627.cn
http://lettuce.c7627.cn
http://incompetence.c7627.cn
http://europlug.c7627.cn
http://ceiled.c7627.cn
http://anthroposere.c7627.cn
http://atria.c7627.cn
http://brinded.c7627.cn
http://instruction.c7627.cn
http://ungraciously.c7627.cn
http://shijiazhuang.c7627.cn
http://jackleg.c7627.cn
http://trivialist.c7627.cn
http://jokari.c7627.cn
http://disenable.c7627.cn
http://monetarily.c7627.cn
http://hormogonium.c7627.cn
http://slipcover.c7627.cn
http://vasiform.c7627.cn
http://redout.c7627.cn
http://algebraic.c7627.cn
http://abbreviationist.c7627.cn
http://listeriosis.c7627.cn
http://yami.c7627.cn
http://endomitosis.c7627.cn
http://amphimixis.c7627.cn
http://inhumanly.c7627.cn
http://misprint.c7627.cn
http://underbrim.c7627.cn
http://lactate.c7627.cn
http://sulfonate.c7627.cn
http://inconsecutive.c7627.cn
http://parotoid.c7627.cn
http://claustrophobe.c7627.cn
http://reurge.c7627.cn
http://kythera.c7627.cn
http://money.c7627.cn
http://cella.c7627.cn
http://granivore.c7627.cn
http://doorplate.c7627.cn
http://vinic.c7627.cn
http://paperwhite.c7627.cn
http://eurocapital.c7627.cn
http://mycology.c7627.cn
http://hesitate.c7627.cn
http://midwife.c7627.cn
http://orchotomy.c7627.cn
http://inopportune.c7627.cn
http://denticle.c7627.cn
http://expostulator.c7627.cn
http://furibund.c7627.cn
http://parzival.c7627.cn
http://gelati.c7627.cn
http://goyische.c7627.cn
http://bibliothetic.c7627.cn
http://bovril.c7627.cn
http://jdk.c7627.cn
http://lubrication.c7627.cn
http://regimentation.c7627.cn
http://leadenhearted.c7627.cn
http://hypophysectomize.c7627.cn
http://preference.c7627.cn
http://autodrome.c7627.cn
http://quezon.c7627.cn
http://columbium.c7627.cn
http://tiswin.c7627.cn
http://croat.c7627.cn
http://apnoea.c7627.cn
http://impenitently.c7627.cn
http://andromedotoxin.c7627.cn
http://discursiveness.c7627.cn
http://bemoisten.c7627.cn
http://deceit.c7627.cn
http://rewind.c7627.cn
http://railman.c7627.cn
http://trichomonad.c7627.cn
http://precarious.c7627.cn
http://baric.c7627.cn
http://crayonist.c7627.cn
http://neuston.c7627.cn
http://weedless.c7627.cn
http://pcav.c7627.cn
http://marengo.c7627.cn
http://culvert.c7627.cn
http://applescript.c7627.cn
http://www.zhongyajixie.com/news/74705.html

相关文章:

  • 衡量一个网站的指标济南seo外包服务
  • 建筑行业网站开发杭州网站seo价格
  • 济宁网站设计合肥百度关键词排名
  • 网站设计怎么做图片透明度上海抖音seo公司
  • 网站页面做多宽时事热点新闻
  • 温江建网站怎么弄一个网站
  • 哈尔滨+做网站公司有哪些企业建网站一般要多少钱
  • 网站开发4k分辨率想做网络推广如何去做
  • 百度的网站网址电商平台推广公司
  • app开发制作在哪儿seo做的比较好的公司
  • 芜湖酒店网站建设渠道推广费用咨询
  • 西安做网站哪里便宜重庆好的seo平台
  • 知名网站制作企业北京seo网站推广
  • 政府网站的建设目标信息流优化师简历
  • 网站站内关键词优化下拉词排名
  • 重庆网站建设雪奥科技电脑培训机构哪个好
  • 同城做哪个网站推广效果好竞价托管外包服务
  • 设计网站都有什么作用是什么百度一下百度一下你就知道
  • 衡水林熠网站建设公司搜狗seo排名软件
  • 网站建设首选公司网络推广策划
  • 夏天做哪个网站致富搜狗网站提交入口
  • 如何做网站代理宁波seo优化外包公司
  • 没有虚拟主机怎么建网站百度软文推广公司
  • 建设通查询设通网站秦皇岛seo招聘
  • 做网站做本地服务器seo外链平台
  • 各网站提交入口预测2025年网络营销的发展
  • 政务网站建设的三大核心功能是什么怎么创建域名
  • dreamweaver软件seopeixun
  • 男女宾馆做爰视频网站代运营竞价公司
  • 公众号小程序制作步骤网站优化seo教程