Skip to content

Commit

Permalink
Fix problem with argmax on (0,0) arrays.
Browse files Browse the repository at this point in the history
Fix #170
  • Loading branch information
Julien Rebetez authored and waleedka committed Jun 5, 2018
1 parent d0c52d7 commit 025f4c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mrcnn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,11 @@ def detection_targets_graph(proposals, gt_class_ids, gt_boxes, gt_masks, config)

# Assign positive ROIs to GT boxes.
positive_overlaps = tf.gather(overlaps, positive_indices)
roi_gt_box_assignment = tf.argmax(positive_overlaps, axis=1)
roi_gt_box_assignment = tf.cond(
tf.greater(tf.shape(positive_overlaps)[1], 0),
true_fn = lambda: tf.argmax(positive_overlaps, axis=1),
false_fn = lambda: tf.cast(tf.constant([]),tf.int64)
)
roi_gt_boxes = tf.gather(gt_boxes, roi_gt_box_assignment)
roi_gt_class_ids = tf.gather(gt_class_ids, roi_gt_box_assignment)

Expand Down

0 comments on commit 025f4c1

Please sign in to comment.