segment-anything icon indicating copy to clipboard operation
segment-anything copied to clipboard

[+] add save and load embedding methods in SamPredictor class

Open Kirscher opened this issue 1 year ago • 0 comments

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.

Kirscher avatar Apr 04 '24 09:04 Kirscher