Skip to main content

Implementation of torchvision-like based on albumentation

Project description

语言: 🇨🇳 🇺🇸

«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

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

ztransforms-0.2.0.tar.gz (98.3 kB view details)

Uploaded Source

Built Distribution

ztransforms-0.2.0-py2.py3-none-any.whl (110.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ztransforms-0.2.0.tar.gz.

File metadata

  • Download URL: ztransforms-0.2.0.tar.gz
  • Upload date:
  • Size: 98.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for ztransforms-0.2.0.tar.gz
Algorithm Hash digest
SHA256 916d5e16d9ceb54b6f44b16da56d8d0110d1a494bdfe01a2f5989de06a59fd69
MD5 305c3526a473d1ac8e2dbb7e99973f1e
BLAKE2b-256 63304f4db7d8e19338d4a824759865cdccc92ab19cfe4a6f347c8ac53d0259c6

See more details on using hashes here.

File details

Details for the file ztransforms-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: ztransforms-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 110.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for ztransforms-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7ded83342480b919c9a293efe6271ad3dfa032d889a1500b8fa0bc66075453b8
MD5 2106a3385cc1b560211add9bfb219273
BLAKE2b-256 8eb742e90976b640833f2e4f9eacc31562c30e8e974d10472df7baa838a509b4

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