def _compare(self, boxlist1, boxlist2):
     """Compute matrix of (negated) sq distances.
     Args:
       boxlist1: BoxList holding N boxes.
       boxlist2: BoxList holding M boxes.
     Returns:
       A tensor with shape [N, M] representing negated pairwise squared distance.
     """
     return -1 * box_list_ops.sq_dist(boxlist1, boxlist2)
Example #2
0
 def graph_fn():
   corners1 = tf.constant([[0.0, 0.0, 0.0, 0.0],
                           [1.0, 1.0, 0.0, 2.0]])
   corners2 = tf.constant([[3.0, 4.0, 1.0, 0.0],
                           [-4.0, 0.0, 0.0, 3.0],
                           [0.0, 0.0, 0.0, 0.0]])
   boxes1 = box_list.BoxList(corners1)
   boxes2 = box_list.BoxList(corners2)
   dist_matrix = box_list_ops.sq_dist(boxes1, boxes2)
   return dist_matrix
  def _compare(self, boxlist1, boxlist2):
    """Compute matrix of (negated) sq distances.

    Args:
      boxlist1: BoxList holding N boxes.
      boxlist2: BoxList holding M boxes.

    Returns:
      A tensor with shape [N, M] representing negated pairwise squared distance.
    """
    return -1 * box_list_ops.sq_dist(boxlist1, boxlist2)
 def test_pairwise_distances(self):
     corners1 = tf.constant([[0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 0.0, 2.0]])
     corners2 = tf.constant([[3.0, 4.0, 1.0, 0.0], [-4.0, 0.0, 0.0, 3.0],
                             [0.0, 0.0, 0.0, 0.0]])
     exp_output = [[26, 25, 0], [18, 27, 6]]
     boxes1 = box_list.BoxList(corners1)
     boxes2 = box_list.BoxList(corners2)
     dist_matrix = box_list_ops.sq_dist(boxes1, boxes2)
     with self.test_session() as sess:
         dist_output = sess.run(dist_matrix)
         self.assertAllClose(dist_output, exp_output)
Example #5
0
 def test_pairwise_distances(self):
   corners1 = tf.constant([[0.0, 0.0, 0.0, 0.0],
                           [1.0, 1.0, 0.0, 2.0]])
   corners2 = tf.constant([[3.0, 4.0, 1.0, 0.0],
                           [-4.0, 0.0, 0.0, 3.0],
                           [0.0, 0.0, 0.0, 0.0]])
   exp_output = [[26, 25, 0], [18, 27, 6]]
   boxes1 = box_list.BoxList(corners1)
   boxes2 = box_list.BoxList(corners2)
   dist_matrix = box_list_ops.sq_dist(boxes1, boxes2)
   with self.test_session() as sess:
     dist_output = sess.run(dist_matrix)
     self.assertAllClose(dist_output, exp_output)
Example #6
0
    def _compare(self, boxlist1, boxlist2):
        reserved_ioa = tf.transpose(box_list_ops.ioa(boxlist2, boxlist1))
        neg_sq_dist = -1 * box_list_ops.sq_dist(boxlist1, boxlist2)

        return tf.multiply(tf.scalar_mul(2, tf.sigmoid(neg_sq_dist)),
                           reserved_ioa)