Python object_detection.utils.np_box_ops.iou() Examples

The following are 30 code examples of object_detection.utils.np_box_ops.iou(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module object_detection.utils.np_box_ops , or try the search function .
Example #1
Source File: np_box_list_ops.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #2
Source File: np_box_ops_test.py    From open-solution-googleai-object-detection with MIT License 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #3
Source File: np_box_list_ops.py    From MAX-Object-Detector with Apache License 2.0 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #4
Source File: np_box_ops_test.py    From MAX-Object-Detector with Apache License 2.0 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #5
Source File: np_box_list_ops.py    From models with Apache License 2.0 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #6
Source File: target_assigner_test.py    From models with Apache License 2.0 5 votes vote down vote up
def test_max_distance_for_overlap(self):
    """Test that the distance ensures the IoU with random boxes."""

    # TODO(vighneshb) remove this after the `_smallest_positive_root`
    # function if fixed.
    self.skipTest(('Skipping test because we are using an incorrect version of'
                   'the `max_distance_for_overlap` function to reproduce'
                   ' results.'))

    rng = np.random.RandomState(0)
    n_samples = 100

    width = rng.uniform(1, 100, size=n_samples)
    height = rng.uniform(1, 100, size=n_samples)
    min_iou = rng.uniform(0.1, 1.0, size=n_samples)

    def graph_fn():
      max_dist = targetassigner.max_distance_for_overlap(height, width, min_iou)
      return max_dist
    max_dist = self.execute(graph_fn, [])
    xmin1 = np.zeros(n_samples)
    ymin1 = np.zeros(n_samples)
    xmax1 = np.zeros(n_samples) + width
    ymax1 = np.zeros(n_samples) + height

    xmin2 = max_dist * np.cos(rng.uniform(0, 2 * np.pi))
    ymin2 = max_dist * np.sin(rng.uniform(0, 2 * np.pi))
    xmax2 = width + max_dist * np.cos(rng.uniform(0, 2 * np.pi))
    ymax2 = height + max_dist * np.sin(rng.uniform(0, 2 * np.pi))

    boxes1 = np.vstack([ymin1, xmin1, ymax1, xmax1]).T
    boxes2 = np.vstack([ymin2, xmin2, ymax2, xmax2]).T

    iou = np.diag(np_box_ops.iou(boxes1, boxes2))

    self.assertTrue(np.all(iou >= min_iou)) 
Example #7
Source File: np_box_ops_test.py    From motion-rcnn with MIT License 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #8
Source File: np_box_list_ops.py    From motion-rcnn with MIT License 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #9
Source File: np_box_ops_test.py    From mtl-ssl with Apache License 2.0 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #10
Source File: np_box_list_ops.py    From mtl-ssl with Apache License 2.0 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #11
Source File: np_box_ops_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #12
Source File: np_box_list_ops.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #13
Source File: np_box_ops_test.py    From models with Apache License 2.0 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #14
Source File: np_box_list_ops.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #15
Source File: np_box_ops_test.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #16
Source File: np_box_ops_test.py    From AniSeg with Apache License 2.0 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #17
Source File: np_box_ops_test.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #18
Source File: np_box_list_ops.py    From Elphas with Apache License 2.0 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #19
Source File: np_box_ops_test.py    From Elphas with Apache License 2.0 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #20
Source File: np_box_list_ops.py    From MBMD with MIT License 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #21
Source File: np_box_ops_test.py    From MBMD with MIT License 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #22
Source File: np_box_list_ops.py    From object_detection_kitti with Apache License 2.0 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #23
Source File: np_box_ops_test.py    From object_detection_kitti with Apache License 2.0 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #24
Source File: np_box_list_ops.py    From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #25
Source File: np_box_ops_test.py    From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #26
Source File: np_box_list_ops.py    From hands-detection with MIT License 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #27
Source File: np_box_ops_test.py    From hands-detection with MIT License 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #28
Source File: np_box_list_ops.py    From moveo_ros with MIT License 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get()) 
Example #29
Source File: np_box_ops_test.py    From moveo_ros with MIT License 5 votes vote down vote up
def testIOU(self):
    iou = np_box_ops.iou(self.boxes1, self.boxes2)
    expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0],
                             [1.0 / 16.0, 0.0, 5.0 / 400.0]],
                            dtype=float)
    self.assertAllClose(iou, expected_iou) 
Example #30
Source File: np_box_list_ops.py    From BMW-TensorFlow-Training-GUI with Apache License 2.0 5 votes vote down vote up
def iou(boxlist1, boxlist2):
  """Computes pairwise intersection-over-union between box collections.

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

  Returns:
    a numpy array with shape [N, M] representing pairwise iou scores.
  """
  return np_box_ops.iou(boxlist1.get(), boxlist2.get())