facebookresearch / facebookresearch/segment-anything
Prompt error
- Dominant language
- Jupyter Notebook
- Stars
- 54.9k
- Forks
- 6.4k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have got that prompt issue below:
```
Traceback (most recent call last):
File "/Users/okanduzyel/Downloads/segment-anything/testWithPrompt.py", line 23, in
masks, _, _ = predictor.predict("brain tumor")
File "/Users/okanduzyel/Downloads/segment-anything/segment_anything/predictor.py", line 139, in predict
assert (
AssertionError: point_labels must be supplied if point_coords is supplied.
```
My code:
```
import cv2
import matplotlib.pyplot as plt
import numpy as np
import os
import argparse
from segment_anything import SamPredictor, sam_model_registry
sam = sam_model_registry["vit_h"](checkpoint="/Users/okanduzyel/Downloads/segment-anything/sam_vit_h_4b8939.pth")
predictor = SamPredictor(sam)
image_path = '/Users/okanduzyel/Downloads/archive-2/Testing/glioma_tumor/image.jpg' #args.input
img = cv2.imread(image_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
predictor.set_image(img)
masks, _, _ = predictor.predict("brain tumor")
```
Any idea?
Contributor guide
Research direction
Start by reading segment_anything/predictor.py around the predict method and the failing call shown in the issue. Compare the accepted inputs with the repository's documented predictor examples; done means the expected prompt usage and required inputs are clearly documented or the issue is shown to be usage-related.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- opencv, python
- Domain
- computer-vision, machine-learning
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100