(labels, scores, bboxes,
                          glabels, gbboxes, gdifficults,
                          matching_threshold=0.5, scope=None)
Matching a collection of detected boxes with groundtruth values.
    Batched-inputs version.

    Args:
      rclasses, rscores, rbboxes: BxN(x4) Tensors. Detected objects, sorted by score;
      glabels, gbboxes: Groundtruth bounding boxes. May be zero padded, hence
        zero-class objects are ignored.
      matching_threshold: Threshold for a positive match.
    Return: Tuple or Dictionaries with:
       n_gbboxes: Scalar Tensor with number of groundtruth boxes (may difer from
         size because of zero padding).
       tp: (B, N)-shaped boolean Tensor containing with True Positives.
       fp: (B, N)-shaped boolean Tensor containing with False Positives.
Matching a collection of detected boxes with groundtruth values.
    Batched-inputs version.
Matching a collection of detected boxes with groundtruth values . Batched - inputs version .
def bboxes_matching_batch(labels, scores, bboxes,
                          glabels, gbboxes, gdifficults,
                          matching_threshold=0.5, scope=None):
    """Matching a collection of detected boxes with groundtruth values.
    Batched-inputs version.

    Args:
      rclasses, rscores, rbboxes: BxN(x4) Tensors. Detected objects, sorted by score;
      glabels, gbboxes: Groundtruth bounding boxes. May be zero padded, hence
        zero-class objects are ignored.
      matching_threshold: Threshold for a positive match.
    Return: Tuple or Dictionaries with:
       n_gbboxes: Scalar Tensor with number of groundtruth boxes (may difer from
         size because of zero padding).
       tp: (B, N)-shaped boolean Tensor containing with True Positives.
       fp: (B, N)-shaped boolean Tensor containing with False Positives.
    """
    # Dictionaries as inputs.
    if isinstance(scores, dict) or isinstance(bboxes, dict):
        with tf.name_scope(scope, 'bboxes_matching_batch_dict'):
            d_n_gbboxes = {}
            d_tp = {}
            d_fp = {}
            for c in labels:
                n, tp, fp = bboxes_matching_batch(c, scores[c], bboxes[c],
                                                 glabels, gbboxes, gdifficults,
                                                 matching_threshold)
                d_n_gbboxes[c] = n
                d_tp[c] = tp
                d_fp[c] = fp
            return d_n_gbboxes, d_tp, d_fp

    with tf.name_scope(scope, 'bboxes_matching_batch',
                       [scores, bboxes, glabels, gbboxes]):
        r = tf.map_fn(lambda x: bboxes_matching(tf.expand_dims(labels, axis=0), x[0], x[1],
                                                x[2], x[3], x[4],
                                                matching_threshold),

                      (tf.expand_dims(scores, axis=0), tf.expand_dims(bboxes, axis=0), tf.expand_dims(glabels, axis=0), tf.expand_dims(gbboxes, axis=0), tf.expand_dims(gdifficults, axis=0)),
                      dtype=(tf.int64, tf.bool, tf.bool),
                      parallel_iterations=10,
                      back_prop=False,
                      swap_memory=True,
                      infer_shape=True)
        return r[0], r[1], r[2]
def bboxes_matching_batch ( labels , scores , bboxes , glabels , gbboxes , gdifficults , matching_threshold = 0.5 , scope = None ) : # Dictionaries as inputs. if isinstance ( scores , dict ) or isinstance ( bboxes , dict ) : with tf . name_scope ( scope , 'bboxes_matching_batch_dict' ) : d_n_gbboxes = { } d_tp = { } d_fp = { } for c in labels : n , tp , fp = bboxes_matching_batch ( c , scores [ c ] , bboxes [ c ] , glabels , gbboxes , gdifficults , matching_threshold ) d_n_gbboxes [ c ] = n d_tp [ c ] = tp d_fp [ c ] = fp return d_n_gbboxes , d_tp , d_fp with tf . name_scope ( scope , 'bboxes_matching_batch' , [ scores , bboxes , glabels , gbboxes ] ) : r = tf . map_fn ( lambda x : bboxes_matching ( tf . expand_dims ( labels , axis = 0 ) , x [ 0 ] , x [ 1 ] , x [ 2 ] , x [ 3 ] , x [ 4 ] , matching_threshold ) , ( tf . expand_dims ( scores , axis = 0 ) , tf . expand_dims ( bboxes , axis = 0 ) , tf . expand_dims ( glabels , axis = 0 ) , tf . expand_dims ( gbboxes , axis = 0 ) , tf . expand_dims ( gdifficults , axis = 0 ) ) , dtype = ( tf . int64 , tf . bool , tf . bool ) , parallel_iterations = 10 , back_prop = False , swap_memory = True , infer_shape = True ) return r [ 0 ] , r [ 1 ] , r [ 2 ]