Skip to content
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

how to compute bilinear interpolate (eg: segment anything 2 include bilinear interpolate) #975

Open
yysu-888 opened this issue Sep 30, 2024 · 2 comments

Comments

@yysu-888
Copy link

yysu-888 commented Sep 30, 2024

import torch.nn.functional as F
F.interpolate(...,mode = "bilinear")

@YavorGIvanov
Copy link
Collaborator

Previously I had to just preprocess the image independent of ggml - https://github.com/YavorGIvanov/sam.cpp/blob/81002818eb0e2cb3b9a523286b067f80f8424431/sam.cpp#L355

However, I am not sure whether there is easier way to do it in ggml

@yysu-888
Copy link
Author

yysu-888 commented Oct 2, 2024

Previously I had to just preprocess the image independent of ggml - https://github.com/YavorGIvanov/sam.cpp/blob/81002818eb0e2cb3b9a523286b067f80f8424431/sam.cpp#L355

However, I am not sure whether there is easier way to do it in ggml

I mean sam2 not sam,https://github.com/facebookresearch/sam2/blob/main/sam2/modeling/backbones/image_encoder.py, in line 116 F.interpolate (fpn_interp_model: str = "bilinear")as follow
top_down_features = F.interpolate(
prev_features.to(dtype=torch.float32),
scale_factor=2.0,
mode=self.fpn_interp_model,
align_corners=(
None if self.fpn_interp_model == "nearest" else False
),

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

No branches or pull requests

2 participants