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 option to export per-sample JSON in FiftyOneDataset format #2028

Merged
merged 26 commits into from
Aug 30, 2022

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Aug 26, 2022

Adds an optional use_dirs=True parameter when exporting in FiftyOneDataset format that causes metadata to be exported in per-sample/frame JSON files rather than the default behavior of writing single samples.json/frames.json files.

This option is useful for large datasets, as well as use cases where one wants to track changes to each sample's labels individually.

import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("cifar10", split="test")

dataset.export(
    export_dir="/tmp/cifar10-test",
    dataset_type=fo.types.FiftyOneDataset,
    export_media=False,
    use_dirs=True,
    ordered=False,
)

dataset2 = fo.Dataset.from_dir(
    dataset_dir="/tmp/cifar10-test",
    dataset_type=fo.types.FiftyOneDataset,
)
$ ls /tmp/cifar10-test
metadata.json	samples

$ ls /tmp/cifar10-test/samples | head -n 10
630851edf7b9b41bff2abdea.json
630851edf7b9b41bff2abdee.json
630851edf7b9b41bff2abdef.json
630851edf7b9b41bff2abdf6.json
630851edf7b9b41bff2abdf7.json
630851edf7b9b41bff2abdf8.json
630851edf7b9b41bff2abdf9.json
630851edf7b9b41bff2abe06.json
630851edf7b9b41bff2abe07.json
630851edf7b9b41bff2abe08.json

@brimoor brimoor added the enhancement Code enhancement label Aug 26, 2022
@brimoor brimoor requested a review from a team August 26, 2022 05:04
@brimoor brimoor self-assigned this Aug 26, 2022
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

@brimoor brimoor merged commit d1d21f2 into develop Aug 30, 2022
@brimoor brimoor deleted the feature/fiftyone-dataset-update branch August 30, 2022 21:23
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.

2 participants