Created
July 9, 2023 20:32
-
-
Save mohan-aditya05/68ffb9ca164ff85b0a19e17029bfd0fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fiftyone as fo | |
from fiftyone import ViewField as F | |
dataset = fo.Dataset("imagenet") | |
# Using array slicing | |
range_view = dataset[2:5] | |
dataset.save_view("range_view", range_view) | |
# Sort by number of detection in "Detections" field "ground_truth" | |
sort_view = dataset.sort_by(F("ground_truth.detections").length(), reverse=True) | |
print(len(view.first().ground_truth.detections)) # 39 | |
print(len(view.last().ground_truth.detections)) # 0 | |
# Populate metadata on all samples | |
dataset.compute_metadata() | |
# Samples whose image is less than 48 KB | |
small_images_view = dataset.match(F("metadata.size_bytes") < 48 * 1024) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment