@@ -120,7 +120,7 @@ class RONNet(object):
120
120
# anchor_steps=[64],
121
121
122
122
anchor_offset = 0.5 ,
123
- prior_scaling = [0.1 , 0.1 , 0.2 , 0.2 ]
123
+ prior_scaling = [1. , 1. , 1. , 1. ] #[ 0.1, 0.1, 0.2, 0.2]
124
124
)
125
125
126
126
def __init__ (self , params = None ):
@@ -608,7 +608,7 @@ def ron_arg_scope(weight_decay=0.0005, is_training=True, data_format='NHWC'):
608
608
biases_initializer = tf .zeros_initializer ()):
609
609
with slim .arg_scope ([slim .conv2d ], activation_fn = tf .nn .relu ,
610
610
weights_regularizer = slim .l2_regularizer (weight_decay ),
611
- weights_initializer = truncated_normal_001_initializer (),
611
+ weights_initializer = tf . contrib . layers . xavier_initializer (), # truncated_normal_001_initializer(),
612
612
biases_initializer = tf .zeros_initializer ()):
613
613
with slim .arg_scope ([slim .conv2d , slim .conv2d_transpose , slim .max_pool2d ],
614
614
padding = 'SAME' ,
@@ -691,7 +691,7 @@ def ron_losses(logits, localisations, objness_logits, objness_pred,
691
691
# negtive examples are those max_overlap is still lower than neg_threshold, note that some positive may also has lower jaccard
692
692
693
693
#negtive_mask = tf.cast(tf.logical_not(positive_mask), dtype) * gscores < neg_threshold
694
- negtive_mask = (gclasses == 0 )
694
+ negtive_mask = tf . equal ( gclasses , 0 ) # (gclasses == 0)
695
695
#negtive_mask = tf.logical_and(gscores < neg_threshold, tf.logical_not(positive_mask))
696
696
fnegtive_mask = tf .cast (negtive_mask , dtype )
697
697
n_negtives = tf .reduce_sum (fnegtive_mask )
@@ -769,7 +769,7 @@ def ron_losses(logits, localisations, objness_logits, objness_pred,
769
769
loss = custom_layers .modified_smooth_l1 (localisations , tf .stop_gradient (glocalisations ), sigma = 3. )
770
770
#loss = custom_layers.abs_smooth(localisations - tf.stop_gradient(glocalisations))
771
771
772
- loss = tf .cond (n_cls_positives > 0. , lambda : beta * tf .reduce_mean (tf .boolean_mask (tf .reduce_sum (loss , axis = - 1 ), tf .stop_gradient (cls_positive_mask ))), lambda : 0. )
772
+ loss = tf .cond (n_cls_positives > 0. , lambda : beta * n_cls_positives / total_examples_for_cls * tf .reduce_mean (tf .boolean_mask (tf .reduce_sum (loss , axis = - 1 ), tf .stop_gradient (cls_positive_mask ))), lambda : 0. )
773
773
#loss = tf.cond(n_positives > 0., lambda: beta * n_positives / total_examples_for_objness * tf.reduce_mean(tf.boolean_mask(tf.reduce_sum(loss, axis=-1), tf.stop_gradient(positive_mask))), lambda: 0.)
774
774
#loss = tf.reduce_mean(loss * weights)
775
775
#loss = tf.reduce_sum(loss * weights)
0 commit comments