bboxconverter.io.api

This module imports all the input / output functions for the bboxconverter package who could be used by the user.

Module Contents

Functions

read_coco(→ bboxconverter.core.bbox_parser.BboxParser)

Read bounding boxes from a coco file.

read_csv(→ bboxconverter.core.bbox_parser.BboxParser)

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

read_manifest(→ bboxconverter.core.bbox_parser.BboxParser)

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

read_pascal_voc(...)

Reads bounding boxes from a pascal_voc folder and returns a BboxParser object.

read_xml(→ bboxconverter.core.bbox_parser.BboxParser)

Reads bounding boxes from an xml file and returns a BboxParser object.

to_coco(df_bbox, output_path)

This function will take an array of bounding box and write it to a .json file respecting the coco format

bboxconverter.io.api.read_coco(path: str | Path) bboxconverter.core.bbox_parser.BboxParser

Read bounding boxes from a coco file.

Parameters:

path (str | Path) – Path to csv file

Returns:

BboxParser object containing bounding boxes

Return type:

BboxParser

bboxconverter.io.api.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

bboxconverter.io.api.read_manifest(path: str | Path, configuration, format='auto') bboxconverter.core.bbox_parser.BboxParser

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

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

  • format (str) – Format of the manifest file. Can be one of the following: ‘auto’, ‘coco’, ‘pascal’

  • configuration (dict) – Dictionary containing the configuration of the manifest file.

Returns:

BboxParser object containing bounding boxes

Return type:

BboxParser

bboxconverter.io.api.read_pascal_voc(path: str | Path) bboxconverter.core.bbox_parser.BboxParser

Reads bounding boxes from a pascal_voc folder and returns a BboxParser object.

Parameters:

path (str | Path) – Path to the pascal_voc folder. The folder should contain the following folders: - Annotations : contains the xml files - Images : contains the images

Returns:

BboxParser object containing bounding boxes

Return type:

BboxParser

bboxconverter.io.api.read_xml(path: str | Path) bboxconverter.core.bbox_parser.BboxParser

Reads bounding boxes from an xml file and returns a BboxParser object.

Parameters:

path (str | Path) – Path to the xml folder.

Returns:

BboxParser object containing bounding boxes

Return type:

BboxParser

bboxconverter.io.api.to_coco(df_bbox: pandas.core.frame.DataFrame, output_path: str | Path)

This function will take an array of bounding box and write it to a .json file respecting the coco format

Parameters:
  • df_bbox (DataFrame) – The dataframe containing the bounding box informations

  • output_path (str | Path) – The path to the output file.