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

Passing attributes through during label coercions #1993

Merged
merged 4 commits into from
Aug 11, 2022
Merged

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Aug 11, 2022

Resolves #1989.

Previously dynamic attributes were not included when performing coerced exports, such as exporting image patches defined by a Detections field in a Classification export format. Now, dynamic attributes are included in these cases.

Example usage:

import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")

dataset.limit(10).export(
    export_dir="/tmp/quickstart-patches",
    dataset_type=fo.types.FiftyOneImageClassificationDataset,
    label_field="ground_truth",
    include_attributes=True,
)
python -m json.tool /tmp/quickstart-patches/labels.json
...
        "000061": {
            "label": "traffic light",
            "attributes": {
                "iscrowd": 0.0,
                "area": 47.59534999999962
            }
        },
        "000062": {
            "label": "person",
            "attributes": {
                "iscrowd": 0.0,
                "area": 794.5827999999998
            }
        },
...

@brimoor brimoor added the enhancement Code enhancement label Aug 11, 2022
@brimoor brimoor requested a review from a team August 11, 2022 05:33
@brimoor brimoor self-assigned this Aug 11, 2022
Copy link
Member

@ehofesmann ehofesmann left a comment

Choose a reason for hiding this comment

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

LGTM!

@brimoor brimoor merged commit c7d45d0 into develop Aug 11, 2022
@brimoor brimoor deleted the feature/iss-1989 branch August 11, 2022 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Code enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] Allow patches exports to pull labels from Detection attributes/fields
2 participants