def to_instance(self):
        """Converts this shape to a :class:`fiftyone.core.labels.Detection`
        with instance mask.

        Returns:
            a :class:`fiftyone.core.labels.Detection`
        """
        xtl, ytl, xbr, ybr = self.points[-4:]
        rel = np.array(self.points[:-4], dtype=int)
        frame_width, frame_height = self.frame_size

        # +1 to convert from CVAT indexing
        mask_w, mask_h = round(xbr - xtl) + 1, round(ybr - ytl) + 1
        mask = HasCVATBinaryMask._rle_to_binary_image_mask(
            rel, mask_height=mask_h, mask_width=mask_w
        )

        bbox = [
            xtl / frame_width,
            ytl / frame_height,
            (xbr - xtl) / frame_width,
            (ybr - ytl) / frame_height,
        ]
        label = fol.Detection(
            label=self.label,
            bounding_box=bbox,
            index=self.index,
            mask=mask,
        )
        self._set_attributes(label)
        return label
Converts this shape to a :class:`fiftyone.core.labels.Detection`
        with instance mask.

        Returns:
            a :class:`fiftyone.core.labels.Detection`
        
fiftyone/utils/cvat.py