facebookresearch / facebookresearch/segment-anything
RuntimeError: An image must be set with .set_image(...) before mask prediction.
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 54.9k
- Forks
- 6.4k
- PR merge metrics
- No merged PRs in 30d
Description
This is a really werid bug; I'm only getting this sometimes in production.
occasionally, when I call mask_generator.generate(image) where mask_generator_2 is an instance of SamAutomaticMaskGenerator.
mask_generator_2 = SamAutomaticMaskGenerator(
model=sam,
points_per_side=32,
pred_iou_thresh=0.86,
stability_score_thresh=0.92,
crop_n_layers=1,
crop_n_points_downscale_factor=2,
min_mask_region_area=100, # Requires open-cv to run post-processing
)
def some_fn_called_from_flask(image):
masks2_annotations = mask_generator_2.generate(image)
can this be because SamAutomaticMaskGenerator .generate is being called again while it is still generating the previous image?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at SamAutomaticMaskGenerator.generate and reproduce the reported production pattern with overlapping calls, checking whether shared state causes the missing image error. Confirm the concurrency behavior and define done as a verified fix or a clear documented explanation, with a regression test if the behavior can be reproduced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100