api handle for data transform
Project description
Auchor
- 西安三重像素科技有限公司
- Xi'an Triple Pixel Technology Co.,
- @PIPIPINoBrain
- 联系方式:PIPIPINoBrain@163.com
Mtripix.Mutils.Mtrans(usage)
安装方式
pip install Mtripix
使用示例
import Mtripix.Mutils.Mtrans as Mt
idxs = [1,2,3]
labels = ["dog", "cat", "person"]
d = Mt.labels2dict(labels, idxs)
path_xml = "C:\Users\18829\Desktop\MTP\A.xml"
path_txt = "C:\Users\18829\Desktop\MTP\A1.txt"
Mt.xml2yoloobb(path_xml, path_txt, d)
updata
- 增加了语义分割的标签图像转换
- 增加了文件夹中标签的统计
Environment
- json
- numpy
- lxml
- PIL
- os
- PIL
Mtripix Function
Mtripix.Mutils(lists)
Mtripix.Mutils.Mtrans(lists)
- Mtripix.Mutils.Mtrans.labels2dict(labels, idxs) 功能: 生成namedict,标签与类别对应的字典
- Mtripix.Mutils.Mtrans.voc2yolo(path_xml, path_txt, namedict) 功能: labelme标注的xml格式转yolo格式(label, xc, yc, w, h)————相对值
- Mtripix.Mutils.Mtrans.json2yolo(path_json, path_txt, namedict, mode) 功能: labelimg标注的json格式转yolo检测格式(label, xc, yc, w, h)和分割格式(label, xy, xy, xy, xy)————相对值
- Mtripix.Mutils.Mtrans.voc2dotaobb(path_xml, path_txt)功能: rolabelme和labelme标注的xml格式转DOTA数据格式,(xy,xy,xy,xy,label,difficulty)————绝对值
- Mtripix.Mutils.Mtrans.voc2yoloobb(path_xml, path_txt, namedict)功能: rolabelme和labelme标注的xml格式转yoloobb数据格式,(label, xy, xy, xy, xy)————相对值
- Mtripix.Mutils.Mtrans.yolo2voc(path_img, path_txt, path_xml, namedict) 功能: 转yolo格式(label, xc, yc, w, h)转labelme标注的xml格式————绝对值**
- Mtripix.Mutils.Mtrans.labelsCheck(path, format) 功能: 计算当前标签文件夹中,各个标签的个数**
- Mtripix.Mutils.Mtrans.json2mask_sem(path_json, path_mask, namedict) 功能: labelme标注的json文件转化为分割图像标签,返回标签灰度图像**
Mtripix.Mutils.Mtrans(intrudction)
Mtripix.Mutils.Mtrans.labels2dict(labels, idxs)
@input:
- labels(list/tuple): 标签名 里边都是str
- idxs(list/tuple): 类别名 里边都是str
@return:
- namedict(dict) 标签与类别对应的字典
Mtripix.Mutils.Mtrans.voc2yolo(path_xml, path_txt, namedict)
@input:
- path_xml(str): xml文件地址
- path_txt(str): 生成的yolo的txt地址
- namedict(dict): 标签和类别对应的字典
@return:
- 0
Mtripix.Mutils.Mtrans.json2yolo(path_json, path_txt, namedict, mode)
@input:
- path_json(str): json文件地址
- path_txt(str): 生成的yolo的txt地址
- namedict(dict): 标签和类别对应的字典
- mode(str): 一共可填两种模式“detection”和“segmentation”, 分别对应yolo检测和分割的文件,默认是“detection”
@return:
- 0
Mtripix.Mutils.Mtrans.voc2dotaobb(path_xml, path_txt)
@input:
- pathxml(str): xml文件地址
- path_txt(str): 生成的DOTA的txt地址
@return:
- 0
Mtripix.Mutils.Mtrans.voc2yoloobb(path_xml, path_txt, namedict)
@input:
- path_xml(str): xml文件地址
- path_txt(str): 生成的yoloobb的txt地址
- namedict(dict): 标签和类别对应的字典
@return:
- 0
Mtripix.Mutils.Mtrans.yolo2voc(path_img, path_txt, path_xml, namedict)
@input:
- path_img(str): 图像地址
- path_txt(str): 图像的yolo格式txt地址
- path_xml(str): 生成的xml地址
- namedict(dict): 类别和标签对应的字典
@return:
- 0
Mtripix.Mutils.Mtrans.labelsCheck(path, format)
@input:
- path(str): 当前的标签的文件夹地址
- format: 需要统计的数据格式,有"voc","yolo"和”data“三种格式
@return:
- 输出字典, keys是当前的类别, value是当前文件夹中各类别出现的次数
Mtripix.Mutils.Mtrans.json2mask_sem(path_json, path_mask, namedict)
@input:
- path_json(str): labelme标注的语义分割json文件
- path_txt(str): 需要保存的8位标签伪图像,png格式
- namedict(dict): 类别和标签对应的字典
@return:
- 原图灰度图大小的分类特征图,类别为像素值,背景为0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Mtripix-0.0.7.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file Mtripix-0.0.7.tar.gz
.
File metadata
- Download URL: Mtripix-0.0.7.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb35024fa9914b09e1de2f1b8c7cb1547a1f11ac075b85b9994e1c0a678aa3a7 |
|
MD5 | 0bd7599f11502cee29f440fa01c36af3 |
|
BLAKE2b-256 | 11c050e3d91f90d776550cd44cf5f22dce1e51172ca2bb4cf36a7b3f38dde004 |
File details
Details for the file Mtripix-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: Mtripix-0.0.7-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5d870d476824e133bb3f7fac96dd2c685c7ced65611fb47d1941d6fa5bdcb29 |
|
MD5 | c6c7cc09fd062fd7e7f8fb2efa456932 |
|
BLAKE2b-256 | e18b8b12b200ed91c5df6eaf04bde0a58447103fd16914e571d796484499999f |