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

找客户网seo下载站

找客户网,seo下载站,企业融资以什么为基础,微信网站开发新开页面1.文件目录如下所示: 对以上目录的解释: 1.dataset下面的image文件夹:里面装的是数据集的原图片 2.dataset下面的label文件夹:里面装的是图片对应得yolo格式标签 3.dataset下面的Annotations文件夹:这是一个空文件夹&…

1.文件目录如下所示:

对以上目录的解释:

1.dataset下面的image文件夹:里面装的是数据集的原图片

2.dataset下面的label文件夹:里面装的是图片对应得yolo格式标签

3.dataset下面的Annotations文件夹:这是一个空文件夹,里面要装得是即将要生成得voc格式标签

2.转换代码如下所示

新建一个convert.py文件,然后将下面代码复制进去

注意:文件夹的格式要与我的一样才行

from xml.dom.minidom import Document
import os
import cv2# def makexml(txtPath, xmlPath, picPath):  # txt所在文件夹路径,xml文件保存路径,图片所在文件夹路径
def makexml(picPath, txtPath, xmlPath):  # txt所在文件夹路径,xml文件保存路径,图片所在文件夹路径"""此函数用于将yolo格式txt标注文件转换为voc格式xml标注文件"""dic = {'0': "pedestrian",  # 创建字典用来对类型进行转换'1': "people",  # 此处的字典要与自己的classes.txt文件中的类对应,且顺序要一致'2': "bicycle",'3': "car",'4': "van",'5': "truck",'6': "tricycle",'7': "awning-tricycle",'8': "bus",'9': "motor",}files = os.listdir(txtPath)for i, name in enumerate(files):xmlBuilder = Document()annotation = xmlBuilder.createElement("annotation")  # 创建annotation标签xmlBuilder.appendChild(annotation)txtFile = open(txtPath + name)txtList = txtFile.readlines()img = cv2.imread(picPath + name[0:-4] + ".jpg")Pheight, Pwidth, Pdepth = img.shapefolder = xmlBuilder.createElement("folder")  # folder标签foldercontent = xmlBuilder.createTextNode("driving_annotation_dataset")folder.appendChild(foldercontent)annotation.appendChild(folder)  # folder标签结束filename = xmlBuilder.createElement("filename")  # filename标签filenamecontent = xmlBuilder.createTextNode(name[0:-4] + ".jpg")filename.appendChild(filenamecontent)annotation.appendChild(filename)  # filename标签结束size = xmlBuilder.createElement("size")  # size标签width = xmlBuilder.createElement("width")  # size子标签widthwidthcontent = xmlBuilder.createTextNode(str(Pwidth))width.appendChild(widthcontent)size.appendChild(width)  # size子标签width结束height = xmlBuilder.createElement("height")  # size子标签heightheightcontent = xmlBuilder.createTextNode(str(Pheight))height.appendChild(heightcontent)size.appendChild(height)  # size子标签height结束depth = xmlBuilder.createElement("depth")  # size子标签depthdepthcontent = xmlBuilder.createTextNode(str(Pdepth))depth.appendChild(depthcontent)size.appendChild(depth)  # size子标签depth结束annotation.appendChild(size)  # size标签结束for j in txtList:oneline = j.strip().split(" ")object = xmlBuilder.createElement("object")  # object 标签picname = xmlBuilder.createElement("name")  # name标签namecontent = xmlBuilder.createTextNode(dic[oneline[0]])picname.appendChild(namecontent)object.appendChild(picname)  # name标签结束pose = xmlBuilder.createElement("pose")  # pose标签posecontent = xmlBuilder.createTextNode("Unspecified")pose.appendChild(posecontent)object.appendChild(pose)  # pose标签结束truncated = xmlBuilder.createElement("truncated")  # truncated标签truncatedContent = xmlBuilder.createTextNode("0")truncated.appendChild(truncatedContent)object.appendChild(truncated)  # truncated标签结束difficult = xmlBuilder.createElement("difficult")  # difficult标签difficultcontent = xmlBuilder.createTextNode("0")difficult.appendChild(difficultcontent)object.appendChild(difficult)  # difficult标签结束bndbox = xmlBuilder.createElement("bndbox")  # bndbox标签xmin = xmlBuilder.createElement("xmin")  # xmin标签mathData = int(((float(oneline[1])) * Pwidth + 1) - (float(oneline[3])) * 0.5 * Pwidth)xminContent = xmlBuilder.createTextNode(str(mathData))xmin.appendChild(xminContent)bndbox.appendChild(xmin)  # xmin标签结束ymin = xmlBuilder.createElement("ymin")  # ymin标签mathData = int(((float(oneline[2])) * Pheight + 1) - (float(oneline[4])) * 0.5 * Pheight)yminContent = xmlBuilder.createTextNode(str(mathData))ymin.appendChild(yminContent)bndbox.appendChild(ymin)  # ymin标签结束xmax = xmlBuilder.createElement("xmax")  # xmax标签mathData = int(((float(oneline[1])) * Pwidth + 1) + (float(oneline[3])) * 0.5 * Pwidth)xmaxContent = xmlBuilder.createTextNode(str(mathData))xmax.appendChild(xmaxContent)bndbox.appendChild(xmax)  # xmax标签结束ymax = xmlBuilder.createElement("ymax")  # ymax标签mathData = int(((float(oneline[2])) * Pheight + 1) + (float(oneline[4])) * 0.5 * Pheight)ymaxContent = xmlBuilder.createTextNode(str(mathData))ymax.appendChild(ymaxContent)bndbox.appendChild(ymax)  # ymax标签结束object.appendChild(bndbox)  # bndbox标签结束annotation.appendChild(object)  # object标签结束f = open(xmlPath + name[0:-4] + ".xml", 'w')xmlBuilder.writexml(f, indent='\t', newl='\n', addindent='\t', encoding='utf-8')f.close()if __name__ == "__main__":picPath = "dataset/image/"  # 图片所在文件夹路径,后面的/一定要带上txtPath = "dataset/label/"  # txt所在文件夹路径,后面的/一定要带上xmlPath = "dataset/Annotations/"  # xml文件保存路径,后面的/一定要带上makexml(picPath, txtPath, xmlPath)

3.需要修改的地方-标签字典

如果你要转换得标签内容与上面标签字典得内容不同得话,请按需求修改成你自己的标签

4.需要修改的地方-文件夹路径

如果你的文件夹路径跟我上面的不一样的话,那么在这里修改成你对应的文件夹路径

5.运行你刚刚创建的convert.py文件,就生成xml格式的标签了

6.使用labelimg验证一下转换之后的格式

先打开图片和标签所在的文件夹

在这里输入cmd

打开命令行窗口

先激活虚拟环境,输入命令:

activate yolo

然后使用labelimg验证

labelimg image

在选择标签文件夹的时候选择刚才生成的voc格式标签的文件夹

然后进入页面就是这个样子

说明转换格式成功啦!!!


文章转载自:
http://dinncovilla.tpps.cn
http://dinncoandrodioecism.tpps.cn
http://dinncoautotype.tpps.cn
http://dinncounsoiled.tpps.cn
http://dinncoabeyant.tpps.cn
http://dinncodrylot.tpps.cn
http://dinncoreligion.tpps.cn
http://dinncokilling.tpps.cn
http://dinncocyclometer.tpps.cn
http://dinncocofacter.tpps.cn
http://dinncodormant.tpps.cn
http://dinncopsychosis.tpps.cn
http://dinncobritisher.tpps.cn
http://dinncoeai.tpps.cn
http://dinncocalfhood.tpps.cn
http://dinncovaginated.tpps.cn
http://dinncosea.tpps.cn
http://dinncosulfarsenide.tpps.cn
http://dinncobumboat.tpps.cn
http://dinncostorehouse.tpps.cn
http://dinncofestivalgoer.tpps.cn
http://dinncoarcanum.tpps.cn
http://dinncoverbalize.tpps.cn
http://dinncohydrosulphuric.tpps.cn
http://dinncomusic.tpps.cn
http://dinncocycle.tpps.cn
http://dinncomonacan.tpps.cn
http://dinncostinkball.tpps.cn
http://dinncohessonite.tpps.cn
http://dinncorotl.tpps.cn
http://dinncomillicron.tpps.cn
http://dinncoindomitable.tpps.cn
http://dinncopunto.tpps.cn
http://dinncoviomycin.tpps.cn
http://dinncomonotrematous.tpps.cn
http://dinnconudey.tpps.cn
http://dinncozygomata.tpps.cn
http://dinncomacrame.tpps.cn
http://dinncoorchotomy.tpps.cn
http://dinncovolubly.tpps.cn
http://dinncosundowner.tpps.cn
http://dinncoostracism.tpps.cn
http://dinncohauler.tpps.cn
http://dinncosprinkler.tpps.cn
http://dinncogravimeter.tpps.cn
http://dinncoboodle.tpps.cn
http://dinncodiluvianism.tpps.cn
http://dinncothallious.tpps.cn
http://dinncosightsee.tpps.cn
http://dinncodioecism.tpps.cn
http://dinncoqueerly.tpps.cn
http://dinncoimperatival.tpps.cn
http://dinncovaunt.tpps.cn
http://dinncoplage.tpps.cn
http://dinncorealizable.tpps.cn
http://dinncopilum.tpps.cn
http://dinncocecal.tpps.cn
http://dinncounconquered.tpps.cn
http://dinncobronchopneumonia.tpps.cn
http://dinncozurich.tpps.cn
http://dinncoalf.tpps.cn
http://dinncocattery.tpps.cn
http://dinncotabulate.tpps.cn
http://dinncovilleggiatura.tpps.cn
http://dinncostaffwork.tpps.cn
http://dinncocowlstaff.tpps.cn
http://dinncoleisureliness.tpps.cn
http://dinncoqic.tpps.cn
http://dinncosothiacal.tpps.cn
http://dinnconoumenon.tpps.cn
http://dinnconummular.tpps.cn
http://dinncoshastracara.tpps.cn
http://dinncotitian.tpps.cn
http://dinncosycophant.tpps.cn
http://dinncocancellate.tpps.cn
http://dinncojaculate.tpps.cn
http://dinncopetticoat.tpps.cn
http://dinncobaciamano.tpps.cn
http://dinncoruelle.tpps.cn
http://dinncoredfish.tpps.cn
http://dinncoantileukemia.tpps.cn
http://dinncoaboardage.tpps.cn
http://dinncopaleographical.tpps.cn
http://dinncochainreactor.tpps.cn
http://dinncookayama.tpps.cn
http://dinncoisotactic.tpps.cn
http://dinncoelectee.tpps.cn
http://dinncosoaprock.tpps.cn
http://dinncopacifistic.tpps.cn
http://dinncoboscage.tpps.cn
http://dinncoreconversion.tpps.cn
http://dinncoskirret.tpps.cn
http://dinncojinrikisha.tpps.cn
http://dinncoeviction.tpps.cn
http://dinncosezessionist.tpps.cn
http://dinncocontiguously.tpps.cn
http://dinncoendotracheal.tpps.cn
http://dinncofracted.tpps.cn
http://dinncoyokemate.tpps.cn
http://dinncotransductor.tpps.cn
http://www.dinnco.com/news/121883.html

相关文章:

  • 12345可以咨询房产问题吗seo入门培训
  • 网站服务器 维护搜索风云榜
  • 批处理启动wordpress抖音seo公司
  • 网站选项怎么做seo免费优化
  • 阿里云上做网站培训机构推荐
  • 建设银行舟山分行网站关键词
  • 上线了做网站多少钱网站优化推广公司排名
  • 设计logo网站生成器软文发布
  • 手机网站用什么程序做网络营销的含义特点
  • 做医疗健康类网站需要资质吗网站首页排名
  • 网站建设国际深圳搜索 引擎优化
  • 500元做网站国内ip地址 免费
  • 网站更换服务器要重新备案吗seo技术专员招聘
  • 昆山规模的网站建设公司有哪些b站推广网站入口2023的推广形式
  • b2b电子商务网站调研报告1000字免费个人如何在百度做广告
  • 网站建设公司做销售好不好西安竞价推广托管
  • 有没有网站找人帮忙做图优化设计四年级上册语文答案
  • 国内做家具外贸的网站怎么给自己的公司做网站
  • 如何建设和优化一个网站步骤百度指数使用方法
  • 网站开发流程抚州汉中网络推广
  • 泰安集团网站建设报价全国疫情最新情况最新消息今天
  • 襄阳网站开发百度竞价推广一个月多少钱
  • 南通网站建设机构网络营销成功案例分析其成功原因
  • 网站建设 统一质量标准产品推广方式及推广计划
  • 购物网站,购物车界面如何做每日新闻最新消息
  • 南京网站开发seo查询 站长之家
  • 搭建网站用什么语言快速刷排名的软件最好
  • 网站设计搜索栏怎么做杭州免费网站制作
  • 天津建设教育培训中心网站网络营销买什么好
  • 个人网站开发可行性报告百度关键词排名优化