BBoxDataCSV
BBoxDataCSV Objects
class BBoxDataCSV(CSVParser.CSVParser)
ApertureDB BBox Data.
This class loads the Bounding Box Data which is present in a CSV file, and converts it into a series of ApertureDB queries.
IMG_KEY
, x_pos
, y_pos
, width
, height
, BBOX_PROP_NAME_1
, ... BBOX_PROP_NAME_N
, constraint_BBOX_PROP_NAME_1
IMG_KEY: column has the property name of the image property that the bounding box will be connected to, and each row has the value that will be used for finding the image.
x_pos, y_pos: Specify the coordinates of top left of the bounding box.
width, height: Specify the dimensions of the bounding box, as integers (unit is in pixels).
BBOX_PROP_NAME_N: is an arbitrary name of the property of the bounding box, and each row has the value for that property.
constraint_BBOX_PROP_NAME_1: Constraints against specific property, used for conditionally adding a Bounding Box.
Example CSV file::
img_unique_id,x_pos,y_pos,width,height,type,dataset_id,constraint_dataset_id
d5b25253-9c1e,257,154,84,125,manual,12345,12345
d5b25253-9c1e,7,537,522,282,manual,12346,12346
...
Example usage:
data = BBoxDataCSV("/path/to/BoundingBoxesData.csv")
loader = ParallelLoader(client)
loader.ingest(data)
In the above example, the constraint_dataset_id ensures that a bounding box with the specified dataset_id would be only inserted if it does not already exist in the database.