Views
No views yet
| Property | Value |
|---|---|
| Base model | RadBERT (RoBERTa-base architecture, pre-trained on radiology text) |
| Task | Multi-label text classification (18 labels) |
| Language | English (en) |
| Framework | 🤗 Transformers + PyTorch |
| Problem type | multi_label_classification |
| ID | Label |
|---|---|
| 0 | Medical material |
| 1 | Arterial wall calcification |
| 2 | Cardiomegaly |
| 3 | Pericardial effusion |
| 4 | Coronary artery wall calcification |
| 5 | Hiatal hernia |
| 6 | Lymphadenopathy |
| 7 | Emphysema |
| 8 | Atelectasis |
| 9 | Lung nodule |
| 10 | Lung opacity |
| 11 | Pulmonary fibrotic sequela |
| 12 | Pleural effusion |
| 13 | Mosaic attenuation pattern |
| 14 | Peribronchial thickening |
| 15 | Consolidation |
| 16 | Bronchiectasis |
| 17 | Interlobular septal thickening |
pip install transformers torch1from transformers import AutoTokenizer, AutoConfig
2from modeling_radbert import RadBertForSequenceClassification
3import torch
4
5repo_id = "suitch/radbert-english-ctrate-classifier"
6
7# Download the custom model class (or copy modeling_radbert.py locally)
8from huggingface_hub import hf_hub_download
9import sys, os
10
11modeling_path = hf_hub_download(repo_id=repo_id, filename="modeling_radbert.py")
12sys.path.insert(0, os.path.dirname(modeling_path))
13
14# Load config, model, and tokenizer
15config = AutoConfig.from_pretrained(repo_id)
16model = RadBertForSequenceClassification.from_pretrained(repo_id, config=config)
17tokenizer = AutoTokenizer.from_pretrained(repo_id)
18
19model.eval()1text = "The heart is mildly enlarged. A small left pleural effusion is noted."
2
3inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
4
5with torch.no_grad():
6 logits = model(**inputs)
7
8probabilities = torch.sigmoid(logits).squeeze()
9threshold = 0.5
10predicted_labels = [
11 config.id2label[i] for i, p in enumerate(probabilities) if p >= threshold
12]
13
14print("Predicted labels:", predicted_labels)
15print("Probabilities:")
16for i, p in enumerate(probabilities):
17 print(f" {config.id2label[i]}: {p:.4f}")[CLS] / pooler output1@article{hamamci2024ctrate,
2 title={CT-RATE: A Large-Scale Computed Tomography Report-Image Dataset for AI in Radiology},
3 author={Hamamci, Ibrahim Ethem and others},
4 journal={arXiv preprint},
5 year={2024}
6}
7
8@article{yan2022radbert,
9 title={RadBERT: Adapting Transformer-based Language Models to Radiology},
10 author={Yan, Di and others},
11 journal={Radiology: Artificial Intelligence},
12 year={2022}
13}