Image Feature Extraction
Transformers
Safetensors
skinmap
feature-extraction
dermatology
medical-imaging
embeddings
clip
custom_code
Instructions to use Digital-Dermatology/SkinMap with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Digital-Dermatology/SkinMap with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="Digital-Dermatology/SkinMap", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Digital-Dermatology/SkinMap", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| from typing import Callable, Tuple | |
| from torchvision import models as torchvision_models | |
| from ....src.models.encoders.swin_transformer import swin_base, swin_small, swin_tiny | |
| from ....src.models.encoders.vision_transformer import ( | |
| vit_base, | |
| vit_large, | |
| vit_small, | |
| vit_tiny, | |
| ) | |
| from ....src.models.utils import ModelType | |
| VIT_DICT = { | |
| "vit_tiny": vit_tiny, | |
| "vit_small": vit_small, | |
| "vit_base": vit_base, | |
| "vit_large": vit_large, | |
| "swin_tiny": swin_tiny, | |
| "swin_small": swin_small, | |
| "swin_base": swin_base, | |
| } | |
| def get_encoder_class(base_model_name: str) -> Tuple[Callable, ModelType]: | |
| encoder_cls = VIT_DICT.get(base_model_name, None) | |
| model_type = ModelType.VIT | |
| if encoder_cls is None: | |
| if base_model_name in torchvision_models.__dict__.keys(): | |
| encoder_cls = torchvision_models.__dict__[base_model_name] | |
| model_type = ModelType.CNN | |
| else: | |
| raise ValueError(f"Invalid base model name: {base_model_name}") | |
| return encoder_cls, model_type | |