python图像增强_【Tool】Augmentor和imgaug——python图像数据增强库

本文介绍了Python中的两个图像增强库:Augmentor和imgaug。Augmentor提供简单的图像增强操作,如旋转、裁剪等,而imgaug则支持更复杂的功能,包括对关键点和边界框的同步处理。在图像分割和检测任务中,imgaug常用于数据增强,能够处理边界框的移动、映射和IoU计算。
摘要由CSDN通过智能技术生成

Augmentor和imgaug——python图像数据增强库

Tags: ComputerVision Python

介绍两个图像增强库:Augmentor和imgaug,Augmentor使用比较简单,只有一些简单的操作。 imgaug实现的功能更多,可以对keypoint, bounding box同步处理,比如你现在由一些标记好的数据,只有同时对原始图片和标记信息同步处理,才能有更多的标记数据进行训练。我在segmentation和detection任务经常使用imgaug这个库。

Augmentor

http://augmentor.readthedocs.io/en/master/index.html

Augmentor 是管道化的图像增强库,每一个增强操作都是逐步叠加在图像上。此外对于输入的图像,可以选择按照一定的概率进行增强,比如只随机对一半图像进行旋转。

rotate(probability=0.5, max_left_rotation=5, max_right_rotation=10)

可以实现的操作有, rotate, crop, perspective skew(视角倾斜), elastic distortions(弹性变换), sheering(坐标轴倾斜), mirroring(镜像)

可以使用Augumentor.Pipeline()创建一个实例,调用各种方法向pipeline添加方法, status()可以显示当前pipeline的状态,在status中每个操作都有一个对应的index, remove_operation(index)移除一个操作, 最后调用sample(nums)得到nums个augument后的图像。

import Augmentor

p = Augmentor.Pipeline("/path/to/images/")

p.status()

p.remove_operation(0)

rotate

rotate() 旋转,非90度旋转会带来padding或者裁剪

rotate90()

rotate180()

rotate270()

rotate_random_90() 随机旋转,90, 180, 270

resize

crop

crop_centre()

crop_by_size()

crop_random()

sheer

+ sheer()

mirroring

flip_left_right()

flip_top_bottom()

flip_random()

elastic distortion

random_distortion()

Before

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值