import fiftyone as fo
from fiftyone.zoo import load_zoo_dataset
def download_vehicle_images():
# Specify the classes of interest (e.g., vehicles, cars)
classes_of_interest = ["Car", "Truck", "Motorcycle", "Bus", "Van"]
# Specify the maximum number of samples you want to download
max_samples = 100 # You can adjust this number as needed
# Load the Open Images V7 dataset using FiftyOne
dataset = load_zoo_dataset(
"open-images-v7",
split="validation",
label_types=["detections", "segmentations", "points"],
classes=classes_of_interest,
max_samples=max_samples,
)
# Save the downloaded dataset
dataset.export(export_dir="/path/to/save/vehicle/images")
if __name__ == "__main__":
# Execute the download function
download_vehicle_images()