voxel51 / eta

ETA: Extensible Toolkit for Analytics
https://voxel51.com
Apache License 2.0
29 stars 13 forks source link

Explicitly show progress bar for large files #627

Open minhtuev opened 4 months ago

minhtuev commented 4 months ago

When following our documentation to download large datasets (such as Open Images), the default behavior is that all progress bars are hidden; hence, sometimes, the snippet appears stuck when downloading large files. This PR changes the behavior so that progress bars are shown explicitly when downloading files greater than a certain size.

Before:

In [20]: dataset = foz.load_zoo_dataset(
    ...:     "open-images-v7",
    ...:     split="train",
    ...:     max_samples=1000,
    ...:     seed=51,
    ...:     shuffle=True,
    ...: )
Downloading split 'train' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train' if necessary
Downloading 'https://storage.googleapis.com/openimages/2018_04/train/train-images-boxable-with-rotation.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/image_ids.csv'
 100% |█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|    4.8Gb/4.8Gb [58.0s elapsed, 0s remaining, 89.5Mb/s]
Downloading 'https://storage.googleapis.com/openimages/v5/class-descriptions-boxable.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/classes.csv'
Downloading 'https://storage.googleapis.com/openimages/v6/oidv6-attributes-description.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/attributes.csv'
Downloading 'https://storage.googleapis.com/openimages/v5/classes-segmentation.txt' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/segmentation_classes.csv'
Downloading 'https://storage.googleapis.com/openimages/v7/oidv7-class-descriptions.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/point_classes.csv'
Downloading 'https://storage.googleapis.com/openimages/2018_04/bbox_labels_600_hierarchy.json' to '/var/folders/bg/cq0lv35x74s_8tlvqfdmf90r0000gn/T/tmptqnku3ue/metadata/hierarchy.json'
Downloading 'https://storage.googleapis.com/openimages/v5/train-annotations-human-imagelabels-boxable.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/labels/classifications.csv'

Downloading 'https://storage.googleapis.com/openimages/v6/oidv6-train-annotations-bbox.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/labels/detections.csv'
Downloading 'https://storage.googleapis.com/openimages/v7/oidv7-train-annotations-point-labels.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/labels/points.csv'

After:


In [1]: import fiftyone as fo
   ...: import fiftyone.zoo as foz

In [2]: dataset = foz.load_zoo_dataset(
   ...:     "open-images-v7",
   ...:     split="train",
   ...:     max_samples=1500,
   ...:     seed=51,
   ...:     shuffle=True,
   ...: )
Downloading split 'train' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train' if necessary
Downloading 'https://storage.googleapis.com/openimages/2018_04/train/train-images-boxable-with-rotation.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/image_ids.csv'
 100% |█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|    4.8Gb/4.8Gb [57.3s elapsed, 0s remaining, 88.3Mb/s]
Downloading 'https://storage.googleapis.com/openimages/v5/class-descriptions-boxable.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/classes.csv'
Downloading 'https://storage.googleapis.com/openimages/v6/oidv6-attributes-description.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/attributes.csv'
Downloading 'https://storage.googleapis.com/openimages/v5/classes-segmentation.txt' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/segmentation_classes.csv'
Downloading 'https://storage.googleapis.com/openimages/v7/oidv7-class-descriptions.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/metadata/point_classes.csv'
Downloading 'https://storage.googleapis.com/openimages/2018_04/bbox_labels_600_hierarchy.json' to '/var/folders/bg/cq0lv35x74s_8tlvqfdmf90r0000gn/T/tmpklrabgfn/metadata/hierarchy.json'
Downloading 'https://storage.googleapis.com/openimages/v5/train-annotations-human-imagelabels-boxable.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/labels/classifications.csv'
 100% |█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|    2.8Gb/2.8Gb [33.2s elapsed, 0s remaining, 89.8Mb/s]
Downloading 'https://storage.googleapis.com/openimages/v6/oidv6-train-annotations-bbox.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/labels/detections.csv'
 100% |████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|   16.8Gb/16.8Gb [3.3m elapsed, 0s remaining, 89.6Mb/s]
Downloading 'https://storage.googleapis.com/openimages/v7/oidv7-train-annotations-point-labels.csv' to '/Users/minhtuevo/.fiftyone/datasets/open-images-v7/train/labels/points.csv'
  21% |████████████████████████\-------------------------------------------------------------------------------------------|    5.6Gb/26.3Gb [1.1m elapsed, 4.1m remaining, 88.9Mb/s]