Intersection over union (IoU) utilities.
Function | compute |
Computes the IoU between the given ground truth and predicted detections. |
Function | compute |
Computes the pairwise IoUs between the predicted and ground truth objects. |
Function | compute |
Populates an attribute on each label in the given spatial field(s) that records the max IoU between the object and another object in the same sample/frame. |
Function | compute |
Computes the pairwise IoUs between the predicted and ground truth temporal detections. |
Function | find |
Returns IDs of duplicate labels in the given field of the collection, as defined as labels with an IoU greater than a chosen threshold with another label in the field. |
Variable | sg |
Undocumented |
Variable | so |
Undocumented |
Function | _compute |
Undocumented |
Function | _compute |
Undocumented |
Function | _compute |
Undocumented |
Function | _compute |
Undocumented |
Function | _compute |
Undocumented |
Function | _compute |
Undocumented |
Function | _compute |
Undocumented |
Function | _compute |
Undocumented |
Function | _extract |
Undocumented |
Function | _find |
Undocumented |
Function | _find |
Undocumented |
Function | _find |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _masks |
Undocumented |
Function | _polylines |
Undocumented |
Function | _polylines |
Undocumented |
Computes the IoU between the given ground truth and predicted detections.
Parameters | |
gt | a fiftyone.core.labels.Detection |
pred | a fiftyone.core.labels.Detection |
gtFalse | whether the ground truth object is a crowd |
Returns | |
the IoU, in [0, 1] |
Computes the pairwise IoUs between the predicted and ground truth objects.
For polylines, IoUs are computed as solid shapes when filled=True` and "IoUs" are computed using `object keypoint similarity <https://cocodataset.org/#keypoints-eval>`_ when ``filled=False.
For keypoints, "IoUs" are computed via object keypoint similarity.
Parameters | |
preds | a list of predicted
fiftyone.core.labels.Detection ,
fiftyone.core.labels.Polyline , or
fiftyone.core.labels.Keypoints instances |
gts | a list of ground truth
fiftyone.core.labels.Detection ,
fiftyone.core.labels.Polyline , or
fiftyone.core.labels.Keypoints instances |
iscrowd:None | an optional name of a boolean attribute or boolean function to apply to each label that determines whether a ground truth object is a crowd. If provided, the area of the predicted object is used as the "union" area for IoU calculations involving crowd objects |
classwise:False | whether to consider objects with different label values as always non-overlapping (True) or to compute IoUs for all objects regardless of label (False) |
useFalse | whether to compute IoUs using the instances masks in
the mask attribute of the provided objects, which must be
fiftyone.core.labels.Detection instances |
useFalse | whether to compute IoUs using the bounding boxes
of the provided fiftyone.core.labels.Polyline instances
rather than using their actual geometries |
tolerance:None | a tolerance, in pixels, when generating approximate polylines for instance masks. Typical values are 1-3 pixels |
sparse:False | whether to return a sparse dict of non-zero IoUs rather than a full matrix |
error | the error level to use when manipulating instance masks or polylines. Valid values are:
If error_level > 0, any calculation that raises a geometric error will default to an IoU of 0 |
Returns | |
a num_preds x num_gts array of IoUs when sparse=False, or a dict of the form d[pred.id] = [(gt.id, iou), ...] when sparse=True |
Populates an attribute on each label in the given spatial field(s) that records the max IoU between the object and another object in the same sample/frame.
If other_field is provided, IoUs are computed between objects in label_field and other_field.
If no other_field is provided, IoUs are computed between objects in label_field alone, excluding the object itself.
Parameters | |
sample | a
fiftyone.core.collections.SampleCollection |
label | a label field of type
fiftyone.core.labels.Detections ,
fiftyone.core.labels.Polylines , or
fiftyone.core.labels.Keypoints |
otherNone | another label field of type
fiftyone.core.labels.Detections ,
fiftyone.core.labels.Polylines , or
fiftyone.core.labels.Keypoints |
iou | the label attribute in which to store the max IoU |
idNone | an optional attribute in which to store the label ID of the maximum overlapping label |
progress:None | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |
**kwargs | optional keyword arguments for compute_ious |
Computes the pairwise IoUs between the predicted and ground truth temporal detections.
Parameters | |
preds | a list of predicted
fiftyone.core.labels.TemporalDetection instances |
gts | a list of ground truth
fiftyone.core.labels.TemporalDetection instances |
sparse:False | whether to return a sparse dict of non-zero IoUs rather than a full matrix |
Returns | |
a num_preds x num_gts array of segment IoUs when sparse=False, or a dict of the form d[pred.id] = [(gt.id, iou), ...] when sparse=True |
Returns IDs of duplicate labels in the given field of the collection, as defined as labels with an IoU greater than a chosen threshold with another label in the field.
The following duplicate removal methods are supported:
- method="simple": mark the latter label in every pair of labels whose IoU exceeds the threshold. This may remove more labels than the greedy method
- method="greedy": apply a greedy method to mark the fewest number of labels as duplicate such that no non-duplicate labels have IoU greater than the specified threshold. This method is more computationally expensive than the simple method
Parameters | |
sample | a
fiftyone.core.collections.SampleCollection |
label | a label field of type
fiftyone.core.labels.Detections ,
fiftyone.core.labels.Polylines , or
fiftyone.core.labels.Keypoints |
iou | the IoU threshold to use to determine whether labels are duplicates |
method:"simple" | the duplicate removal method to use. The supported values are ("simple", "greedy") |
progress:None | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |
**kwargs | optional keyword arguments for compute_ious |
Returns | |
a list of IDs of duplicate labels |
Undocumented
Undocumented