facebookresearch / facebookresearch/sam2
only get the background by predictor
- Dominant language
- Jupyter Notebook
- Stars
- 19.9k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
In my image, there's a mobile, but when I use 'predictor.predict_torch', I only get a mask with background but no mobile.
below is the codes:
`
> sam = sam_model_registry["vit_l"](checkpoint="../../models/segment-anything/sam_vit_l_0b3195.pth")
> device="cpu"
> sam.to(device=device)
> predictor = SamPredictor(sam)
> predictor.set_image(image)
> boxes_filt=torch.Tensor([[7.5935, 14.0314, 589.9314, 372.0146]])
> transformed_boxes = predictor.transform.apply_boxes_torch(boxes_filt, image.shape[:2]).to(device)
> masks, _, _ = predictor.predict_torch(
> point_coords = None,
> point_labels = None,
> boxes = transformed_boxes.to(device),
> multimask_output = False,
> )
`
but I get the blow mask:
> Original Image

> Image with Mask(**_only the background is masked_**)

Contributor guide
Assessment
This issue has not been assessed yet.