-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from roboflow/feature/qwen_2_5_vl_object_dete…
…ction_support Qwen2.5-VL object detection fine-tuning support
- Loading branch information
Showing
10 changed files
with
161 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import numpy as np | ||
from qwen_vl_utils import smart_resize | ||
|
||
|
||
def detections_to_suffix_formatter( | ||
xyxy: np.ndarray, | ||
class_id: np.ndarray, | ||
classes: list[str], | ||
resolution_wh: tuple[int, int], | ||
min_pixels: int, | ||
max_pixels: int, | ||
) -> str: | ||
image_w, image_h = resolution_wh | ||
input_h, input_w = smart_resize(height=image_h, width=image_w, min_pixels=min_pixels, max_pixels=max_pixels) | ||
|
||
xyxy = xyxy / [image_w, image_h, image_w, image_h] | ||
xyxy = xyxy * [input_w, input_h, input_w, input_h] | ||
xyxy = xyxy.astype(int) | ||
|
||
detection_lines = [] | ||
for cid, box in zip(class_id, xyxy): | ||
label = classes[int(cid)] | ||
bbox_str = ", ".join(str(num) for num in box.tolist()) | ||
line = f'\t{{"bbox_2d": [{bbox_str}], "label": "{label}"}}' | ||
detection_lines.append(line) | ||
|
||
joined_detections = ",\n".join(detection_lines) | ||
formatted_str = f"```json\n[\n{joined_detections}\n]\n```" | ||
return formatted_str | ||
|
||
|
||
def detections_to_prefix_formatter( | ||
xyxy: np.ndarray, class_id: np.ndarray, classes: list[str], resolution_wh: tuple[int, int] | ||
) -> str: | ||
return "Outline the position of " + ", ".join(classes) + ". Output all the coordinates in JSON format." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "maestro" | ||
version = "1.1.0rc2" | ||
version = "1.1.0rc3" | ||
description = "Streamline the fine-tuning process for vision-language models like PaliGemma 2, Florence-2, and Qwen2.5-VL." | ||
authors = [ | ||
{name = "Piotr Skalski", email = "[email protected]"} | ||
|
@@ -40,7 +40,7 @@ dependencies = [ | |
"roboflow>=1.1.0", | ||
"dacite>=1.9.1", | ||
"lightning>=2.4.0", | ||
"supervision>=0.20.0,<0.26.0", | ||
"supervision>=0.26.0rc4", | ||
"requests>=2.31.0,<=2.32.3", | ||
"typer>=0.12.5", | ||
"evaluate>=0.4.3", | ||
|