5e039083f5736d9a8f7e060a94e9d3079598acbd,tf_unet/unet.py,Unet,__init__,#Unet#Any#Any#Any#Any#Any#Any#,179

Before Change


        if class_weights is not None:
            class_weights = tf.constant(np.array(class_weights, dtype=np.float32))
            weighted_logits = tf.mul(tf.reshape(logits, [-1, n_class]), class_weights)
            loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(weighted_logits, tf.reshape(self.y, [-1, n_class])))
            
        else:
            loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(tf.reshape(logits, [-1, n_class]), 
                                                                               tf.reshape(self.y, [-1, n_class])))

After Change


            class_weights = tf.constant(np.array(class_weights, dtype=np.float32))
            labels = tf.reshape(self.y, [-1, n_class])

            weight_map = tf.mul(labels, class_weights)
            weight_map = tf.reduce_sum(weight_map, axis=1)

            loss_map = tf.nn.softmax_cross_entropy_with_logits(tf.reshape(logits, [-1, n_class]), labels)
            weighted_loss = tf.mul(loss_map, weight_map)

            loss = tf.reduce_mean(weighted_loss)
            
        else:
            loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(tf.reshape(logits, [-1, n_class]), 
                                                                               tf.reshape(self.y, [-1, n_class])))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: jakeret/tf_unet
Commit Name: 5e039083f5736d9a8f7e060a94e9d3079598acbd
Time: 2016-12-19
Author: felix.gruen@outlook.de
File Name: tf_unet/unet.py
Class Name: Unet
Method Name: __init__


Project Name: jakeret/tf_unet
Commit Name: 31516c4984224611174203a9822e102f94def3ac
Time: 2017-01-08
Author: jakeret@phys.ethz.ch
File Name: tf_unet/unet.py
Class Name: Unet
Method Name: _get_cost


Project Name: jakeret/tf_unet
Commit Name: 6abab74f85bf850de55fa9e39ece64b8a9eeff58
Time: 2016-12-27
Author: jakeret@phys.ethz.ch
File Name: tf_unet/unet.py
Class Name: Unet
Method Name: __init__


Project Name: jakeret/tf_unet
Commit Name: 5e039083f5736d9a8f7e060a94e9d3079598acbd
Time: 2016-12-19
Author: felix.gruen@outlook.de
File Name: tf_unet/unet.py
Class Name: Unet
Method Name: __init__