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

学做家常菜的网站陕西seo推广

学做家常菜的网站,陕西seo推广,济南免费网站建设优化,如何找做网站的公司Python将COCO格式实例分割数据集转换为YOLO格式实例分割数据集 前言相关介绍COCO格式实例分割数据集转换为YOLO格式实例分割数据集coco格式对应的json文件,以test.json为例格式转换代码,内容如下 前言 由于本人水平有限,难免出现错漏&#xf…

Python将COCO格式实例分割数据集转换为YOLO格式实例分割数据集

  • 前言
  • 相关介绍
    • COCO格式实例分割数据集转换为YOLO格式实例分割数据集
    • coco格式对应的json文件,以test.json为例
    • 格式转换代码,内容如下

前言

  • 由于本人水平有限,难免出现错漏,敬请批评改正。
  • 更多精彩内容,可点击进入YOLO系列专栏或我的个人主页查看
  • YOLOv5:添加SE、CBAM、CoordAtt、ECA注意力机制
  • YOLOv5:yolov5s.yaml配置文件解读、增加小目标检测层
  • YOLOv5:IoU、GIoU、DIoU、CIoU、EIoU
  • YOLOv7训练自己的数据集(口罩检测)
  • YOLOv8训练自己的数据集(足球检测)
  • 玩转Jetson Nano(五):TensorRT加速YOLOv5目标检测

相关介绍

  • Python是一种跨平台的计算机程序设计语言。是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。最初被设计用于编写自动化脚本(shell),随着版本的不断更新和语言新功能的添加,越多被用于独立的、大型项目的开发。
  • PyTorch 是一个深度学习框架,封装好了很多网络和深度学习相关的工具方便我们调用,而不用我们一个个去单独写了。它分为 CPU 和 GPU 版本,其他框架还有 TensorFlow、Caffe 等。PyTorch 是由 Facebook 人工智能研究院(FAIR)基于 Torch 推出的,它是一个基于 Python 的可续计算包,提供两个高级功能:1、具有强大的 GPU 加速的张量计算(如 NumPy);2、构建深度神经网络时的自动微分机制。
    在这里插入图片描述

COCO格式实例分割数据集转换为YOLO格式实例分割数据集

coco格式对应的json文件,以test.json为例

{"annotations": [{"id": 2094,"iscrowd": 0,"image_id": 173,"category_id": 1,"segmentation": [[1113,777,1115,785,1118,784,1120,786,1120,792,1118,796,1117,801,1117,868,1118,875,1120,880,1124,882,1138,882,1146,884,1153,899,1157,901,1166,901,1176,899,1178,897,1185,888,1204,887,1217,884,1291,886,1299,885,1302,883,1312,883,1323,890,1325,899,1332,905,1353,905,1360,895,1362,885,1364,863,1364,833,1359,797,1351,774,1326,735,1313,726,1297,722,1198,720,1191,716,1186,718,1177,718,1155,732,1150,736,1145,745,1145,747,1140,755,1135,769,1124,776,1121,776,1119,774]],"area": 38102,"bbox": [1113,716,251,189]},{"id": 577,"iscrowd": 0,"image_id": 43,"category_id": 3,"segmentation": [[950,795,954,803,960,803,961,802,963,801,959,796,957,794,952,794]],"area": 76.5,"bbox": [950,794,13,9]},{"id": 606,"iscrowd": 0,"image_id": 43,"category_id": 3,"segmentation": [[632,782,628,780,619,780,607,785,601,785,597,786,596,787,594,787,591,790,588,791,581,791,569,797,558,799,552,803,541,804,523,809,515,812,510,815,501,816,495,820,485,821,476,825,470,827,459,829,456,832,447,833,435,840,427,840,420,842,418,844,403,847,398,850,390,851,373,857,368,857,356,862,345,864,327,869,315,874,307,875,297,881,300,883,310,883,318,881,321,879,336,876,341,873,381,860,388,859,410,852,421,847,427,847,434,843,451,838,453,836,460,834,467,834,472,831,492,826,500,822,514,818,524,817,536,811,544,810,550,808,556,804,579,797,583,797,594,792,601,792,609,788,622,786]],"area": 1939,"bbox": [297,780,335,103]}],"images": [{"id": 762,"width": 1920,"height": 1080,"file_name": "0762.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 179,"width": 1920,"height": 1080,"file_name": "0179.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 13,"width": 1920,"height": 1080,"file_name": "0013.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1871,"width": 1920,"height": 1080,"file_name": "1871.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 396,"width": 1920,"height": 1080,"file_name": "0396.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1762,"width": 1920,"height": 1080,"file_name": "1762.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 89,"width": 1920,"height": 1080,"file_name": "0089.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 2198,"width": 1920,"height": 1080,"file_name": "2198.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 262,"width": 1920,"height": 1080,"file_name": "0262.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1132,"width": 1920,"height": 1080,"file_name": "1099.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 929,"width": 1920,"height": 1080,"file_name": "0929.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1396,"width": 1920,"height": 1080,"file_name": "1318.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 2208,"width": 1920,"height": 1080,"file_name": "2208.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1248,"width": 1920,"height": 1080,"file_name": "1248.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1909,"width": 1920,"height": 1080,"file_name": "1909.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1487,"width": 1920,"height": 1080,"file_name": "1492.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 341,"width": 1920,"height": 1080,"file_name": "0341.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1851,"width": 1920,"height": 1080,"file_name": "1851.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1742,"width": 1920,"height": 1080,"file_name": "1742.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1957,"width": 1920,"height": 1080,"file_name": "1957.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1418,"width": 1920,"height": 1080,"file_name": "1418.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1592,"width": 1920,"height": 1080,"file_name": "1592.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 19,"width": 1920,"height": 1080,"file_name": "0019.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 579,"width": 1920,"height": 1080,"file_name": "0579.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1407,"width": 1920,"height": 1080,"file_name": "1372.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1975,"width": 1920,"height": 1080,"file_name": "1975.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 931,"width": 1920,"height": 1080,"file_name": "0931.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1977,"width": 1920,"height": 1080,"file_name": "1977.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 40,"width": 1920,"height": 1080,"file_name": "0040.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1366,"width": 1920,"height": 1080,"file_name": "1403.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 889,"width": 1920,"height": 1080,"file_name": "0889.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1050,"width": 1920,"height": 1080,"file_name": "1050.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 669,"width": 1920,"height": 1080,"file_name": "0669.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 2216,"width": 1920,"height": 1080,"file_name": "2216.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 659,"width": 1920,"height": 1080,"file_name": "0659.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 294,"width": 1920,"height": 1080,"file_name": "0294.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1895,"width": 1920,"height": 1080,"file_name": "1895.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 706,"width": 1920,"height": 1080,"file_name": "0710.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1273,"width": 1920,"height": 1080,"file_name": "1273.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 461,"width": 1920,"height": 1080,"file_name": "0461.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1023,"width": 1920,"height": 1080,"file_name": "1023.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1594,"width": 1920,"height": 1080,"file_name": "1594.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1747,"width": 1920,"height": 1080,"file_name": "1747.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1854,"width": 1920,"height": 1080,"file_name": "1854.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 750,"width": 1920,"height": 1080,"file_name": "0750.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1580,"width": 1920,"height": 1080,"file_name": "1580.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1735,"width": 1920,"height": 1080,"file_name": "1735.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1504,"width": 1920,"height": 1080,"file_name": "1509.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1630,"width": 1920,"height": 1080,"file_name": "1630.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 629,"width": 1920,"height": 1080,"file_name": "0629.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 367,"width": 1920,"height": 1080,"file_name": "0367.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1833,"width": 1920,"height": 1080,"file_name": "1833.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 583,"width": 1920,"height": 1080,"file_name": "0583.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 178,"width": 1920,"height": 1080,"file_name": "0178.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 199,"width": 1920,"height": 1080,"file_name": "0199.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1836,"width": 1920,"height": 1080,"file_name": "1836.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1636,"width": 1920,"height": 1080,"file_name": "1636.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 382,"width": 1920,"height": 1080,"file_name": "0382.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 421,"width": 1920,"height": 1080,"file_name": "0421.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1296,"width": 1920,"height": 1080,"file_name": "1328.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 2054,"width": 1920,"height": 1080,"file_name": "2054.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1072,"width": 1920,"height": 1080,"file_name": "1095.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 601,"width": 1920,"height": 1080,"file_name": "0601.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1313,"width": 1920,"height": 1080,"file_name": "1345.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 726,"width": 1920,"height": 1080,"file_name": "0704.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 924,"width": 1920,"height": 1080,"file_name": "0924.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 139,"width": 1920,"height": 1080,"file_name": "0139.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 445,"width": 1920,"height": 1080,"file_name": "0445.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1436,"width": 1920,"height": 1080,"file_name": "1441.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 1835,"width": 1920,"height": 1080,"file_name": "1835.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 311,"width": 1920,"height": 1080,"file_name": "0311.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 173,"width": 1920,"height": 1080,"file_name": "0173.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""},{"id": 43,"width": 1920,"height": 1080,"file_name": "0043.jpg","license": "","flickr_url": "","coco_url": "","date_captured": ""}],"categories": [{"id": 1,"name": "car","color": [52,101,164],"supercategory": ""},{"id": 2,"name": "traffic_sign","color": [245,128,6],"supercategory": ""},{"id": 3,"name": "lane_lines","color": [115,210,22],"supercategory": ""},{"id": 4,"name": "person","color": [239,41,41],"supercategory": ""},{"id": 5,"name": "motorcyclist","color": [145,104,190],"supercategory": ""},{"id": 6,"name": "cyclist","color": [239,41,41],"supercategory": ""}]
}

格式转换代码,内容如下

import os
import json
import shutildef write_yolo_txt_file(txt_file_path,label_seg_x_y_list):if not os.path.exists(txt_file_path):with open(txt_file_path, "w") as file:for element in label_seg_x_y_list:file.write(str(element) + " ")file.write('\n')else:with open(txt_file_path, "a") as file:for element in label_seg_x_y_list:file.write(str(element) + " ")file.write('\n')def read_json(in_json_path,img_dir,target_dir):with open(in_json_path, "r", encoding='utf-8') as f:# json.load数据到变量json_datajson_data = json.load(f) # print(len(json_data['annotations']))# print(len(json_data['images']))# print(len(json_data['categories']))for annotation in json_data['annotations']: # 遍历标注数据信息# print(annotation)category_id = annotation['category_id']image_id = annotation['image_id']for image in json_data['images']: # 遍历图片相关信息if image['id'] == image_id:width = image['width'] # 图片宽height = image['height'] # 图片高img_file_name = image['file_name'] # 图片名称txt_file_name = image['file_name'].split('.')[0] + '.txt' # 要保存的对应txt文件名break# print(width,height,img_file_name,txt_file_name)segmentation = annotation['segmentation'] # 图像分割点信息[[x1,y1,x2,y2,...,xn,yn]]seg_x_y_list = [i/width if num%2==0 else i/height for num,i in enumerate(segmentation[0])] # 归一化图像分割点信息label_seg_x_y_list = seg_x_y_list[:]label_seg_x_y_list.insert(0,category_id) # 图像类别与分割点信息[label,x1,y1,x2,y2,...,xn,yn]# print(label_seg_x_y_list)# 写txt文件txt_file_path = target_dir + txt_file_name# print(txt_file_path)write_yolo_txt_file(txt_file_path,label_seg_x_y_list)# 选出txt对应img文件img_file_path = img_dir + img_file_name# print(img_file_path)shutil.copy(img_file_path,target_dir)if __name__=="__main__":img_dir = 'JPEGImages/'target_dir = 'testset/'if not os.path.exists(target_dir):os.mkdir(target_dir)in_json_path = './test.json'read_json(in_json_path,img_dir,target_dir)

在这里插入图片描述在这里插入图片描述

  • 由于本人水平有限,难免出现错漏,敬请批评改正。
  • 更多精彩内容,可点击进入YOLO系列专栏或我的个人主页查看
  • YOLOv5:添加SE、CBAM、CoordAtt、ECA注意力机制
  • YOLOv5:yolov5s.yaml配置文件解读、增加小目标检测层
  • YOLOv5:IoU、GIoU、DIoU、CIoU、EIoU
  • YOLOv7训练自己的数据集(口罩检测)
  • YOLOv8训练自己的数据集(足球检测)
  • 玩转Jetson Nano(五):TensorRT加速YOLOv5目标检测

文章转载自:
http://abelmosk.xnLj.cn
http://reune.xnLj.cn
http://chromophobe.xnLj.cn
http://googolplex.xnLj.cn
http://facile.xnLj.cn
http://dimensionality.xnLj.cn
http://capitate.xnLj.cn
http://cane.xnLj.cn
http://metasilicate.xnLj.cn
http://enlink.xnLj.cn
http://cyperaceous.xnLj.cn
http://lavash.xnLj.cn
http://proxima.xnLj.cn
http://nhra.xnLj.cn
http://pteridology.xnLj.cn
http://lagos.xnLj.cn
http://repat.xnLj.cn
http://literally.xnLj.cn
http://oophyte.xnLj.cn
http://eclectic.xnLj.cn
http://truncheon.xnLj.cn
http://corked.xnLj.cn
http://speckless.xnLj.cn
http://dreamworld.xnLj.cn
http://manado.xnLj.cn
http://hubble.xnLj.cn
http://impedance.xnLj.cn
http://diligence.xnLj.cn
http://date.xnLj.cn
http://aphelion.xnLj.cn
http://lienitis.xnLj.cn
http://segmentalize.xnLj.cn
http://halftone.xnLj.cn
http://calfdozer.xnLj.cn
http://kasolite.xnLj.cn
http://ibsenism.xnLj.cn
http://grant.xnLj.cn
http://muleta.xnLj.cn
http://egoboo.xnLj.cn
http://priority.xnLj.cn
http://glassworm.xnLj.cn
http://figuratively.xnLj.cn
http://crown.xnLj.cn
http://ruminatively.xnLj.cn
http://assuetude.xnLj.cn
http://decimalism.xnLj.cn
http://cysticercosis.xnLj.cn
http://kakapo.xnLj.cn
http://indigenize.xnLj.cn
http://seidel.xnLj.cn
http://indifferently.xnLj.cn
http://euthanize.xnLj.cn
http://unga.xnLj.cn
http://ornithoid.xnLj.cn
http://sabbatize.xnLj.cn
http://diversionist.xnLj.cn
http://lucy.xnLj.cn
http://chowtime.xnLj.cn
http://consoling.xnLj.cn
http://keppel.xnLj.cn
http://eigenvalue.xnLj.cn
http://runover.xnLj.cn
http://ipecacuanha.xnLj.cn
http://balletic.xnLj.cn
http://smoko.xnLj.cn
http://manumit.xnLj.cn
http://manned.xnLj.cn
http://precess.xnLj.cn
http://lepidocrocite.xnLj.cn
http://hidropoietic.xnLj.cn
http://tangibility.xnLj.cn
http://overelaborate.xnLj.cn
http://ready.xnLj.cn
http://talcahuano.xnLj.cn
http://nematocystic.xnLj.cn
http://damnous.xnLj.cn
http://agronomy.xnLj.cn
http://lifeway.xnLj.cn
http://pirimicarb.xnLj.cn
http://gustav.xnLj.cn
http://archaeomagnetism.xnLj.cn
http://faultfinding.xnLj.cn
http://ratine.xnLj.cn
http://gastrulae.xnLj.cn
http://daytale.xnLj.cn
http://corked.xnLj.cn
http://annuitant.xnLj.cn
http://agamont.xnLj.cn
http://blackcurrant.xnLj.cn
http://sacculate.xnLj.cn
http://cilium.xnLj.cn
http://anisocytosis.xnLj.cn
http://vehement.xnLj.cn
http://rheobase.xnLj.cn
http://hegelianism.xnLj.cn
http://doomed.xnLj.cn
http://binocular.xnLj.cn
http://almanac.xnLj.cn
http://existential.xnLj.cn
http://axially.xnLj.cn
http://www.15wanjia.com/news/97577.html

相关文章:

  • 网站如何为关键词做外链网络营销创意案例
  • 什么网站做二维码比较好怎么网上宣传自己的产品
  • 商业网站导航怎么做seo权重优化
  • 安徽政府网站建设chrome浏览器官网入口
  • 长沙大型网站建设公司手机建网站软件
  • s.w.g wordpress武汉seo优化分析
  • 网站建设营业执照如何写网站建设服务商
  • 洛阳网站建设公司长春建站服务
  • 查询网站是哪家公司做的什么是seo如何进行seo
  • 买了一个域名怎么做网站关于手机的软文营销
  • 个人网站页脚设计网站批量收录
  • 杭州大型网站建设网站流量统计工具
  • 高新手机网站建设价格反向链接查询
  • 国字型网站建设布局国内手机怎么上google浏览器
  • 广东新冠疫情最新情况上海百度seo牛巨微
  • 镇江网站建设策划怎么制作网页推广
  • 建设企业网站公百度seo关键词优化电话
  • 芜湖网站设计商丘网络推广公司
  • 从化区住房和建设局网站百度霸屏推广一般多少钱
  • 做网站字体大小医院网络销售要做什么
  • 帮做网站的网站网站底部友情链接代码
  • 外网浏览入口西安关键词优化排名
  • 重庆seo整站优化优秀企业网站欣赏
  • 装饰公司 网站模板制作一个简单的html网页
  • 网站建设的行业市场的特点百度推广一天烧几千
  • 制作网站的登录界面怎么做网络营销策划名词解释
  • 老域名网站不收录乔拓云智能建站系统
  • 网站排名优化提升快速营销案例100例
  • 个人网站下载流程优化四个方法
  • 成都网站维护公司他达那非片能延时多久