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

Minimum image size? #70

Open
neilkale opened this issue Nov 16, 2024 · 1 comment
Open

Minimum image size? #70

neilkale opened this issue Nov 16, 2024 · 1 comment

Comments

@neilkale
Copy link

I am trying to run grounded_sam2_local_demo.py on the image below, but I am finding the following stack trace. Is there a minimum image size for SAM2, or is some other issue at play?

Traceback (most recent call last): File "/home/nkale/ml_projects/Grounded-SAM-2/grounded_sam2_local_demo.py", line 80, in <module> masks, scores, logits = sam2_predictor.predict( File "/home/nkale/ml_projects/Grounded-SAM-2/sam2/sam2_image_predictor.py", line 291, in predict masks, iou_predictions, low_res_masks = self._predict( File "/home/nkale/miniconda3/envs/gsam2env/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) File "/home/nkale/ml_projects/Grounded-SAM-2/sam2/sam2_image_predictor.py", line 420, in _predict low_res_masks, iou_predictions, _, _ = self.model.sam_mask_decoder( File "/home/nkale/miniconda3/envs/gsam2env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/home/nkale/miniconda3/envs/gsam2env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "/home/nkale/ml_projects/Grounded-SAM-2/sam2/modeling/sam/mask_decoder.py", line 136, in forward masks, iou_pred, mask_tokens_out, object_score_logits = self.predict_masks( File "/home/nkale/ml_projects/Grounded-SAM-2/sam2/modeling/sam/mask_decoder.py", line 203, in predict_masks assert image_embeddings.shape[0] == tokens.shape[0] AssertionError

image

@neilkale neilkale changed the title minimum image size? Minimum image size? Nov 16, 2024
@ShuoShenDe
Copy link
Contributor

Hi~Dear,

To help us debug the issue more effectively, could you please provide the following additional information:

Input details:
How are you loading and preprocessing the image before passing it to the model?

Environment details:
Could you share your system configuration, such as the version of Python, PyTorch, and any relevant libraries you're using?

Additional runtime information:
Please output and share the shapes of image_embeddings and tokens just before the assertion error occurs. This will help us understand the source of the mismatch.

Shuo Shen

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