Skip to content

Conversation

@anwai98
Copy link
Collaborator

@anwai98 anwai98 commented Jul 25, 2024

No description provided.

h, w = y_one_hot.shape[-2:]
padh = self.model.sam.image_encoder.img_size - h
padw = self.model.sam.image_encoder.img_size - w
y_one_hot = F.pad(input=y_one_hot, pad=(0, padw, 0, padh))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this not just ResizeLongsetSide until here? Can't we just use it instead of duplicating the code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's because of one parameter that I have to remplement this: (they set antialias to True, which for labels here, we need to set to False.) https://github.com/facebookresearch/segment-anything/blob/main/segment_anything/utils/transforms.py#L63-L65

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also to add: with ResizeLongestSide, it's still a two stage agenda: (taking LIVECell (images of shape (520, 704) as an example)

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, makes sense!

@anwai98
Copy link
Collaborator Author

anwai98 commented Apr 7, 2025

I'll close this in favor of #990

@anwai98 anwai98 closed this Apr 7, 2025
@anwai98 anwai98 deleted the u-trainers branch April 28, 2025 20:51
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