Image Segmentation
Transformers
Safetensors
cond_unet
ultrasound
medical-image-segmentation
attention-unet
custom-pipeline
custom_code
Instructions to use AImageLab-Zip/US_Cond-UNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AImageLab-Zip/US_Cond-UNet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="AImageLab-Zip/US_Cond-UNet", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForImageSegmentation model = AutoModelForImageSegmentation.from_pretrained("AImageLab-Zip/US_Cond-UNet", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- unet_base.py +2 -1
unet_base.py
CHANGED
|
@@ -199,7 +199,8 @@ class BaseUnet(nn.Module, ABC):
|
|
| 199 |
self.distill_adapter = nn.Conv2d(student_channels, 2048, kernel_size=1)
|
| 200 |
|
| 201 |
if self.distill:
|
| 202 |
-
|
|
|
|
| 203 |
from utils.paths import MEDSAM_BASE_WEIGHTS
|
| 204 |
|
| 205 |
sam_model = sam_model_registry["vit_b"](checkpoint=MEDSAM_BASE_WEIGHTS)
|
|
|
|
| 199 |
self.distill_adapter = nn.Conv2d(student_channels, 2048, kernel_size=1)
|
| 200 |
|
| 201 |
if self.distill:
|
| 202 |
+
import importlib
|
| 203 |
+
sam_model_registry = importlib.import_module("segment_anything").sam_model_registry
|
| 204 |
from utils.paths import MEDSAM_BASE_WEIGHTS
|
| 205 |
|
| 206 |
sam_model = sam_model_registry["vit_b"](checkpoint=MEDSAM_BASE_WEIGHTS)
|