Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for field descriptions #2216

Merged
merged 42 commits into from
Nov 7, 2022
Merged

Adding support for field descriptions #2216

merged 42 commits into from
Nov 7, 2022

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Nov 1, 2022

Resolves #2163

Adds support for storing field-level descriptions on datasets.

This information can be viewed in the App via a new field tooltip (thanks @ritch!) by hovering over the field or attribute names in the App's sidebar! 🥳

app-field-tooltips-full

Example usage

import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")
dataset.add_dynamic_sample_fields()

field = dataset.get_field("ground_truth")
field.description = "Ground truth annotations"
field.info = {"url": "https://fiftyone.ai"}
field.save()  # must save after edits

field = dataset.get_field("ground_truth.detections.area")
field.description = "Area of the box, in pixels^2"
field.info = {"url": "https://fiftyone.ai"}
field.save()  # must save after edits

dataset.reload()

field = dataset.get_field("ground_truth")
print(field.description)  # Ground truth annotations
print(field.info)  # {'url': 'https://fiftyone.ai'}

field = dataset.get_field("ground_truth.detections.area")
print(field.description)  # Area of the box, in pixels^2
print(field.info)  # {'url': 'https://fiftyone.ai'}

Field metadata may also be provided when the field is declared, if desired:

import fiftyone as fo

dataset = fo.Dataset()
dataset.add_sample_field(
    "int_field", fo.IntField, description="An integer field"
)

field = dataset.get_field("int_field")
print(field.description)  # An integer field

@brimoor brimoor added the feature Work on a feature request label Nov 1, 2022
@brimoor brimoor requested a review from a team November 1, 2022 17:10
@brimoor brimoor self-assigned this Nov 1, 2022
@brimoor brimoor changed the title Adding support for field descriptions (option 2) Adding support for field descriptions Nov 2, 2022
@ehofesmann
Copy link
Member

I love this syntax!

field = dataset.get_field("ground_truth")
field.description = "Ground truth annotations"
field.info = {"url": "https://fiftyone.ai"}
field.save()  # must save after edits

Copy link
Contributor

@benjaminpkane benjaminpkane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from add-dynamic-fields1 to develop November 7, 2022 05:59
@brimoor brimoor merged commit 81f215d into develop Nov 7, 2022
@brimoor brimoor deleted the field-descriptions2 branch November 7, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Work on a feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] Store and visualize custom field-level information
4 participants