debooleanize#
- Dataset.debooleanize(dataframe: Literal['both', 'images', 'annotations'] = 'both') Self[source]#
Convert booleanized columns back to list form, for exporting purpose.
Note
This will only debooleanize columns that have been explicitly booleanized, and not just boolean columns. It will look for values in
self.booleanized_columnsand retrieve all the column with the name in the formcolumn_name.entryto reconstruct thecolumn_namecolumn.- Parameters:
dataframe – Which dataframe you want to booleanize. Can be either “images”, “annotations” or None. If set to None, will debooleanize both dataframes. Defaults to None.
- Returns:
New dataset object with converted columns, booleanized columns are dropped.
See also
Example
>>> from lours.utils.doc_utils import dummy_dataset >>> example = dummy_dataset( ... n_imgs=3, ... n_annot=3, ... n_list_columns_images=[2, 3], ... n_list_columns_annotations=1, ... ) >>> example Dataset object containing 3 images and 3 objects Name : inside_else_memory Images root : such/serious Images : width height ... beyond father id ... 0 342 167 ... [enough] [challenge, someone] 1 377 114 ... [present, successful] [challenge] 2 136 257 ... [present, successful, enough] [challenge, someone] [3 rows x 7 columns] Annotations : image_id category_str ... box_height where id ... 0 2 why ... 138.451739 [no, season, play, choice, force, bit] 1 1 why ... 63.576932 [no, choice, force] 2 2 step ... 99.999123 [no, season, play, week, bit] [3 rows x 9 columns] Label map : {15: 'step', 19: 'why', 25: 'interview'} >>> modified = example.booleanize(column_names=["beyond", "where"]) >>> modified Dataset object containing 3 images and 3 objects Name : inside_else_memory Images root : such/serious Images : width height ... beyond.present beyond.successful id ... 0 342 167 ... False False 1 377 114 ... True True 2 136 257 ... True True [3 rows x 9 columns] Annotations : image_id category_str category_id ... where.play where.season where.week id ... 0 2 why 19 ... True True False 1 1 why 19 ... False False False 2 2 step 15 ... True True True [3 rows x 15 columns] Label map : {15: 'step', 19: 'why', 25: 'interview'} >>> modified.debooleanize() Dataset object containing 3 images and 3 objects Name : inside_else_memory Images root : such/serious Images : width height ... beyond father id ... 0 342 167 ... [enough] [challenge, someone] 1 377 114 ... [present, successful] [challenge] 2 136 257 ... [enough, present, successful] [challenge, someone] [3 rows x 7 columns] Annotations : image_id category_str ... box_height where id ... 0 2 why ... 138.451739 [bit, choice, force, no, play, season] 1 1 why ... 63.576932 [choice, force, no] 2 2 step ... 99.999123 [bit, no, play, season, week] [3 rows x 9 columns] Label map : {15: 'step', 19: 'why', 25: 'interview'} >>> modified.debooleanize(dataframe="images") Dataset object containing 3 images and 3 objects Name : inside_else_memory Images root : such/serious Images : width height ... beyond father id ... 0 342 167 ... [enough] [challenge, someone] 1 377 114 ... [present, successful] [challenge] 2 136 257 ... [enough, present, successful] [challenge, someone] [3 rows x 7 columns] Annotations : image_id category_str category_id ... where.play where.season where.week id ... 0 2 why 19 ... True True False 1 1 why 19 ... False False False 2 2 step 15 ... True True True [3 rows x 15 columns] Label map : {15: 'step', 19: 'why', 25: 'interview'}