fix(pre_commit): 🎨 auto format pre-commit hooks
This commit is contained in:
1 parent
9e2a535044
commit
8e845caeeb
2 files changed
+6
-9
No files matched your search
@@ -36,12 +36,12 @@ from supervision.detection.utils import (
|
||||
from supervision.detection.vlm import (
|
||||
LMM,
|
||||
VLM,
|
||||
from_deepseek_vl_2,
|
||||
from_florence_2,
|
||||
from_google_gemini,
|
||||
from_paligemma,
|
||||
from_qwen_2_5_vl,
|
||||
validate_vlm_parameters,
|
||||
from_deepseek_vl_2,
|
||||
)
|
||||
from supervision.geometry.core import Position
|
||||
from supervision.utils.internal import deprecated, get_instance_variables
|
||||
@@ -902,7 +902,6 @@ class Detections:
|
||||
LMM.DEEPSEEK_VL_2: VLM.DEEPSEEK_VL_2,
|
||||
LMM.GOOGLE_GEMINI_2_0: VLM.GOOGLE_GEMINI_2_0,
|
||||
LMM.GOOGLE_GEMINI_2_5: VLM.GOOGLE_GEMINI_2_5,
|
||||
|
||||
}
|
||||
|
||||
# (this works even if the LMM enum is wrapped by @deprecated)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ast
|
||||
import json
|
||||
import re
|
||||
import ast
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
@@ -244,9 +244,7 @@ def from_qwen_2_5_vl(
|
||||
|
||||
|
||||
def from_deepseek_vl_2(
|
||||
result: str,
|
||||
resolution_wh: Tuple[int, int],
|
||||
classes: Optional[List[str]] = None
|
||||
result: str, resolution_wh: Tuple[int, int], classes: Optional[List[str]] = None
|
||||
) -> Tuple[np.ndarray, Optional[np.ndarray], np.ndarray]:
|
||||
"""
|
||||
Parse bounding boxes from deepseek-vl2-formatted text, scale them to the specified
|
||||
@@ -280,8 +278,8 @@ def from_deepseek_vl_2(
|
||||
f"Both dimensions in resolution_wh must be positive. Got ({w}, {h})."
|
||||
)
|
||||
|
||||
label_segments = re.findall(r'<\|ref\|>(.*?)<\|/ref\|>', result, flags=re.DOTALL)
|
||||
bbox_segments = re.findall(r'<\|det\|>(.*?)<\|/det\|>', result, flags=re.DOTALL)
|
||||
label_segments = re.findall(r"<\|ref\|>(.*?)<\|/ref\|>", result, flags=re.DOTALL)
|
||||
bbox_segments = re.findall(r"<\|det\|>(.*?)<\|/det\|>", result, flags=re.DOTALL)
|
||||
|
||||
if len(label_segments) != len(bbox_segments):
|
||||
return np.empty((0, 4)), None, np.empty((0,), dtype=str)
|
||||
@@ -290,7 +288,7 @@ def from_deepseek_vl_2(
|
||||
|
||||
for label_str, bbox_str in zip(label_segments, bbox_segments):
|
||||
label_str = label_str.strip()
|
||||
raw_box_groups = re.findall(r'\[\[.*?\]\]', bbox_str, flags=re.DOTALL)
|
||||
raw_box_groups = re.findall(r"\[\[.*?\]\]", bbox_str, flags=re.DOTALL)
|
||||
|
||||
if not raw_box_groups:
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user