bboxconverter.io.reader_csv

Module Contents

Functions

get_bbox_type(→ str)

Get the bbox type from a pandas dataframe.

read_csv(→ bboxconverter.core.bbox_parser.BboxParser)

Read bounding boxes from a csv file using pandas.read_csv.

bboxconverter.io.reader_csv.get_bbox_type(df) str

Get the bbox type from a pandas dataframe.

Parameters:

df (DataFrame) – Pandas dataframe containing bounding boxes

Returns:

Type of bounding box. Can be one of the following: ‘tlbr’, ‘tlwh’, ‘cwh’

Return type:

str

Raises:

SyntaxError – If the dataframe does not contain any of the following columns: ‘x_center’, ‘y_center’, ‘width’, ‘height’, ‘x_max’, ‘y_max’, ‘x_min’, ‘y_min’, ‘x_min’, ‘y_min’, ‘width’, ‘height’

bboxconverter.io.reader_csv.read_csv(path: str | Path, mapping=None, kwargs={}) bboxconverter.core.bbox_parser.BboxParser

Read bounding boxes from a csv file using pandas.read_csv.

Parameters:
  • path (str | Path) – Path to csv file

  • mapping (dict) – Dictionary to map column names to bboxconverter standard format

  • kwargs (dict) – Keyword arguments for pandas.read_csv

Returns:

BboxParser object containing bounding boxes

Return type:

BboxParser