修补
patchfy可以按给定的补丁单元大小将图像拆分为可重叠的小补丁,并将补丁合并为原始图像。
该库提供两个功能: patchify和unpatchify 。
安装
pip install patchify
用法
将图像分割为补丁
patchify(image_to_patch, patch_shape, step=1)
2D图像:
#This will split the image into small images of shape [3,3]
patches = patchify ( image , ( 3 , 3 ), step = 1 )
3D图片:
#This will split the image into small images of shape [3,3,3]
patches = patchify ( image , ( 3 , 3 , 3 ), ste
1