Query SDK
Query the Datapoints / Predictions / Groundtruths
To query the Datapoints, Predictions or Groundtruths, you can use the select_datapoints
select_predictions
, select_groundtruths
utilities. The output is a pandas DataFrame
from dioptra.lake.utils import (
select_datapoints,
select_predictions,
select_groundtruths
)
def select_datapoints( # similarly select_predictions and select_groundtruths
fields: List[str] -> ['*'],
filters: List[object],
limit: Optional[int],
order_by: Optional[str],
desc: Optional[bool]
)
fields
the list of fields to be retrieved. To query sub fields, use a jq format. For example: image_metadata.uri
filters
A list of filters to be used to query the data. Should follow the format
{
'left': 'my_field',
'op': '=', 'right:
'my_value'
}
Supported operators are =
, !=
, >
, <
, >=
, <=
, in
, not in
, like
, not like
limit
limit to the number of datapoints to query
order_by
the name of a field to order by when doing a limit
This is to control the order on which the limit
is applied
desc
whether the order should be desc or asc
Joining query results
To join query results in a single DataFrame, you can use the join_on_datapoints
utility
from dioptra.lake.utils import join_on_datapoints
def join_on_datapoints(
datapoints: DataFrame,
predictions: DataFrame,
groundtruths: DataFrame,
)
datapoints
a DataFrame containing the datapoints
predictions
a DataFrame containing the predictions
groundtruths
a DataFrame containing the groundtruths
Deleting
To delete datapoints, predictions or ground truths, use the delete_xxx
functions. Note that deleting a datapoint will delete all attachment: groundtruths, tags, predictions.
from dioptra.lake.utils import delete_datapoints, delete_predictions, delete_groundtruths
def delete_datapoints(filters, limit=None, order_by=None, desc=None)
def delete_predictions(prediction_ids)
def delete_groundtruths(groundtruth_ids)
Last updated
Was this helpful?