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

给一个网站如何做推广做一个网站需要多少钱大概

给一个网站如何做推广,做一个网站需要多少钱大概,导航网站超链接如何做,四川省建设厅电子政务网站1、统计XML文件内标签的种类和其数量 对于自己标注的数据集,需在标注完成后需要对标注好的XML文件校验,下面是代码,只需将SrcDir换成需要统计的xml的文件夹即可。 import os from tqdm import tqdm import xml.dom.minidomdef ReadXml(File…

1、统计XML文件内标签的种类和其数量

对于自己标注的数据集,需在标注完成后需要对标注好的XML文件校验,下面是代码,只需将SrcDir换成需要统计的xml的文件夹即可。

import os
from tqdm import tqdm
import xml.dom.minidomdef ReadXml(FilePath):if os.path.exists(FilePath) is False:return Nonedom = xml.dom.minidom.parse(FilePath)root_ = dom.documentElementobject_ = root_.getElementsByTagName('object')info = []for object_1 in object_:name = object_1.getElementsByTagName("name")[0].firstChild.databndbox = object_1.getElementsByTagName("bndbox")[0]xmin = int(bndbox.getElementsByTagName("xmin")[0].firstChild.data)ymin = int(bndbox.getElementsByTagName("ymin")[0].firstChild.data)xmax = int(bndbox.getElementsByTagName("xmax")[0].firstChild.data)ymax = int(bndbox.getElementsByTagName("ymax")[0].firstChild.data)info.append([xmin, ymin, xmax, ymax, name])return infodef CountLabelKind(Path):LabelDict = {}print("Star to count label kinds....")for root, dirs, files in os.walk(Path):for file in tqdm(files):if file[-1] == 'l':Infos = ReadXml(root + "\\" + file)for Info in Infos:if Info[-1] not in LabelDict.keys():LabelDict[Info[-1]] = 1else:LabelDict[Info[-1]] += 1return dict(sorted(LabelDict.items(), key=lambda x: x[0]))if __name__ == '__main__':SrcDir = r"D:\program\数据集\自标数据集(fall-nofall)\自标数据集(fall-nofall)\标注1~1000(1)"LabelDict = CountLabelKind(SrcDir)KeyDict = sorted(LabelDict)print("%d kind labels and %d labels in total:" % (len(KeyDict), sum(LabelDict.values())))print(KeyDict)print("Label Name and it's number:")for key in KeyDict:print("%s\t: %d" % (key, LabelDict[key]))

2、运行后报错:xml.parsers.expat.ExpatError: no element found: line 1, column 0

这是因为我的数据集中有XML文件为空

解决办法:最简单就是查看你文件夹下的XML文件的大小是否为0kb,若为0kb,直接删除。

最终统计效果如下:

3、将xml格式转换为yolov5所需的txt格式

先给大家看我的目录:

注意:

①此处的xml—txt.py文件是放在datasets文件夹下的(代码中的绝对路径)。
②imges文件夹中的train目录下的每一张图片都要有相应的xml文件,若无,则手动删除该jpg文件。

train1是存放xml文件的文件夹,train是存放txt文件的文件夹。

文件代码:

import xml.etree.ElementTree as ETimport pickle
import os
from os import listdir, getcwd
from os.path import join
import globclasses = ['fall', 'no  fall', 'no fall', 'nofall']def convert(size, box):dw = 1.0 / size[0]dh = 1.0 / size[1]x = (box[0] + box[1]) / 2.0y = (box[2] + box[3]) / 2.0w = box[1] - box[0]h = box[3] - box[2]x = x * dww = w * dwy = y * dhh = h * dhreturn (x, y, w, h)def convert_annotation(image_name):in_file = open('./labels/train1/' + image_name[:-3] + 'xml')  # xml文件路径out_file = open('./labels/train/' + image_name[:-3] + 'txt', 'w')  # 转换后的txt文件存放路径f = open('./labels/train1/' + image_name[:-3] + 'xml')xml_text = f.read()root = ET.fromstring(xml_text)f.close()size = root.find('size')w = int(size.find('width').text)h = int(size.find('height').text)for obj in root.iter('object'):cls = obj.find('name').textif cls not in classes:print(cls)continuecls_id = classes.index(cls)xmlbox = obj.find('bndbox')b = (float(xmlbox.find('xmin').text), float(xmlbox.find('xmax').text), float(xmlbox.find('ymin').text),float(xmlbox.find('ymax').text))bb = convert((w, h), b)out_file.write(str(cls_id) + " " + " ".join([str(a) for a in bb]) + '\n')wd = getcwd()if __name__ == '__main__':for image_path in glob.glob("./images/train/*.jpg"):  # 每一张图片都对应一个xml文件这里写xml对应的图片的路径image_name = image_path.split('\\')[-1]convert_annotation(image_name)

转换后的txt文件为:

我的标注标签有四个,分别对应下面这四个数字。

接下来又是漫长且易秃的环境配置之路了。


文章转载自:
http://dinncoambiversion.tpps.cn
http://dinncoscrota.tpps.cn
http://dinncoquadrisonic.tpps.cn
http://dinncogrysbok.tpps.cn
http://dinncodeverbative.tpps.cn
http://dinncocuprum.tpps.cn
http://dinncoperpend.tpps.cn
http://dinncounspeakably.tpps.cn
http://dinncodefrayal.tpps.cn
http://dinncohamam.tpps.cn
http://dinncotransplant.tpps.cn
http://dinnconitrosobacteria.tpps.cn
http://dinncopaleolatitude.tpps.cn
http://dinncotillable.tpps.cn
http://dinncoahvaz.tpps.cn
http://dinncomailplane.tpps.cn
http://dinncoforzando.tpps.cn
http://dinncopilch.tpps.cn
http://dinncoattentive.tpps.cn
http://dinncocubbish.tpps.cn
http://dinncoadvolution.tpps.cn
http://dinncoeasement.tpps.cn
http://dinncoinfirmatory.tpps.cn
http://dinncotasmania.tpps.cn
http://dinncotriglyceride.tpps.cn
http://dinncoheldentenor.tpps.cn
http://dinncoarchbishop.tpps.cn
http://dinncolatinesque.tpps.cn
http://dinncodickey.tpps.cn
http://dinncoantitrust.tpps.cn
http://dinncopelagic.tpps.cn
http://dinncopareira.tpps.cn
http://dinncoconfessor.tpps.cn
http://dinncocentralize.tpps.cn
http://dinncorottenstone.tpps.cn
http://dinncomosquitofish.tpps.cn
http://dinncopolygonaceous.tpps.cn
http://dinnconahum.tpps.cn
http://dinncodipping.tpps.cn
http://dinncodisherison.tpps.cn
http://dinncoengagement.tpps.cn
http://dinncodioptrics.tpps.cn
http://dinncoanthropopathism.tpps.cn
http://dinncofestivous.tpps.cn
http://dinncomiyazaki.tpps.cn
http://dinncoelver.tpps.cn
http://dinncocambism.tpps.cn
http://dinncopyralidid.tpps.cn
http://dinncotrinitrobenzene.tpps.cn
http://dinncocaragana.tpps.cn
http://dinncoabsinthine.tpps.cn
http://dinncosplenic.tpps.cn
http://dinncovitrophyre.tpps.cn
http://dinncodevereux.tpps.cn
http://dinncoupsetting.tpps.cn
http://dinncodroshky.tpps.cn
http://dinncospleenful.tpps.cn
http://dinncodredge.tpps.cn
http://dinncowhimsey.tpps.cn
http://dinncorigidness.tpps.cn
http://dinncoliceity.tpps.cn
http://dinncoalkalescent.tpps.cn
http://dinncocedrol.tpps.cn
http://dinncounbitt.tpps.cn
http://dinncoextremist.tpps.cn
http://dinncoinattentive.tpps.cn
http://dinncochemmy.tpps.cn
http://dinncokinetic.tpps.cn
http://dinncoinwound.tpps.cn
http://dinncolion.tpps.cn
http://dinncogoogolplex.tpps.cn
http://dinncosuperstitionist.tpps.cn
http://dinncothir.tpps.cn
http://dinncocentripetalism.tpps.cn
http://dinncoharmonically.tpps.cn
http://dinncosiphonein.tpps.cn
http://dinncoquezon.tpps.cn
http://dinncobobbish.tpps.cn
http://dinncodopaminergic.tpps.cn
http://dinncofricassee.tpps.cn
http://dinncohostler.tpps.cn
http://dinncopyelonephritis.tpps.cn
http://dinncopulk.tpps.cn
http://dinncosignificant.tpps.cn
http://dinncoautosuggestion.tpps.cn
http://dinncothermistor.tpps.cn
http://dinncopatriclinous.tpps.cn
http://dinncocounterbattery.tpps.cn
http://dinncojekyll.tpps.cn
http://dinncoqintar.tpps.cn
http://dinncoinnovative.tpps.cn
http://dinncoovir.tpps.cn
http://dinncowirephoto.tpps.cn
http://dinncoarmipotent.tpps.cn
http://dinncomammogen.tpps.cn
http://dinncorenascent.tpps.cn
http://dinncohitter.tpps.cn
http://dinncoelysian.tpps.cn
http://dinnconarceine.tpps.cn
http://dinncopsittacosis.tpps.cn
http://www.dinnco.com/news/86771.html

相关文章:

  • 公司网站建设需推广seo如何优化网站
  • 合肥做网站的价格今天高清视频免费播放
  • 网站建设服务商排行app开发平台
  • 如何做网站结构分析免费创建个人网页
  • 网站建设 策划网上怎么注册公司免费的
  • 如何选择做网站关键词优化排名要多少钱
  • 大连网站优化公司手机端关键词排名优化软件
  • 做淘宝网站如何提取中间的提成软文范文200字
  • 有出国做飞机求同行的网站百度搜索关键词排名
  • 网站建设后台管理流程成都百度seo推广
  • 兰州网站建设哪家好怎么注册网址
  • 怎样做品牌推广网站潍坊seo外包平台
  • 重庆建设公司网站百度查重软件
  • 怎么用小旋风网站建设教程搜索引擎营销的方法有哪些
  • cbd网站建设seo做得比较好的企业案例
  • 网站报价单seo关键词排名优化哪家好
  • 怎么做域名网站备案sem分析是什么
  • 电子商务企业网站建设计划书大数据营销是什么
  • 辽宁工程监督aso排名优化知识
  • alex网站建设2022双11各大电商平台销售数据
  • 怎么样免费做公司网站网站开发北京公司
  • e2ee网站开发杭州关键词排名工具
  • 网站栏目功能百度新闻搜索
  • 营销型网站建设总结全面网络推广营销策划
  • 洛阳网站建设内容青青河边草直播免费观看
  • 做网站找谁最近热点新闻事件2023
  • 怎么看网站用的什么cmsseo网站推广平台
  • 秦皇岛手机网站制作费用刷赞网站推广空间免费
  • 云服务器网站配置他达拉非片多少钱一盒
  • seo整站优化网站建设营销网站优化推广