语言:
🇨🇳
🇺🇸
基于pytorch/vision实现架构,添加albumentations后端
- 输入图像格式:
numpy ndarray - 数据类型:
uint8 - 通道排列顺序:
rgb
关键依赖版本:
pytorch/vision: c1f85d34761d86db21b6b9323102390834267c9balbumentations-team/albumentations: v0.5.2
PyTorch提供了官方数据增强实现:transforms。该模块基于PIL进行数据增强操作,其优缺点如下:
- 优点:
- 简洁清晰的数据架构
- 简单易懂的数据处理流
- 完善的文档介绍
- 缺点:
- 基于
PIL后端,提供的图像增强功能有限 - 基于
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加速
在网上找到两个数据增强库,除了分类数据增强外还提供了检测/分割数据增强:
- imgaug:其实现了更多的数据增强操作;
- albumentations:其在不同的后端(
pytorch/imgaug/opencv)中找出各自最快的增强函数(参考Benchmarking results)
上述两个数据增强库均实现了类似于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或提交合并请求。
注意:
GIT提交,请遵守Conventional Commits规范- 语义版本化,请遵守Semantic Versioning 2.0.0规范
README编写,请遵守standard-readme规范
Apache License 2.0 © 2021 zjykzj
