def preprocess_yolox(img: ndarray, input_size: Tuple, swap: Tuple = (2, 0, 1)) -> Tuple[ndarray, float]:
    """prepares an image for yolox inference

    Args:
        img (ndarray): 
        input_size (Tuple): 
        swap (Tuple, optional): . Defaults to (2, 0, 1).

    Returns:
        Tuple[ndarray, float]: 
    """
    if len(img.shape) == 3:
        padded_img = np.ones((input_size[0], input_size[1], 3), dtype=np.uint8) * 114
    else:
        padded_img = np.ones(input_size, dtype=np.uint8) * 114

    r = min(input_size[0] / img.shape[0], input_size[1] / img.shape[1])
    resized_img = cv2.resize(
        img,
        (int(img.shape[1] * r), int(img.shape[0] * r)),
        interpolation=cv2.INTER_LINEAR,
    ).astype(np.uint8)
    padded_img[: int(img.shape[0] * r), : int(img.shape[1] * r)] = resized_img

    padded_img = padded_img.transpose(swap)
    padded_img = np.ascontiguousarray(padded_img, dtype=np.float32)
    
    return padded_img, r
prepares an image for yolox inference

    Args:
        img (ndarray): 
        input_size (Tuple): 
        swap (Tuple, optional): . Defaults to (2, 0, 1).

    Returns:
        Tuple[ndarray, float]: 
    
src/marqo/s2_inference/processing/yolox_utils.py