gather#

gather(boxlist: NpBoxList, indices: ndarray, fields: Optional[List[str]] = None) NpBoxList[source]#

Gather boxes from BoxList according to indices and return new BoxList.

By default, gather returns boxes corresponding to the input index list, as well as all additional fields stored in the boxlist (indexing into the first dimension). However one can optionally only gather from a subset of fields.

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

  • indices (np.ndarray) – A 1-d numpy array of type int.

  • fields (Optional[List[str]]) – List of fields to also gather from. If None, all fields are gathered from. Pass an empty fields list to only gather the box coordinates. Defaults to None.

Returns

A BoxList corresponding to the subset of the input BoxList specified by indices.

Raises

ValueError – If specified field is not contained in boxlist or if the indices are not of type int.

Return type

NpBoxList