datumaro
datumaro copied to clipboard
Delete class from dataset
Hi,
First of all, thank you for this amazing dataset management framework!
I was wondering how I could delete a class from my dataset. I have two empty classes in my current dataset since it belongs to a CVAT project that represents the final dataset containing all classes of my interest. Keeping these empty classes in my dataset does not work well with training a model.
Kind regards, Thomas
Hi! There are 2 options available: use remap_labels or project_labels transforms.
From CLI you can do it this way:
datum create
datum import -f <format> <path>
datum transform -t remap_labels -l "cat:" -l "dog:" # --overwrite or -o <dst_dir>
From Python API you can use it like this:
import datumaro as dm
dataset = dm.Dataset.import_from('path', 'format')
dataset.transform('remap_labels', mapping={'cat': '', 'dog': ''})
dataset.export('path2', 'format')
Great, thank you!