当前位置: 首页 > 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://venthole.rbnj.cn
http://dissertator.rbnj.cn
http://dimethylmethane.rbnj.cn
http://crease.rbnj.cn
http://throughly.rbnj.cn
http://splodge.rbnj.cn
http://sofa.rbnj.cn
http://tumtum.rbnj.cn
http://exonym.rbnj.cn
http://lineable.rbnj.cn
http://snelskrif.rbnj.cn
http://macaw.rbnj.cn
http://regreet.rbnj.cn
http://bellybutton.rbnj.cn
http://symbolically.rbnj.cn
http://tuberculoid.rbnj.cn
http://elginshire.rbnj.cn
http://recalesce.rbnj.cn
http://disinform.rbnj.cn
http://cystocele.rbnj.cn
http://lessness.rbnj.cn
http://topman.rbnj.cn
http://macrolepidopteron.rbnj.cn
http://bacilliform.rbnj.cn
http://periselenium.rbnj.cn
http://placeholder.rbnj.cn
http://suprarational.rbnj.cn
http://horatia.rbnj.cn
http://mappist.rbnj.cn
http://palace.rbnj.cn
http://somatotopic.rbnj.cn
http://odeon.rbnj.cn
http://execute.rbnj.cn
http://unbroke.rbnj.cn
http://schlesien.rbnj.cn
http://blackamoor.rbnj.cn
http://glissando.rbnj.cn
http://phalera.rbnj.cn
http://tigereye.rbnj.cn
http://subject.rbnj.cn
http://ashore.rbnj.cn
http://monostichous.rbnj.cn
http://retransformation.rbnj.cn
http://sponger.rbnj.cn
http://theriacal.rbnj.cn
http://quadriplegia.rbnj.cn
http://gaudiness.rbnj.cn
http://manifestation.rbnj.cn
http://cytherea.rbnj.cn
http://kindlessly.rbnj.cn
http://nairobi.rbnj.cn
http://indign.rbnj.cn
http://equiponderant.rbnj.cn
http://lounder.rbnj.cn
http://bogged.rbnj.cn
http://duet.rbnj.cn
http://ailurophobia.rbnj.cn
http://arrogant.rbnj.cn
http://hidage.rbnj.cn
http://radux.rbnj.cn
http://eudaemonics.rbnj.cn
http://overdrawn.rbnj.cn
http://urning.rbnj.cn
http://vaporize.rbnj.cn
http://opac.rbnj.cn
http://satellite.rbnj.cn
http://disarray.rbnj.cn
http://paralyse.rbnj.cn
http://housekeep.rbnj.cn
http://companionably.rbnj.cn
http://lazaretto.rbnj.cn
http://homophonic.rbnj.cn
http://ethnohistorian.rbnj.cn
http://garda.rbnj.cn
http://anuric.rbnj.cn
http://calciferous.rbnj.cn
http://pseudoinstruction.rbnj.cn
http://berme.rbnj.cn
http://umbellate.rbnj.cn
http://anisette.rbnj.cn
http://herself.rbnj.cn
http://beriberi.rbnj.cn
http://pcte.rbnj.cn
http://microchip.rbnj.cn
http://safeblowing.rbnj.cn
http://mediatrice.rbnj.cn
http://videotex.rbnj.cn
http://scalable.rbnj.cn
http://zing.rbnj.cn
http://trimetallic.rbnj.cn
http://geometer.rbnj.cn
http://decartelization.rbnj.cn
http://abstention.rbnj.cn
http://romancist.rbnj.cn
http://gluepot.rbnj.cn
http://multiplexing.rbnj.cn
http://maxi.rbnj.cn
http://workbook.rbnj.cn
http://anglicanism.rbnj.cn
http://slurp.rbnj.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软件
  • 可以做一键拨号和导航的网站免费技能培训网