rakib72642's picture
ready init project
08ec965
import PIL.Image as Image
def resize_pil(I, patch_size=16) :
w, h = I.size
new_w, new_h = int(round(w / patch_size)) * patch_size, int(round(h / patch_size)) * patch_size
feat_w, feat_h = new_w // patch_size, new_h // patch_size
return I.resize((new_w, new_h), resample=Image.LANCZOS), w, h, feat_w, feat_h