一/ 百度easydl数据标注 脚本

1 官方标注工具,链接如下,由lableme改进而形成

GitHub - Baidu-AIP/Easyyibiao

2 官网数据导入格式三种分别为:

布局如图所示

2.1json 通用格式 .json

{"labels": [{"y1": 579, "x2": 466, "x1": 328, "y2": 718, "name": "other","meta":{"points":[{"y": 718,"x": 400},{"y": 626,"x": 328},{"y": 579,"x": 393},{"y": 672,"x": 466}]}}]}

2.2 xml ,这个比较好扩展 object节点,复制增加即可

<?xml version="1.0" encoding="utf-8"?>
<annotation><filename>00036.jpg</filename><segmented>0</segmented><owner><name>Lmars, Wuhan University</name><flickrid>I do not know</flickrid></owner><folder>RSDS2016</folder><object><name>other</name><pose>Left</pose><truncated>1</truncated><difficult>0</difficult><quad><x1>400</x1><y1>718</y1><x2>328</x2><y2>626</y2><x3>393</x3><y3>579</y3><x4>466</x4><y4>672</y4></quad><bbox><x1>328</x1><y1>579</y1><x2>466</x2><y2>718</y2></bbox></object>
</annotation>

2.3 coco json

{"info": {"contributor": "nihao", "data_created": "2021", "version": "1.0", "year": 2021}, "licenses": "licenses", "image_nums": 1, "images": [{"file_name": "00036.jpg", "id": 1, "width": 1024, "height": 768}], "categories": [{"id": 1, "name": "other", "supercategory": "other"}], "annotations": [{"category_id": 1, "bbox":[328, 579, 138, 139],"area": 9430, "segmentation": [[400, 718, 328, 626, 393, 579, 466, 672]], "iscrowd": 0, "image_id": 1, "id": 1, "shape": "quad"}]}

3 接下来,通过程序自动生成xml文件

txt2xml.pyimport os
from lxml.etree import Element, SubElement, tostringdef txt_xml(img_name, txt_path, img_xml, xml_path):#读取txt的信息clas=[]imh, imw = 800, 800txt_img=os.path.join(txt_path,img_name)with open(txt_img,"r") as f:for line in f.readlines():line = line.strip('\n')list = line.split(" ")clas.append(list)       # [0, x1, y1, x2, y2]node_root = Element('annotation')node_folder = SubElement(node_root, 'folder')node_folder.text = '1'# filenamenode_filename = SubElement(node_root, 'filename')node_filename.text = img_name.split(".")[0]+".jpg"# pathnode_path = SubElement(node_root, 'path')node_path.text = str(txt_img).split('.')[0] + '.jpg'# sourcenode_source = SubElement(node_root, 'source')node_database = SubElement(node_source, 'database')node_database.text = 'Unknown'# size# node_size = SubElement(node_root, 'size')# node_width = SubElement(node_size, 'width')# node_width.text = str(imw)# node_height = SubElement(node_size, 'height')# node_height.text = str(imh)# node_depth = SubElement(node_size, 'depth')# node_depth.text = '3'# segmentednode_segmented = SubElement(node_root, 'segmented')node_segmented.text = '0'# objectfor i in range(len(clas)):node_object = SubElement(node_root, 'object')node_name = SubElement(node_object, 'name')node_name.text = 'other'node_pose=SubElement(node_object, 'pose')node_pose.text="Left"node_truncated=SubElement(node_object, 'truncated')node_truncated.text="1"node_difficult = SubElement(node_object, 'difficult')node_difficult.text = '0'# bndboxnode_bndbox = SubElement(node_object, 'quad')x1 = SubElement(node_bndbox, 'x1')x1.text = str(clas[i][1])y1 = SubElement(node_bndbox, 'y1')y1.text = str(clas[i][2])x2 = SubElement(node_bndbox, 'x2')x2.text = str(clas[i][3])y2 = SubElement(node_bndbox, 'y2')y2.text = str(clas[i][4])x3 = SubElement(node_bndbox, 'x3')x3.text = str(clas[i][5])y3 = SubElement(node_bndbox, 'y3')y3.text = str(clas[i][6])x4 = SubElement(node_bndbox, 'x4')x4.text = str(clas[i][7])y4 = SubElement(node_bndbox, 'y4')y4.text = str(clas[i][8])  xml = tostring(node_root, pretty_print=True)  # 格式化显示,该换行的换行img_newxml = os.path.join(xml_path, img_xml)file_object = open(img_newxml, 'wb')file_object.write(xml)file_object.close()if __name__ == "__main__":#标注文件夹所在位置txt_path=r"temp"#txt转化成xml格式后存放的文件夹xml_path=r"temp1"if not os.path.exists(xml_path):os.mkdir(xml_path)for img_name in os.listdir(txt_path):print(img_name)img_xml=img_name.split(".")[0]+".xml"txt_xml(img_name, txt_path, img_xml, xml_path)

最终效果图

参考 yolo图像检测数据集格式转换:xml 与 txt格式相互转换_uncle_ll的博客-CSDN博客_yolo数据集txt格式

二/ 利用PIL 模块生成相应的图片 字符图片

参考link :https://github.com/mpcabd/python-arabic-reshaper

https://github.com/MichalBusta/E2E-MLT

效果:

pip install --upgrade arabic-reshaper

conda install -c mpcabd arabic-reshaper

pip install --upgrade arabic-reshaper python-bidi pillow

代码

#产生阿拉伯文图片
import arabic_reshapertext_to_be_reshaped = '2023 06 14/2022 06 16'
text_to_be_reshaped1='JXG'
text_to_be_reshaped2='14 06 2023/16 06 2022 X21'reshaped_text = arabic_reshaper.reshape(text_to_be_reshaped)'''
At this stage the text is reshaped, all letters are in their correct form
based on their surroundings, but if you are going to print the text in a
left-to-right context, which usually happens in libraries/apps that do not
support Arabic and/or right-to-left text rendering, then you need to use
get_display from python-bidi.
Note that this is optional and depends on your usage of the reshaped text.
'''
from bidi.algorithm import get_display
bidi_text = get_display(reshaped_text)# At this stage the text in bidi_text can be easily rendered in any library
# that doesn't support Arabic and/or right-to-left, so use it as you'd use
# any other string. For example if you're using PIL.ImageDraw.text to draw
# text over an image you'd just use it like this...from PIL import Image, ImageDraw, ImageFont# We load Arial since it's a well known font that supports Arabic Unicode
# font = ImageFont.truetype('Arial', 40)
font = ImageFont.truetype('/PaddleOCR/StyleText/fonts/arabic.ttf', 50)
font1= ImageFont.truetype('PaddleOCR/StyleText/fonts/en_standard.ttf',40)
image = Image.new('RGBA', (800, 600), (255,255,255,0))
image_draw = ImageDraw.Draw(image)
image_draw.text((350,10), text_to_be_reshaped1, fill=(255,255,255,200), font=font1)
image_draw.text((10,10), bidi_text, fill=(255,255,255,200), font=font)
image_draw.text((10,70), text_to_be_reshaped2, fill=(255,255,255,200), font=font1)# image.show()
image.save("temp.png")

百度easydl数据标注相关推荐

  1. 《新闻联播》报道百度山西数据标注基地 培育新业态打开新就业空间

    人工智能通过培育新业态创造出更多的新就业方式,正在为中国稳就业作出重要贡献. 7月26日,央视<新闻联播>--"培育新业态 打开就业新空间"报道,全国城镇调查失业率实现 ...

  2. 基于百度EasyDL定制化图像识别平台的海洋鱼类识别方法

    [目的]鱼类识别对渔业资源的开发利用有着重要的意义.针对海底环境恶劣.拍摄环境亮度低.场景模糊的实际情况导致海底观测视频品质差,视频中的鱼类识别难的问题以及现有鱼类识别方法存在的鱼类标注数据集过少导致 ...

  3. @赛迪顾问拍了拍我:数据标注基地全国多点开花

    近日,国内权威咨询机构赛迪顾问发布<百度智能云人工智能基础数据产业基地项目价值评估报告>(以下简称报告).报告显示,作为 AI 新业态,发展人工智能基础数据服务产业对培育人工智能产业,推动 ...

  4. 基于JDBC从数据库中读取数据,在百度地图批量标注地点

    基于JDBC从数据库中读取数据,在百度地图批量标注地点 一.相关技术 JSP,JDBC,JSON,JS,百度地图API 二.基于JDBC从数据库读取数据 见"JSP基于JDBC操作MSSQL ...

  5. 从谷歌AutoML到百度EasyDL,AI大生产时代,调参师不再是刚需

    出品 | AI科技大本营 头图 | 付费下载于视觉中国 2018 年,Google Cloud 宣布将 AutoML 作为机器学习产品的一部分.至此,AutoML 开始进入大众的视野. 实际上,201 ...

  6. 如何获取高精度CV模型?快来试试百度EasyDL超大规模视觉预训练模型

    在深度学习领域,有一个名词正在被越来越频繁地得到关注:迁移学习.它相比效果表现好的监督学习来说,可以减去大量的枯燥标注过程,简单来说就是在大数据集训练的预训练模型上进行小数据集的迁移,以获得对新数据较 ...

  7. Paw 百度ai_直面落地!百度EasyDL产业智能创新大赛成果覆盖能源、交通、水利民生重业...

    物体检测模型实现高压线路隐患检测.图像分类实现短视频快速剪辑和量产.文本情感分类辅助潜在心理疾病患者自发检测.图片识别车辆轮轴数监管车辆载重--每一个创想都能简单快速实现,没有AI开发基础的小伙伴们也 ...

  8. 百度EasyDL深度学习实战营,免费教你转型AI工程师!

    新型冠状病毒的疫情动态牵动着每个人的心,在当下疫情控制阶段,AI技术的应用也正在为抗疫贡献自己的力量. 百度飞桨联合百度技术学院正式加推"EasyDL深度学习实战营"系列直播课,免 ...

  9. 如何通过大华sdk采集一帧图像?_EasyData解放数据标注员双手,采集清洗标注一站搞定...

    在AI模型开发中,数据准备往往占据了大量时间.经过长时间的调研与访问,我们发现用户常常会遇到以下问题: · 难以获取与场景数据匹配的训练数据.在具体业务场景中,模型的效果至关重要,我们往往会追求高精度 ...

最新文章

  1. 收藏!工作中Git使用实践和常用命令流程合集
  2. Asp.net中的两种刷新父窗体方法
  3. Tensorboard on Server
  4. 使用带有OAuth2的Web应用程序和使用JWT来调用API – WSO2 API Manager
  5. 【LeetCode笔记】85. 最大矩形(Java、单调栈)
  6. 笔记10:时时屏幕抓取小程序
  7. [LUOGU] P2024 食物链
  8. 关于sql多条件查询,但又不确定值的个数的方法。
  9. 组合体计算机绘图的实验原理,《机械制图及计算机绘图》实验教案.pdf
  10. css cursor 鼠标手势
  11. 机房怎么制作服务器,电信服务器机房服务器搬迁地网制作方法
  12. 手机黑圆点怎么打_输入法:外国人名字中间的点(实心小黑点)怎么打出来?...
  13. 易到网约车许可证到手,终于能卖个好价钱了
  14. Lock锁和ReentrantLock锁
  15. 49个python经典电子书
  16. 抖音安心购有假货吗?四川鹰迪
  17. java架构设计图,不止面试题,笔记源码统统都有
  18. 软件测试中的因果图法,判定表法场景法和正交表法
  19. MSTP+VRRP综合实验
  20. java字符串数组转数字数组_Java数字字符串如何转化为数字数组并且排序

热门文章

  1. 区块链开发之Metamask使用调研
  2. IDEA创建自己的xml类型文件
  3. python2和python3的区别
  4. python面向对象之面向对象三要素
  5. 玩游戏提升计算机内存不足,电脑内存不足怎么办?详细解决方案.
  6. 不只是CAD电子签名,设计院电子签章还要有这些!
  7. Unity 3D官方教程——Adventure Game学习记录
  8. CSS中如何让背景颜色半透明
  9. JS返回到上一页的三种方法
  10. Zookeeper连接异常 Got ping response for sessionid 2021-06-30