用VGG16对102种鲜花分类
用VGG16对102种鲜花分类
dataset:
import os import torch import numpy as np from PIL import Image from torch.utils.data import Dataset from torch.utils.data import DataLoader class Datasets(Dataset): def __init__(self,path): self.path=path self.dataset=[] self.dataset.extend(open(os.path.join(path,"label.txt")).readlines()) # self.dataset.extend(open(os.path.join(path, "negative.txt")).readlines()) # self.dataset.extend(open(os.path.join(path,"part.txt")).readlines()) def __getitem__(self, index): strs=self.dataset[index].strip().split( ) # print(strs) image_path=os.path.join(self.path,strs[0]) label=torch.Tensor([int(strs[1])]) # offset=torch.Tensor([float(strs[2]),float(strs[3]),float(strs[4]),float(strs[5])]) image_data=Image.open(image_path) image_data = image_data.convert('RGB') #把图片制作成正方形,否则采样的时候会报错 w, h = image_data.size background = Image.new('RGB', size=(max(w, h), max(w, h)), color=(127, 127, 127)) # 创建背景图,颜色值为127 length = int(abs(w - h) // 2) # 一侧需要填充的长度 box = (length, 0) if w < h else (0, length) # 粘贴的位置 background.paste(image_data, box) image_data=background.resize((224,224)) image_data=torch.Tensor(np.array(image_data)
12345678910111213141516171819202122232425262728293031相关知识
Keras复现VGG16及实现花卉分类
深度学习简单网络VGG鲜花分类
利用VGG16做花数据集的识别
【深度学习图像识别课程】tensorflow迁移学习系列:VGG16花朵分类
卷积神经网络训练花卉识别分类器
转移学习:使用VGGNet对花朵图像进行分类
7 Resnet深度残差网络实现102种花卉分类
基于深度学习和迁移学习的识花实践
网友众筹植物图鉴 一书饱览102种“卧龙花”
基于卷积神经网络的樱桃叶片病虫害识别与防治系统,vgg16,resnet,swintransformer,模型融合(pytorch框架,python代码)
原文链接: 用VGG16对102种鲜花分类 https://www.huajiangbk.com/newsview343161.html
| 上一篇: 宝花纹在唐朝服饰中的发展历史:将... | 下一篇: 木本花卉有哪些品种 常见木本花卉... |
推荐分享

- 1明日花キララ:明日花绮罗年度... 22842
- 2明日花キララ(明日花绮罗)经... 13398
- 3家庭养花知识大全 家庭养花有... 8774
- 4兰花叶子扭的是什么兰 8660
- 5家庭养花风水知识 家庭养花“... 8491
- 6君子兰什么品种最名贵 十大名... 7885
- 7十大致癌花卉排行榜,哪些花卉... 7582
- 8五月天婷婷开心六月丁香:音乐... 7375
- 9秋天养花,掌握这5点养花知识... 7079
- 10李晓明工笔牡丹(魏紫)《牡丹... 6754




