(predictions_layer, localizations_layer,
                           select_threshold=None,
                           num_classes=21,
                           scope=None)
Extract classes, scores and bounding boxes from features in one layer.
    Batch-compatible: inputs are supposed to have batch-type shapes.

    Args:
      predictions_layer: prediction layer;
      localizations_layer: localization layer;
      select_threshold: Classification threshold for selecting a box. All boxes
        under the threshold are set to 'zero'. If None, no threshold applied.
    Return:
      d_scores, d_bboxes: Dictionary of scores and bboxes Tensors of
        size N x 1 | 4. Each key corresponding to a class.
Extract classes, scores and bounding boxes from features in one layer.
    Batch-compatible: inputs are supposed to have batch-type shapes.
Extract classes scores and bounding boxes from features in one layer . Batch - compatible : inputs are supposed to have batch - type shapes .
def tf_bboxes_select_layer(predictions_layer, localizations_layer,
                           select_threshold=None,
                           num_classes=21,
                           scope=None):
    """Extract classes, scores and bounding boxes from features in one layer.
    Batch-compatible: inputs are supposed to have batch-type shapes.

    Args:
      predictions_layer: prediction layer;
      localizations_layer: localization layer;
      select_threshold: Classification threshold for selecting a box. All boxes
        under the threshold are set to 'zero'. If None, no threshold applied.
    Return:
      d_scores, d_bboxes: Dictionary of scores and bboxes Tensors of
        size N x 1 | 4. Each key corresponding to a class.
    """
    select_threshold = 0.0 if select_threshold is None else select_threshold
    with tf.name_scope(scope, 'bboxes_select_layer',
                       [predictions_layer, localizations_layer]):
        d_scores = {}
        d_bboxes = {}
        for c in range(1, num_classes):
            # Remove boxes under the threshold.
            scores = predictions_layer[:, c]
            fmask = tf.cast(tf.greater(scores, select_threshold), scores.dtype)
            scores = scores * fmask
            bboxes = localizations_layer * tf.expand_dims(fmask, axis=-1)
            # Append to dictionary.
            d_scores[c] = scores
            d_bboxes[c] = bboxes

        return d_scores, d_bboxes
def tf_bboxes_select_layer ( predictions_layer , localizations_layer , select_threshold = None , num_classes = 21 , scope = None ) : select_threshold = 0.0 if select_threshold is None else select_threshold with tf . name_scope ( scope , 'bboxes_select_layer' , [ predictions_layer , localizations_layer ] ) : d_scores = { } d_bboxes = { } for c in range ( 1 , num_classes ) : # Remove boxes under the threshold. scores = predictions_layer [ : , c ] fmask = tf . cast ( tf . greater ( scores , select_threshold ) , scores . dtype ) scores = scores * fmask bboxes = localizations_layer * tf . expand_dims ( fmask , axis = - 1 ) # Append to dictionary. d_scores [ c ] = scores d_bboxes [ c ] = bboxes return d_scores , d_bboxes