pixano.datasets.exporters.default_json_dataset_exporter
DefaultJSONDatasetExporter(dataset, export_dir, overwrite=False)
Bases: DatasetExporter
Default JSON dataset exporter.
Source code in pixano/datasets/exporters/dataset_exporter.py
export_dataset_item(export_data, dataset_item)
Store the dataset item in the export_data
dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
export_data
|
dict[str, Any]
|
A dictionary containing the data to be exported. |
required |
dataset_item
|
DatasetItem
|
The dataset item to be exported. |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
A dictionary containing the data to be exported. |
Source code in pixano/datasets/exporters/default_json_dataset_exporter.py
initialize_export_data(info, sources)
Initialize the dictionary or list of dictionaries 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 |
---|---|
dict[str, Any]
|
A dictionary containing the data to be exported. |
Source code in pixano/datasets/exporters/default_json_dataset_exporter.py
save_data(export_data, split, file_name, file_num)
Save data to the specified directory.
The saved directory has the following structure
export_dir/{split}{file_name}_0.json /... /{split}{file_name}{file_num}.json /... /{split}{file_name}_n.json
Parameters:
Name | Type | Description | Default |
---|---|---|---|
export_data
|
dict[str, Any]
|
The dictionary containing the data to be saved. |
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 |