Skip to content

Instantly share code, notes, and snippets.

@jacobmarks
Last active November 29, 2022 18:11
Show Gist options
  • Save jacobmarks/cce8ac4c14acb8746b68e254365d68c0 to your computer and use it in GitHub Desktop.
Save jacobmarks/cce8ac4c14acb8746b68e254365d68c0 to your computer and use it in GitHub Desktop.
# will count the number of samples in a dataset
sample_count = fo.Count()
# will retrieve the distinct labels in the `ground_truth` field
distinct_labels = fo.Distinct("ground_truth.detections.label")
# will compute a histogram of the `uniqueness` field
histogram_values = fo.HistogramValues("uniqueness")
# efficiently compute all three results
aggs = [sample_count, distinct_labels, histogram_values]
count, labels, hist = dataset.aggregate(aggs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment