"enable_center_crop" in eval_config for Image Classification and how to pre-process image to also enable center crop for inference in Triton?

For “enable_center_crop”, we firstly resize to (target_width + CROP_PADDING, target_height + CROP_PADDING). Will resize while keeping aspect ratio.

The crop_padding is 32 pixels.

For example, if an ori image has 640x480 resolution, i.e,
ori_img : 640x 480
target: 224x224

Keep ratio, ori_img will resize to 341x256

The left_corner = int(round(341/2)) - int(round(224/2)) = 58
The top_corner = int(round(256/2)) - int(round(224/2)) = 16

Then crop this 341x256 image to 224x224.

You can modify

def as_numpy(self, image):
    """Return a numpy array."""
    image = image.resize((self.w, self.h), Image.ANTIALIAS)

to

   def as_numpy(self, image):
    """Return a numpy array."""
    image = image.resize((341, 256), Image.ANTIALIAS)  
    image = image.crop((58,16,282,240))