def test_get_instance_id_count_with_max(self): instance_ids = self._get_instance_id_example() instance_id_count = sampling_utils.get_instance_id_count( instance_ids=instance_ids, max_instance_id=4) np_expected_instance_id_count = np.array( [[3, 3, 3, 2, 1, 2, 0], [2, 2, 5, 5, 5, 5, 5]], dtype=np.float32) self.assertAllClose(instance_id_count.numpy(), np_expected_instance_id_count)
def test_get_instance_id_count_with_valid_mask(self): instance_ids = self._get_instance_id_example() valid_mask = self._get_valid_mask() instance_id_count = sampling_utils.get_instance_id_count( instance_ids=instance_ids, valid_mask=valid_mask) np_expected_instance_id_count = np.array( [[3, 3, 3, 1, 1, 0, 0], [1, 0, 3, 3, 3, 0, 0]], dtype=np.float32) self.assertAllClose(instance_id_count.numpy(), np_expected_instance_id_count)