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
Download configuration_cond_unet.py from AImageLab-Zip/US_Cond-UNet: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/AImageLab-Zip/US_Cond-UNet/resolve/main/configuration_cond_unet.py
- Command line
-
hf download hf://AImageLab-Zip/US_Cond-UNet/configuration_cond_unet.py
-
curl -L -o configuration_cond_unet.py https://huggingface.co/AImageLab-Zip/US_Cond-UNet/resolve/main/configuration_cond_unet.py
1.44 kB
| from transformers import PretrainedConfig | |
| class CondUNetConfig(PretrainedConfig): | |
| model_type = "cond_unet" | |
| def __init__( | |
| self, | |
| in_channels=3, | |
| num_labels=1, | |
| n_organs=10, | |
| size=32, | |
| depth=5, | |
| attn_start=0, | |
| use_attn=True, | |
| image_size=512, | |
| patch_size=8, | |
| emb_dim=768, | |
| n_heads=8, | |
| use_dwt=False, | |
| wavelet="haar", | |
| dwt_bands=None, | |
| use_shape=False, | |
| shape_res=32, | |
| unknown_organ_id=-1, | |
| keep_aspect_ratio=True, | |
| self_normalize=True, | |
| **kwargs, | |
| ): | |
| super().__init__(**kwargs) | |
| self.in_channels = in_channels | |
| self.num_labels = num_labels | |
| self.n_organs = n_organs | |
| self.size = size | |
| self.depth = depth | |
| self.attn_start = attn_start | |
| self.use_attn = use_attn | |
| self.image_size = image_size | |
| self.patch_size = patch_size | |
| self.emb_dim = emb_dim | |
| self.n_heads = n_heads | |
| self.use_dwt = use_dwt | |
| self.wavelet = wavelet | |
| self.dwt_bands = dwt_bands or ["LL", "LH", "HL", "HH"] | |
| self.use_shape = use_shape | |
| self.shape_res = shape_res | |
| self.unknown_organ_id = unknown_organ_id | |
| self.keep_aspect_ratio = keep_aspect_ratio | |
| self.self_normalize = self_normalize | |
| self.id2label = {0: "foreground"} | |
| self.label2id = {"foreground": 0} | |