The repository provides code for running inference with the SegmentAnything Model (SAM), links for downloading the trained model checkpoints, and example notebooks that show how to use the model.
Apache License 2.0
47.87k
stars
5.66k
forks
source link
[+] add save and load embedding methods in SamPredictor class #724
Added save and load functionality for image embeddings in SamPredictor class.
This pull request includes two new methods in the SamPredictor class:
save_image_embedding(self, path): This method allows saving the image embedding to a specified path. It raises a RuntimeError if an image has not been set with .set_image() before saving the embedding.
load_image_embedding(self, path): This method allows loading the image embedding from a specified path and sets it as an attribute of the object. It uses the torch library to load the saved embedding.
Added save and load functionality for image embeddings in SamPredictor class.
This pull request includes two new methods in the SamPredictor class:
save_image_embedding(self, path)
: This method allows saving the image embedding to a specified path. It raises a RuntimeError if an image has not been set with.set_image()
before saving the embedding.load_image_embedding(self, path)
: This method allows loading the image embedding from a specified path and sets it as an attribute of the object. It uses thetorch
library to load the saved embedding.