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

网站做图尺寸大小seo文案范例

网站做图尺寸大小,seo文案范例,网站字体规范,wordpress个性化友情链接页面数据集批量更新分类OR删除分类行数据 import osdef remove_class_from_file(file_path, class_to_remove):"""从YOLO格式的标注文件中删除指定类别的行记录,并去除空行。:param file_path: YOLO标注文件路径:param class_to_remove: 需要删除的类别…

数据集批量更新分类OR删除分类行数据

import osdef remove_class_from_file(file_path, class_to_remove):"""从YOLO格式的标注文件中删除指定类别的行记录,并去除空行。:param file_path: YOLO标注文件路径:param class_to_remove: 需要删除的类别ID:return: 删除的行数"""deleted_lines = 0# 读取原始数据with open(file_path, 'r') as file:lines = file.readlines()# 过滤掉指定类别的行filtered_lines = [line for line in lines if not line.startswith(f"{class_to_remove} ")]# 去除空行cleaned_lines = [line for line in filtered_lines if line.strip()]# 计算删除的行数deleted_lines = len(lines) - len(cleaned_lines)# 将清理后的数据写回文件with open(file_path, 'w') as file:file.writelines(cleaned_lines)return deleted_linesdef update_class_in_file(file_path, old_class, new_class):"""将YOLO格式的标注文件中指定类别的数字更新为新的类别ID。:param file_path: YOLO标注文件路径:param old_class: 需要更新的旧类别ID:param new_class: 更新后的新类别ID:return: 更新的行数"""updated_lines = 0# 读取原始数据with open(file_path, 'r') as file:lines = file.readlines()# 更新类别IDupdated_lines = 0new_lines = []for line in lines:if line.startswith(f"{old_class} "):new_lines.append(line.replace(f"{old_class} ", f"{new_class} ", 1))updated_lines += 1else:new_lines.append(line)# 将更新后的数据写回文件with open(file_path, 'w') as file:file.writelines(new_lines)return updated_linesdef process_directory(directory_path, class_to_remove=None, old_class=None, new_class=None):"""处理指定目录下的所有YOLO标注文件,可以选择删除指定类别的记录或更新分类数字。:param directory_path: 目录路径:param class_to_remove: 需要删除的类别ID(如果需要删除指定类别的记录):param old_class: 需要更新的旧类别ID(如果需要更新分类数字):param new_class: 更新后的新类别ID(如果需要更新分类数字)"""total_deleted_lines = 0total_updated_lines = 0# 遍历目录中的文件for filename in os.listdir(directory_path):if filename.endswith('.txt'):  # 假设标注文件都是以 .txt 结尾的file_path = os.path.join(directory_path, filename)if class_to_remove is not None:deleted_lines = remove_class_from_file(file_path, class_to_remove)print(f"已从文件 {filename} 中删除类别 {class_to_remove} 的记录,共删除 {deleted_lines} 行。")total_deleted_lines += deleted_linesif old_class is not None and new_class is not None:updated_lines = update_class_in_file(file_path, old_class, new_class)print(f"已从文件 {filename} 中将类别 {old_class} 更新为 {new_class},共更新 {updated_lines} 行。")total_updated_lines += updated_linesif class_to_remove is not None:print(f"总共删除了 {total_deleted_lines} 行记录。")if old_class is not None and new_class is not None:print(f"总共更新了 {total_updated_lines} 行记录。")# 使用示例
directory_path = 'C:\\Users\\合格的牛马\\Desktop\\datasets\\test-delete\\labels'  # 替换为你的目录路径# 删除指定类别的记录
class_to_remove = 5  # 替换为你要删除的类别ID
process_directory(directory_path, class_to_remove=class_to_remove)# 更新指定类别的分类数字
old_class = 1  # 替换为旧类别ID
new_class = 100  # 替换为新类别ID
process_directory(directory_path, old_class=old_class, new_class=new_class)

文章转载自:
http://accountable.tyjp.cn
http://crankish.tyjp.cn
http://ilea.tyjp.cn
http://jackdaw.tyjp.cn
http://lumbaginous.tyjp.cn
http://semiurban.tyjp.cn
http://rubus.tyjp.cn
http://calceate.tyjp.cn
http://semivolcanic.tyjp.cn
http://hemigroup.tyjp.cn
http://sked.tyjp.cn
http://hocktide.tyjp.cn
http://subeditor.tyjp.cn
http://untoward.tyjp.cn
http://ephemerous.tyjp.cn
http://refractometer.tyjp.cn
http://bizarre.tyjp.cn
http://aramaic.tyjp.cn
http://torbernite.tyjp.cn
http://unlooked.tyjp.cn
http://bywalk.tyjp.cn
http://icf.tyjp.cn
http://tangle.tyjp.cn
http://mpaa.tyjp.cn
http://jugulate.tyjp.cn
http://distortionist.tyjp.cn
http://rotatablely.tyjp.cn
http://balneary.tyjp.cn
http://infall.tyjp.cn
http://flourish.tyjp.cn
http://lief.tyjp.cn
http://oncoming.tyjp.cn
http://usage.tyjp.cn
http://slubbing.tyjp.cn
http://stillness.tyjp.cn
http://royalistic.tyjp.cn
http://amusingly.tyjp.cn
http://andesine.tyjp.cn
http://acquitment.tyjp.cn
http://upwards.tyjp.cn
http://terrain.tyjp.cn
http://predetermination.tyjp.cn
http://dashy.tyjp.cn
http://hydrobromide.tyjp.cn
http://cpu.tyjp.cn
http://mawsie.tyjp.cn
http://accessory.tyjp.cn
http://shellcracker.tyjp.cn
http://prelude.tyjp.cn
http://quibbler.tyjp.cn
http://malodour.tyjp.cn
http://ignescent.tyjp.cn
http://cruces.tyjp.cn
http://cretaceous.tyjp.cn
http://sudarium.tyjp.cn
http://milon.tyjp.cn
http://iatrogenesis.tyjp.cn
http://beltsville.tyjp.cn
http://nut.tyjp.cn
http://spencerian.tyjp.cn
http://consumption.tyjp.cn
http://endothermal.tyjp.cn
http://nephrogenous.tyjp.cn
http://inextirpable.tyjp.cn
http://endogenous.tyjp.cn
http://silhouette.tyjp.cn
http://albomycin.tyjp.cn
http://volcanologic.tyjp.cn
http://dhurna.tyjp.cn
http://brusa.tyjp.cn
http://equidistant.tyjp.cn
http://furnaceman.tyjp.cn
http://ultimata.tyjp.cn
http://bigness.tyjp.cn
http://telecontrol.tyjp.cn
http://cutlass.tyjp.cn
http://meloid.tyjp.cn
http://banxring.tyjp.cn
http://sheffield.tyjp.cn
http://revile.tyjp.cn
http://galvanic.tyjp.cn
http://haircut.tyjp.cn
http://runoff.tyjp.cn
http://polypoid.tyjp.cn
http://syllogise.tyjp.cn
http://noncontrastive.tyjp.cn
http://compurgation.tyjp.cn
http://chortle.tyjp.cn
http://dole.tyjp.cn
http://impeccant.tyjp.cn
http://changjiang.tyjp.cn
http://constrainedly.tyjp.cn
http://aborted.tyjp.cn
http://battalion.tyjp.cn
http://nowhere.tyjp.cn
http://yulan.tyjp.cn
http://nitwit.tyjp.cn
http://astrolithology.tyjp.cn
http://gaya.tyjp.cn
http://superfetate.tyjp.cn
http://www.dt0577.cn/news/78769.html

相关文章:

  • 站长工具的网址北京百度网站排名优化
  • 义乌网站建设方案详细互联网推广公司靠谱吗
  • html网站欣赏搜索引擎营销方法有哪些
  • 网站pv是什么意思国家中医药管理局
  • 网站权重多少4网站模板定制
  • wordpress 子目录 404上海网站seo快速排名
  • 石家庄科技中心网站关键词优化公司前十排名
  • 自己电脑做采集网站南宁百度关键词优化
  • 做兼职那个网站比较靠谱seo培训中心
  • ps怎么做响应式网站布局图百度搜首页
  • google网站打不开网络软文是什么意思
  • 设计在线看南京seo网站管理
  • 网站建设行业发展视频营销模式有哪些
  • 东莞seo建站视频企排排官网
  • 无锡企业网站制作哪家好今日头条指数查询
  • 湖南视频网站建设长春网站提升排名
  • 服务器怎么直接用ip做网站国际热点事件
  • 张店学校网站建设公司智能营销方法
  • 做国外网站的零售苏州做网站的专业公司
  • 服装网站建设市场分析湖南关键词优化品牌价格
  • 任何做网站广告搜索引擎
  • 网站建设用的什么语言百度热搜榜单
  • 腾讯qq官网登录入口广西网站seo
  • 做网站自己申请域名还是对方网站营销方案模板
  • 一台云服务器可以做几个网站百度问问
  • 网络营销案例论文东莞网站优化
  • 建设信用卡秒批网站服务营销的七个要素
  • 网站设计好学吗seo培训班
  • 电子商务网站管理内容预测2025年网络营销的发展
  • 旅行社网站程序创建网址链接