def to_detected_object(detection, name=None, extra_attrs=True):
    """Returns an ``eta.core.objects.DetectedObject`` representation of the
    given :class:`fiftyone.core.labels.Detection`.

    Args:
        detection: a :class:`fiftyone.core.labels.Detection`
        name (None): the name of the label field
        extra_attrs (True): whether to include custom attributes in the
            conversion

    Returns:
        an ``eta.core.objects.DetectedObject``
    """
    label = detection.label
    index = detection.index

    # pylint: disable=unpacking-non-sequence
    tlx, tly, w, h = detection.bounding_box
    brx = tlx + w
    bry = tly + h
    bounding_box = etag.BoundingBox.from_coords(tlx, tly, brx, bry)

    mask = detection.get_mask()
    confidence = detection.confidence

    attrs = _to_eta_attributes(detection, extra_attrs=extra_attrs)

    return etao.DetectedObject(
        label=label,
        index=index,
        bounding_box=bounding_box,
        mask=mask,
        confidence=confidence,
        name=name,
        attrs=attrs,
        tags=detection.tags,
    )
Returns an ``eta.core.objects.DetectedObject`` representation of the
    given :class:`fiftyone.core.labels.Detection`.

    Args:
        detection: a :class:`fiftyone.core.labels.Detection`
        name (None): the name of the label field
        extra_attrs (True): whether to include custom attributes in the
            conversion

    Returns:
        an ``eta.core.objects.DetectedObject``
    
fiftyone/utils/eta.py