Skip to main content

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

  • 0.0.7
  • 增加了语义分割的标签图像转换
  • 增加了文件夹中标签的统计
  • 0.0.8
  • 增加了文件夹图片计算均值和方差的代码
  • 修复了yolo2voc中空目标转换的bug,修复了未引用math的bug

Environment

  • import json
  • import os.path
  • import PIL
  • import imgviz
  • import numpy as np
  • import cv2
  • import lxml.etree as ET
  • import math
  • from lxml.etree import Element, SubElement, tostring, ElementTree

Mtripix Function

Mtripix.Mutils(lists)

Mtripix.Mutils.Mtrans(lists)

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:

  • count()输出字典, 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:

  • img(array): 原图灰度图大小的分类特征图,类别为像素值,背景为0

Mtripix.Mutils.Mtrans.compute_mean_and_std(path, format=1)

@input:

  • path(str): 图像存放的文件夹路径
  • format(int): 图片的类型 1 代表RGB, 2代表灰度图

@return:

  • 返回两个参数,文件夹下图片的均值,方差(量化后)
  • mean: 文件夹下图片的均值(量化后)
  • std: 文件夹下图片的方差(量化后)

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.9.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

Mtripix-0.0.9-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file Mtripix-0.0.9.tar.gz.

File metadata

  • Download URL: Mtripix-0.0.9.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.18

File hashes

Hashes for Mtripix-0.0.9.tar.gz
Algorithm Hash digest
SHA256 ab1ba524f311b8fb946a9f1c0bd5fb97457538b9631f27fc19626b58bcd993a6
MD5 22cdbf58646eabc26b73e14375260f82
BLAKE2b-256 0d8e3002459a52b0b28ffc46a3b9f11c25ff0f1366e7edc239f34ad7e2846350

See more details on using hashes here.

File details

Details for the file Mtripix-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: Mtripix-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.18

File hashes

Hashes for Mtripix-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 05390cef6ce671c5f6b702ceb83a6866fc3c8669665eba6c301183939137a1cf
MD5 af440a1bdd12cde0094babfb66ed55cd
BLAKE2b-256 56b11930cef657996732df06a09dd09a4109476f2f6b313eeac9441676466e3a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page