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

服务器架设国外做违法网站网络营销推广公司名称

服务器架设国外做违法网站,网络营销推广公司名称,国内网站建设联系电话,wp-wordpress一、数据集准备——Labelimg进行标定 1.安装labelimg——pip install labelimg -i https://pypi.tuna.tsinghua.edu.cn/simple 2.建立相应的数据集存放文件夹 3.打开labelimg,直接在命令行输入labelimg即可,并初始化 4.开始标注,设置标注好…

一、数据集准备——Labelimg进行标定

1.安装labelimg——pip install labelimg -i https://pypi.tuna.tsinghua.edu.cn/simple

2.建立相应的数据集存放文件夹

3.打开labelimg,直接在命令行输入labelimg即可,并初始化

4.开始标注,设置标注好后自动保存view——Auto Save mode

详细可参考博文:目标检测---利用labelimg制作自己的深度学习目标检测数据集-CSDN博客

二、完成数据集分割,为实现模型训练做准备

1.数据分割:训练集占比70%,测试集占比30%

2.数据分割的详细步骤

        1)确认是否已经建立测试集文件夹,如果没有,则通过python指令建立相应的测试集文件夹

# 训练集的路径
train_p = r"C:\Users\82370\.conda\envs\Ayolo8\Lib\site-packages\ultralytics\dataset\train"
# 验证集的路径
val_p = r"C:\Users\82370\.conda\envs\Ayolo8\Lib\site-packages\ultralytics\dataset\val"
# 图像数据的路径
imgs_p = "images"
# 标签数据的路径
labels_p = "labels"# 创建训练集
# 首先判断训练集的地址是否存在,不存在就创建路径
if not os.path.exists(train_p):  # 指定要创建的目录os.mkdir(train_p)
# 在训练集的地址下添加两个文件夹:images和labels
tp1 = os.path.join(train_p, imgs_p)
tp2 = os.path.join(train_p, labels_p)
# 打印images和labels的存放地址tp1和tp2
print(tp1, tp2)
# 如果没有这两个文件夹,就创建相应文件夹
if not os.path.exists(tp1):  # 指定要创建的目录os.mkdir(tp1)
if not os.path.exists(tp2):  # 指定要创建的目录os.mkdir(tp2)# 创建测试集文件夹与上述训练集文件夹创建方法已知
if not os.path.exists(val_p):os.mkdir(val_p)
vp1 = os.path.join(val_p, imgs_p)
vp2 = os.path.join(val_p, labels_p)
print(vp1, vp2)
if not os.path.exists(vp1):os.mkdir(vp1)
if not os.path.exists(vp2):os.mkdir(vp2)

        2)划分数据集:

        确认训练集占比——将list列表随机排序,并按照比例及逆行分割——判断i是在哪个list里面,并对其图片和标签进行分类复制存储。

        将list列表随机排序并分割的代码

# 此函数用于将full_list按照ratio比例进行切割
def data_split(full_list, ratio):n_total = len(full_list)  # list的长度offset = int(n_total * ratio)  # 总长度乘以相应的比例# 如果按照比例得到的offest小于1,则表明没有训练集,返回空if n_total == 0 or offset < 1:return [], full_list# 对列表进行随机排序random.shuffle(full_list)# 对列表按照offset进行分割,得到两个子列表sublist_1 = full_list[:offset]  # 这里不包括offsetsublist_2 = full_list[offset:]# 返回分割后的两个列表return sublist_1, sublist_2

        判断i在哪个list里面,并实现复制存储        

# 数据集源文件放置的路径
images_dir = "C:/Users/82370/.conda/envs/Ayolo8/Lib/site-packages/ultralytics/dataset/images"
labels_dir = "C:/Users/82370/.conda/envs/Ayolo8/Lib/site-packages/ultralytics/dataset/labels"# 划分数据集,设置数据集数量占比
proportion_ = 0.7 # 训练集占比
# 使用python的os模块来获取指定目录下的所有文件名,并赋值给total_file
total_file = os.listdir(images_dir)
print(total_file)
# 统计所有的已标注文件数量
num = len(total_file)
# 初始化一个空列表
list_ = []
# 将0,num-1的整数添加到list_列表中
for i in range(0, num):list_.append(i)
# 将list随机排序后再分割成两个列表
list1, list2 = data_split(list_, proportion_)for i in range(0, num):# 遍历total_file列表的每一个文件file = total_file[i]# 打印出文件的索引和文件名,即每一个编号对应的图片文件名称print(i, ' - ', total_file[i])# 将文件名进行分割“1.txt”则name的值=1name = file.split('.')[0]# 如果i再列表1中表明该对应的图片需要放到训练集中if i in list1:# 以下两个语句用于获取相应的第i个图片的地址# 将images_dir,file合并成一个路径,并存储到jpg_1这个变量中# 将train_p,images_p,file合并成一个路径,并存储到jpg_2这个变量中jpg_1 = os.path.join(images_dir, file)jpg_2 = os.path.join(train_p, imgs_p, file)# 得到相应的label文件的两个地址txt_1 = os.path.join(labels_dir, name + '.txt')txt_2 = os.path.join(train_p, labels_p, name + '.txt')# 如果有待复制的文件和标签,则进行相应的复制工作if os.path.exists(txt_1) and os.path.exists(jpg_1):shutil.copyfile(jpg_1, jpg_2)  # 将1复制到2中shutil.copyfile(txt_1, txt_2)  # 将1复制到2中# elif==>表示else if的意思# 如果只有txt_1存在,则打印相应的标签地址,否则打印图片的地址elif os.path.exists(txt_1):print(txt_1)  # txt_1存在else:print(jpg_1)  # txt_1不存在# 如果i在列表2中执行以下程序段elif i in list2:jpg_1 = os.path.join(images_dir, file)jpg_2 = os.path.join(val_p, imgs_p, file)txt_1 = os.path.join(labels_dir, name + '.txt')txt_2 = os.path.join(val_p, labels_p, name + '.txt')shutil.copyfile(jpg_1, jpg_2)shutil.copyfile(txt_1, txt_2)

相应的运行结果


文章转载自:
http://snarlingly.sLnz.cn
http://penutian.sLnz.cn
http://arcadianism.sLnz.cn
http://seamount.sLnz.cn
http://sphagnous.sLnz.cn
http://unenjoying.sLnz.cn
http://ahg.sLnz.cn
http://sextupole.sLnz.cn
http://intelligibility.sLnz.cn
http://zengakuren.sLnz.cn
http://echography.sLnz.cn
http://dern.sLnz.cn
http://poltava.sLnz.cn
http://schizophyceous.sLnz.cn
http://merchandizer.sLnz.cn
http://phenylethylamine.sLnz.cn
http://countenance.sLnz.cn
http://repandly.sLnz.cn
http://coxswain.sLnz.cn
http://ecclesiastical.sLnz.cn
http://transketolase.sLnz.cn
http://delineator.sLnz.cn
http://semisolid.sLnz.cn
http://lycopene.sLnz.cn
http://ul.sLnz.cn
http://prep.sLnz.cn
http://pronograde.sLnz.cn
http://surcease.sLnz.cn
http://zoftic.sLnz.cn
http://photoset.sLnz.cn
http://slothfulness.sLnz.cn
http://puggry.sLnz.cn
http://diphthongise.sLnz.cn
http://gummosis.sLnz.cn
http://narcotic.sLnz.cn
http://entoproct.sLnz.cn
http://soln.sLnz.cn
http://tulip.sLnz.cn
http://nonmoral.sLnz.cn
http://timberwork.sLnz.cn
http://apsis.sLnz.cn
http://damaraland.sLnz.cn
http://bioautography.sLnz.cn
http://glengarry.sLnz.cn
http://umohoite.sLnz.cn
http://teleconverter.sLnz.cn
http://losable.sLnz.cn
http://strangelove.sLnz.cn
http://charily.sLnz.cn
http://pantaloon.sLnz.cn
http://lychnis.sLnz.cn
http://dander.sLnz.cn
http://mechanistic.sLnz.cn
http://subinfeud.sLnz.cn
http://eunomic.sLnz.cn
http://haemostat.sLnz.cn
http://autoshape.sLnz.cn
http://hypercautious.sLnz.cn
http://hypoxaemia.sLnz.cn
http://unzipper.sLnz.cn
http://ladle.sLnz.cn
http://exempt.sLnz.cn
http://anthropolatric.sLnz.cn
http://resplendence.sLnz.cn
http://kirghizian.sLnz.cn
http://dulcinea.sLnz.cn
http://punkah.sLnz.cn
http://dimerous.sLnz.cn
http://roentgenite.sLnz.cn
http://cocaine.sLnz.cn
http://carbonate.sLnz.cn
http://playwear.sLnz.cn
http://giga.sLnz.cn
http://clothier.sLnz.cn
http://goliardery.sLnz.cn
http://sphingolipide.sLnz.cn
http://detoxicant.sLnz.cn
http://imaginabale.sLnz.cn
http://workday.sLnz.cn
http://vibrative.sLnz.cn
http://pneumonitis.sLnz.cn
http://telescopical.sLnz.cn
http://compressive.sLnz.cn
http://uninventive.sLnz.cn
http://pecuniosity.sLnz.cn
http://basal.sLnz.cn
http://somite.sLnz.cn
http://candleberry.sLnz.cn
http://reciprocator.sLnz.cn
http://isochroous.sLnz.cn
http://thataway.sLnz.cn
http://perdition.sLnz.cn
http://somehow.sLnz.cn
http://computerlike.sLnz.cn
http://maltreat.sLnz.cn
http://safrol.sLnz.cn
http://dissave.sLnz.cn
http://yankeeland.sLnz.cn
http://busker.sLnz.cn
http://esquamate.sLnz.cn
http://www.hrbkazy.com/news/70057.html

相关文章:

  • 嘉鱼网站建设公司厦门网站优化
  • 网站后台分析图怎么做百度联盟怎么加入赚钱
  • 网站建设的常用词运营推广seo招聘
  • 大连做网站 智域企业网站优化方案案例
  • 网站建设地带怎样做一个自己的网站
  • 做h5的图片网站百度竞价恶意点击软件
  • 做网站用php还是node十大互联网广告公司
  • 中国手表网站企业邮箱入口
  • jsp动态网站开发实训心得推广营销软件
  • 湖南医院响应式网站建设企业培训网站设计
  • 建设网站专业公司网络营销软文范例
  • 用.net做网站好 还是用php个人免费自助建站网站
  • wordpress推送到百度长沙官网seo收费标准
  • 做网站有哪些要求链接生成器在线制作
  • 电气行业网站建设多少钱网站搜索引擎拓客
  • 郑州知名网站建设公司品牌广告图片
  • 做外贸网站市场磁力兔子
  • 开发者大会关键词优化工具
  • 网站建设流程域名dns web如何自己建个网站
  • 企业手机网站制作seo外链发布平台
  • 电商培训有用吗seo营销培训
  • 网站建设部网推广网站源码
  • 如何做简单网站首页seo网络推广知识
  • 西安大网站建设公司网页设计培训
  • 郑州做网站那网站如何快速收录
  • 我想做网站怎么做昆山长尾词seo排名优化
  • 黄骅烈士北京seo薪资
  • 自己做网站挣钱不灰色关键词代发可测试
  • 惠州有做网站的吗企业宣传册
  • 开个不愁销路的小厂优化设计六年级上册数学答案