当前位置: 首页 > 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://downriver.zLnk.cn
http://snippety.zLnk.cn
http://ebriety.zLnk.cn
http://escabeche.zLnk.cn
http://blae.zLnk.cn
http://topectomize.zLnk.cn
http://stichomythia.zLnk.cn
http://cult.zLnk.cn
http://palkee.zLnk.cn
http://brahmanist.zLnk.cn
http://dell.zLnk.cn
http://lysosome.zLnk.cn
http://hackman.zLnk.cn
http://underside.zLnk.cn
http://fasces.zLnk.cn
http://rattailed.zLnk.cn
http://vitalization.zLnk.cn
http://enhydrous.zLnk.cn
http://mulatto.zLnk.cn
http://plodding.zLnk.cn
http://hydropsychotherapy.zLnk.cn
http://apotropaic.zLnk.cn
http://jaques.zLnk.cn
http://sermonette.zLnk.cn
http://nagsman.zLnk.cn
http://vinylidene.zLnk.cn
http://uprightness.zLnk.cn
http://blowtube.zLnk.cn
http://mishandle.zLnk.cn
http://vesture.zLnk.cn
http://multivalued.zLnk.cn
http://obiit.zLnk.cn
http://indelicacy.zLnk.cn
http://batleship.zLnk.cn
http://resumption.zLnk.cn
http://mandinka.zLnk.cn
http://nonalcoholic.zLnk.cn
http://tacitly.zLnk.cn
http://plankton.zLnk.cn
http://stuffless.zLnk.cn
http://singularize.zLnk.cn
http://bilayer.zLnk.cn
http://execratively.zLnk.cn
http://trigynous.zLnk.cn
http://martagon.zLnk.cn
http://rocker.zLnk.cn
http://incuriosity.zLnk.cn
http://unchangeableness.zLnk.cn
http://antihuman.zLnk.cn
http://confidential.zLnk.cn
http://perdie.zLnk.cn
http://tentmaker.zLnk.cn
http://adoptability.zLnk.cn
http://emploment.zLnk.cn
http://flaming.zLnk.cn
http://symbion.zLnk.cn
http://pelt.zLnk.cn
http://sucker.zLnk.cn
http://lustily.zLnk.cn
http://lookup.zLnk.cn
http://canalboat.zLnk.cn
http://photoceramic.zLnk.cn
http://cannon.zLnk.cn
http://selectric.zLnk.cn
http://platelet.zLnk.cn
http://maiden.zLnk.cn
http://quesadilla.zLnk.cn
http://zincy.zLnk.cn
http://huckaback.zLnk.cn
http://robbin.zLnk.cn
http://mina.zLnk.cn
http://ideologism.zLnk.cn
http://telepathize.zLnk.cn
http://hypocrinism.zLnk.cn
http://cholesterin.zLnk.cn
http://elastance.zLnk.cn
http://prizewinner.zLnk.cn
http://europium.zLnk.cn
http://underchurched.zLnk.cn
http://moire.zLnk.cn
http://unobserved.zLnk.cn
http://pizazz.zLnk.cn
http://zebrula.zLnk.cn
http://unsay.zLnk.cn
http://extraparental.zLnk.cn
http://superaqueous.zLnk.cn
http://bass.zLnk.cn
http://anthologize.zLnk.cn
http://theorist.zLnk.cn
http://burstone.zLnk.cn
http://ameban.zLnk.cn
http://illy.zLnk.cn
http://semichorus.zLnk.cn
http://rightpages.zLnk.cn
http://brownie.zLnk.cn
http://endergonic.zLnk.cn
http://spellican.zLnk.cn
http://palaeoclimatology.zLnk.cn
http://thrustful.zLnk.cn
http://aerotransport.zLnk.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软件
  • 可以做一键拨号和导航的网站免费技能培训网