2b51587c8f372a8eb80a6b41e6a7acf309a56660,luminoth/models/fasterrcnn/rpn_target.py,RPNTarget,_build,#RPNTarget#Any#Any#Any#,75

Before Change


        fg_inds_size = tf.size(fg_inds)
        // Condition for check if we have too many positive labels.
        subsample_positive_cond = (
            tf.to_int32(fg_inds_size) > tf.to_int32(num_fg))
        // Check the condition and subsample positive labels.
        labels = tf.cond(
            subsample_positive_cond,

After Change


                x=tf.to_float(tf.fill(tf.shape(labels), -1)), y=labels
            )

        num_bg = tf.to_int32(self._minibatch_size - fg_inds_size)
        // Get background indices, get True in the indices where we have a cero.
        bg_inds = tf.equal(labels, 0)
        // We get only the indices where we have True.
        bg_inds = tf.squeeze(tf.where(bg_inds), axis=1)
        bg_inds_size = tf.size(bg_inds)
        // Condition for check if we have too many positive labels.
        subsample_negative_cond = bg_inds_size > num_bg
        // Check the condition and subsample positive labels.
        labels = tf.cond(
            subsample_negative_cond,
            true_fn=subsample_negative, false_fn=lambda: labels
        )

        // Returns bbox targets with shape (anchors.shape[0], 4)

        // Find the closest gt box for each anchor.
        argmax_overlaps = tf.argmax(overlaps, axis=1)
        // Eliminate duplicates.
        argmax_overlaps_unique, _ = tf.unique(argmax_overlaps)
        // Filter the gt_boxes.
        // We get only the indices where we have "inside anchors".
        anchor_filter_inds = tf.where(anchor_filter)
        gt_boxes = tf.gather(gt_boxes, argmax_overlaps)

        bbox_targets = encode_tf(anchors, gt_boxes)

        // For the anchors that arent foreground, we ignore the bbox_targets
        anchor_foreground_filter = tf.equal(labels, 1)
        bbox_targets = tf.where(
            condition=anchor_foreground_filter,
            x=bbox_targets, y=tf.zeros_like(bbox_targets)
        )
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: tryolabs/luminoth
Commit Name: 2b51587c8f372a8eb80a6b41e6a7acf309a56660
Time: 2017-08-31
Author: gaston@tryolabs.com
File Name: luminoth/models/fasterrcnn/rpn_target.py
Class Name: RPNTarget
Method Name: _build


Project Name: tensorflow/models
Commit Name: a4d9c3a0656639f00ea0050e6535f7bf547d8719
Time: 2018-04-13
Author: lzc@google.com
File Name: research/object_detection/meta_architectures/faster_rcnn_meta_arch.py
Class Name: FasterRCNNMetaArch
Method Name: _gather_instance_masks


Project Name: tensorflow/tpu
Commit Name: 2c631052b5c6109ee789be05dea30396e3c17dec
Time: 2019-07-18
Author: laigd@google.com
File Name: models/official/mask_rcnn/mask_rcnn_model.py
Class Name:
Method Name: build_model_graph