(box_a, box_b)
return inter / union
Compute the jaccard overlap of two sets of boxes.  The jaccard overlap
    is simply the intersection over union of two boxes.  Here we operate on
    ground truth boxes and default boxes.
    E.g.:
        A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B)
    Args:
        box_a: (tensor) Ground truth bounding boxes, Shape: [num_objects,4]
        box_b: (tensor) Prior boxes from priorbox layers, Shape: [num_priors,4]
    Return:
        jaccard overlap: (tensor) Shape: [box_a.size(0), box_b.size(0)]
Compute the jaccard overlap of two sets of boxes.  The jaccard overlap
    is simply the intersection over union of two boxes.  Here we operate on
    ground truth boxes and default boxes.
    E.g.:
        A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B)
    Args:
        box_a: (tensor) Ground truth bounding boxes, Shape: [num_objects,4]
        box_b: (tensor) Prior boxes from priorbox layers, Shape: [num_priors,4]
    Return:
        jaccard overlap: (tensor) Shape: [box_a.size(0), box_b.size(0)]
Compute the jaccard overlap of two sets of boxes . The jaccard overlap is simply the intersection over union of two boxes . Here we operate on ground truth boxes and default boxes . E . g . : A ∩ B / A ∪ B = A ∩ B / ( area ( A ) + area ( B ) - A ∩ B ) Args : box_a : ( tensor ) Ground truth bounding boxes Shape : [ num_objects 4 ] box_b : ( tensor ) Prior boxes from priorbox layers Shape : [ num_priors 4 ] Return : jaccard overlap : ( tensor ) Shape : [ box_a . size ( 0 ) box_b . size ( 0 ) ]
def jaccard(box_a, box_b):
    """Compute the jaccard overlap of two sets of boxes.  The jaccard overlap
    is simply the intersection over union of two boxes.  Here we operate on
    ground truth boxes and default boxes.
    E.g.:
        A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B)
    Args:
        box_a: (tensor) Ground truth bounding boxes, Shape: [num_objects,4]
        box_b: (tensor) Prior boxes from priorbox layers, Shape: [num_priors,4]
    Return:
        jaccard overlap: (tensor) Shape: [box_a.size(0), box_b.size(0)]
    """
    inter = intersect(box_a, box_b)
    area_a = ((box_a[:, 2]-box_a[:, 0]) *
              (box_a[:, 3]-box_a[:, 1])).unsqueeze(1).expand_as(inter)  # [A,B]
    area_b = ((box_b[:, 2]-box_b[:, 0]) *
              (box_b[:, 3]-box_b[:, 1])).unsqueeze(0).expand_as(inter)  # [A,B]
    union = area_a + area_b - inter
    return inter / union
def jaccard ( box_a , box_b ) : inter = intersect ( box_a , box_b ) area_a = ( ( box_a [ : , 2 ] - box_a [ : , 0 ] ) * ( box_a [ : , 3 ] - box_a [ : , 1 ] ) ) . unsqueeze ( 1 ) . expand_as ( inter ) # [A,B] area_b = ( ( box_b [ : , 2 ] - box_b [ : , 0 ] ) * ( box_b [ : , 3 ] - box_b [ : , 1 ] ) ) . unsqueeze ( 0 ) . expand_as ( inter ) # [A,B] union = area_a + area_b - inter return inter / union