python脚本制作dlib数据集
来源:互联网 发布:聊城气象数据 编辑:程序博客网 时间:2024/06/09 19:13
前提:你已经得到了预选框范围,来自动制作dlib数据集(xml),从而省去imglab花框过程
预选框文件内容格式(图片名,左上角x,左上角y,右下角x,右下角y),如:left_88.png 294 170 115 190
python脚本:
root_path="'/home/ubuntu/sotfware/dlib-18.16-new/examples/tiaotong/"k=open('a.xml','w')k.write("<?xml version='1.0' encoding='ISO-8859-1'?>")k.write("\n")k.write("<?xml-stylesheet type='text/xsl' href='image_metadata_stylesheet.xsl'?>")k.write("\n")k.write("<dataset>")k.write("\n")k.write("<name>imglab dataset</name>")k.write("\n")k.write("<comment>Created by imglab tool.</comment>")k.write("\n")k.write("<images>")k.write("\n")f=open('11.txt','r')c=[]c.append('0')for line in open('11.txt'): #line=f.readline() filename=line.split(' ')[0] left_top_x=line.split(' ')[2] left_top_y=line.split(' ')[1] width=line.split(' ')[3] height=line.split(' ')[4].strip() #print height if c[-1]==filename: k.write(" <box top='{0}' left='{1}' width='{2}' height='{3}'/>".format(left_top_x,left_top_y,width,height)) k.write("\n") else: if len(c)>1: k.write(" </image>") k.write("\n") k.write(" <image file={0}{1}'>".format(root_path,filename)) k.write("\n") k.write(" <box top='{0}' left='{1}' width='{2}' height='{3}'/>".format(left_top_x,left_top_y,width,height)) k.write("\n") c.append(filename)f.close()k.write(" </image>")k.write("\n")k.write("</images>")k.write("\n")k.write("</dataset>")k.close()
路径自行修改,执行该脚本,即可得到a.xml
阅读全文
0 0
- python脚本制作dlib数据集
- python脚本及exe制作
- 安装dlib python接口
- python dlib、opencv 配置
- python安装dlib
- python安装dlib
- python安装dlib失败
- python备份数据脚本
- python处理数据脚本
- python 安装dlib和boost
- 【Dlib+Python+Ubuntu】人脸landmark
- windows8下配置dlib(python)
- (win10/ubuntu)dlib-python安装
- Python-mysql 抽取数据 脚本
- Python 简单数据备份脚本
- 【详解】Python抓取数据脚本
- spark--python数据分析脚本
- 制作自己的python版本的类CIFAR10数据集
- 线性化与串行化比较
- C++编程题1——输入字符串,输出数字最小的值
- K最近邻算法(介绍)
- MATLAB-轨道分叉
- spring父子容器
- python脚本制作dlib数据集
- Java泛型
- php5.5新特性之yield理解
- 1035. 插入与归并
- Java经典面试题(其三)——JVM原理和调优
- 观察者模式
- shell基础
- 输入三个整数x,y,z,请把这三个数由大到小输出。(利用一维数组)
- JSP运行原理和九大内置对象