pixano.datasets.exporters.dataset_exporter
DatasetExporter(dataset, export_dir, overwrite=False)
Bases: ABC
Abstract base class for dataset exporters.
To export a dataset, you need to implement this class and provide an implementation for the abstract methods.
Attributes:
Name | Type | Description |
---|---|---|
dataset |
The dataset to be exported. |
|
export_dir |
The directory where the exported files will be saved. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset
|
Dataset
|
The dataset to be exported. |
required |
export_dir
|
str | Path
|
The directory where the exported files will be saved. |
required |
overwrite
|
bool
|
Whether to overwrite existing directory. |
False
|
Source code in pixano/datasets/exporters/dataset_exporter.py
export(file_name='pixano_export', items_per_file=None, batch_size=None)
Export the dataset to the specified directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_name
|
str
|
The name of the exported dataset. |
'pixano_export'
|
items_per_file
|
int | None
|
The number of items to export per file. If not specified, all items will be exported in a single file. |
None
|
batch_size
|
int | None
|
The size of each batch when exporting data. If not specified, all data will be exported at once. |
None
|
Source code in pixano/datasets/exporters/dataset_exporter.py
export_dataset_item(export_data, dataset_item)
abstractmethod
Store the dataset item in the data structure to be exported.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
export_data
|
Any
|
The data structure to be exported. |
required |
dataset_item
|
DatasetItem
|
The dataset item to be exported. |
required |
Returns: The data structure to be exported.
Source code in pixano/datasets/exporters/dataset_exporter.py
initialize_export_data(info, sources)
abstractmethod
Initialize the data structure to be exported.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
info
|
DatasetInfo
|
The dataset information. |
required |
sources
|
list[Source]
|
The list of sources. |
required |
Returns:
Type | Description |
---|---|
Any
|
The data structure to be exported. |
Source code in pixano/datasets/exporters/dataset_exporter.py
save_data(export_data, split, file_name, file_num)
abstractmethod
Save data to the specified directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
export_data
|
Any
|
The data structure to be exported. |
required |
split
|
str
|
The split of the dataset item being saved. |
required |
file_name
|
str
|
The name of the file to save the data in. |
required |
file_num
|
int
|
The number of the file to save the data in. |
required |