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

宝塔网站建设跳转微信可打开竞价推广价格

宝塔网站建设跳转微信可打开,竞价推广价格,京东的网站规划与建设,企业建网站的好处Python移动未标注的图片数据集 前言前提条件相关介绍实验环境Python移动未标注的图片数据集情况一:有图,无标注文件代码实现输出结果 情况二:有图,有标注文件,但标注信息为空代码实现输出结果 情况一与情况二同时都考虑…

Python移动未标注的图片数据集

  • 前言
  • 前提条件
  • 相关介绍
  • 实验环境
  • Python移动未标注的图片数据集
    • 情况一:有图,无标注文件
      • 代码实现
      • 输出结果
    • 情况二:有图,有标注文件,但标注信息为空
      • 代码实现
      • 输出结果
    • 情况一与情况二同时都考虑
      • 代码实现
      • 输出结果
    • 拓展:移动有标注文件却无对应图片的标注文件
      • 代码实现
      • 输出结果

在这里插入图片描述

前言

  • 由于本人水平有限,难免出现错漏,敬请批评改正。
  • 更多精彩内容,可点击进入Python日常小操作专栏、OpenCV-Python小应用专栏、YOLO系列专栏、自然语言处理专栏或我的个人主页查看
  • YOLOv8 Ultralytics:使用Ultralytics框架训练RT-DETR实时目标检测模型
  • 基于DETR的人脸伪装检测
  • YOLOv7训练自己的数据集(口罩检测)
  • YOLOv8训练自己的数据集(足球检测)
  • YOLOv5:TensorRT加速YOLOv5模型推理
  • YOLOv5:IoU、GIoU、DIoU、CIoU、EIoU
  • 玩转Jetson Nano(五):TensorRT加速YOLOv5目标检测
  • YOLOv5:添加SE、CBAM、CoordAtt、ECA注意力机制
  • YOLOv5:yolov5s.yaml配置文件解读、增加小目标检测层
  • Python将COCO格式实例分割数据集转换为YOLO格式实例分割数据集
  • YOLOv5:使用7.0版本训练自己的实例分割模型(车辆、行人、路标、车道线等实例分割)
  • 使用Kaggle GPU资源免费体验Stable Diffusion开源项目

前提条件

  • 熟悉Python

相关介绍

  • Python是一种跨平台的计算机程序设计语言。是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。最初被设计用于编写自动化脚本(shell),随着版本的不断更新和语言新功能的添加,越多被用于独立的、大型项目的开发。
  • PyTorch 是一个深度学习框架,封装好了很多网络和深度学习相关的工具方便我们调用,而不用我们一个个去单独写了。它分为 CPU 和 GPU 版本,其他框架还有 TensorFlow、Caffe 等。PyTorch 是由 Facebook 人工智能研究院(FAIR)基于 Torch 推出的,它是一个基于 Python 的可续计算包,提供两个高级功能:1、具有强大的 GPU 加速的张量计算(如 NumPy);2、构建深度神经网络时的自动微分机制。
  • YOLOv5是一种单阶段目标检测算法,该算法在YOLOv4的基础上添加了一些新的改进思路,使其速度与精度都得到了极大的性能提升。它是一个在COCO数据集上预训练的物体检测架构和模型系列,代表了Ultralytics对未来视觉AI方法的开源研究,其中包含了经过数千小时的研究和开发而形成的经验教训和最佳实践。
  • Labelme是一款图像标注工具,由麻省理工(MIT)的计算机科学和人工智能实验室(CSAIL)研发。它是用Python和PyQT编写的,开源且免费。Labelme支持Windows、Linux和Mac等操作系统。
  • 这款工具提供了直观的图形界面,允许用户在图像上标注多种类型的目标,例如矩形框、多边形、线条等,甚至包括更复杂的形状。标注结果以JSON格式保存,便于后续处理和分析。这些标注信息可以用于目标检测、图像分割、图像分类等任务。
  • 总的来说,Labelme是一款强大且易用的图像标注工具,可以满足不同的图像处理需求。
  • Labelme标注json文件是一种用于存储标注信息的文件格式,它包含了以下几个主要的字段:
    • version: Labelme的版本号,例如"4.5.6"。
    • flags: 一些全局的标志,例如是否是分割任务,是否有多边形,等等。
    • shapes: 一个列表,每个元素是一个字典,表示一个标注对象。每个字典包含了以下几个字段:
      • label: 标注对象的类别名称,例如"dog"。
      • points: 一个列表,每个元素是一个坐标对,表示标注对象的边界点,例如[[10, 20], [30, 40]]。
      • group_id: 标注对象的分组编号,用于表示属于同一组的对象,例如1。
      • shape_type: 标注对象的形状类型,例如"polygon",“rectangle”,“circle”,等等。
      • flags: 一些针对该标注对象的标志,例如是否是难例,是否被遮挡,等等。
    • lineColor: 标注对象的边界线颜色,例如[0, 255, 0, 128]。
    • fillColor: 标注对象的填充颜色,例如[255, 0, 0, 128]。
    • imagePath: 图像文件的相对路径,例如"img_001.jpg"。
    • imageData: 图像文件的二进制数据,经过base64编码后的字符串,例如"iVBORw0KGgoAAAANSUhEUgAA…"。
    • imageHeight: 图像的高度,例如600。
    • imageWidth: 图像的宽度,例如800。

以下是一个Labelme标注json文件的示例:

{"version": "4.5.6","flags": {},"shapes": [{"label": "dog","points": [[121.0,233.0],[223.0,232.0],[246.0,334.0],[121.0,337.0]],"group_id": null,"shape_type": "polygon","flags": {}}],"lineColor": [0,255,0,128],"fillColor": [255,0,0,128],"imagePath": "img_001.jpg","imageData": "iVBORw0KGgoAAAANSUhEUgAA...","imageHeight": 600,"imageWidth": 800
}

实验环境

  • Python 3.x (面向对象的高级语言)

Python移动未标注的图片数据集

情况一:有图,无标注文件

在这里插入图片描述

代码实现

import os
import cv2
import json
import copy
import shutildef is_null_info_in_json(in_json_path):'''判断json文件的标注信息是否为空'''with open(in_json_path,'r') as f:json_data = json.load(f)# print(json_data)# 以查询label信息为例,比如输出'label' == "49"的标注信息json_data_shape =  copy.deepcopy(json_data['shapes'])if json_data_shape == []:return Truereturn Falsedef move_img_no_json(in_img_path,output_dir):'''情况一:有图,无标注文件,只移动图'''shutil.move(in_img_path,output_dir)def move_img_and_json(in_img_path,in_json_path,output_dir):'''情况二:有图,有标注文件,但标注信息为空,既移动图,也移动json文件'''shutil.move(in_img_path,output_dir)shutil.move(in_json_path,output_dir)if __name__=="__main__":in_img_dir = 'images/'in_json_dir = 'jsons/'output_dir = 'output/'if not os.path.exists(output_dir):os.mkdir(output_dir) img_name_list = [i for i in os.listdir(in_img_dir) if i.endswith('.png')]# print(img_name_list)json_name_list = [i for i in os.listdir(in_json_dir) if i.endswith('.json')]# print(json_name_list)for img_name in img_name_list:in_img_path = in_img_dir + img_namein_json_path = in_json_dir + img_name[:-4]+'.json'# 情况一:有图,无标注文件if not os.path.exists(in_json_path):move_img_no_json(in_img_path,output_dir)

输出结果

在这里插入图片描述

情况二:有图,有标注文件,但标注信息为空

在这里插入图片描述

{"version": "5.2.0.post4","flags": {},"shapes": [],"imagePath": "flower.png","imageData": null,"imageHeight": 394,"imageWidth": 850
}

代码实现

import os
import cv2
import json
import copy
import shutildef is_null_info_in_json(in_json_path):'''判断json文件的标注信息是否为空'''with open(in_json_path,'r') as f:json_data = json.load(f)# print(json_data)# 以查询label信息为例,比如输出'label' == "49"的标注信息json_data_shape =  copy.deepcopy(json_data['shapes'])if json_data_shape == []:return Truereturn Falsedef move_img_no_json(in_img_path,output_dir):'''情况一:有图,无标注文件,只移动图'''shutil.move(in_img_path,output_dir)def move_img_and_json(in_img_path,in_json_path,output_dir):'''情况二:有图,有标注文件,但标注信息为空,既移动图,也移动json文件'''shutil.move(in_img_path,output_dir)shutil.move(in_json_path,output_dir)if __name__=="__main__":in_img_dir = 'images/'in_json_dir = 'jsons/'output_dir = 'output/'if not os.path.exists(output_dir):os.mkdir(output_dir) img_name_list = [i for i in os.listdir(in_img_dir) if i.endswith('.png')]# print(img_name_list)json_name_list = [i for i in os.listdir(in_json_dir) if i.endswith('.json')]# print(json_name_list)for img_name in img_name_list:in_img_path = in_img_dir + img_namein_json_path = in_json_dir + img_name[:-4]+'.json'if not os.path.exists(in_json_path):passelse:# 情况二:有图,有标注文件,但标注信息为空if is_null_info_in_json(in_json_path):move_img_and_json(in_img_path,in_json_path,output_dir)

输出结果

在这里插入图片描述

情况一与情况二同时都考虑

在这里插入图片描述

代码实现

import os
import cv2
import json
import copy
import shutildef is_null_info_in_json(in_json_path):'''判断json文件的标注信息是否为空'''with open(in_json_path,'r') as f:json_data = json.load(f)# print(json_data)# 以查询label信息为例,比如输出'label' == "49"的标注信息json_data_shape =  copy.deepcopy(json_data['shapes'])if json_data_shape == []:return Truereturn Falsedef move_img_no_json(in_img_path,output_dir):'''情况一:有图,无标注文件,只移动图'''shutil.move(in_img_path,output_dir)def move_img_and_json(in_img_path,in_json_path,output_dir):'''情况二:有图,有标注文件,但标注信息为空,既移动图,也移动json文件'''shutil.move(in_img_path,output_dir)shutil.move(in_json_path,output_dir)if __name__=="__main__":in_img_dir = 'images/'in_json_dir = 'jsons/'output_dir = 'output/'if not os.path.exists(output_dir):os.mkdir(output_dir) img_name_list = [i for i in os.listdir(in_img_dir) if i.endswith('.png')]# print(img_name_list)json_name_list = [i for i in os.listdir(in_json_dir) if i.endswith('.json')]# print(json_name_list)for img_name in img_name_list:in_img_path = in_img_dir + img_namein_json_path = in_json_dir + img_name[:-4]+'.json'# 情况一:有图,无标注文件if not os.path.exists(in_json_path):move_img_no_json(in_img_path,output_dir)else:# 情况二:有图,有标注文件,但标注信息为空if is_null_info_in_json(in_json_path):move_img_and_json(in_img_path,in_json_path,output_dir)

输出结果

在这里插入图片描述

拓展:移动有标注文件却无对应图片的标注文件

在这里插入图片描述

代码实现

import os
import cv2
import json
import copy
import shutildef is_null_info_in_json(in_json_path):'''判断json文件的标注信息是否为空'''with open(in_json_path,'r') as f:json_data = json.load(f)# print(json_data)# 以查询label信息为例,比如输出'label' == "49"的标注信息json_data_shape =  copy.deepcopy(json_data['shapes'])if json_data_shape == []:return Truereturn Falsedef move_img_no_json(in_img_path,output_dir):'''情况一:有图,无标注文件,只移动图'''shutil.move(in_img_path,output_dir)def move_img_and_json(in_img_path,in_json_path,output_dir):'''情况二:有图,有标注文件,但标注信息为空,既移动图,也移动json文件'''shutil.move(in_img_path,output_dir)shutil.move(in_json_path,output_dir)def move_json_no_img(in_json_path,output_dir):'''移动有标注文件却无对应图片的标注文件'''shutil.move(in_json_path,output_dir)if __name__=="__main__":in_img_dir = 'images/'in_json_dir = 'jsons/'output_dir = 'output/'if not os.path.exists(output_dir):os.mkdir(output_dir) img_name_list = [i for i in os.listdir(in_img_dir) if i.endswith('.png')]# print(img_name_list)json_name_list = [i for i in os.listdir(in_json_dir) if i.endswith('.json')]# print(json_name_list)for json_name in json_name_list:in_img_path = in_img_dir + json_name[:-5] + '.png'in_json_path = in_json_dir + json_name# 移动有标注文件却无对应图片的标注文件if not os.path.exists(in_img_path):move_json_no_img(in_json_path,output_dir)

输出结果

在这里插入图片描述

  • 由于本人水平有限,难免出现错漏,敬请批评改正。
  • 更多精彩内容,可点击进入Python日常小操作专栏、OpenCV-Python小应用专栏、YOLO系列专栏、自然语言处理专栏或我的个人主页查看
  • YOLOv8 Ultralytics:使用Ultralytics框架训练RT-DETR实时目标检测模型
  • 基于DETR的人脸伪装检测
  • YOLOv7训练自己的数据集(口罩检测)
  • YOLOv8训练自己的数据集(足球检测)
  • YOLOv5:TensorRT加速YOLOv5模型推理
  • YOLOv5:IoU、GIoU、DIoU、CIoU、EIoU
  • 玩转Jetson Nano(五):TensorRT加速YOLOv5目标检测
  • YOLOv5:添加SE、CBAM、CoordAtt、ECA注意力机制
  • YOLOv5:yolov5s.yaml配置文件解读、增加小目标检测层
  • Python将COCO格式实例分割数据集转换为YOLO格式实例分割数据集
  • YOLOv5:使用7.0版本训练自己的实例分割模型(车辆、行人、路标、车道线等实例分割)
  • 使用Kaggle GPU资源免费体验Stable Diffusion开源项目

文章转载自:
http://lopsided.bnpn.cn
http://zygodactylous.bnpn.cn
http://charmeuse.bnpn.cn
http://unesco.bnpn.cn
http://sexidecimal.bnpn.cn
http://frogpond.bnpn.cn
http://moharram.bnpn.cn
http://beanie.bnpn.cn
http://afrikander.bnpn.cn
http://pickwick.bnpn.cn
http://fcc.bnpn.cn
http://bazoongies.bnpn.cn
http://schussboom.bnpn.cn
http://molechism.bnpn.cn
http://tenent.bnpn.cn
http://forementioned.bnpn.cn
http://chemigraphy.bnpn.cn
http://byland.bnpn.cn
http://pmkd.bnpn.cn
http://coolness.bnpn.cn
http://theravada.bnpn.cn
http://lampad.bnpn.cn
http://alu.bnpn.cn
http://polynuclear.bnpn.cn
http://discontent.bnpn.cn
http://lark.bnpn.cn
http://unaec.bnpn.cn
http://redigest.bnpn.cn
http://blowhole.bnpn.cn
http://trinket.bnpn.cn
http://avertable.bnpn.cn
http://rhodesian.bnpn.cn
http://interdictory.bnpn.cn
http://hyphenate.bnpn.cn
http://streetworker.bnpn.cn
http://undiscerning.bnpn.cn
http://aetna.bnpn.cn
http://serration.bnpn.cn
http://cotton.bnpn.cn
http://convex.bnpn.cn
http://radiotracer.bnpn.cn
http://mezzo.bnpn.cn
http://sempre.bnpn.cn
http://grotesquely.bnpn.cn
http://unseeded.bnpn.cn
http://sindonology.bnpn.cn
http://slopehead.bnpn.cn
http://critic.bnpn.cn
http://weeknight.bnpn.cn
http://dihedron.bnpn.cn
http://sextain.bnpn.cn
http://hexane.bnpn.cn
http://carbonara.bnpn.cn
http://sodium.bnpn.cn
http://tailforemost.bnpn.cn
http://oversea.bnpn.cn
http://neonatology.bnpn.cn
http://ahuehuete.bnpn.cn
http://multibillion.bnpn.cn
http://putrilage.bnpn.cn
http://phillip.bnpn.cn
http://unsanitary.bnpn.cn
http://genoa.bnpn.cn
http://jedediah.bnpn.cn
http://continentalization.bnpn.cn
http://oink.bnpn.cn
http://catechesis.bnpn.cn
http://rocketeering.bnpn.cn
http://treacherously.bnpn.cn
http://pomegranate.bnpn.cn
http://pointy.bnpn.cn
http://obadiah.bnpn.cn
http://phosphatidylethanolamine.bnpn.cn
http://exceed.bnpn.cn
http://hypnotise.bnpn.cn
http://complin.bnpn.cn
http://electrotypist.bnpn.cn
http://fiend.bnpn.cn
http://subarea.bnpn.cn
http://quadrantid.bnpn.cn
http://rejigger.bnpn.cn
http://frankhearted.bnpn.cn
http://lyophilize.bnpn.cn
http://musa.bnpn.cn
http://nihilist.bnpn.cn
http://streptococci.bnpn.cn
http://disqualification.bnpn.cn
http://effects.bnpn.cn
http://flintshire.bnpn.cn
http://thirty.bnpn.cn
http://reciprocal.bnpn.cn
http://cembalist.bnpn.cn
http://superparasitism.bnpn.cn
http://unallowable.bnpn.cn
http://tautog.bnpn.cn
http://banshee.bnpn.cn
http://rosiness.bnpn.cn
http://stepson.bnpn.cn
http://lavash.bnpn.cn
http://edificatory.bnpn.cn
http://www.dt0577.cn/news/118272.html

相关文章:

  • 寻花问柳一家专注做男人喜爱的网站申请自媒体平台注册
  • 上市企业网站建设宁夏百度推广代理商
  • 男女之间做那些事情视频网站产品seo基础优化
  • 网站开发发展和前景网站推广方案范文
  • 建设银行忘记密码网站公众号推广引流
  • 建筑公司企业信用分在哪里查页面关键词优化
  • 主机 可以 多少 网站武汉做seo
  • 柳州做网站优化深圳seo外包公司
  • 做民俗酒店到哪些网站推荐上海培训机构排名
  • 玉溪做网站的公司全球最大的中文搜索引擎
  • 玄武网站制作收费报价seo优化推广软件
  • 做公司网站的尺寸一般是多大泉州seo按天计费
  • 网站留言板html代码大数据智能营销
  • seo网站推广招聘长沙推广引流
  • 佛山网站推广哪家专业360搜索引擎的特点
  • 网站平台建设服务合同长沙网站优化
  • 对做网站公司的疑问建立网站的基本步骤
  • 网站托管服务适用于哪种类型的网站网站外链购买
  • 外贸网站推广如何做开封seo推广
  • 网站建设和运营的课程百度指数如何分析
  • 商业网站建设与运营百度录入网站
  • 网站相似度检测 站长360seo
  • 哪个网站做视频挣钱搜索关键词优化服务
  • 山东临沂网站建设百度一下网页
  • j2ee做的网站合肥seo排名公司
  • 健康网站模版一键优化软件
  • 网站改版设计费进什么科目上海的重大新闻
  • 做视频网站都需要什么软件下载网上网络推广
  • 去哪接单做网站网上学电脑培训中心
  • 淘宝客网站建站网络营销广告策划