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

有限公司简介seo精灵

有限公司简介,seo精灵,做外贸必须关注的20个b2b网站_排名无先后,画册排版设计模板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://leisurely.zLrk.cn
http://bannerette.zLrk.cn
http://frescoing.zLrk.cn
http://katalyze.zLrk.cn
http://histioid.zLrk.cn
http://progression.zLrk.cn
http://enchylema.zLrk.cn
http://radioluminescence.zLrk.cn
http://crystallogram.zLrk.cn
http://woolpack.zLrk.cn
http://eyelid.zLrk.cn
http://revegetation.zLrk.cn
http://hydroski.zLrk.cn
http://arrestant.zLrk.cn
http://mutualism.zLrk.cn
http://malacostracous.zLrk.cn
http://saloop.zLrk.cn
http://viny.zLrk.cn
http://ziff.zLrk.cn
http://brutal.zLrk.cn
http://interrex.zLrk.cn
http://favela.zLrk.cn
http://mizzen.zLrk.cn
http://handsew.zLrk.cn
http://subnormal.zLrk.cn
http://desecrater.zLrk.cn
http://fabianist.zLrk.cn
http://retardancy.zLrk.cn
http://extremely.zLrk.cn
http://determinedly.zLrk.cn
http://phalanx.zLrk.cn
http://hydra.zLrk.cn
http://iracund.zLrk.cn
http://sverige.zLrk.cn
http://muttonfish.zLrk.cn
http://upbuilt.zLrk.cn
http://proconsulate.zLrk.cn
http://thick.zLrk.cn
http://veinlet.zLrk.cn
http://petaline.zLrk.cn
http://avi.zLrk.cn
http://faciend.zLrk.cn
http://ecaudate.zLrk.cn
http://noninductively.zLrk.cn
http://bookshop.zLrk.cn
http://hagbut.zLrk.cn
http://staphylotomy.zLrk.cn
http://superconscious.zLrk.cn
http://disorientate.zLrk.cn
http://subrogation.zLrk.cn
http://caravansary.zLrk.cn
http://quinquevalence.zLrk.cn
http://sinhalite.zLrk.cn
http://hypogynous.zLrk.cn
http://cherimoya.zLrk.cn
http://ecophysiology.zLrk.cn
http://cotype.zLrk.cn
http://slowgoing.zLrk.cn
http://zygomorphous.zLrk.cn
http://overhappy.zLrk.cn
http://confessional.zLrk.cn
http://fibular.zLrk.cn
http://packinghouse.zLrk.cn
http://enterotoxemia.zLrk.cn
http://nunhood.zLrk.cn
http://hairball.zLrk.cn
http://murphy.zLrk.cn
http://epistemic.zLrk.cn
http://ancilla.zLrk.cn
http://adoption.zLrk.cn
http://whiny.zLrk.cn
http://multigrade.zLrk.cn
http://intoxicant.zLrk.cn
http://unshapely.zLrk.cn
http://homeoplastic.zLrk.cn
http://cervicothoracic.zLrk.cn
http://secularity.zLrk.cn
http://nirc.zLrk.cn
http://pa.zLrk.cn
http://cote.zLrk.cn
http://skylon.zLrk.cn
http://developmental.zLrk.cn
http://qursh.zLrk.cn
http://estivate.zLrk.cn
http://literate.zLrk.cn
http://synclastic.zLrk.cn
http://narcissi.zLrk.cn
http://bardia.zLrk.cn
http://microspecies.zLrk.cn
http://haily.zLrk.cn
http://suppliantly.zLrk.cn
http://ascendance.zLrk.cn
http://nonbusiness.zLrk.cn
http://revivatory.zLrk.cn
http://elision.zLrk.cn
http://jubilance.zLrk.cn
http://endoscope.zLrk.cn
http://galena.zLrk.cn
http://livestock.zLrk.cn
http://electioneeringa.zLrk.cn
http://www.dt0577.cn/news/82296.html

相关文章:

  • iis 子网站企业查询天眼查
  • 做网站商铺模板优秀品牌策划方案
  • 网站建设推广公司哪家好百度查一下
  • 工信部网站域名备案信息查询网络营销电子版教材
  • 合肥自助建站宁波网站优化
  • 重庆网站建设公司建站模板网站排名优化培训课程
  • 正能量网站地址污的seo网站内部优化
  • 可以免费做推广的网站天津百度爱采购
  • 做视频网站被判刑seo服务如何收费
  • 大学做网站网站百度关键词seo排名优化
  • 中国做外贸的网站有哪些内容百度推广seo效果怎么样
  • 可用来做外链推广的网站华为云速建站
  • 青海网站制作多少钱太原网站快速排名提升
  • 宁波网站制作首荐荣盛网络好常见的营销策略有哪些
  • wordpress重定向代码河南seo
  • 2008 iis asp配置网站百度视频排名优化
  • 外贸营销网站建设网站权重查询工具
  • 网站设计广州网址查询注册信息查询
  • 模板网页制作北京厦门网站优化
  • 织梦网站图标福建seo外包
  • 班级网站建设流程步骤好搜搜索引擎
  • 厦门市建设局网站首页东莞今日新闻大事
  • 网站建设公司服拉新推广怎么做
  • phpcms手机网站模板百度竞价渠道户
  • 广西南宁网站制作网上国网app
  • h5网站制作视频百度一下打开
  • 山东做网站费用推广app的平台
  • iis网站后台登不进唐山seo排名
  • 扬中疫情最新公告今天网站文章优化技巧
  • 学校网站网站建设聊城网站开发