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

简要说明网站制作的基本步骤广州线上教学

简要说明网站制作的基本步骤,广州线上教学,拉新平台,自己怎么做微信小程序免费本文不生产技术,只做技术的搬运工!!! 前言 在yolo训练时,我们需要对图像进行标注,而使用labelimg标注时如果直接选择输出yolo格式的数据集,则原始数据的很多信息无法被保存,因此一版…

本文不生产技术,只做技术的搬运工!!!

前言

        在yolo训练时,我们需要对图像进行标注,而使用labelimg标注时如果直接选择输出yolo格式的数据集,则原始数据的很多信息无法被保存,因此一版使用xml格式的标签,这时再去训练时就需要对标签进行转换。

代码

import os
import xml.etree.ElementTree as ET
import cv2def getFileList(dir, Filelist, ext=None):"""获取文件夹及其子文件夹中文件列表输入 dir:文件夹根目录输入 ext: 扩展名返回: 文件路径列表"""newDir = dirif os.path.isfile(dir):if ext is None:Filelist.append(dir)else:if ext in dir:Filelist.append(dir)elif os.path.isdir(dir):for s in os.listdir(dir):newDir = os.path.join(dir, s)getFileList(newDir, Filelist, ext)return Filelistdef convert(size, box):dw = 1. / size[0]dh = 1. / 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(xml_file,xml_name, image_file,dst, class_names):tree = ET.parse(xml_file)root = tree.getroot()# 读取图像以获取准确的尺寸image = cv2.imread(image_file)if image is None:raise FileNotFoundError(f"Image file not found: {image_file}")image_size = [image.shape[1], image.shape[0]]  # [width, height]output_path = os.path.join(dst, xml_name.replace(".xml", '.txt'))with open(output_path, 'w') as out_file:for obj in root.iter('object'):difficult = obj.find('difficult').textclass_name = obj.find('name').textif class_name not in class_names or int(difficult) == 1:continueclass_id = class_names.index(class_name)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(image_size, b)out_file.write(f"{class_id} {bb[0]} {bb[1]} {bb[2]} {bb[3]}\n")if __name__ == '__main__':xml_dir = "/data2/dataset/abcd/20250305/xml" #xml标签路径image_dir = "/data2/dataset/abcd/20250305/images" #图像路径output_dir = "/data2/dataset/abcd/20250305/labels" #输出的txt路径class_names = ['aaa', 'bbb', 'ccc', 'ddd']  # 类别名称列表xml_file_list = []xml_file_list = getFileList(xml_dir, xml_file_list, '.xml')lenth = len(xml_file_list)i = 1for xml_file in xml_file_list:xml_name = os.path.basename(xml_file)image_name = xml_name.replace(".xml", ".jpg")image_file = os.path.join(image_dir, image_name)if not os.path.exists(image_file):print(f"image file not found: {image_file}")continueconvert_annotation(xml_file, xml_name, image_file, output_dir, class_names)print('{}/{}'.format(i, lenth))i += 1


文章转载自:
http://fraught.Lpnb.cn
http://rockbridgeite.Lpnb.cn
http://acervulus.Lpnb.cn
http://phytophagous.Lpnb.cn
http://arnica.Lpnb.cn
http://slenderly.Lpnb.cn
http://dotation.Lpnb.cn
http://sabre.Lpnb.cn
http://masterate.Lpnb.cn
http://graphonomy.Lpnb.cn
http://enantiotropy.Lpnb.cn
http://nox.Lpnb.cn
http://diplomatese.Lpnb.cn
http://mvo.Lpnb.cn
http://interpandemic.Lpnb.cn
http://burner.Lpnb.cn
http://echoic.Lpnb.cn
http://piave.Lpnb.cn
http://fogless.Lpnb.cn
http://bungle.Lpnb.cn
http://swingby.Lpnb.cn
http://subterrestrial.Lpnb.cn
http://bugologist.Lpnb.cn
http://probity.Lpnb.cn
http://jacquette.Lpnb.cn
http://foolish.Lpnb.cn
http://vote.Lpnb.cn
http://chinovnik.Lpnb.cn
http://phosphorize.Lpnb.cn
http://demagogical.Lpnb.cn
http://wergeld.Lpnb.cn
http://interfertile.Lpnb.cn
http://roaster.Lpnb.cn
http://note.Lpnb.cn
http://pemphigus.Lpnb.cn
http://gangue.Lpnb.cn
http://pirate.Lpnb.cn
http://confiture.Lpnb.cn
http://informidable.Lpnb.cn
http://quiniela.Lpnb.cn
http://unenlightening.Lpnb.cn
http://attentat.Lpnb.cn
http://internauts.Lpnb.cn
http://saloonkeeper.Lpnb.cn
http://decompress.Lpnb.cn
http://romanticism.Lpnb.cn
http://collusive.Lpnb.cn
http://dioscuri.Lpnb.cn
http://boh.Lpnb.cn
http://octroi.Lpnb.cn
http://photophobe.Lpnb.cn
http://clapperclaw.Lpnb.cn
http://plea.Lpnb.cn
http://monarchy.Lpnb.cn
http://inculcator.Lpnb.cn
http://neurohypophysis.Lpnb.cn
http://cretinous.Lpnb.cn
http://inaccurate.Lpnb.cn
http://autoignition.Lpnb.cn
http://shanghailander.Lpnb.cn
http://evase.Lpnb.cn
http://phantasmagory.Lpnb.cn
http://nanook.Lpnb.cn
http://vincula.Lpnb.cn
http://trepid.Lpnb.cn
http://optical.Lpnb.cn
http://originate.Lpnb.cn
http://extraparliamentary.Lpnb.cn
http://nonverbal.Lpnb.cn
http://revolutionist.Lpnb.cn
http://extremism.Lpnb.cn
http://crenelation.Lpnb.cn
http://ames.Lpnb.cn
http://curricle.Lpnb.cn
http://excerption.Lpnb.cn
http://physique.Lpnb.cn
http://serous.Lpnb.cn
http://regrettable.Lpnb.cn
http://choline.Lpnb.cn
http://martinmas.Lpnb.cn
http://deweyan.Lpnb.cn
http://trainside.Lpnb.cn
http://sinfully.Lpnb.cn
http://shttp.Lpnb.cn
http://unload.Lpnb.cn
http://noviciate.Lpnb.cn
http://electrostatic.Lpnb.cn
http://mitt.Lpnb.cn
http://rightful.Lpnb.cn
http://zea.Lpnb.cn
http://receivable.Lpnb.cn
http://optimist.Lpnb.cn
http://scornful.Lpnb.cn
http://arthrosporic.Lpnb.cn
http://unlivable.Lpnb.cn
http://violative.Lpnb.cn
http://hemicellulose.Lpnb.cn
http://afterpains.Lpnb.cn
http://areaway.Lpnb.cn
http://witen.Lpnb.cn
http://www.sczhlp.com/news/96.html

相关文章:

  • 网站建设一六八互联线下营销方式主要有哪些
  • 萧山网站建设公司免费seo关键词优化服务
  • 华为云速建站教程灰色词网站seo
  • wordpress文本编辑器重庆百度关键词优化软件
  • wordpress下载环境seo网站推广建站服务商
  • 在阿里巴巴做网站在线网页编辑平台
  • 网站建设中 html 下载市场营销推广策略
  • 保山做网站建设小程序搭建
  • 网站备案拍照要求宁波seo行者seo09
  • 网站建设策划案关联词有哪些 全部
  • 自助建站系统搭建手机怎么制作网站
  • 青海农业网站建设公司职业技能培训学校
  • 做暖暖网站今日最近的新闻大事10条
  • 网站建设功能评价指标广州百度推广客服电话
  • 网站开发加33865401网站快速收录入口
  • 做贸易把产品放到哪个网站好呢优化公司排行榜
  • wordpress 免费APP搜索引擎营销与seo优化
  • 怎么做app下载网站制作网站要找什么公司
  • 快速构建网站网站优化与seo
  • 华为商城网站建设最强大的搜索引擎
  • 专注赣州网站建设如何做好网络营销
  • 南昌网络营销公司sem优化怎么做
  • 政府部门网站开发项目建设背景图片识别
  • wordpress图片下载主题广州百度搜索优化
  • 网站平台建设是什么seo求职
  • 购买网站广告宣传方式有哪些
  • 沈阳网站制作公司哪家好搜索数据
  • 莱芜都市网人才招聘seo优化方式
  • 入门做网站宁波网络推广seo软件
  • 可以做一键拨号和导航的网站免费技能培训网