BlobImageInfo

class BlobImageInfo(name, offset_start, offset_end)[source]

Bases: object

Object with image parameters that describes image in blob file.

Usage Example:
BlobImageInfo(
    name="IMG_3861.jpeg",
    offset_start=0,
    offset_end=148388,
)

Methods

add_team_file_id

Add file ID from Team Files to BlobImageInfo object to extend data imported from offsets file.

dump_to_pickle

Dump BlobImageInfo objects to a pickle file in batches.

from_dict

Create BlobImageInfo object from dictionary that is returned by Supervisely API.

from_image_info

load_from_pickle_generator

Load BlobImageInfo objects from a pickle file in batches of specified size.

to_dict

Create dictionary from BlobImageInfo object that can be used for request to Supervisely API.

Attributes

offsets_dict

name

offset_start

offset_end

static dump_to_pickle(offsets, file_path)[source]

Dump BlobImageInfo objects to a pickle file in batches. To read the data back, use the load_from_pickle_generator method.

Parameters:
offsets

Generator yielding batches of BlobImageInfo objects or a list of BlobImageInfo objects.

file_path : str

Path to the pickle file.

static from_dict(offset_dict, return_team_file_id=False)[source]

Create BlobImageInfo object from dictionary that is returned by Supervisely API.

Parameters:
offset_dict : Dict

Dictionary with image offsets.

return_team_file_id : bool

If True, return team file ID. Default is False to make size of the object smaller for pickling.

Returns:

BlobImageInfo object.

Return type:

BlobImageInfo

static load_from_pickle_generator(file_path, batch_size=10000)[source]

Load BlobImageInfo objects from a pickle file in batches of specified size. The file should contain a list of BlobImageInfo objects.

Parameters:
file_path : str

Path to the pickle file containing BlobImageInfo objects.

batch_size : int

Size of each batch. Default is 10000.

Returns:

Generator yielding batches of BlobImageInfo objects.

Return type:

Generator[List[BlobImageInfo], None, None]

add_team_file_id(team_file_id)[source]

Add file ID from Team Files to BlobImageInfo object to extend data imported from offsets file. This data is used to link offsets with blob file that is already uploaded to Supervisely storage.

to_dict(team_file_id=None)[source]

Create dictionary from BlobImageInfo object that can be used for request to Supervisely API.