facebookresearch / facebookresearch/segment-anything
How to store embedding and then use it in the SamPredictor Class?
- Dominant language
- Jupyter Notebook
- Stars
- 54.9k
- Forks
- 6.4k
- PR merge metrics
- No merged PRs in 30d
Description
I would like to calculate embedding in a machine, then use it in another to do predictions. I have been trying to save it using
predictor = SamPredictor(sam)
predictor.set_image(img)
embedding = predictor.get_image_embedding().detach().cpu().numpy()
with open(pickle_file_name, "wb") as f:
pickle.dump(embedding, f)
then I upload the pickle file in another script but I don't know how to insert embedding again in the predictor avoiding to calculate embedding again with set_image(img).
Contributor guide
Research direction
Start with the SamPredictor methods named in the report—set_image and get_image_embedding—and the pickle save/load workflow. Trace how the predictor handles image embeddings, then document the cross-machine usage path; done means a saved embedding can be used for prediction without recomputing it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision, machine-learning
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100