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

备案信息修改网站名称肇庆疫情最新情况

备案信息修改网站名称,肇庆疫情最新情况,织梦搭建网站,惠州seo关键词排名一、 JSON格式转Txt import json import osjson_path rC:\Users\PC\Desktop\2000张标注完-json文件\Json # json文件路径 txt_path rC:\Users\PC\Desktop\2000张标注完-json文件\Txt # txt文本文件路径 # 关键点数组(这里我写的是人体的7个关键点,大…

一、 JSON格式转Txt

import json
import osjson_path = r'C:\Users\PC\Desktop\2000张标注完-json文件\Json'  # json文件路径
txt_path = r'C:\Users\PC\Desktop\2000张标注完-json文件\Txt'  # txt文本文件路径
# 关键点数组(这里我写的是人体的7个关键点,大家可以改成自己标注顺序的关键点数组)
pointsArr = ["yading", "jiejian1", "jiejian2", "caizhai", "jiejian3","yezhongxin","jiejian4",]# 坐标归一化,返回中心点坐标和宽高
def coordinates2yolo(xmin, ymin, xmax, ymax, img_w, img_h):x = abs(xmin + xmax) / (2.0 * img_w)y = abs(ymin + ymax) / (2.0 * img_h)w = abs(xmax - xmin) / (1.0 * img_w)h = abs(ymax - ymin) / (1.0 * img_h)return x, y, w, hdef writeJson(rootpath, rootpath1, filename):path = os.path.join(rootpath, filename + '.json')count = 0  # 记录一张图片中人数的多少index = 0  # data索引,用于区分json文件中的label值with open(path) as f:# 读取json格式文件并获取相应信息data = json.load(f)imageHeight = data['imageHeight']imageWidth = data['imageWidth']data = data['shapes']length = len(data)# print('length', length)# 遍历json文件,用变量count记录 data[i]['label']=’类别名‘ 的次数,以此说明图片中有几个人for i in range(0, length):# 类别名换成自己的类别,当有多个类别时,用关键字or进行连接# if data[i]['label'] == '类别名1' or data[i]['label'] == '类别名2'。。。if data[i]['label'] == 'nenshao':count += 1# 将json文件信息写入txt文本文件中file = open(os.path.join(rootpath1, filename + '.txt'), mode='w')for j in range(0, count):# 在txt文本文件中写入类别id、目标框中心坐标以及图片宽高file.write(str(data[index]['group_id']))file.write(" ")points = data[index]['points']xmin = points[0][0]ymin = points[0][1]xmax = points[1][0]ymax = points[1][1]x, y, w, h = coordinates2yolo(xmin, ymin, xmax, ymax, imageWidth, imageHeight)file.write(str(round(x, 6)))file.write(" ")file.write(str(round(y, 6)))file.write(" ")file.write(str(round(w, 6)))file.write(" ")file.write(str(round(h, 6)))file.write(" ")index += 1# 在txt文本文件中写入关键点坐标与对应id值for point in pointsArr:# print(index)if index < length:if data[index]['label'] == point:point = data[index]['points']  # 获取关键点的坐标值file.write(str(round(point[0][0] / imageWidth, 6)))file.write(" ")file.write(str(round(point[0][1] / imageHeight, 6)))file.write(" ")# data[index]['group_id'] == 1,表名为被遮挡的关键点,在txt文档中写入1if data[index]['group_id'] == 1:file.write('1.000000')file.write(" ")# data[index]['group_id'] != 1,表名为正常标记的关键点,在txt文档中写入2else:file.write('2.000000')file.write(" ")index += 1# 若data[index]['label'] != point,则写入(0, 0, 0),前两个代表坐标,最后一个‘0’代表此关键点未被标记else:file.write('0.000000')file.write(" ")file.write('0.000000')file.write(" ")file.write('0.000000')file.write(" ")else:file.write('0.000000')file.write(" ")file.write('0.000000')file.write(" ")file.write('0.000000')file.write(" ")file.write('\n')# 读取path路径中的文件
filenames = os.listdir(json_path)
for item in filenames:# 以'.'为标志分割获取文件名filename = item.split('.')[0]print(filename)writeJson(json_path, txt_path, filename)

二、本人数据标注格式

使用软件为labelme

框为nenshao(ID:0)

第一个点为yading

第二个点为jiejian1

第三个点为jiejian2

第四个点为caizhai

第五个点为jiejian3

第六个点为yezhongxin

第七个点为jiejian4

在图像内且被遮挡住的点(ID:1)

示例:

http://www.dtcms.com/wzjs/173958.html

相关文章:

  • wordpress 悬浮广告宁波谷歌seo
  • 广州seo网站排名临沂seo整站优化厂家
  • 新民企业自助建站怎么查搜索关键词排名
  • 西藏建设工程消防备案网站谷歌首页
  • 全国住房城乡建设厅网站互联网营销做什么
  • 福田网络win7优化教程
  • 成都网站建设小程序网页设计与制作模板
  • 2016企业网站建设方案企业网站有哪些功能
  • 公众号做漫画网站最新热搜新闻
  • 提升学历的好处有哪些搜索引擎的优化方法
  • 高端网站欣赏网络营销的主要工作有哪些
  • wordpress 知名网站关键词林俊杰免费听
  • 文章收录网站苏州网站建设开发公司
  • 网站有备案需要什么手续西安网站外包
  • 知乎 做网站的公司 中企动力网络推广外包怎么接单
  • 陕西省医院网站建设管理专注网络营销推广公司
  • wordpress 编辑器修改北京seo案例
  • 论坛网站搭建手机百度搜索app
  • 深圳顶级做网站公司排名免费的推广网站
  • 新乡专业做网站网络营销的工具和方法
  • 实训做网站收获百度app打开
  • 免费网站建设 优帮云swot分析
  • xp 做网站服务器吗小游戏推广接单平台
  • 英文网站做翻译接单seo是什么职业做什么的
  • 免费做图片链接网站杭州关键词排名提升
  • wordpress edit_post_link搜索引擎优化的作用是什么
  • 做网站流程 优帮云专业搜索引擎seo公司
  • 网站建设画册网站seo哪家好
  • 药店怎么建设自己的网站百度网盘搜索引擎盘多多
  • 云南疫情最新消息今天又封了如何优化企业网站