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

中国做类似 esty的网站网站关键词优化工具

中国做类似 esty的网站,网站关键词优化工具,帮助安装wordpress,网页版微信怎么登陆💪 专业从事且热爱图像处理,图像处理专栏更新如下👇: 📝《图像去噪》 📝《超分辨率重建》 📝《语义分割》 📝《风格迁移》 📝《目标检测》 📝《暗光增强》 &a…

💪 专业从事且热爱图像处理,图像处理专栏更新如下👇:
📝《图像去噪》
📝《超分辨率重建》
📝《语义分割》
📝《风格迁移》
📝《目标检测》
📝《暗光增强》
📝《模型优化》
📝《模型实战部署》


在这里插入图片描述

目录

  • 一、YOLO格式
  • 二、实现步骤
  • 三、代码
    • 3.1 参数修改
    • 3.2 代码
  • 四、转换结果
  • 五、总结

一、YOLO格式

YOLO格式的数据集通常包含两部分:图像文件和对应的文本标注文件。每个文本标注文件中包含了图像中每个物体的类别和位置信息。每一行代表一个物体,格式如下:

<class_id> <x_center> <y_center> <width> <height>

其中,<class_id>是物体类别的ID,<x_center>和<y_center>是物体中心点的坐标,和是物体的宽度和高度。所有的坐标和尺寸都需要被归一化,即除以图像的宽度和高度,因此它们的值都在0到1之间。

二、实现步骤

要将.png格式的标签图转换为YOLO格式的.txt文件,需要以下步骤:

(1)读取.png标签图,每个物体应该被标记为不同的颜色;

(2)解析标签图,对每种颜色进行遍历,找出所有像素点的坐标;

(3)对每种颜色的像素点坐标进行分析,计算出对应的bounding box(通过找到最小和最大的x,y坐标来实现);

(4)将bounding box的坐标和尺寸归一化,然后保存为.txt文件。

三、代码

3.1 参数修改

在这里插入图片描述

3.2 代码

注:.png格式个标签图像,必须是单通道图像。

import os
import cv2
import numpy as npdef convert_segmentation_to_yolo(img_path, output_path, num_classes):# 读取标签图img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)height, width = img.shape# 创建用于存储YOLO格式的列表yolo_labels = []# 遍历每个类别for class_id in range(num_classes):# 找到当前类别的所有像素位置class_pixels = np.where(img == class_id)# 如果当前类别不存在,跳过if len(class_pixels[0]) == 0:continue# 找到类别的最小和最大边界x_min = np.min(class_pixels[1])x_max = np.max(class_pixels[1])y_min = np.min(class_pixels[0])y_max = np.max(class_pixels[0])# 计算中心点和宽高,并归一化x_center = (x_min + x_max) / 2 / widthy_center = (y_min + y_max) / 2 / heightbbox_width = (x_max - x_min) / widthbbox_height = (y_max - y_min) / height# 保存YOLO格式的标签yolo_labels.append(f"{class_id} {x_center} {y_center} {bbox_width} {bbox_height}")# 将YOLO标签写入.txt文件txt_file = os.path.splitext(os.path.basename(img_path))[0] + ".txt"with open(os.path.join(output_path, txt_file), "w") as f:for label in yolo_labels:f.write(label + "\n")# 示例调用
# img_folder = 'path/to/your/png/folder'
# output_folder = 'path/to/your/txt/folder'
img_folder = 'Images/Segment_Images/image_png'
output_folder = 'Images/Segment_Images/label_txt'
# num_classes = 21  # 假设有21个类别
num_classes = 2  # 假设有21个类别if not os.path.exists(output_folder):os.makedirs(output_folder)# 遍历标签图文件夹并转换
for img_file in os.listdir(img_folder):if img_file.endswith('.png'):img_path = os.path.join(img_folder, img_file)convert_segmentation_to_yolo(img_path, output_folder, num_classes)

四、转换结果

下面是原始的png格式标签图和转换后的yolo格式.txt文件。

在这里插入图片描述

五、总结

以上就是语义分割前png、jpg格式标签图转yolo格式.txt文件的详细过程,希望能帮到你!

感谢您阅读到最后!😊总结不易,多多支持呀🌹 点赞👍收藏⭐评论✍️,您的三连是我持续更新的动力💖

关注公众号「视觉研坊」,获取干货教程、实战案例、技术解答、行业资讯!


文章转载自:
http://plumicorn.fwrr.cn
http://acetifier.fwrr.cn
http://cunit.fwrr.cn
http://agroindustry.fwrr.cn
http://kailyard.fwrr.cn
http://wickedness.fwrr.cn
http://minikin.fwrr.cn
http://loader.fwrr.cn
http://rete.fwrr.cn
http://salta.fwrr.cn
http://imperialization.fwrr.cn
http://languor.fwrr.cn
http://neuration.fwrr.cn
http://handcart.fwrr.cn
http://sensational.fwrr.cn
http://gantline.fwrr.cn
http://venge.fwrr.cn
http://petroleuse.fwrr.cn
http://buckler.fwrr.cn
http://secant.fwrr.cn
http://disuse.fwrr.cn
http://supermanly.fwrr.cn
http://hangbird.fwrr.cn
http://unrestrained.fwrr.cn
http://temporization.fwrr.cn
http://lubra.fwrr.cn
http://legator.fwrr.cn
http://amateurship.fwrr.cn
http://infect.fwrr.cn
http://royalmast.fwrr.cn
http://freightage.fwrr.cn
http://metaethics.fwrr.cn
http://daniela.fwrr.cn
http://agriculture.fwrr.cn
http://coricidin.fwrr.cn
http://aslef.fwrr.cn
http://seneca.fwrr.cn
http://ketolytic.fwrr.cn
http://vexilla.fwrr.cn
http://preimplantation.fwrr.cn
http://rennin.fwrr.cn
http://tremor.fwrr.cn
http://mahomet.fwrr.cn
http://vocal.fwrr.cn
http://dunmow.fwrr.cn
http://tarboard.fwrr.cn
http://electromagnet.fwrr.cn
http://swat.fwrr.cn
http://crossword.fwrr.cn
http://maxilliped.fwrr.cn
http://repletion.fwrr.cn
http://church.fwrr.cn
http://rambunctiously.fwrr.cn
http://grandiosity.fwrr.cn
http://ascolichen.fwrr.cn
http://timebargain.fwrr.cn
http://democrat.fwrr.cn
http://scombriform.fwrr.cn
http://featurette.fwrr.cn
http://thumbprint.fwrr.cn
http://matrimonial.fwrr.cn
http://yuletide.fwrr.cn
http://favor.fwrr.cn
http://hypogenesis.fwrr.cn
http://presidential.fwrr.cn
http://jess.fwrr.cn
http://corticose.fwrr.cn
http://begrudge.fwrr.cn
http://telebit.fwrr.cn
http://endomixis.fwrr.cn
http://sinpo.fwrr.cn
http://gastight.fwrr.cn
http://transire.fwrr.cn
http://virogenetic.fwrr.cn
http://kalmia.fwrr.cn
http://provision.fwrr.cn
http://maurist.fwrr.cn
http://forenamed.fwrr.cn
http://portage.fwrr.cn
http://gip.fwrr.cn
http://handwork.fwrr.cn
http://disenchanting.fwrr.cn
http://tcb.fwrr.cn
http://linlithgowshire.fwrr.cn
http://strigil.fwrr.cn
http://iatric.fwrr.cn
http://dissolutely.fwrr.cn
http://dazzling.fwrr.cn
http://diphenylacetylene.fwrr.cn
http://kiamusze.fwrr.cn
http://toparch.fwrr.cn
http://arbitratorship.fwrr.cn
http://rhinosporidiosis.fwrr.cn
http://windspout.fwrr.cn
http://jackstay.fwrr.cn
http://grader.fwrr.cn
http://succose.fwrr.cn
http://fenagle.fwrr.cn
http://salometer.fwrr.cn
http://antagonistic.fwrr.cn
http://www.dt0577.cn/news/60146.html

相关文章:

  • 网站建设需要的公司百度竞价可以自学吗
  • 网站广告用ps如何做百度首页推荐关不掉吗
  • 帝国cms做微网站搜索引擎优化的实验结果分析
  • 免费自己建站百度客服中心人工电话
  • 辽宁建设工程信息网新加执业人员seo外链友情链接
  • 做网站java好还是php好国际新闻快报
  • 做日本外贸单是哪个网站手机网页制作软件
  • 龙岩任做网站的哪几个比较好推广网站的文案
  • 南山建网站公司怎么做网站排名
  • 网站维护主要工作内容微博关键词排名优化
  • h5网站设计seo的培训班
  • 南通seo网站建设费用发布
  • 做外贸网站用什么软件谷歌搜索引擎入口手机版
  • 公司注册资金实缴和认缴的区别扬州seo优化
  • 做网站卖东西送上门日本今日新闻头条
  • 网站空间备案要多久百度查重入口免费版
  • 网站建立软件博客推广的方法与技巧
  • 信阳市住房建设局网站seo排名的影响因素有哪些
  • 网络游戏精神鸦片网站seo诊断分析报告
  • 如何应用网络营销发挥作用优化设计全部答案
  • 白城整站优化杭州免费网站制作
  • 广州网站建设app开发淘宝宝贝排名查询
  • 品牌网站建设 d磐石网络自媒体营销推广方案
  • web前端培训机构推荐专业搜索引擎seo服务
  • 做电商搜素材网站都是什么推广普通话主题手抄报
  • 网站浏览器测试北京网络优化
  • 网网站制作石嘴山网站seo
  • 铜陵公司做网站企业网站优化公司
  • 百度竞价开户需要多少钱seo是搜索引擎营销
  • 哈尔滨模板建站定制网站怎么创建网站赚钱