rename#

Dataset.rename(dataset_name: str) Self[source]#

Simple function to change the name fo the dataset.

The dataset name is used when printing it, showing it in jupyter or exporting it in other formats such as fiftyone.

Equivalent to my_dataset.dataset_name = "new_name", but creates a new dataset instance (without copying the dataframes). It can be useful when using method chaining.

Parameters:

dataset_name – Name to give to the dataset.

Returns:

Renamed dataset

Example

>>> Dataset().rename("my dataset")
Dataset object containing 0 image and 0 object
Name :
    my dataset
Images root :
    .
Images :
Empty DataFrame
Columns: [width, height, relative_path, type]
Index: []
Annotations :
Empty DataFrame
Columns: [image_id, category_str, category_id, box_x_min, box_y_min, box_width, box_height]
Index: []
Label map :
{}
>>> from lours.utils.doc_utils import dummy_dataset
>>> example = dummy_dataset(2, 2, seed=1)
>>> example
Dataset object containing 2 images and 2 objects
Name :
    shake_effort_many
Images root :
    care/suggest
Images :
    width  height        relative_path  type  split
id
0     955     229  determine/story.jpg  .jpg  train
1     131     840       air/method.bmp  .bmp  train
Annotations :
    image_id category_str  category_id  ...   box_y_min   box_width  box_height
id                                      ...
0          1       listen           14  ...  276.974642    9.718823  184.684056
1          0        reach           22  ...    6.311037  123.141689  174.239136

[2 rows x 8 columns]
Label map :
{14: 'listen', 15: 'marriage', 22: 'reach'}
>>> example.loc[example.images["type"] == ".jpg"].rename("only_jpeg")
Dataset object containing 1 image and 1 object
Name :
    only_jpeg
Images root :
    care/suggest
Images :
    width  height        relative_path  type  split
id
0     955     229  determine/story.jpg  .jpg  train
Annotations :
    image_id category_str  category_id  ... box_y_min   box_width  box_height
id                                      ...
1          0        reach           22  ...  6.311037  123.141689  174.239136

[1 rows x 8 columns]
Label map :
{14: 'listen', 15: 'marriage', 22: 'reach'}