slice()
Slice the data of a directory by a given query.
Slices the data based on the given query. The query is based on our Dataset Explorer feature, so any query that's working on our dataset explorer, should also work on the slice()
method.
You can try the explorer and query engine here: https://diffgram.com/studio/annotate/coco-dataset/explorer?
Parameters:
- query (str): the string of the query to slice the dataset.
Returns
A SlicedDirectory
object. This object inherits from Directory
classs, so all functionality and methods available in directory, are also available on SlicedDirectory
objects.
dataset = project.dataset.get('my dataset')
# Get only the images with more than 3 cars and at least one pedestrian
sliced_dataset = dataset.slice('labels.cars > 3 and labels.pedestrian >= 1')
Updated over 1 year ago