Repository: roboflow/supervision
File: supervision/detection/core.py (Python)

Code before:
        )
        ocr_text = np.array([result[1] for result in easyocr_results])

        return cls(
            xyxy=xyxy.astype(np.float32),
            confidence=confidence.astype(np.float32),
            data={
                CLASS_NAME_DATA_FIELD: ocr_text,
            },
        )

    @classmethod
    def from_ncnn(cls, ncnn_results) -> Detections:
        """
        Creates a Detections instance from the
        [ncnn](https://github.com/Tencent/ncnn) inference result.
        Supports object detection models.

        Arguments:
            ncnn_results (dict): The output Results instance from ncnn.

        Returns:
            Detections: A new Detections object.

        Example:
            ```python
            import cv2
            from ncnn.model_zoo import get_model
            import supervision as sv

            image = cv2.imread(<SOURCE_IMAGE_PATH>)
            model = get_model(
                "yolov8s",
                target_size=640
                prob_threshold=0.5,
                nms_threshold=0.45,
                num_threads=4,
                use_gpu=True,
                )
            result = model(image)
            detections = sv.Detections.from_ncnn(result)
            ```
        """

        xywh, confidences, class_ids = [], [], []

        if len(ncnn_results) == 0:
            return cls.empty()

        for ncnn_result in ncnn_results:
            rect = ncnn_result.rect

Review comment (suggestion):
Once `from_google_gemini` is updated, please make sure to propagate the `class_id` values into the `Detections` object.

Code after:

        if vlm == VLM.QWEN_2_5_VL:
            xyxy, class_id, class_name = from_qwen_2_5_vl(result, **kwargs)
            data = {CLASS_NAME_DATA_FIELD: class_name}
            return cls(xyxy=xyxy, class_id=class_id, data=data)

        if vlm == VLM.FLORENCE_2:
            xyxy, labels, mask, xyxyxyxy = from_florence_2(result, **kwargs)
            if len(xyxy) == 0:
                return cls.empty()

            data = {}
            if labels is not None:
                data[CLASS_NAME_DATA_FIELD] = labels
            if xyxyxyxy is not None:
                data[ORIENTED_BOX_COORDINATES] = xyxyxyxy

            return cls(xyxy=xyxy, mask=mask, data=data)

        if (
            vlm == VLM.GOOGLE_GEMINI_2_0
            or vlm == VLM.GOOGLE_GEMINI_2_5
            or vlm == VLM.GOOGLE_GEMINI_2_5_FLASH_PREVIEW
            or vlm == VLM.GOOGLE_GEMINI_2_5_PRO_PREVIEW
        ):
            xyxy, class_name = from_google_gemini(result, **kwargs)
            data = {CLASS_NAME_DATA_FIELD: class_name}
            return cls(xyxy=xyxy, data=data)

        return cls.empty()

    @classmethod
    def from_easyocr(cls, easyocr_results: list) -> Detections:
        """
        Create a Detections object from the
        [EasyOCR](https://github.com/JaidedAI/EasyOCR) result.

        Results are placed in the `data` field with the key `"class_name"`.

        Args:
            easyocr_results (List): The output Results instance from EasyOCR

        Returns:
            Detections: A new Detections object.

        Example:
            ```python
            import supervision as sv
            import easyocr

            reader = easyocr.Reader(['en'])