bd2f006eb0170735290f180dc9a8e95aed72411f,frcnn/rpn.py,RPN,loss,#RPN#Any#,108

Before Change



                // Flatten rpn_cls_prob (only anchors, not completely).
                rpn_cls_prob = tf.reshape(
                    rpn_cls_prob, [-1, 2], name="rpn_cls_prob_flatten")

                // Now we only have the labels we are going to compare with the
                // cls probability. We need to remove the background.
                labels = tf.boolean_mask(
                    rpn_cls_target, labels_not_ignored, name="labels")
                cls_prob = tf.boolean_mask(rpn_cls_prob, labels_not_ignored)

                // We need to transform `labels` to `cls_prob` shape.
                cls_target = tf.one_hot(labels, depth=2)

                // TODO: In other implementations they use
                // `sparse_softmax_cross_entropy_with_logits` with
                // `reduce_mean`. Should we use that?
                log_loss = tf.losses.log_loss(cls_target, cls_prob)
                // TODO: For logs
                cls_loss = tf.identity(log_loss, name="log_loss")

                // Finally, we need to calculate the regression loss over `rpn_bbox_target`
                // and `rpn_bbox_pred`.
                // Since `rpn_bbox_target` is obtained from AnchorTargetLayer then we

After Change



                return {
                    "rpn_cls_loss": tf.reduce_mean(cross_entropy_per_anchor),
                    "rpn_reg_loss": tf.reduce_mean(reg_loss_per_anchor),
                }
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: tryolabs/luminoth
Commit Name: bd2f006eb0170735290f180dc9a8e95aed72411f
Time: 2017-06-28
Author: javirey@gmail.com
File Name: frcnn/rpn.py
Class Name: RPN
Method Name: loss


Project Name: ray-project/ray
Commit Name: b7dbbfbf4111698145bb9e0bf2e34e36fef0430c
Time: 2020-11-25
Author: sven@anyscale.io
File Name: rllib/agents/sac/sac_tf_policy.py
Class Name:
Method Name: sac_actor_critic_loss


Project Name: NifTK/NiftyNet
Commit Name: 369afab10deee16ef572c738df083d2e74863e64
Time: 2017-08-27
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/application/toy_application.py
Class Name: ToyApplication
Method Name: connect_data_and_network