contextnet/utils/utils.py
def WBF(keypoints, similarity, threshold, skip_threshold=0.0, conf_type='avg'):
    '''
    Weighted Boxes Fusion method for matching keypoints.

    Parameters
    ----------
    keypoints: np.array
        input keypoints.
    similarity: func
        the function to measure similariry between keypoints.
    threshold: float
        threshold for similarity.
    skip_threshold: float
        the threshold to skip keypoints with low confidence.
    conf_type: str
        type of confidence.
    Returns
    -------
    match_keypoints: np.array
        matched keypoints.
    '''
    match_keypoints = []
    filtered_keypoints = prefilter_boxes(keypoints, skip_threshold)
    for label in filtered_keypoints:
        points = filtered_keypoints[label]
        new_points = []
        weighted_points = []
        for j in range(0, len(points)):
            index, best_sim = find_matching_box(
                weighted_points, points[j], similarity, threshold)
            if index != -1:
                new_points[index].append(points[j])
                weighted_points[index] = get_weighted_box(
                    new_points[index], conf_type)
            else:
                new_points.append([points[j].copy()])
                weighted_points.append(points[j].copy())
        match_keypoints += weighted_points
    match_keypoints = np.stack(match_keypoints)
    return match_keypoints

    Weighted Boxes Fusion method for matching keypoints.

    Parameters
    ----------
    keypoints: np.array
        input keypoints.
    similarity: func
        the function to measure similariry between keypoints.
    threshold: float
        threshold for similarity.
    skip_threshold: float
        the threshold to skip keypoints with low confidence.
    conf_type: str
        type of confidence.
    Returns
    -------
    match_keypoints: np.array
        matched keypoints.
    
Weighted Boxes Fusion method for matching keypoints.
Parameters




Weighted Boxes Fusion method for matching keypoints . Parameters
def WBF(keypoints, similarity, threshold, skip_threshold=0.0, conf_type='avg'):
    match_keypoints = []
    filtered_keypoints = prefilter_boxes(keypoints, skip_threshold)
    for label in filtered_keypoints:
        points = filtered_keypoints[label]
        new_points = []
        weighted_points = []
        for j in range(0, len(points)):
            index, best_sim = find_matching_box(
                weighted_points, points[j], similarity, threshold)
            if index != -1:
                new_points[index].append(points[j])
                weighted_points[index] = get_weighted_box(
                    new_points[index], conf_type)
            else:
                new_points.append([points[j].copy()])
                weighted_points.append(points[j].copy())
        match_keypoints += weighted_points
    match_keypoints = np.stack(match_keypoints)
    return match_keypoints
def WBF ( keypoints , similarity , threshold , skip_threshold = 0.0 , conf_type = 'avg' ) : match_keypoints = [ ] filtered_keypoints = prefilter_boxes ( keypoints , skip_threshold ) for label in filtered_keypoints : points = filtered_keypoints [ label ] new_points = [ ] weighted_points = [ ] for j in range ( 0 , len ( points ) ) : index , best_sim = find_matching_box ( weighted_points , points [ j ] , similarity , threshold ) if index != - 1 : new_points [ index ] . append ( points [ j ] ) weighted_points [ index ] = get_weighted_box ( new_points [ index ] , conf_type ) else : new_points . append ( [ points [ j ] . copy ( ) ] ) weighted_points . append ( points [ j ] . copy ( ) ) match_keypoints += weighted_points match_keypoints = np . stack ( match_keypoints ) return match_keypoints
Weighted Boxes Fusion method for matching keypoints.
Weighted Boxes Fusion method for matching keypoints .
'''
    Weighted Boxes Fusion method for matching keypoints.

    Parameters
    ----------
    keypoints: np.array
        input keypoints.
    similarity: func
        the function to measure similariry between keypoints.
    threshold: float
        threshold for similarity.
    skip_threshold: float
        the threshold to skip keypoints with low confidence.
    conf_type: str
        type of confidence.
    Returns
    -------
    match_keypoints: np.array
        matched keypoints.
    '''
keypoints
similarity
threshold
skip_threshold
conf_type