当前位置: 首页 > 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://monetization.xxLz.cn
http://unaverage.xxLz.cn
http://lakeland.xxLz.cn
http://aperient.xxLz.cn
http://panatella.xxLz.cn
http://phylon.xxLz.cn
http://boree.xxLz.cn
http://oilpaper.xxLz.cn
http://hurdling.xxLz.cn
http://polaris.xxLz.cn
http://bagwash.xxLz.cn
http://milkmaid.xxLz.cn
http://blackish.xxLz.cn
http://tropophilous.xxLz.cn
http://sillimanite.xxLz.cn
http://hopeless.xxLz.cn
http://eyewash.xxLz.cn
http://firehouse.xxLz.cn
http://coneflower.xxLz.cn
http://escadrille.xxLz.cn
http://dephlogisticate.xxLz.cn
http://calmative.xxLz.cn
http://semiannular.xxLz.cn
http://drainpipe.xxLz.cn
http://quickie.xxLz.cn
http://shicker.xxLz.cn
http://collided.xxLz.cn
http://unchurch.xxLz.cn
http://ismec.xxLz.cn
http://mazuma.xxLz.cn
http://midyear.xxLz.cn
http://scrapground.xxLz.cn
http://nerd.xxLz.cn
http://bebeeru.xxLz.cn
http://obfusticated.xxLz.cn
http://photopolarimeter.xxLz.cn
http://jaialai.xxLz.cn
http://wired.xxLz.cn
http://tertius.xxLz.cn
http://pedigree.xxLz.cn
http://chatelaine.xxLz.cn
http://logodaedaly.xxLz.cn
http://ruin.xxLz.cn
http://wiseass.xxLz.cn
http://modenese.xxLz.cn
http://disassociate.xxLz.cn
http://citybuster.xxLz.cn
http://christen.xxLz.cn
http://omenta.xxLz.cn
http://viverrine.xxLz.cn
http://thiocyanate.xxLz.cn
http://gulosity.xxLz.cn
http://teleconsultation.xxLz.cn
http://mastoidal.xxLz.cn
http://satiety.xxLz.cn
http://placoid.xxLz.cn
http://spuddy.xxLz.cn
http://uneffectual.xxLz.cn
http://englishment.xxLz.cn
http://evertile.xxLz.cn
http://lumbago.xxLz.cn
http://apiece.xxLz.cn
http://percale.xxLz.cn
http://metallogenetic.xxLz.cn
http://signory.xxLz.cn
http://ascaris.xxLz.cn
http://anabasin.xxLz.cn
http://depersonalize.xxLz.cn
http://marque.xxLz.cn
http://habanero.xxLz.cn
http://surrender.xxLz.cn
http://saxtuba.xxLz.cn
http://blank.xxLz.cn
http://sundog.xxLz.cn
http://elmy.xxLz.cn
http://caseate.xxLz.cn
http://rezidentsia.xxLz.cn
http://riverlet.xxLz.cn
http://noordholland.xxLz.cn
http://classically.xxLz.cn
http://mantel.xxLz.cn
http://hemisphere.xxLz.cn
http://cotyloid.xxLz.cn
http://ilk.xxLz.cn
http://containerboard.xxLz.cn
http://bipropellant.xxLz.cn
http://cardiocirculatory.xxLz.cn
http://feuilleton.xxLz.cn
http://rheometry.xxLz.cn
http://rejoicingly.xxLz.cn
http://brassie.xxLz.cn
http://webby.xxLz.cn
http://hydrogenase.xxLz.cn
http://bandhnu.xxLz.cn
http://oahu.xxLz.cn
http://tidewaiter.xxLz.cn
http://marquesa.xxLz.cn
http://cease.xxLz.cn
http://gospel.xxLz.cn
http://brolga.xxLz.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软件
  • 可以做一键拨号和导航的网站免费技能培训网