Add MPS Pytorch support for batched_mask_to_box function #180
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an edited copy of the
batched_mask_to_box()
function fromsegment_anything/utils/amg.py
to the micro-sam codebase. The function has been edited to solve two problems:The license for segment-anything is Apache 2.0, which is compatible with the MIT licence micro-sam uses.
Eventually, if this gets fixed upstream we can remove it from the micro-sam code and go back to using the
batched_mask_to_box()
function directly from segment-anything. But that seems unlikely to happen soon.Added changes for MPS facebookresearch/segment-anything#122
batched_mask_to_box()
. Creating an issue would be helpful here (maybe I'll try and do that this evening).Extra context: discussed here previously on the main PR for adding .MPS support to micro-sam.