637ecf5877bbd6647caef2bd64925e66a586fb29,keras_rcnn/layers/losses/__init__.py,RCNN,regression_loss,#RCNN#,23

Before Change



        target_scores = self.target_scores[:, :, 1:]

        weights = keras.backend.sum(target_scores, axis=1)

        weights = keras.backend.sum(target_scores) / keras.backend.maximum(weights, keras.backend.epsilon())

        weights = 1.0 / (1 + keras.backend.exp(-weights))

        // mask out output values where class is different from targetrcnn loss
        // function
        a = keras_rcnn.backend.where(keras.backend.equal(target_scores, 1))

        a = keras.backend.cast(a, "int32")

        rr = a[:, :2]
        cc = a[:, 2:]

        indices = [
            keras.backend.concatenate([rr, cc * 4 + 0], 1),
            keras.backend.concatenate([rr, cc * 4 + 1], 1),
            keras.backend.concatenate([rr, cc * 4 + 2], 1),
            keras.backend.concatenate([rr, cc * 4 + 3], 1)
        ]

        indices = keras.backend.concatenate(indices, 0)

        weights = keras.backend.sum(target_scores * weights, axis=-1)
        weights = keras_rcnn.backend.gather_nd(weights, rr)

        weights = keras.backend.reshape(weights, (-1,))

        updates = keras.backend.tile(weights, (4,))

After Change



        updates = keras.backend.ones_like(indices, dtype=keras.backend.floatx())

        labels = keras_rcnn.backend.scatter_add_tensor(keras.backend.zeros_like(output_deltas, dtype="float32"), indices, updates[:, 0])

        loss = keras_rcnn.backend.smooth_l1(output_deltas * labels, target_deltas * labels, anchored=True)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: broadinstitute/keras-rcnn
Commit Name: 637ecf5877bbd6647caef2bd64925e66a586fb29
Time: 2018-01-30
Author: allen.goodman@icloud.com
File Name: keras_rcnn/layers/losses/__init__.py
Class Name: RCNN
Method Name: regression_loss


Project Name: uber/ludwig
Commit Name: 15bc4baff9c2dfa2e42947a417e45a159ab50dad
Time: 2020-05-14
Author: w4nderlust@gmail.com
File Name: ludwig/models/modules/embedding_modules.py
Class Name: EmbedSparse
Method Name: __call__


Project Name: uber/ludwig
Commit Name: 66866187ee32e7ec2f1e93cbd39a21a0afd1ccd3
Time: 2020-05-09
Author: w4nderlust@gmail.com
File Name: ludwig/models/modules/embedding_modules.py
Class Name: EmbedSparse
Method Name: call