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
metadata
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.ptconvnext_small_fb_in22k_ft_in1k_fold0.ptich_resnet18.pt
์ฒดํฌํฌ์ธํธ๋ model_state_dict (๋๋ ResNet18์ model) ํค๋ฅผ ํฌํจํ torch.save dict์
๋๋ค.
Usage
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 ์๋์ฐ๋ฅผ ์ฌ์ฉํ์ธ์.