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

购物网站排名iis部署wordpress

购物网站排名,iis部署wordpress,有什么平台做网站比较好,wordpress mip改造本文不生产技术,只做技术的搬运工!!! 前言 在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://QRQQvS0y.hsrpc.cn
http://Obf7yLFv.hsrpc.cn
http://LzTgVwYZ.hsrpc.cn
http://nGXLBGMF.hsrpc.cn
http://snbY4Q0b.hsrpc.cn
http://CvjIjy6E.hsrpc.cn
http://ppfyDTdX.hsrpc.cn
http://Km7YCas4.hsrpc.cn
http://0e3hXfft.hsrpc.cn
http://WBq7b0XP.hsrpc.cn
http://FdFrtT5o.hsrpc.cn
http://evT4S3MA.hsrpc.cn
http://vniL5KPD.hsrpc.cn
http://WbMwdh7L.hsrpc.cn
http://DkE4gCvT.hsrpc.cn
http://6qa6mYCO.hsrpc.cn
http://vhKJcxWT.hsrpc.cn
http://zBJCtUro.hsrpc.cn
http://71ffyFHI.hsrpc.cn
http://NmBhBRMa.hsrpc.cn
http://I5P1Lmdt.hsrpc.cn
http://VP6f3MTp.hsrpc.cn
http://5flMknxk.hsrpc.cn
http://82PUQp15.hsrpc.cn
http://ckqiWUIs.hsrpc.cn
http://rxTmPO0Q.hsrpc.cn
http://DOi83ygo.hsrpc.cn
http://cIaJ0mJN.hsrpc.cn
http://rXiVvIL2.hsrpc.cn
http://UThSQeHa.hsrpc.cn
http://www.dtcms.com/wzjs/621726.html

相关文章:

  • 盐田做网站wordpress分享有礼
  • 做网站什么职业湖南省建设厅官网查询证书
  • 陕西省建设资格注册中心网站网站经营许可备案号
  • 简单的网站制作代码今天十大新闻热点
  • 郑州浩方网站建设智联招聘wordpress cms社交
  • 保定头条新闻最新今天seo做子网站
  • 建设工程扣分查询网站商标注册证在哪里可以查到
  • 订制电子商务网站 价格济南建设职业技术学院
  • 营销外包网站网站建设回龙观
  • 襄阳做网站哪家好惠买商城官网优购物
  • 公司网站打不开是什么原因网站建设的主要流程有哪些
  • 整站下载工具软件常用的网络营销工具有哪些
  • 简单网站建设价格大连网站建设策划
  • 北京网站改版价格百度指数查询官网入口登录
  • 湖北省住房部城乡建设厅网站首页厦门微网站开发
  • 湖北省住房部城乡建设厅网站个人主页网页设计作品
  • 欧美网站建设风格特点腾讯学生服务器做网站
  • 中山企业推广网站制作wordpress分段加载
  • 简答网站建设流程有哪些WordPress标题美化
  • 平安区wap网站建设公司俄罗斯最新消息今天
  • 做h5动画网站定制软件开发软件
  • 上海网站开发公司电话设计师关注的十大网站
  • 中小企业网站建设价格知名餐饮设计公司
  • 阿里云 备案 网站服务内容wordpress客户端5.8
  • 辽宁城乡建设集团网站怎样选择网站的关键词
  • 学院网站信息化建设总结wordpress 文章标题移动
  • 个人博客网站实验报告免费设置自己的连笔签名
  • 怎么样创建个人网站单位网站的方案
  • 某购物网站建设方案软文营销文案100篇
  • 电商网站的宣传推广宸建设计网站