Skip to main content

ImageDataCSV

ImageDataProcessor​

ImageDataProcessor(check_image, n_download_retries)

Processing for Image data, used when loading images

ImageDataCSV​

ImageDataCSV(filename: str, check_image: bool = True, n_download_retries: int = 3, **kwargs)

Bases: CSVParser, ImageDataProcessor

ApertureDB Image Data.

This class loads the Image Data which is present in a CSV file, and converts it into a series of ApertureDB queries.

Note

Is backed by a CSV file with the following columns:

filename, PROP_NAME_1, ... PROP_NAME_N, constraint_PROP1, format

OR

url, PROP_NAME_1, ... PROP_NAME_N, constraint_PROP1, format

OR

s3_url, PROP_NAME_1, ... PROP_NAME_N, constraint_PROP1, format

OR

gs_url, PROP_NAME_1, ... PROP_NAME_N, constraint_PROP1, format

Example CSV file::

filename,id,label,constraint_id,format
/home/user/file1.jpg,321423532,dog,321423532,jpg
/home/user/file2.jpg,42342522,cat,42342522,png
...

Example usage:


data = ImageDataCSV("/path/to/ImageData.csv")
loader = ParallelLoader(client)
loader.ingest(data)

or


adb ingest from-csv /path/to/ImageData.csv --ingest-type IMAGE

Info

In the above example, the constraint_id ensures that an Image with the specified id would be only inserted if it does not already exist in the database.

ImageUpdateDataCSV​

ImageUpdateDataCSV(filename: str, check_image: bool = True, n_download_retries: int = 3, **kwargs)

Bases: SingleEntityUpdateDataCSV, ImageDataProcessor

ApertureDB Image CSV Parser for Adding an Image and updating the properties on the image. Usage is in EntityUpdateDataCSV.

Note that this class will not change a blob in an existing entity. If looking to change a blob in an existing entity, look at ImageForceNewestDataCSV, but be careful of all caveats.

ImageForceNewestDataCSV​

ImageForceNewestDataCSV(filename, check_image=True, n_download_retries=3, **kwargs)

Bases: BlobNewestDataCSV, ImageDataProcessor

ApertureDB Image CSV Parser for Maintaining a Blob set with changing blob data. See BlobNewestDataCSV for usage.

ImageSparseAddDataCSV​

ImageSparseAddDataCSV(filename: str, check_image: bool = True, n_download_retries: int = 3, **kwargs)

Bases: SparseAddingDataCSV, ImageDataProcessor

ApertureDB Spare Loading Image Data.

ImageSparseAddDataCSV should be used the same as ImageDataCSV.

See SparseAddingDataCSV for description of when to use this versus ImageDataCSV.

Example CSV file::

filename,id,label,constraint_id,format
/home/user/file1.jpg,321423532,dog,321423532,jpg
/home/user/file2.jpg,42342522,cat,42342522,png
...

Example usage:


data = ImageSparseAddDataCSV("/path/to/ImageData.csv")
loader = ParallelLoader(client)
loader.ingest(data)