当前位置: 首页>>代码示例>>Python>>正文


Python np_box_list_ops.sort_by_field方法代码示例

本文整理汇总了Python中object_detection.utils.np_box_list_ops.sort_by_field方法的典型用法代码示例。如果您正苦于以下问题:Python np_box_list_ops.sort_by_field方法的具体用法?Python np_box_list_ops.sort_by_field怎么用?Python np_box_list_ops.sort_by_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object_detection.utils.np_box_list_ops的用法示例。


在下文中一共展示了np_box_list_ops.sort_by_field方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sort_by_field

# 需要导入模块: from object_detection.utils import np_box_list_ops [as 别名]
# 或者: from object_detection.utils.np_box_list_ops import sort_by_field [as 别名]
def sort_by_field(box_mask_list, field,
                  order=np_box_list_ops.SortOrder.DESCEND):
  """Sort boxes and associated fields according to a scalar field.

  A common use case is reordering the boxes according to descending scores.

  Args:
    box_mask_list: BoxMaskList holding N boxes.
    field: A BoxMaskList field for sorting and reordering the BoxMaskList.
    order: (Optional) 'descend' or 'ascend'. Default is descend.

  Returns:
    sorted_box_mask_list: A sorted BoxMaskList with the field in the specified
      order.
  """
  return box_list_to_box_mask_list(
      np_box_list_ops.sort_by_field(
          boxlist=box_mask_list, field=field, order=order)) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:20,代码来源:np_box_mask_list_ops.py

示例2: test_with_invalid_field

# 需要导入模块: from object_detection.utils import np_box_list_ops [as 别名]
# 或者: from object_detection.utils.np_box_list_ops import sort_by_field [as 别名]
def test_with_invalid_field(self):
    with self.assertRaises(ValueError):
      np_box_list_ops.sort_by_field(self.boxlist, 'objectness')
    with self.assertRaises(ValueError):
      np_box_list_ops.sort_by_field(self.boxlist, 'labels') 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:7,代码来源:np_box_list_ops_test.py

示例3: test_with_invalid_sorting_order

# 需要导入模块: from object_detection.utils import np_box_list_ops [as 别名]
# 或者: from object_detection.utils.np_box_list_ops import sort_by_field [as 别名]
def test_with_invalid_sorting_order(self):
    with self.assertRaises(ValueError):
      np_box_list_ops.sort_by_field(self.boxlist, 'scores', 'Descending') 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:5,代码来源:np_box_list_ops_test.py

示例4: test_with_descending_sorting

# 需要导入模块: from object_detection.utils import np_box_list_ops [as 别名]
# 或者: from object_detection.utils.np_box_list_ops import sort_by_field [as 别名]
def test_with_descending_sorting(self):
    sorted_boxlist = np_box_list_ops.sort_by_field(self.boxlist, 'scores')

    expected_boxes = np.array([[14.0, 14.0, 15.0, 15.0], [3.0, 4.0, 6.0, 8.0],
                               [0.0, 0.0, 20.0, 20.0]],
                              dtype=float)
    self.assertAllClose(expected_boxes, sorted_boxlist.get())

    expected_scores = np.array([0.9, 0.5, 0.4], dtype=float)
    self.assertAllClose(expected_scores, sorted_boxlist.get_field('scores')) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:np_box_list_ops_test.py

示例5: test_with_ascending_sorting

# 需要导入模块: from object_detection.utils import np_box_list_ops [as 别名]
# 或者: from object_detection.utils.np_box_list_ops import sort_by_field [as 别名]
def test_with_ascending_sorting(self):
    sorted_boxlist = np_box_list_ops.sort_by_field(
        self.boxlist, 'scores', np_box_list_ops.SortOrder.ASCEND)

    expected_boxes = np.array([[0.0, 0.0, 20.0, 20.0],
                               [3.0, 4.0, 6.0, 8.0],
                               [14.0, 14.0, 15.0, 15.0],],
                              dtype=float)
    self.assertAllClose(expected_boxes, sorted_boxlist.get())

    expected_scores = np.array([0.4, 0.5, 0.9], dtype=float)
    self.assertAllClose(expected_scores, sorted_boxlist.get_field('scores')) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:14,代码来源:np_box_list_ops_test.py


注:本文中的object_detection.utils.np_box_list_ops.sort_by_field方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。