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

Looker grid tag fixes for custom classifications #3141

Merged
merged 82 commits into from
Jun 23, 2023

Conversation

benjaminpkane
Copy link
Contributor

@benjaminpkane benjaminpkane commented May 30, 2023

Consist rendering of classifications and other dynamic label fields in the App

Image

Dynamic documents

import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart", max_samples=10)

for sample in dataset:
    sample["dynamic"] = fo.DynamicEmbeddedDocument(
        classification=fo.Classification(label="single"),
        classifications=fo.Classifications(
            classifications=[fo.Classification(label="list")]
        ),
        raw_classifications=[fo.Classification(label="raw_list")],
        detection=fo.Detection(
            bounding_box=[0.25, 0.25, 0.5, 0.5], label="single"
        ),
        detections=fo.Detections(
            detections=[
                fo.Detection(bounding_box=[0.25, 0.25, 0.5, 0.5], label="list")
            ]
        ),
        raw_detections=[
            fo.Detection(bounding_box=[0.25, 0.25, 0.5, 0.5], label="raw_list")
        ],
    )

    sample.save()

dataset.add_dynamic_sample_fields()

session = fo.launch_app(dataset)

Lists of dynamic documents

import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart", max_samples=10)

for sample in dataset:
    sample["dynamic"] = [
        fo.DynamicEmbeddedDocument(
            annotator="alice",
            labels=fo.Classifications(
                classifications=[
                    fo.Classification(label="cat", mood="surly"),
                    fo.Classification(label="dog"),
                ]
            ),
        ),
        fo.DynamicEmbeddedDocument(
            annotator="bob",
            labels=fo.Classifications(
                classifications=[
                    fo.Classification(label="rabbit"),
                    fo.Classification(label="squirrel", age=51),
                ]
            ),
        ),
    ]
    sample.save()

dataset.add_dynamic_sample_fields()

session = fo.launch_app(dataset)

Video

import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart-video")
for sample in dataset:
    sample.frames[1]["dynamic"] = fo.DynamicEmbeddedDocument(
        classification=fo.Classification(label="single"),
        classifications=fo.Classifications(
            classifications=[fo.Classification(label="list")]
        ),
        raw_classifications=[fo.Classification(label="raw_list")],
        detection=fo.Detection(
            bounding_box=[0.25, 0.25, 0.5, 0.5], label="single"
        ),
        detections=fo.Detections(
            detections=[
                fo.Detection(bounding_box=[0.25, 0.25, 0.5, 0.5], label="list")
            ]
        ),
        raw_detections=[
            fo.Detection(bounding_box=[0.25, 0.25, 0.5, 0.5], label="raw_list")
        ],
    )

    sample.save()

dataset.add_dynamic_frame_fields()

session = fo.launch_app(dataset)

@benjaminpkane benjaminpkane changed the base branch from develop to release/v0.21.1 June 12, 2023 14:41
@benjaminpkane benjaminpkane changed the title [WIP] Looker grid tag fixes for custom classifications Looker grid tag fixes for custom classifications Jun 12, 2023
@benjaminpkane
Copy link
Contributor Author

This work is incomplete, will follow up in a new PR

@benjaminpkane benjaminpkane merged commit 2ecd2f1 into release/v0.21.1 Jun 23, 2023
@benjaminpkane benjaminpkane deleted the bugfix/label-lists-looker branch June 23, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants