sort_by_field#

sort_by_field(boxlist: NpBoxList, field: str, order: SortOrder = 2)[source]#

Sort boxes and associated fields according to a scalar field. A common use case is reordering the boxes according to descending scores.

Parameters
  • boxlist (BoxList) – A BoxList holding N boxes.

  • field (str) – A BoxList field for sorting and reordering the BoxList.

  • order (SortOrder, optional) – ‘descend’ or ‘ascend’. Default is descend.

Returns

A sorted BoxList with the field in the specified order.

Return type

BoxList

Raises
  • ValueError – If specified field does not exist or is not of single dimension.

  • ValueError – If the order is not either descend or ascend.