concatenate#

concatenate(boxlists: list[rastervision.core.data.label.tfod_utils.np_box_list.NpBoxList], fields: list[str] | None = None) NpBoxList[source]#

Concatenate list of BoxLists.

This op concatenates a list of input BoxLists into a larger BoxList. It also handles concatenation of BoxList fields as long as the field tensor shapes are equal except for the first dimension.

Parameters:
  • boxlists (list[BoxList]) – List of BoxList objects.

  • fields (list[str] | None) – Optional list of fields to also concatenate. If None, all fields from the first BoxList in the list are included in the concatenation. Defaults to None.

Returns:

A BoxList with number of boxes equal to

sum([boxlist.num_boxes() for boxlist in BoxList])

Return type:

BoxList

Raises:

ValueError – If boxlists is invalid (i.e., is not a list, is empty, or contains non BoxList objects), or if requested fields are not contained in all boxlists