remove_empty_images#

Dataset.remove_empty_images() Self[source]#

Remove images without annotations from dataset.

Note: This does NOT remove empty images from the disk, but simply from the dataset object, and thus they will not be copied when saving the dataset elsewhere.

Returns:

Dataset object with the rows of empty images removed from the self.images dataframe.

Example

>>> from lours.utils.doc_utils import dummy_dataset
>>> example = dummy_dataset(2, 1, seed=0)
>>> example
Dataset object containing 2 images and 1 object
Name :
    inside_else_memory
Images root :
    such/serious
Images :
    width  height      relative_path   type split
id
0     342     136       help/me.jpeg  .jpeg  eval
1     377     167  whatever/wait.png   .png   val
Annotations :
    image_id category_str  category_id  ...  box_y_min  box_width  box_height
id                                      ...
0          0    interview           25  ...  73.932999  62.674584    8.569467

[1 rows x 8 columns]
Label map :
{15: 'step', 19: 'why', 25: 'interview'}
>>> example.remove_empty_images()
Dataset object containing 1 image and 1 object
Name :
    inside_else_memory
Images root :
    such/serious
Images :
    width  height relative_path   type split
id
0     342     136  help/me.jpeg  .jpeg  eval
Annotations :
    image_id category_str  category_id  ...  box_y_min  box_width  box_height
id                                      ...
0          0    interview           25  ...  73.932999  62.674584    8.569467

[1 rows x 8 columns]
Label map :
{15: 'step', 19: 'why', 25: 'interview'}