segment-anything
segment-anything copied to clipboard
[+] add save and load embedding methods in SamPredictor class
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 thetorchlibrary to load the saved embedding.