def pre_process(image: np.ndarray) -> np.ndarray:
        """Pre-process input image.

        Args:
            image (np.ndarray): Input image.

        Returns:
            np.ndarray: Pre-processed image with shape (N,C,H,W).
        """
        # Normalize numpy array to range [0, 1]
        if image.dtype != np.float32:
            image = image.astype(np.float32)
        if image.max() > 1.0:
            image /= 255.0

        if len(image.shape) == 3:
            image = np.expand_dims(image, axis=0)

        if image.shape[-1] == 3:
            image = image.transpose(0, 3, 1, 2)

        return image
Pre-process input image.

        Args:
            image (np.ndarray): Input image.

        Returns:
            np.ndarray: Pre-processed image with shape (N,C,H,W).
        
src/anomalib/deploy/inferencers/openvino_inferencer.py