def calculate_distance_ratio(lmk: np.ndarray, idx1: int, idx2: int, idx3: int, idx4: int, eps: float = 1e-6) -> np.ndarray:
    """
    Calculate the ratio of the distance between two pairs of landmarks.

    Parameters:
    lmk (np.ndarray): Landmarks array of shape (B, N, 2).
    idx1, idx2, idx3, idx4 (int): Indices of the landmarks.
    eps (float): Small value to avoid division by zero.

    Returns:
    np.ndarray: Calculated distance ratio.
    """
    return (np.linalg.norm(lmk[:, idx1] - lmk[:, idx2], axis=1, keepdims=True) /
            (np.linalg.norm(lmk[:, idx3] - lmk[:, idx4], axis=1, keepdims=True) + eps))

    Calculate the ratio of the distance between two pairs of landmarks.

    Parameters:
    lmk (np.ndarray): Landmarks array of shape (B, N, 2).
    idx1, idx2, idx3, idx4 (int): Indices of the landmarks.
    eps (float): Small value to avoid division by zero.

    Returns:
    np.ndarray: Calculated distance ratio.
    
liveportrait/utils/retargeting_utils.py