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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: Mtripix-0.0.10.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.10.tar.gz
Algorithm Hash digest
SHA256 f78e462fdcc7ac4391857c0482f6e63dc60cb5cb2b22398bcec5c0ef17c8f222
MD5 edce273ce12b6db21d7da2e92cd44e3f
BLAKE2b-256 240f9be8ed36b2d8db6549fde904db33809c80f190afb2ecc1cea94e1adad120

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Mtripix-0.0.10-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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 30a2c6882aa2681c936514af35c5683468ebefeb53409316b83b512e4ca88055
MD5 51bcf347f774ae079139067ede1db4cf
BLAKE2b-256 364cabedb289c35a5ad15695c73185783c5873a19aa4d4c59a2b49e27ca3e005

See more details on using hashes here.

Supported by

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