Commit 6aa4328b authored by Yuxin Wu's avatar Yuxin Wu

rpn total loss

parent c648e3ac
...@@ -96,7 +96,7 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits): ...@@ -96,7 +96,7 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
summaries.extend([precision, recall]) summaries.extend([precision, recall])
add_moving_summary(*summaries) add_moving_summary(*summaries)
placeholder = 1. placeholder = 0. # Per-level loss summaries in FPN may appear lower. But the sum should be OK.
label_loss = tf.nn.sigmoid_cross_entropy_with_logits( label_loss = tf.nn.sigmoid_cross_entropy_with_logits(
labels=tf.to_float(valid_anchor_labels), logits=valid_label_logits) labels=tf.to_float(valid_anchor_labels), logits=valid_label_logits)
label_loss = tf.reduce_sum(label_loss) * (1. / config.RPN_BATCH_PER_IM) label_loss = tf.reduce_sum(label_loss) * (1. / config.RPN_BATCH_PER_IM)
......
...@@ -389,7 +389,11 @@ class ResNetFPNModel(DetectionModel): ...@@ -389,7 +389,11 @@ class ResNetFPNModel(DetectionModel):
'fastrcnn', all_rois, config.FASTRCNN_FC_HEAD_DIM, config.NUM_CLASS) 'fastrcnn', all_rois, config.FASTRCNN_FC_HEAD_DIM, config.NUM_CLASS)
if is_training: if is_training:
# rpn_losses = .. with tf.name_scope('rpn_losses'):
rpn_total_label_loss = tf.add_n(rpn_loss_collection[::2], name='label_loss')
rpn_total_box_loss = tf.add_n(rpn_loss_collection[1::2], name='box_loss')
add_moving_summary(rpn_total_box_loss, rpn_total_label_loss)
# fastrcnn loss: # fastrcnn loss:
matched_gt_boxes = tf.gather(gt_boxes, fg_inds_wrt_gt) matched_gt_boxes = tf.gather(gt_boxes, fg_inds_wrt_gt)
...@@ -579,6 +583,7 @@ if __name__ == '__main__': ...@@ -579,6 +583,7 @@ if __name__ == '__main__':
PeriodicCallback( PeriodicCallback(
ModelSaver(max_to_keep=10, keep_checkpoint_every_n_hours=1), ModelSaver(max_to_keep=10, keep_checkpoint_every_n_hours=1),
every_k_epochs=20), every_k_epochs=20),
SessionRunTimeout(60000), # 1 minute timeout
# linear warmup # linear warmup
ScheduledHyperParamSetter( ScheduledHyperParamSetter(
'learning_rate', warmup_schedule, interp='linear', step_based=True), 'learning_rate', warmup_schedule, interp='linear', step_based=True),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment