ProportionalDataSplitter
- class cocohelper.splitters.proportional.ProportionalDataSplitter[source]
Bases:
Splitter
Split a COCO dataset into N datasets.
Each split will contain a part of the original dataset samples proportionally to the arguments.
- Parameters:
*proportions – Describe the split proportions for each split.
Method List
_get_ids
(ch)For each split, GET a list of image ids for a target COCOHelper dataset, respecting the splitting proportions.
_get_n_samples
(n_images)Get the number of samples for each split.
apply
(coco)Applies the splitter to the given COCOHelper.
Attributes List
Methods Details
- _get_ids(ch)[source]
For each split, GET a list of image ids for a target COCOHelper dataset, respecting the splitting proportions.
- Parameters:
ch (COCOHelper) – target COCOHelper dataset.
- Returns:
A list of indices lists (a list of indices per each split).
- Return type:
List
- _get_n_samples(n_images)[source]
Get the number of samples for each split. :param n_images: the total number of images in the dataset.
- Returns:
A list of integers with the number of samples for each split.
- apply(coco)[source]
Applies the splitter to the given COCOHelper.
- Parameters:
coco (COCOHelper) – a COCOHelper containing the source dataset to be split.
- Returns:
A list containing the splits of the source COCO dataset.
- Return type:
List[COCOHelper]
Attribute Details
- _abc_impl = <_abc._abc_data object>