Feat/microsam#1097
Open
keejkrej wants to merge 5 commits intoSchmollerLab:mainfrom
Open
Conversation
- cellacdc/promptable_models/micro-sam/acdcPromptSegment.py: Model with vit_b_lm default, same interface as sam2
- myutils: download_model('micro-sam') returns True (weights via pooch on first use)
- tests: ensure_microsam(), test_microsam.py (skipped when no GPU)
Co-authored-by: Cursor <cursoragent@cursor.com>
…_other_objects_as_background=False - micro-sam: remove i param from segment_from_points (2D data rejects index) - micro-sam, sam2, segment_anything: set treat_other_objects_as_background=False by default Co-authored-by: Cursor <cursoragent@cursor.com>
- Use micro-sam @ git+https://github.com/keejkrej/micro-sam.git in microsam extra - Remove [tool.uv.sources] override for broader pip/uv compatibility Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces initial micro-sam support into Cell-ACDC’s promptable segmentation framework, along with installation extras and a new prompt-segmentation test to exercise the integration.
Changes:
- Added a new promptable model implementation for micro-sam and a corresponding pytest module test.
- Simplified test import checks for SAM/SAM2 and added an import check for micro-sam.
- Updated packaging (
pyproject.toml) to add optional extras for SAM/SAM2/CellSAM/micro-sam and adjusted core dependencies.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
tests/utils/segmentation.py |
Simplifies ensure_sam/ensure_sam2 and adds ensure_microsam. |
tests/utils/__init__.py |
Re-exports ensure_microsam for test modules. |
tests/prompt_segm/test_microsam.py |
Adds a prompt-based micro-sam integration test using ground-truth centroids. |
pyproject.toml |
Updates base deps and adds new optional dependency groups for promptable SAM variants and micro-sam. |
cellacdc/promptable_models/segment_anything/acdcPromptSegment.py |
Changes default treat_other_objects_as_background behavior. |
cellacdc/promptable_models/sam2/acdcPromptSegment.py |
Changes default treat_other_objects_as_background behavior. |
cellacdc/promptable_models/micro-sam/acdcPromptSegment.py |
Adds the new promptable micro-sam backend implementation. |
cellacdc/myutils.py |
Uses stdlib configparser for custom model config parsing and adds micro-sam handling in download_model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
3999
to
4001
| acdcPromptSegment = import_module( | ||
| f'cellacdc.promptable_models.{model_name}.acdcPromptSegment' | ||
| ) |
Comment on lines
+83
to
+90
| def _set_image(self, image): | ||
| img_rgb = self._to_rgb(image) | ||
| if self._embedded_shape is None or self._embedded_shape != img_rgb.shape: | ||
| self._image_embeddings = precompute_image_embeddings( | ||
| self.model, img_rgb, ndim=2, verbose=False, | ||
| ) | ||
| self._embedded_shape = img_rgb.shape | ||
|
|
| slice(x0, x0 + obj_mask.shape[2]), | ||
| ) | ||
|
|
||
| lab_out[obj_slice][obj_mask] = prompt_id |
| "matplotlib", | ||
| "sympy", | ||
| "imagecodecs" | ||
| "matplotlib" |
| # Check if custom model (config is GUI-only) | ||
| import configparser | ||
| cp = configparser.ConfigParser() | ||
| cp.read(models_list_file_path) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
microsam integration, requires modified microsam source for installation
https://github.com/keejkrej/micro-sam/tree/cellacdc
don't merge yet!