Skip to main content
语言: 🇨🇳 🇺🇸

«ZTransforms»是一个图像数据增强代码库

基于pytorch/vision实现架构,添加albumentations后端

  • 输入图像格式:numpy ndarray
  • 数据类型:uint8
  • 通道排列顺序:rgb

关键依赖版本:

  • pytorch/vision: c1f85d34761d86db21b6b9323102390834267c9b
  • albumentations-team/albumentations: v0.5.2

内容列表

背景

PyTorch提供了官方数据增强实现:transforms。该模块基于PIL进行数据增强操作,其优缺点如下:

  • 优点:
    1. 简洁清晰的数据架构
    2. 简单易懂的数据处理流
    3. 完善的文档介绍
  • 缺点:
    1. 基于PIL后端,提供的图像增强功能有限
    2. 基于PIL后端,相较于其他库的执行速度慢

针对于执行速度问题,torchvision也意识到了这一点,从0.8.0开始进行了改进

Prior to v0.8.0, transforms in torchvision have traditionally been PIL-centric and presented multiple limitations due to that. Now, since v0.8.0, transforms implementations are Tensor and PIL compatible and we can achieve the following new features:

transform multi-band torch tensor images (with more than 3-4 channels)
torchscript transforms together with your model for deployment
support for GPU acceleration
batched transformation such as for videos
read and decode data directly as torch tensor with torchscript support (for PNG and JPEG image formats)
  • 一方面通过新的后端Pillow-SIMD来提高PIL的执行速度;
  • 另一方面添加PyTorch后端来实现GPU加速

在网上找到两个数据增强库,除了分类数据增强外还提供了检测/分割数据增强:

上述两个数据增强库均实现了类似于transforms的数据流操作方式。不过相对而言,个人还是最喜欢官方的实现和使用方式,所以新建这个代码库,基于transforms,在原有功能中添加albumentation后端实现,同时添加新的数据增强操作(如果albumentation未实现,就使用imgaug实现)

安装

$ pip install ztransforms

使用

# import torchvision.transforms as transforms
import ztransforms.cls as transforms
...
...

主要维护人员

  • zhujian - Initial work - zjykzj

致谢

@Article{info11020125,
    AUTHOR = {Buslaev, Alexander and Iglovikov, Vladimir I. and Khvedchenya, Eugene and Parinov, Alex and Druzhinin, Mikhail and Kalinin, Alexandr A.},
    TITLE = {Albumentations: Fast and Flexible Image Augmentations},
    JOURNAL = {Information},
    VOLUME = {11},
    YEAR = {2020},
    NUMBER = {2},
    ARTICLE-NUMBER = {125},
    URL = {https://www.mdpi.com/2078-2489/11/2/125},
    ISSN = {2078-2489},
    DOI = {10.3390/info11020125}
}

@misc{imgaug,
  author = {Jung, Alexander B.
            and Wada, Kentaro
            and Crall, Jon
            and Tanaka, Satoshi
            and Graving, Jake
            and Reinders, Christoph
            and Yadav, Sarthak
            and Banerjee, Joy
            and Vecsei, Gábor
            and Kraft, Adam
            and Rui, Zheng
            and Borovec, Jirka
            and Vallentin, Christian
            and Zhydenko, Semen
            and Pfeiffer, Kilian
            and Cook, Ben
            and Fernández, Ismael
            and De Rainville, François-Michel
            and Weng, Chi-Hung
            and Ayala-Acevedo, Abner
            and Meudec, Raphael
            and Laporte, Matias
            and others},
  title = {{imgaug}},
  howpublished = {\url{https://github.com/aleju/imgaug}},
  year = {2020},
  note = {Online; accessed 01-Feb-2020}
}

参与贡献方式

欢迎任何人的参与!打开issue或提交合并请求。

注意:

许可证

Apache License 2.0 © 2021 zjykzj

Metadata

Release files for ztransforms 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ztransforms 0.2.0
File Size Uploaded Provenance
ztransforms-0.2.0.tar.gz 98.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ztransforms 0.2.0
File Interpreter ABI Platform
ztransforms-0.2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 208.3 kB

Release files / ztransforms-0.2.0.tar.gz

Download URL ztransforms-0.2.0.tar.gz
Size 98.3 kB
Tags Source
SHA-256 checksum
How to use checksums
916d5e16d9ceb54b6f44b16da56d8d0110d1a494bdfe01a2f5989de06a59fd69
BLAKE2b-256 checksum
How to use checksums
63304f4db7d8e19338d4a824759865cdccc92ab19cfe4a6f347c8ac53d0259c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2.post20210110 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

Release files / ztransforms-0.2.0-py2.py3-none-any.whl

Download URL ztransforms-0.2.0-py2.py3-none-any.whl
Size 110.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7ded83342480b919c9a293efe6271ad3dfa032d889a1500b8fa0bc66075453b8
BLAKE2b-256 checksum
How to use checksums
8eb742e90976b640833f2e4f9eacc31562c30e8e974d10472df7baa838a509b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2.post20210110 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

Security for ztransforms 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page