Benoît Boidin
Benoît Boidin

Reputation: 87

How to remove tags from FiftyOne persistent dataset?

I added sample tags to a FiftyOne persistent dataset ("train", "test", "val"), as shown in the example here: https://docs.voxel51.com/api/fiftyone.utils.random.html (# Generate a random sample and encode results via tags).

dataset = fo.load_dataset(dataset_name)
view = (dataset.match(F("max_similarity") < 0.9))
four.random_split(view, {"train": 0.7, 
                            "test": 0.2, 
                            "val": 0.1})

However, I made a mistake in the proportions and would like to remove these tags.

I found something about untaging a dataset in the FiftyOne doc https://docs.voxel51.com/api/fiftyone.core.clips.html?highlight=untag#fiftyone.core.clips.ClipsView.untag_labels.

I tried view.untag_labels("train"), and expected the tag to disappear but according to FiftyOne desktop app it's still here:

enter image description here

Here is the code I wrote to delete tags:

dataset = fo.load_dataset(dataset_name)
view = (dataset.match(F("max_similarity") < 0.9))
view.untag_labels("train", "sample tags")
view.untag_labels("val", "sample tags")
view.untag_labels("test", "sample tags")

I also tried view.untag_labels("train"), view.tags.pop() and dataset.untag_labels("train").

Thanks in advance for your answers!

Upvotes: 0

Views: 598

Answers (2)

Jacob
Jacob

Reputation: 111

In FiftyOne, tags can be added on 3 distinct levels:

  1. Dataset-level as in dataset.tags
  2. Sample-level as in dataset.first().tags (tags on first sample)
  3. Label-level as in dataset.first().ground_truth.detections[0].tags (tags on the first "ground-truth" detections label on the first sample).

The method untag_labels() that you originally used is meant for removing tags from the label-level. As you correctly identified, untag_samples() is the appropriate method for removing tags from the sample-level.

Upvotes: 1

Beno&#238;t Boidin
Beno&#238;t Boidin

Reputation: 87

I found the answer in the doc: https://docs.voxel51.com/api/fiftyone.core.clips.html#fiftyone.core.clips.ClipsView.untag_samples

view.untag_samples("train")

Upvotes: 2

Related Questions