Downloads · 30 days
111
23% of all-time downloads
Ethosoft/NeuroMed-Cardio-0.8B
NeuroMed-Cardio-0.8B is a image classification model from Ethosoft. Use it when you need a label for an image. It is set up for keras. The card lists the license as mit.
A multi-component AI system for cardiomegaly detection from chest X-ray images. The system combines segmentation, object detection, radiomics feature extraction, and an artificial neural network to produce a single fi…
Downloads · 30 days
111
23% of all-time downloads
All-time downloads
491
Public
Repo size
1.2 GB
Likes
1
Public
Click a slice to open those files.
.keras1.2 GB · 96%
From the Hugging Face model README
A multi-component AI system for cardiomegaly detection from chest X-ray images. The system combines segmentation, object detection, radiomics feature extraction, and an artificial neural network to produce a single final prediction.

Clinical Context: A cardiothoracic ratio (CTR) ≥ 0.5 on a chest X-ray is the standard clinical threshold for cardiomegaly — an early indicator of heart failure.
The pipeline runs through two parallel branches. All outputs are fused inside a final ANN for the binary cardiomegaly prediction.
Chest X-Ray
│
▼
[Preprocessing]
Gamma Correction → Gaussian Blur → CLAHE
│
├──────────────────────────────────┐
│ │
▼ ▼
[Segmentation Branch] [YOLOv11 Branch]
U-Net++ (Heart) Heart + Lung
DeepLabV3+ (Lungs) Bounding Box Detection
│ │
├── Segmentation CTR YOLO CTR
├── Heart/Lung Area Ratio │
├── Heart Left–Right Width │
└── Radiomics (55 features) │
│ │
└──────────┬─────────────────┘
▼
Ensemble CTR
(YOLO 95% + Segmentation 5%)
│
▼
[ANN — 63 Features]
512 → 256 → 128 neurons
│
▼
Cardiomegaly Prediction
Raw X-ray images vary significantly across different scanner devices — contrast imbalances and sensor noise directly affect model performance. A three-stage preprocessing pipeline is applied before any model sees the image:
| Technique | What It Does |
|---|---|
| Gamma Correction | Reveals cardiac tissue and vascular boundary details hidden in dark regions |
| Gaussian Blur | Suppresses pixel-level sensor noise and smooths edges for cleaner detection |
| CLAHE | Locally enhances contrast to bring out fine anatomical structures |
All images are normalized to 256×256 pixels.
Predicts the heart mask at the pixel level.
Produces separate masks for the left and right lungs.
Runs in parallel with segmentation and produces an independent CTR estimate.
Canny edge detection is applied to the heart and lung masks. Horizontal extents are measured from the detected boundaries:
CTR = Heart Width / Lung Width
The two branches are combined with a weighted average:
Ensemble CTR = (YOLO CTR × 0.95) + (Segmentation CTR × 0.05)
YOLO contributes high overall accuracy; the segmentation branch adds fine anatomical detail as a complementary correction signal.
Ensemble performance improvement:
| Model | MAPE | SMAPE | MAE | RMSE |
|---|---|---|---|---|
| YOLO only | 5.58% | 5.32% | 0.02 | 0.04 |
| Segmentation only | 6.03% | 5.64% | 0.03 | 0.05 |
| Ensemble | 5.02% | 4.87% | 0.02 | 0.03 |
The 63 features fed into the ANN come from four sources:
The weighted CTR value computed above. The primary clinical measurement.
Computed as: Heart Pixel Area / Lung Pixel Area
Complements CTR by providing an area-based measurement rather than a width-based one. Particularly useful in cases of chest deformity or lung disease where width measurements alone can be misleading.
Measures how much the heart extends to the left and right of the cardiac midline.
arctan2 and extended into a full axis lineThis determines the direction of cardiac enlargement, providing clinically meaningful spatial context beyond a single ratio.
Extracted from the heart segmentation mask using PyRadiomics.
A custom Residual Attention CNN runs alongside the feature extraction pipeline and provides an independent classification signal.
| Component | Purpose |
|---|---|
| Residual (skip) blocks | Prevents information loss in deeper layers |
| Attention mechanism | Focuses the model on the cardiac and pulmonary region |
| Dropout + Batch Normalization | Prevents overfitting |
| Latent Supervision | Trains on both intermediate and final outputs for balanced learning |
All features (63-dimensional vector) are fused in a single fully-connected ANN that produces the final prediction.
To address low diversity in cardiomegaly cases, four GAN architectures were trained and evaluated using FID scores (lower = better):
| Model | FID Score |
|---|---|
| CGAN | 62 |
| DCGAN | 72 |
| IAGAN | 40 |
| StyleGAN2-ADA | 25 ✓ |
StyleGAN2-ADA's Adaptive Data Augmentation (ADA) mechanism enables stable training even with limited data, achieving the lowest FID score and the most realistic synthetic X-ray images.
The system not only produces a prediction — it explains why.
A total of 80,572 images from five datasets were assembled into a balanced training set (40,286 cardiomegaly / 40,286 non-cardiomegaly).
| Dataset | Institution | Images | Split |
|---|---|---|---|
| MIMIC-CXR | MIT, USA | 51,693 | Training |
| PadChest | Hospital San Juan, Spain | 12,600 | Training |
| CheXpert | Stanford University, USA | 6,046 | Training |
| VinDr-CXR | VinBigData, Vietnam | 4,598 | Training |
| BRAX | Hospital Albert Einstein, Brazil | 2,572 | Hard Training |
| NIH ChestX-Ray14 | NIH Clinical Center, USA | 3,063 | External Test |
| Model / Component | Metric | Value |
|---|---|---|
| U-Net++ (Heart Segmentation) | IoU | 89% |
| YOLOv11 CTR | MAPE / SMAPE | 5.58% / 5.32% |
| Segmentation CTR | MAPE / SMAPE | 6.03% / 5.64% |
| Ensemble CTR | MAPE / SMAPE | 5.02% / 4.87% |
| CNN Classifier | F1 / Accuracy | 81.8% / 80.8% |
| ANN (Final) | F1 / Accuracy | 85.3% / 84.0% |
This is the official technical documentation prepared by the Ethosoft team for Teknofest validators.
Python 3.12 must be installed on the validation device. This is required for full library compatibility.
If the validation device has an NVIDIA GPU and GPU acceleration is desired, follow the steps below. This step can be skipped for CPU-only runs.
⚠️ On Windows, GPU acceleration will not work for TensorFlow. It can be used for PyTorch only.
⚠️ Non-NVIDIA GPUs are not supported.
nvidia-smi
pip install -r winrequirements.txt
pip install -r requirements.txt
The cardiomegaly task uses PyRadiomics, which cannot be installed directly via pip and requires a manual build. Git must be installed on your system.
git clone https://github.com/AIM-Harvard/pyradiomics.git
pip install -e pyradiomics/[dev,docs,test]
From the documentation folder, with your Python environment active, run:
python kardiyomegaliteknefes.py --base_path [IMAGE_PATH] --output_json [OUTPUT_JSON_PATH]
Replace the bracketed values with your own paths:
| Argument | Description |
|---|---|
--base_path | Path to the folder containing the chest X-ray images |
--output_json | Path where the output JSON file will be saved |