/ Модель

Характеристики

Лицензия
Своя лицензия
Библиотека
transformers
Опубликована
20 окт 2026

BrainTumorClassifier

Классификация изображенийИзображение → label3 профессии

Двухэтапная модель анализирует 2D T1-срезы МРТ мозга и классифицирует их как глиому, менингиому, опухоль гипофиза или отсутствие опухоли.

0скачиваний за 30 дней0лайковвеса обновлены20 окт 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Модель imbenjita/BrainTumorClassifier — двухэтапная система классификации срезов МРТ головного мозга, обученная на наборе BRISC 2025 с T1-взвешенными изображениями. Сначала SegFormer-B5 формирует карту вероятности опухоли по пикселям, затем ConvNeXt-Base классифицирует изображение вместе с этой картой по четырём классам: глиома, менингиома, опухоль гипофиза и отсутствие опухоли. Для основного варианта при инференсе достаточно среза МРТ; вариант gt_seg требует экспертную маску и служит верхней оценкой качества.

Модель предназначена для исследовательской классификации 2D-срезов и демонстрации методов интерпретации Grad-CAM и SHAP. Правило принятия решения настроено так, чтобы снижать риск пропустить опухоль, поэтому сомнительные срезы чаще получают опухолевую метку. В отчёте об оценке на официальной тестовой выборке из 1000 срезов для основного варианта указаны точность 95,9% и макро-F1 96,3%; эти результаты относятся только к данному набору данных.

Модель не является медицинским устройством и не предназначена для диагностики или клинических решений. Она проверена только на одном публичном наборе 2D T1-срезов, без 3D-контекста и внешней валидации; отсутствие идентификаторов пациентов допускает пересечение срезов одного пациента между обучением и тестом. Классификатор всегда выбирает один из четырёх классов, а карта сегментации лишь приблизительно локализует опухоль. Репозиторий использует веса SegFormer-B5 и ConvNeXt-Base с Hugging Face; лицензия указана как other, конкретные условия в доступной карточке не раскрыты.

Сценарии применения

  • исследовательская классификация срезов МРТ мозга по четырём классам
  • предварительная сортировка T1-срезов для последующего просмотра специалистом
  • сравнение классификации с предсказанной и экспертной маской опухоли
  • визуализация областей, влияющих на классификацию, методами Grad-CAM и SHAP

Ограничения

Не предназначена для клинического применения: обучена и проверена только на одном наборе 2D T1-срезов, не валидирована на других учреждениях, сканерах и популяциях; возможна утечка между выборками из-за отсутствия идентификаторов пациентов. Модель принудительно относит изображение к одному из четырёх классов, а чувствительность 100% на тесте не гарантирует отсутствия пропусков опухоли.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Brain Tumor MRI Classification: SegFormer-B5 + ConvNeXt-Base

Research demo, not a medical device. Do not use this model to diagnose or to make clinical decisions.

Introduction

This repository contains a two-stage model that classifies a brain MRI slice as glioma, meningioma, pituitary tumor or no tumor. It is trained on the BRISC 2025 T1-weighted dataset.

Architecture.

  1. SegFormer-B5 (nvidia/segformer-b5-finetuned-ade-640-640, Mix Transformer encoder + All-MLP decoder) is fine-tuned as a binary tumor segmenter (background / tumor) with a frozen encoder. It outputs a per-pixel tumor probability map.
  2. ConvNeXt-Base (facebook/convnext-base-224) is the classifier. Its input is the RGB scan plus the tumor map as a fourth channel. The first three stages are frozen. Features from the last stage are pooled and passed to a linear head.

Minimizing false negatives. Missing a tumor is treated as more costly than a false alarm:

  • Training loss: class-weighted cross-entropy plus an asymmetric detection loss. A tumor called "no tumor" costs 5× a false alarm.
  • Decision rule: a minimum-expected-cost rule instead of plain argmax. A slice is cleared as no_tumor only when P(no_tumor) is above roughly 0.83. Every other slice gets the most likely tumor type.

Two classifier variants.

VariantCheckpointClassifier inputNeeds a mask at inference?
pred_seg (main model)seg_best.pt + cls_pred_seg_best.ptscan + SegFormer-predicted tumor mapNo
gt_seg (upper bound)cls_gt_seg_best.ptscan + expert tumor maskYes

The gt_seg model shows how well the classifier can do when the tumor location is perfect. An empty mask is treated as no_tumor.

Data handling.

  • Train images that are byte-identical to a test image, or repeated within train, were removed (SHA-256) to prevent leakage.
  • The validation set was cut from train in blocks of 20 consecutive indices per class and plane. This is a heuristic, because the dataset has no patient IDs, so slices of the same patient may still appear in both train and validation.
  • The test set is the official BRISC test split (1,000 slices).

Figure 1. Left: one example of every class and anatomical plane (red outline = ground-truth mask). Right: one training batch.

Evaluation Results

All numbers are on the official BRISC test split (1,000 slices: 254 glioma, 306 meningioma, 300 pituitary, 140 no tumor; 398 axial, 305 coronal, 297 sagittal). Metrics use the cost-aware decision rule. On this test set the cost-aware rule and plain argmax gave identical predictions.

Metric (test)pred_seg (scan only)gt_seg (scan + true mask)
Accuracy95.996.7
Macro F196.397.1
Tumor sensitivity (tumor vs no tumor)100.0 (860/860)100.0 (860/860)
Specificity (no-tumor slices cleared)98.6 (138/140)100.0 (140/140)
False negatives (tumor called no tumor)00
False alarms (no tumor called tumor)20

Per-class results (test, cost-aware rule)

Classpred_seg precisionpred_seg recallpred_seg F1gt_seg precisiongt_seg recallgt_seg F1
glioma96.792.994.897.191.394.1
meningioma94.193.193.692.597.194.7
pituitary95.2100.097.699.399.399.3
no_tumor100.098.699.3100.0100.0100.0

Accuracy by anatomical plane (test)

PlaneSlicespred_seg accuracygt_seg accuracy
Axial39895.798.2
Coronal30596.495.1
Sagittal29795.696.3

Tumor sensitivity was 100% in every plane for both variants. The most common error is glioma versus meningioma, in both directions.

Confusion matrices

Red box = false negatives (a tumor called no tumor). The right panel collapses the four classes into tumor / no tumor.

Main model (pred_seg), test set

Upper bound (gt_seg), test set

Interpretability

Grad-CAM (on the last ConvNeXt stage) and SHAP (GradientExplainer on P(tumor)) are provided for both variants. Heat maps show evidence for the predicted class.

Main model (pred_seg): Grad-CAM, random correctly classified test slices (last column = SegFormer tumor map)

Main model (pred_seg): SHAP (red = evidence for tumor, blue = against)

How to read these. The SHAP panels on the tumor-map and mask channels show that the classifier uses the segmented region. Grad-CAM often also highlights areas outside the tumor, such as the skull edge, other anatomy or the image border, even for correct predictions. These maps show where the model got evidence, not a verified tumor localization. Treat them as a debugging aid, not as proof that the model "looks at the tumor".

Usage

Files needed in one folder: brisc_segformer_convnext.py (model and prediction code), seg_best.pt, cls_pred_seg_best.pt, and optionally cls_gt_seg_best.pt. Only the trainable weights are stored in the .pt files. The frozen base weights are downloaded from the Hub on first load.

import os
os.environ["BRISC_OUTPUT_DIR"] = "."   # folder holding the .pt files

import brisc_segformer_convnext as brisc

# Scan only: SegFormer finds the tumor, ConvNeXt classifies it.
segmenter, classifier = brisc.load_trained_models(brisc.MODE_PREDICTED_MASK)
result = brisc.predict_tumor_type("scan.jpg", segmenter, classifier)
print(result["tumor_type"], result["tumor_probability"])

# Scan + a tumor mask you already have (any non-zero pixel = tumor).
_, true_mask_classifier = brisc.load_trained_models(brisc.MODE_TRUE_MASK)
result = brisc.predict_tumor_type_with_mask("scan.jpg", "mask.png", true_mask_classifier)

The returned dictionary contains:

KeyMeaning
tumor_typeRecommended label from the false-negative-minimizing rule
argmax_typePlain highest-probability class
tumor_detectedTrue unless the label is no_tumor
tumor_probability1 − P(no_tumor)
probabilities_pctPer-class probabilities in percent
tumor_area_pctShare of the slice covered by the tumor map or mask
figurePath to the saved scan / tumor map / Grad-CAM picture

Preprocessing: the slice is padded to a square and resized (512×512 for SegFormer, 320×320 for ConvNeXt). The segmenter must be used at the size it was trained at.

Figure 2. Left: scan-only prediction (pred_seg). Right: prediction with a provided mask (gt_seg).

Per-slice test predictions with class probabilities are available in test_predictions.csv (pred_seg) and gt_test_predictions.csv (gt_seg).

Limitations

  • Not for clinical use. The model was trained and tested on one public dataset of 2D T1 slices. It has not been validated on other scanners, sequences, hospitals or populations, and 2D slices carry no 3D context.
  • Possible optimistic estimates. BRISC has no patient IDs. Exact duplicates were removed, but slices from the same patient can still appear in both train and test, which would inflate the results above.
  • The 100% sensitivity is on 860 tumor slices. It does not guarantee that no tumor will ever be missed. The cost-aware rule trades false negatives for false alarms, so borderline scans will be flagged as tumors.
  • Only four labels. Any other pathology, an unusual scan, or a non-brain image will still be forced into one of the four classes.
  • Segmentation quality is moderate. The predicted tumor map is only an approximate localization, and the classifier is more accurate when given true masks (gt_seg).
  • Grad-CAM can highlight non-tumor regions (see the interpretability note above).

License

The model code in this repository and the trained checkpoints are released for research use. Please check the licenses of what they build on before any other use:

  • SegFormer (nvidia/segformer-b5-finetuned-ade-640-640): see the model card for its license, which may restrict commercial use.
  • ConvNeXt (facebook/convnext-base-224): see the model card for its license.
  • BRISC 2025 dataset: see the dataset's terms.

Citation

If you use this model, please also cite the dataset and the backbones:

@article{fateh2025brisc,
  title={Brisc: Annotated dataset for brain tumor segmentation and classification with swin-hafnet},
  author={Fateh, Amirreza and Rezvani, Yasin and Moayedi, Sara and Rezvani, Sadjad and Fateh, Fatemeh and Fateh, Mansoor and Abolghasemi, Vahid},
  journal={arXiv preprint arXiv:2506.14318},
  year={2025}
}

@inproceedings{xie2021segformer,
  title={SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers},
  author={Xie, Enze and Wang, Wenhai and Yu, Zhiding and Anandkumar, Anima and Alvarez, Jose M and Luo, Ping},
  booktitle={NeurIPS},
  year={2021}
}

@inproceedings{liu2022convnet,
  title={A ConvNet for the 2020s},
  author={Liu, Zhuang and Mao, Hanzi and Wu, Chao-Yuan and Feichtenhofer, Christoph and Darrell, Trevor and Xie, Saining},
  booktitle={CVPR},
  year={2022}
}

Contact

Questions and issues: please open a discussion on this model's Community tab.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · image-classification

Нельзя запустить

В репозитории нет config.json: не понять архитектуру модели.

Ревизия весов
04c94c4

0 моделей