Instructions to use kimsungil/brain-ich-ensemble with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use kimsungil/brain-ich-ensemble with timm:
import timm model = timm.create_model("hf_hub:kimsungil/brain-ich-ensemble", pretrained=True) - Notebooks
- Google Colab
- Kaggle
| license: apache-2.0 | |
| library_name: timm | |
| pipeline_tag: image-classification | |
| tags: | |
| - medical | |
| - computer-vision | |
| - image-classification | |
| - brain-ct | |
| - hemorrhage | |
| # Brain CT ICH Ensemble | |
| λ CT λκ°λ΄μΆν(ICH) 6ν΄λμ€ λΆλ₯ μμλΈμ λλ€. | |
| EfficientNet-B4 + ConvNeXt-Small + ResNet18 νλ₯ νκ· μ μ¬μ©ν©λλ€. | |
| **μ°κ΅¬/κ΅μ‘μ©μ΄λ©° μμ μ§λ¨μ©μ΄ μλλλ€.** | |
| ## Classes | |
| | id | name | νκΈ | | |
| |---|---|---| | |
| | 0 | epidural | κ²½λ§μΈμΆν | | |
| | 1 | intraparenchymal | λμ€μ§λ΄μΆν | | |
| | 2 | intraventricular | λμ€λ΄μΆν | | |
| | 3 | subarachnoid | μ§μ£Όλ§νμΆν | | |
| | 4 | subdural | κ²½λ§νμΆν | | |
| | 5 | any | λκ°λ΄μΆν | | |
| ## Files | |
| - `tf_efficientnet_b4_ns_jft_in1k_fold0.pt` | |
| - `convnext_small_fb_in22k_ft_in1k_fold0.pt` | |
| - `ich_resnet18.pt` | |
| 체ν¬ν¬μΈνΈλ `model_state_dict` (λλ ResNet18μ `model`) ν€λ₯Ό ν¬ν¨ν `torch.save` dictμ λλ€. | |
| ## Usage | |
| ```python | |
| from pathlib import Path | |
| import torch | |
| import timm | |
| from huggingface_hub import hf_hub_download | |
| REPO = "kimsungil/brain-ich-ensemble" | |
| NUM_CLASSES = 6 | |
| def load_ckpt(filename, model_name, device): | |
| path = hf_hub_download(REPO, filename) | |
| blob = torch.load(path, map_location=device, weights_only=False) | |
| sd = blob.get("model_state_dict") or blob.get("model") or blob | |
| kwargs = dict(pretrained=False, num_classes=NUM_CLASSES) | |
| if "resnet" not in model_name.lower(): | |
| kwargs.update(drop_rate=0.2, drop_path_rate=0.1) | |
| model = timm.create_model(model_name, **kwargs) | |
| model.load_state_dict(sd, strict=False) | |
| return model.to(device).eval() | |
| device = torch.device("cpu") | |
| models = [ | |
| load_ckpt("tf_efficientnet_b4_ns_jft_in1k_fold0.pt", "tf_efficientnet_b4.ns_jft_in1k", device), | |
| load_ckpt("convnext_small_fb_in22k_ft_in1k_fold0.pt", "convnext_small.fb_in22k_ft_in1k", device), | |
| load_ckpt("ich_resnet18.pt", "resnet18", device), | |
| ] | |
| ``` | |
| μ λ ₯ μ΄λ―Έμ§λ νμ΅κ³Ό κ°μ΄ 380Γ380, brain/subdural μλμ°λ₯Ό μ¬μ©νμΈμ. | |