Step 4: Accessing Data
Accessing and loading Hub Datasets.
Loading Datasets
Hub Datasets can be loaded and created in a variety of storage locations with minimal configuration.
Since ds = hub.dataset(path)
can be used to both create and load datasets, you may accidentally create a new dataset if there is a typo in the path you provided while intending to load a dataset. If that occurs, simply use ds.delete()
to remove the unintended dataset permanently.
Referencing Tensors
Hub allows you to reference specific tensors using keys or via the "." notation outlined below.
Note: data is still not loaded by these commands.
Accessing Data
Data within the tensors is loaded and accessed using the .numpy()
command:
The .numpy()
method will produce an exception if all samples in the requested tensor do not have a uniform shape. If that's the case, running .numpy(aslist=True)
solves the problem by returning a list of NumPy arrays, where the indices of the list correspond to different samples.
Last updated