import imutils import cv2 class AspectProcess: def __init__(self, width, height, inter=cv2.INTER_AREA): self.width= width self.height= height self.inter= inter def preprocess(self, image): h,w= image.shape[0:2] dh=0 dw=0 # Resize the smaller dimension and calculate the offset of the other dim # The offset is chosen such that a centre crop is formed if w