-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e60ede2
commit 11f170d
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import unittest | ||
import micro_sam.util as util | ||
|
||
from skimage.data import binary_blobs | ||
|
||
|
||
class TestState(unittest.TestCase): | ||
model_type = "vit_t" if util.VIT_T_SUPPORT else "vit_b" | ||
|
||
def test_state_for_interactive_segmentation(self): | ||
from micro_sam.sam_annotator._state import AnnotatorState | ||
image = binary_blobs(512) | ||
predictor = util.get_sam_model(model_type=self.model_type) | ||
image_embeddings = util.precompute_image_embeddings(predictor, image) | ||
|
||
state = AnnotatorState() | ||
state.image_embeddings = image_embeddings | ||
state.predictor = predictor | ||
state.image_shape = image.shape | ||
self.assertTrue(state.initialized_for_interactive_segmentation()) | ||
|
||
def test_state_for_tracking(self): | ||
from micro_sam.sam_annotator._state import AnnotatorState | ||
|
||
state = AnnotatorState() | ||
state.current_track_id = 1 | ||
state.lineage = {1: {}} | ||
self.assertTrue(state.initialized_for_tracking()) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |