Skip to content

Add LightGlue fast image processor#41670

Merged
yonigozlan merged 4 commits intohuggingface:mainfrom
yonigozlan:add-image-processor-fast-lightglue
Oct 21, 2025
Merged

Add LightGlue fast image processor#41670
yonigozlan merged 4 commits intohuggingface:mainfrom
yonigozlan:add-image-processor-fast-lightglue

Conversation

@yonigozlan
Copy link
Copy Markdown
Member

What does this PR do?

As the title says

@yonigozlan yonigozlan requested a review from molbap October 16, 2025 19:43
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Copy Markdown
Contributor

@molbap molbap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool! left minor comments

Whether to convert the image to grayscale. Can be overridden by `do_grayscale` in the `preprocess` method.
"""

do_grayscale: bool
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert_to_grayscale maybe?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed it's better but it would be breaking BC :(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true true

Comment thread src/transformers/models/lightglue/modular_lightglue.py Outdated
Comment on lines +98 to +100
This function is supposed to return a 1-channel image, but it returns a 3-channel image with the same value in each
channel, because of an issue that is discussed in :
https://github.com/huggingface/transformers/pull/25786#issuecomment-1730176446
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😩

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is still a problem, but better to keep it just in case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah not a big issue, it's just funny to see

Comment thread src/transformers/models/lightglue/image_processing_lightglue_fast.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, lightglue

@yonigozlan
Copy link
Copy Markdown
Member Author

Thanks for the review @molbap ! It should be good now :)

@yonigozlan yonigozlan requested a review from molbap October 17, 2025 15:31
Copy link
Copy Markdown
Contributor

@molbap molbap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, looks good to me! Nice work!

Whether to convert the image to grayscale. Can be overridden by `do_grayscale` in the `preprocess` method.
"""

do_grayscale: bool
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true true

Comment on lines +98 to +100
This function is supposed to return a 1-channel image, but it returns a 3-channel image with the same value in each
channel, because of an issue that is discussed in :
https://github.com/huggingface/transformers/pull/25786#issuecomment-1730176446
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah not a big issue, it's just funny to see

Comment on lines +232 to +239
class LightGlueImageProcessorFast(SuperGlueImageProcessorFast):
def post_process_keypoint_matching(
self,
outputs: LightGlueKeypointMatchingOutput,
target_sizes: Union[TensorType, list[tuple]],
threshold: float = 0.0,
) -> list[dict[str, torch.Tensor]]:
return super().post_process_keypoint_matching(outputs, target_sizes, threshold)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's cool

@yonigozlan yonigozlan merged commit 2e67a9b into huggingface:main Oct 21, 2025
22 checks passed
ngazagna-qc pushed a commit to ngazagna-qc/transformers that referenced this pull request Oct 23, 2025
* add fast image processor skel

* add working lightglue fast image processor + tests

* remove plot_keypoint_matching
i3hz pushed a commit to i3hz/transformers that referenced this pull request Oct 30, 2025
* add fast image processor skel

* add working lightglue fast image processor + tests

* remove plot_keypoint_matching
SangbumChoi pushed a commit to SangbumChoi/transformers that referenced this pull request Jan 23, 2026
* add fast image processor skel

* add working lightglue fast image processor + tests

* remove plot_keypoint_matching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants