fix: ajouter position relative au prompt grounding (désambiguïsation)
Quand plusieurs éléments ont le même texte ("Rechercher" dans la taskbar
ET dans l'explorateur), la position relative (en bas, en haut, à gauche)
aide le VLM à choisir le bon.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4580,7 +4580,14 @@ def _resolve_by_grounding(
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# Prompt natif Qwen2.5-VL — format bbox_2d (le seul fiable)
|
# Prompt natif Qwen2.5-VL — format bbox_2d (le seul fiable)
|
||||||
prompt = f"Detect '{description}' in this image with a bounding box."
|
# Ajouter la position relative pour désambiguïser (ex: deux "Rechercher" à l'écran)
|
||||||
|
original_pos = target_spec.get("original_position", {})
|
||||||
|
pos_hint = ""
|
||||||
|
y_rel = original_pos.get("y_relative", "")
|
||||||
|
x_rel = original_pos.get("x_relative", "")
|
||||||
|
if y_rel or x_rel:
|
||||||
|
pos_hint = f" located {y_rel} {x_rel} of the screen".strip()
|
||||||
|
prompt = f"Detect '{description}'{pos_hint} in this image with a bounding box."
|
||||||
|
|
||||||
# Le grounding nécessite un modèle entraîné pour les coordonnées (bbox_2d).
|
# Le grounding nécessite un modèle entraîné pour les coordonnées (bbox_2d).
|
||||||
# Qwen2.5-VL est le seul qui retourne des positions précises.
|
# Qwen2.5-VL est le seul qui retourne des positions précises.
|
||||||
|
|||||||
Reference in New Issue
Block a user