Skip to main content

Some tools for AI model training and inference.

Project description

tools_zyVersion MIT License

此工具包旨在给AI工作者提供一把趁手的工具,尽量简化非核心的工作。
其中包含深度学习模型过程中可能会用到的一些工具,比如数据整理、格式转换、划分数据集等。

因此也要注意,其中某些函数可能并没有提供过多自由度,如果需要,请自行修改。

安装

$ pip install tools-zy

使用

含有的功能示例如下:

import tools_zy as tz

# 复制、移动文件夹中以.bmp结尾的文件。(还支持指定文件名,支持递归操作)
tz.copy_file("/home/org_folder", "/home/new_folder", format=".bmp")
tz.move_file("/home/org_folder", "/home/new_folder", format=".bmp")

# 获取(复制、移动)文件夹中以.bmp结尾的一些随机文件。
tz.copy_some_random_files("/home/org_folder", "/home/new_folder", 1000, format='.bmp')
tz.move_some_random_files("/home/org_folder", "/home/new_folder", 1000, format='.bmp')

# 划分分类数据集
img_folder = r"/home/classify/rawData"  # 包含n个名称为数字序列的文件夹
out_folder = r"/home/classify/splitData"  # 
tz.split_classifid_images(img_folder, out_folder, (0.8, 0.2, 0), format=".bmp")
# 划分lablmes数据集 (划分图片和json文件到train, val, test文件夹)
labelme_folder = r"D:\Zhiyuan\pics_get\keypoints\20241118"
data_folder = tz.split_labelmes(labelme_folder, ratio=(0.85, 0.1, 0.05), format=".bmp")


# 将labelme的json格式转化为coco格式,要求图片和json文件名相同且在同一文件夹下
labelme_json_folder = r'D:\Zhiyuan\pics_get\keypoints\keypoints\20241030' 
coco_json_path = r'D:\Zhiyuan\pics_get\keypoints\keypoints\20241030.json'
categories_json_file = r"D:\Zhiyuan\code\tz\categories_person.json"
tz.labelmes2coco(labelme_json_folder, coco_json_path, categories_json_file, bbox=[1, 1, 511, 1023])
coco_json_path = r'D:\Zhiyuan\pics_get\keypoints\keypoints\20241121.json'
labelme_json_folder = r'D:\Zhiyuan\pics_get\keypoints\keypoints\20241121'
tz.coco2labelmes(coco_json_path, labelme_json_folder)

labelme标注文件连续操作:划分labelme数据集->转化为coco格式

labelme_folder = r"D:\Zhiyuan\pics_get\keypoints\20241118"
splited_labelmes_folder = tz.split_labelmes(labelme_folder, ratio=(0.85, 0.1, 0.05), format='.bmp')
categories_json_file = r"D:\Zhiyuan\code\tz\categories_person.json"
tz.splited_labelmes2cocos(splited_labelmes_folder, categories_json_file=categories_json_file)

License

MIT

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

tools_zy-0.1.7.10.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

tools_zy-0.1.7.10-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file tools_zy-0.1.7.10.tar.gz.

File metadata

  • Download URL: tools_zy-0.1.7.10.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for tools_zy-0.1.7.10.tar.gz
Algorithm Hash digest
SHA256 23b0b9c6eef3f15074beee44997454feb30c17a4ed2a592494c3de78ec8af43d
MD5 2029e4d98027996b0a443122904fff6a
BLAKE2b-256 12eefb84e1efc4d6962bd29e7ba231f0f31a71321d8239c6fbc13967741b9408

See more details on using hashes here.

File details

Details for the file tools_zy-0.1.7.10-py3-none-any.whl.

File metadata

  • Download URL: tools_zy-0.1.7.10-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for tools_zy-0.1.7.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ae7b915189a22e4be3e5bb42d6084ba9fa673934c101200cf1fd0cd7d5f982b4
MD5 a59a9d4a5af589a990fd53ed1c9c0918
BLAKE2b-256 5634bd93b29e3ec70b8ab14f50246bb4a2874ac2a6efeed4fc3f9a719f170eaa

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