-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update trainers to compute loss over low_res_mask #669
base: master
Are you sure you want to change the base?
Conversation
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)) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
ResizeLongestSide
would only adjust the inputs to the longest side: (eg.(520, 704)
-?(720, 1024)
).- There's still the next stage where the padding takes place to complete the image shape to the desired input shape: (eg.
(720, 1024)
->(1024, 1024)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, makes sense!
No description provided.