当前位置: 首页 > 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://clap.tnhg.cn
http://nucleonics.tnhg.cn
http://determinantal.tnhg.cn
http://unmaidenly.tnhg.cn
http://fiddlestick.tnhg.cn
http://lacking.tnhg.cn
http://swan.tnhg.cn
http://collaborationism.tnhg.cn
http://battleground.tnhg.cn
http://expurgate.tnhg.cn
http://pibal.tnhg.cn
http://unwed.tnhg.cn
http://tyrolese.tnhg.cn
http://delimitate.tnhg.cn
http://rockfall.tnhg.cn
http://feelingful.tnhg.cn
http://intine.tnhg.cn
http://infirmness.tnhg.cn
http://westerner.tnhg.cn
http://homocercy.tnhg.cn
http://coated.tnhg.cn
http://ekistics.tnhg.cn
http://anlistatig.tnhg.cn
http://theta.tnhg.cn
http://myxy.tnhg.cn
http://viscose.tnhg.cn
http://howl.tnhg.cn
http://diphycercal.tnhg.cn
http://arrester.tnhg.cn
http://madarosis.tnhg.cn
http://maccabees.tnhg.cn
http://espressivo.tnhg.cn
http://abashed.tnhg.cn
http://ozonide.tnhg.cn
http://mihrab.tnhg.cn
http://accidentalism.tnhg.cn
http://glycose.tnhg.cn
http://some.tnhg.cn
http://comsat.tnhg.cn
http://minifestival.tnhg.cn
http://puke.tnhg.cn
http://levelheaded.tnhg.cn
http://duplicity.tnhg.cn
http://camelry.tnhg.cn
http://nujiang.tnhg.cn
http://uncate.tnhg.cn
http://meccan.tnhg.cn
http://coorg.tnhg.cn
http://borghese.tnhg.cn
http://accentuator.tnhg.cn
http://crakeberry.tnhg.cn
http://salut.tnhg.cn
http://viscerocranium.tnhg.cn
http://saunter.tnhg.cn
http://oceanica.tnhg.cn
http://lux.tnhg.cn
http://inferiority.tnhg.cn
http://unclear.tnhg.cn
http://folder.tnhg.cn
http://solubilizer.tnhg.cn
http://socialite.tnhg.cn
http://hern.tnhg.cn
http://dowlas.tnhg.cn
http://ironical.tnhg.cn
http://hemophiliac.tnhg.cn
http://chivy.tnhg.cn
http://unimagined.tnhg.cn
http://textual.tnhg.cn
http://calorigenic.tnhg.cn
http://sombre.tnhg.cn
http://hearer.tnhg.cn
http://hoik.tnhg.cn
http://cytostome.tnhg.cn
http://longboat.tnhg.cn
http://stratocirrus.tnhg.cn
http://withoutdoors.tnhg.cn
http://gebang.tnhg.cn
http://dupable.tnhg.cn
http://jorum.tnhg.cn
http://caput.tnhg.cn
http://kristiansand.tnhg.cn
http://hyperesthesia.tnhg.cn
http://specifiable.tnhg.cn
http://colza.tnhg.cn
http://microeconomic.tnhg.cn
http://lcdr.tnhg.cn
http://poppied.tnhg.cn
http://ideomotor.tnhg.cn
http://covetously.tnhg.cn
http://nonallelic.tnhg.cn
http://lipbrush.tnhg.cn
http://retrobulbar.tnhg.cn
http://lobar.tnhg.cn
http://palaeanthropic.tnhg.cn
http://craniopagus.tnhg.cn
http://galleon.tnhg.cn
http://wiredraw.tnhg.cn
http://snub.tnhg.cn
http://taster.tnhg.cn
http://semiround.tnhg.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软件
  • 可以做一键拨号和导航的网站免费技能培训网