【Python】Pillow-SIMD:Pillow 加速版

Backto Python Index

SIMD 代表 single instruction, multiple data, 充分压榨多核(Intel) CPU 的性能. 常用的 CPU SIMD 指令集有
MMX, SSE-SSE4, AVX, AVX2, AVX512, NEON 等。

Pillow-SIMD 就是 应用 SIMD 加速的 Pillow,100% API cover, production ready。默认 SSE4 编译,提供 AVX2 支持。

已加速的常见操作:

Resize (convolution-based resampling): SSE4, AVX2
Gaussian and box blur: SSE4
Alpha composition: SSE4, AVX2
RGBA → RGBa (alpha premultiplication): SSE4, AVX2
RGBa → RGBA (division by alpha): SSE4, AVX2
RGB → L (grayscale): SSE4
3x3 and 5x5 kernel filters: SSE4, AVX2
Split and get_channel: SSE4

Pillow Performance 中可以看出,SIMD 优化后的操作,速度全面优于 OpenCV. 但是 OpenCV 毕竟是大哥大,全面、均衡、稳定。

安装

# must remove existed pillow first.
$ pip uninstall pillow
# install SSE4 version
$ pip install pillow-simd
# install AVX2 version
$ CC="cc -mavx2" pip install -U --force-reinstall pillow-simd
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值