core.services.data.dataset.preprocessing.classification_dataset_preparator¶
classification_dataset_preparator
¶
Classes:
Name | Description |
---|---|
ClassificationBaseDatasetPreparator |
Prepares and organizes dataset images into directories based on their classification categories. |
ClassificationBaseDatasetPreparator(dataset, destination_dir)
¶
Prepares and organizes dataset images into directories based on their classification categories.
This class takes a dataset with category and annotation information in COCO format. It organizes the dataset by creating a directory for each category and moves the images into their respective category directories, which is often required for classification tasks in deep learning frameworks.
Attributes:
Name | Type | Description |
---|---|---|
dataset |
BaseDataset
|
The context of the dataset including paths and COCO file. |
destination_dir |
str
|
The target directory where the images will be moved and organized. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
BaseDataset
|
The context of the dataset to organize. |
required |
|
str
|
The directory where the organized images will be stored. |
required |
Methods:
Name | Description |
---|---|
organize |
Organizes the dataset by creating category directories and moving images. |
dataset = dataset
instance-attribute
¶
destination_dir = destination_dir
instance-attribute
¶
organize()
¶
Organizes the dataset by creating category directories and moving images.
Extracts category information from the COCO file, maps images to their categories, and organizes the images into the respective category directories. Cleans up the original image directory and annotations directory after moving the images.
Returns:
Name | Type | Description |
---|---|---|
CocoDataset |
CocoDataset
|
The updated dataset with the new image directory. |