Step 10: Dataset Filtering
Filtering datasets using user-defined-functions or SQL-style queries.
How to Filter and Query Data in Deep Lake
Filtering using our Tensor Query Language (TQL)
Filtering with user-defined-functions (UDF)
import deeplake
from PIL import Image
# Let's create a local copy of the dataset (Explanation is in the next section)
ds = deeplake.deepcopy('hub://activeloop/mnist-train', './mnist-train-local') labels_list = ['0', '8'] # Desired labels for filtering
@deeplake.compute
def filter_labels(sample_in, labels_list):
return sample_in.labels.data()['text'][0] in labels_listDataset Views
Was this helpful?