Skip to content
ModelListedExternal
Download

Ct Head Hemorrhage Detection

Research model for slice- and series-level intracranial hemorrhage detection and slice-level localization on noncontrast head CT. The complete system combines:

KindOtherVersionRevision e6d89c2Bgrade

Model source

Kind
Other
File size
5.24–117 MB
Version
vRevision e6d89c2
Updated
Oct 10, 2026
Downloads
39
Source
Hugging Face

Source description

CT Head Hemorrhage Detection

Research model for slice- and series-level intracranial hemorrhage detection and slice-level localization on noncontrast head CT. The complete system combines:

  1. a 9-channel MaxViT-Tiny slice encoder/classifier;
  2. a two-layer bidirectional GRU for contextual slice and series predictions;
  3. five DeepLabV3+ decoders sharing that exact encoder state for radiologist-facing localization.

This is research software, not a medical device. It must not be used to diagnose, exclude, triage, or manage intracranial hemorrhage without independent clinical validation and appropriate regulatory review.

Model Details

ComponentSpecification
Slice encodermaxvit_tiny_tf_512.in1k, ImageNet initialization
Slice inputThree adjacent axial slices centered on the predicted slice
ChannelsBrain, subdural, and bone windows for each slice, flattened to 9 channels
Slice outputsEpidural, intraparenchymal, intraventricular, subarachnoid, subdural, and any hemorrhage
Sequence headTwo-layer bidirectional GRU, 256 hidden units/direction, class-specific attention
Sequence outputsContext-refined slice probabilities and attention-pooled series probabilities
LocalizationFive-fold DeepLabV3+ decoder ensemble sharing the permanently frozen classification encoder
Inference executionOne encoder pass per slab, followed by the classifier/BiGRU branches and five lightweight decoder passes
Input size512 x 512 pixels

Class order is always:

epidural, intraparenchymal, intraventricular, subarachnoid, subdural, any

The segmentation output is intended as a localization heatmap after the classifier has flagged a slice. It is not intended for hemorrhage volume measurement.

9-channel slab
      |
      v
shared MaxViT-Tiny encoder (one pass)
      |
      +-- multiscale feature maps --> decoder fold 0 --+
      |                            --> decoder fold 1   |
      |                            --> decoder fold 2   +--> mean heatmap
      |                            --> decoder fold 3   |
      |                            --> decoder fold 4 --+
      |
      +-- deepest map --> classifier head/pool --> 512-D pooled feature
                                                   |               |
                                                   v               v
                                           linear slice head   BiGRU sequence head

Input Processing

The model expects three correctly ordered adjacent slices. At the beginning or end of a series, the missing neighboring slice is replaced by a zero-valued windowed slice.

  1. Read each source PNG without reducing its 16-bit depth.

  2. Normalize spatial size to 512 x 512. If either source dimension exceeds 640 pixels, resize the complete field of view with area interpolation. Otherwise, center-crop or zero-pad.

  3. Convert stored values to Hounsfield units:

    HU = stored_value * rescale_slope + rescale_intercept

  4. Apply three linear CT windows independently:

WindowCenterWidthHU interval
Brain40800 to 80
Subdural80200-20 to 180
Bone6002800-800 to 2000
  1. Clip each window and scale it to [0, 1].

  2. Flatten in slice-major order:

    [previous brain, previous subdural, previous bone, center brain, ..., next bone]

  3. The model linearly normalizes [0, 1] to [-1, 1].

Slices were ordered by the first numeric token in each slice filename within each patient/study/series directory. Physical z-spacing was not available to the sequence model.

Data And Splits

Classification used the RSNA Intracranial Hemorrhage Detection challenge dataset converted to lossless 16-bit PNG. Splits were made at the patient level so no patient appeared in more than one partition. The separate BHSD pixel-annotated subset was excluded from classification training, validation, and test.

PartitionPatientsStudies/seriesSlices
Training16,91019,102661,118
Validation8871,00034,865
Heldout test9891,45050,415
Excluded BHSD subset191Not reported6,404

The intended 1,000-study test sample was expanded to all studies belonging to the selected patients, yielding 1,450 heldout studies. This prevents leakage and avoids discarding studies from those patients.

The holdout was first evaluated for the earlier EfficientNetV2-M release. The MaxViT architecture, checkpoint, and blend coefficients were subsequently selected using validation only, then evaluated here to document the replacement release. The test set is therefore consumed and these MaxViT results are a post-selection benchmark, not a pristine one-shot estimate. It must not be used for further tuning.

Training

Slice classifier

The classifier was trained for three epochs on two GPUs with batch size 32 per GPU, bf16-mixed precision, AdamW (lr=3e-4, weight_decay=1e-2), 5% linear warmup from zero, and cosine decay to 1e-6. The multilabel BCE class weights were [1, 1, 1, 1, 1, 2], giving the any target twice the weight of each subtype.

For the 9-channel stem, timm repeated the three ImageNet input-channel kernels three times and multiplied them by 3/9, preserving the aggregate activation scale at initialization.

Spatial flips were independently applied with probability 0.25 for depth, horizontal, and vertical axes. One transform was then sampled uniformly from: no-op, affine, brightness/contrast, Gaussian or motion blur, Gaussian noise, and coarse dropout.

Sequence model

The frozen classifier produced one 512-dimensional pooled feature per slice. The sequence model used the natural class distribution, a maximum length of 64, normalized slice position, a 512 -> 512 projection, and a two-layer bidirectional GRU with 256 hidden units per direction. Training-time feature augmentation used Gaussian noise SD 0.02, elementwise dropout 0.05, and whole-slice feature dropout 0.02.

The sequence model was trained for 20 epochs on two GPUs with effective batch size 256 series, AdamW (lr=3e-4, weight_decay=1e-2), and the same warmup and cosine schedule. Loss weights were slice BCE 1.00, contextual series BCE 0.25, and auxiliary MIL series BCE 0.10. All objectives used class weights [1, 1, 1, 1, 1, 2]. Seed 88 was selected after a deterministic sweep and the architecture was repeated with seeds 89 and 90.

For sequences longer than 64, inference samples round(linspace(0, length - 1, 64)) and restores predictions to original slice indices with nearest-neighbor assignment. The observed development-data maximum was 60 slices.

Segmentation model

The localization branch was developed on BHSD with five patient-separated folds. It predicts six multilabel maps for the middle slice of the 3-slice input. The final model uses a DeepLabV3+ decoder and per-sample DiceFocalLoss. Training used batch size 32/GPU, AdamW, decoder LR 3e-4, ten epochs, and a threshold sweep from 0.1 through 0.9.

The selected path initialized the decoder from an RSNA pseudomask-training stage and then trained five BHSD folds while freezing the classification encoder. Encoder parameters and buffers were restored from the canonical classifier, kept in evaluation mode throughout training, and verified tensor-for-tensor against the classifier checkpoint after training. The five validation-selected best.ckpt decoder outputs are ensembled by averaging sigmoid probabilities. See Segmentation Evaluation Caveat below.

Inference Blending

Blend logits, not probabilities. For each class:

final_logit = (1 - alpha) * baseline_logit + alpha * contextual_logit
ClassSlice alphaSeries alpha
Epidural0.750.50
Intraparenchymal0.750.25
Intraventricular0.750.50
Subarachnoid0.751.00
Subdural0.750.50
Any1.000.50

For series inference, the baseline is the maximum baseline probability over valid slices, clipped to [1e-6, 1 - 1e-6] and converted back to a logit before blending with the contextual attention logit. Coefficients were independently selected from [0, 0.25, 0.5, 0.75, 1] on validation and frozen before test.

The auxiliary MIL output is retained as a diagnostic but is not part of the selected final blend.

Heldout Test Performance

The test set contains 50,415 slices from 1,450 series belonging to 989 patients. Positive prevalence was 15.65% by slice and 44.97% by series for any hemorrhage. AUROC is threshold-independent and does not imply calibration or a clinically acceptable operating point.

Slice AUROC

ClassBaseline classifierContextual BiGRUFixed blend
Epidural0.9540600.9230960.947909
Intraparenchymal0.9864400.9864070.987003
Intraventricular0.9940890.9906940.993089
Subarachnoid0.9716420.9732720.974216
Subdural0.9680030.9718910.972305
Any0.9808260.9827640.982764
Macro mean0.9758430.9713540.976214

Series AUROC

ClassBaseline maxContextual attentionFixed blend
Epidural0.9262510.9090210.926238
Intraparenchymal0.9686430.9698310.969060
Intraventricular0.9874290.9842720.987287
Subarachnoid0.9500670.9544780.954478
Subdural0.9578910.9600660.960236
Any0.9790370.9798710.980402
Macro mean0.9615530.9595900.962950

Patient-cluster bootstrap comparisons against the baseline gave:

  • fixed-blend slice any AUROC delta +0.001952, 95% CI [+0.001283, +0.002693];
  • fixed-blend slice macro-AUROC delta +0.000292, 95% CI [-0.001714, +0.001782];
  • fixed-blend series any AUROC delta +0.001347, 95% CI [+0.000164, +0.003135];
  • fixed-blend series macro-AUROC delta +0.001432, 95% CI [-0.000152, +0.003001].

The data support improved any discrimination from the fixed contextual blend. Macro-average changes are less certain, and the raw contextual head regresses epidural AUROC substantially. Validation selected a nonzero epidural blend for this MaxViT release, so that regression remains visible rather than being silently replaced with classifier-only output.

Epidural hemorrhage was rare: 264 positive test slices and 27 positive test series. Its per-class estimates and blend coefficient are correspondingly less stable than those of more prevalent labels.

Segmentation Evaluation Caveat

The released corrected frozen-state run produced the following fold-averaged any hemorrhage metrics:

Released best.ckpt ensemble membersValue
Volume Dice, threshold swept per fold0.6403
Volume Dice at threshold 0.50.6362
Slice Dice at threshold 0.50.5407
Volume HD95 at threshold 0.534.37 mm
Slice HD95 at threshold 0.589.02 mm

The checkpoint monitor's fold values were 0.6055, 0.6326, 0.6331, 0.6443, and 0.6858 (mean 0.6403). Empty/empty slice pairs were excluded from slice Dice/HD95. Dice thresholds were swept from 0.1 through 0.9 within each BHSD validation fold, while the fixed-threshold Dice and HD95 values above are fold means at threshold 0.5.

An earlier internal summary reported volume Dice 0.6875 for the frozen-gradient experiment. That value mixed pre-training sanity validation with trained epochs and is not a valid final checkpoint estimate; it is not used for this release.

**These are not...

Sources

1 source
Hugging FacePrimaryVersion e6d89c253fdcc2a597dd0fd0f5771821f4947b37
huggingface.co/ianpan/ct-head-hemorrhage-detection/tree/e6d89c253fdcc2a597dd0fd0f5771821f4947b37

Verified Oct 10

Model artifacts

7 artifacts

classifier/model.safetensors

safetensors · 117 MB · SHA-256 525b5fc1731d…1489 · Hugging Face

Download

segmentation/fold0.safetensors

safetensors · 5.24 MB · SHA-256 d299e204c640…c786 · Hugging Face

Download

segmentation/fold1.safetensors

safetensors · 5.24 MB · SHA-256 1dbad6ad4dfd…2c3e · Hugging Face

Download

segmentation/fold2.safetensors

safetensors · 5.24 MB · SHA-256 e814b8e398b7…d052 · Hugging Face

Download

segmentation/fold3.safetensors

safetensors · 5.24 MB · SHA-256 971bfe116379…910d · Hugging Face

Download

segmentation/fold4.safetensors

safetensors · 5.24 MB · SHA-256 f1913ce8d7f9…0e8f · Hugging Face

Download

sequence/model.safetensors

safetensors · 10.6 MB · SHA-256 9421066cb5c6…e487 · Hugging Face

Download

Source excerpts

3 excerpts

--- license: mit library_name: pytorch pipeline_tag: image-classification tags: - medical - radiology - ct - intracranial-hemorrhage - image-classification - image-segmentation - pytorch - timm datasets: - rsna-intracranial-hemorrhage-detection metrics: - roc_auc --- # CT Head Hemorrhage Detection Research model for slice- and series-level intracranial hemorrhage detection and slice-level localization on noncontrast head CT. The complete system combines: 1. a 9-channel MaxViT-Tiny slice encoder/classifier; 2. a two-layer bidirectional GRU for contextual slice and series predictions; 3. five DeepLabV3+ decoders sharing that exact encoder state for radiologist-facing localization. This is **research software, not a medical device**. It must not be used to diagnose, exclude, triage, or manage intracranial hemorrhage without independent clinical validation and appropriate regulatory review. ## Model Details | Component | Specification | | --- | --- | | Slice encoder | `maxvit_tiny_tf_512.in1k`, ImageNet initialization | | Slice input | Three adjacent axial slices centered on the predicted slice | | Channels | Brain, subdural, and bone windows for each slice, flattened to 9 channels | | Slice outputs | Epidural, intraparenchymal, intraventricular, subarachnoid, subdural, and any hemorrhage | | Sequence head | Two-layer bidirectional GRU, 256 hidden units/direction, class-specific attention | | Sequence outputs | Context-refined slice probabilities and attention-pooled series probabilities | | Localization | Five-fold DeepLabV3+ decoder ensemble sharing the permanently frozen classification encoder | | Inference execution | One encoder pass per slab, followed by the classifier/BiGRU branches and five lightweight decoder passes | | Input size | 512 x 512 pixels | Class order is always: ```text epidural, intraparenchymal, intraventricular, subarachnoid, subdural, any ``` The segmentation output is intended as a localization heatmap after the classifier has flagged a slice. It is not intended for hemorrhage volume measurement. ```text 9-channel slab | v shared MaxViT-Tiny encoder (one pass) | +-- multiscale feature maps --> decoder fold 0 --+ | --> decoder fold 1 | | --> decoder fold 2 +--> mean heatmap | --> decoder fold 3 | | --> decoder fold 4 --+ | +-- deepest map --> classifier head/pool --> 512-D pooled feature | | v v linear slice he...

Source context: 39 downloads · 0 likes · Pipeline image-classification · Library pytorch · Repo ianpan/ct-head-hemorrhage-detection

Source context: 15466 downloads · 0 likes · Pipeline image-classification · Library pytorch · Repo ianpan/ct-head-hemorrhage-detection