Deep optimization-guided hybrid neural network for accurate detection and segmentation of white matter hyperintensities in clinical MRI images.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 271 lines · 7.1 KB · CC-BY-4.0
- # %%
- !pip install torch torchvision opencv-python tqdm
- # %%
- from google.colab import files
- uploaded = files.upload()
- # %%
- !unzip mini_dataset.zip
- # %%
- import os, cv2, torch, torch.nn as nn
- import matplotlib.pyplot as plt
- from torch.utils.data import Dataset, DataLoader
- import random
- import numpy as np
- device = "cuda" if torch.cuda.is_available() else "cpu"
- # ===== DATASET =====
- class MiniWMH(Dataset):
- def __init__(self, root="mini_dataset", size=128):
- self.imgs=sorted(os.listdir(f"{root}/images"))
- self.root=root; self.size=size
- def __len__(self): return len(self.imgs)
- def __getitem__(self,i):
- img=cv2.imread(f"{self.root}/images/{self.imgs[i]}",0)
- mask=cv2.imread(f"{self.root}/masks/{self.imgs[i]}",0)
- img=cv2.resize(img,(self.size,self.size))/255.0
- mask=cv2.resize(mask,(self.size,self.size))/255.0
- return torch.tensor(img).unsqueeze(0).float(), torch.tensor(mask).unsqueeze(0).float()
- dataset=MiniWMH()
- loader=DataLoader(dataset,8,shuffle=True)
- # ===== LOSS =====
- def weighted_bce(pred,target):
- w = target*10 + 1
- return nn.functional.binary_cross_entropy_with_logits(pred,target,weight=w)
- def dice_loss(pred,target):
- pred=torch.sigmoid(pred)
- inter=(pred*target).sum()
- return 1-(2*inter+1)/(pred.sum()+target.sum()+1)
- def loss_fn(pred,target):
- return weighted_bce(pred,target) + dice_loss(pred,target)
- def dice(pred,target):
- pred=(torch.sigmoid(pred)>0.3).float()
- inter=(pred*target).sum()
- return (2*inter)/(pred.sum()+target.sum()+1e-8)
- # ===== MODEL A: Inception =====
- class InceptionBlock(nn.Module):
- def __init__(self,in_c,out_c):
- super().__init__()
- self.b1=nn.Conv2d(in_c,out_c,1)
- self.b3=nn.Conv2d(in_c,out_c,3,padding=1)
- self.b5=nn.Conv2d(in_c,out_c,5,padding=2)
- def forward(self,x):
- return torch.relu(self.b1(x)+self.b3(x)+self.b5(x))
- class InceptionUNet(nn.Module):
- def __init__(self):
- super().__init__()
- self.e1=InceptionBlock(1,16)
- self.e2=InceptionBlock(16,32)
- self.e3=InceptionBlock(32,64)
- self.pool=nn.MaxPool2d(2)
- self.up=nn.Upsample(scale_factor=2)
- self.d2=InceptionBlock(64,32)
- self.d1=InceptionBlock(32,16)
- self.out=nn.Conv2d(16,1,1)
- def forward(self,x):
- e1=self.e1(x)
- e2=self.e2(self.pool(e1))
- e3=self.e3(self.pool(e2))
- d2=self.d2(self.up(e3))
- d1=self.d1(self.up(d2))
- return self.out(d1)
- # ===== MODEL B: ResNet =====
- class ResBlock(nn.Module):
- def __init__(self,c):
- super().__init__()
- self.c1=nn.Conv2d(c,c,3,padding=1)
- self.c2=nn.Conv2d(c,c,3,padding=1)
- def forward(self,x):
- return torch.relu(self.c2(torch.relu(self.c1(x)))+x)
- class ResUNet(nn.Module):
- def __init__(self):
- super().__init__()
- self.c1=nn.Conv2d(1,16,3,padding=1)
- self.r1=ResBlock(16)
- self.pool=nn.MaxPool2d(2)
- self.c2=nn.Conv2d(16,32,3,padding=1)
- self.r2=ResBlock(32)
- self.up=nn.Upsample(scale_factor=2)
- self.out=nn.Conv2d(32,1,1)
- def forward(self,x):
- x=torch.relu(self.c1(x))
- x=self.r1(x)
- x=self.pool(x)
- x=torch.relu(self.c2(x))
- x=self.r2(x)
- x=self.up(x)
- return self.out(x)
- # ===== DOGHNN HYBRID =====
- class DOGHNN(nn.Module):
- def __init__(self):
- super().__init__()
- self.a=InceptionUNet()
- self.b=ResUNet()
- self.fuse=nn.Conv2d(2,1,1)
- def forward(self,x):
- a=self.a(x)
- b=self.b(x)
- return self.fuse(torch.cat([a,b],1))
- # ===== PSO SEARCH =====
- print("\nRunning PSO on DOGHNN...\n")
- best_lr=0
- best_score=0
- for particle in range(5):
- lr=random.uniform(1e-4,5e-3)
- model=DOGHNN().to(device)
- opt=torch.optim.Adam(model.parameters(),lr)
- # train particle
- for epoch in range(8):
- for img,mask in loader:
- img,mask=img.to(device),mask.to(device)
- pred=model(img)
- loss=loss_fn(pred,mask)
- opt.zero_grad();loss.backward();opt.step()
- # evaluate
- total=0
- with torch.no_grad():
- for img,mask in loader:
- img,mask=img.to(device),mask.to(device)
- pred=model(img)
- total+=dice(pred,mask).item()
- score=total/len(loader)
- print(f"Particle {particle+1} | LR: {lr:.6f} | Dice: {score:.4f}")
- if score>best_score:
- best_score=score
- best_lr=lr
- print("\nBest LR:",best_lr)
- print("Best Dice:",best_score)
- # ===== FINAL TRAIN =====
- print("\nTraining final DOGHNN with PSO LR...\n")
- model=DOGHNN().to(device)
- opt=torch.optim.Adam(model.parameters(),best_lr)
- for epoch in range(15):
- total=0
- for img,mask in loader:
- img,mask=img.to(device),mask.to(device)
- pred=model(img)
- loss=loss_fn(pred,mask)
- opt.zero_grad();loss.backward();opt.step()
- total+=dice(pred,mask).item()
- print("Epoch",epoch,"Dice:",total/len(loader))
- # ===== FINAL METRICS =====
- dice_scores=[]
- model.eval()
- with torch.no_grad():
- for img,mask in loader:
- img,mask=img.to(device),mask.to(device)
- pred=model(img)
- dice_scores.append(dice(pred,mask).item())
- print("\nFinal Hybrid Dice:",np.mean(dice_scores))
- # ===== VISUALIZATION =====
- print("\nShowing hybrid segmentation examples\n")
- for i in range(5):
- img,mask=dataset[i]
- img=img.unsqueeze(0).to(device)
- with torch.no_grad():
- pred=model(img)
- pred=(torch.sigmoid(pred)>0.3).float().cpu()
- plt.figure(figsize=(10,3))
- plt.subplot(1,3,1);plt.imshow(img.cpu()[0][0],cmap='gray');plt.title("Input");plt.axis('off')
- plt.subplot(1,3,2);plt.imshow(mask[0],cmap='gray');plt.title("GT");plt.axis('off')
- plt.subplot(1,3,3);plt.imshow(pred[0][0],cmap='gray');plt.title("DOGHNN+PSO");plt.axis('off')
- plt.show()
- # %%
- # %%
- import numpy as np
- model.eval()
- dice_list=[]
- iou_list=[]
- precision_list=[]
- recall_list=[]
- specificity_list=[]
- accuracy_list=[]
- f1_list=[]
- with torch.no_grad():
- for img,mask in loader:
- img,mask=img.to(device),mask.to(device)
- pred=model(img)
- pred=(torch.sigmoid(pred)>0.3).float()
- TP=(pred*mask).sum().item()
- FP=(pred*(1-mask)).sum().item()
- FN=((1-pred)*mask).sum().item()
- TN=((1-pred)*(1-mask)).sum().item()
- dice=(2*TP)/(2*TP+FP+FN+1e-8)
- iou=TP/(TP+FP+FN+1e-8)
- precision=TP/(TP+FP+1e-8)
- recall=TP/(TP+FN+1e-8)
- specificity=TN/(TN+FP+1e-8)
- accuracy=(TP+TN)/(TP+TN+FP+FN+1e-8)
- f1=(2*precision*recall)/(precision+recall+1e-8)
- dice_list.append(dice)
- iou_list.append(iou)
- precision_list.append(precision)
- recall_list.append(recall)
- specificity_list.append(specificity)
- accuracy_list.append(accuracy)
- f1_list.append(f1)
- print("\n===== FINAL EVALUATION METRICS =====")
- print("Dice:", np.mean(dice_list))
- print("IoU:", np.mean(iou_list))
- print("Precision:", np.mean(precision_list))
- print("Recall:", np.mean(recall_list))
- print("Specificity:", np.mean(specificity_list))
- print("Accuracy:", np.mean(accuracy_list))
- print("F1-score:", np.mean(f1_list))
DOGHNN_with_PSO.ipynb, under CC-BY-4.0 · at the source
Overview
Abstract
White matter hyperintensities (WMHs) are common radiological findings in brain magnetic resonance imaging (MRI) and are strongly associated with neurological disorders such as stroke, dementia, and multiple sclerosis. Accurate detection and segmentation of WMHs are crucial for early diagnosis, disease progression analysis, and treatment planning. However, manual delineation of WMHs is labour-intensive, time-consuming, and prone to inter-observer variability, which limits its practicality in large-scale clinical and research settings. Deep learning has shown promise in automating WMH analysis; however, challenges remain due to heterogeneous lesion sizes, low contrast boundaries, and imaging noise. We propose a Deep Optimization-Guided Hybrid Neural Network (DOGHNN) that combines Inception-v3, ResNet-50, and Practical Swarm Optimization (PSO) for enhanced WMH segmentation. Inception-v3 is employed to capture multi-scale lesion features, enabling the detection of both small punctate and large confluent WMHs. ResNet-50 is integrated to extract deep contextual representations, leveraging residual learning to distinguish true lesions from surrounding tissue and artifacts. Finally, PSO is incorporated as an optimization strategy to iteratively refine fusion weights, segmentation thresholds, and key parameters, minimizing segmentation loss and improving boundary delineation. This hybrid approach ensures both fine-grained lesion sensitivity and robust global feature learning. The DOGHNN framework was evaluated on benchmark WMH MRI datasets with diverse lesion loads and anatomical complexities. Comparative experiments showed superior performance over baseline deep learning models. Quantitative evaluation yielded a maximum precision of 93.2%, recall of 91.5%, dice score 91.1%, and f1-score of 90.5% were achieved by the suggested DOGHNN, and Hausdorff distance of 6.5, confirming its robustness and reliability. By combining multi-scale learning, residual contextual modelling, and optimization-driven refinement, the DOGHNN framework delivers accurate and efficient WMH segmentation. This approach holds strong potential for clinical integration, supporting automated neuroimaging workflows and improving diagnostic decision-making in neurological care.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above.
Zenodo 18604208
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
- 30 September 2026: the link answers (HTTP 200)
4 files
- DOGHNN_with_PSO.ipynb, Jupyter, 271 lines
- Inception.ipynb, Jupyter, 207 lines
- PSO_optimizationipynb.ip
ynb , Jupyter, 102 lines - ResNet_50.ipynb, Jupyter, 197 lines
Code availability
The custom code and implementation of the proposed model used to generate the results reported in this study are publicly available at Zenodo: 10.5281/
Reproduced under the paper's license (CC BY), from the paper cited above.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 4 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data availability
The datasets used and/
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 10 keywords, 8 MeSH terms, 33 references.
Cite
This paper
Panduri, B., & Rao, O. S. (2026). Deep optimization-guided hybrid neural network for accurate detection and segmentation of white matter hyperintensities in clinical MRI images. Scientific reports, 16(1), 16211. https://
BibTeX
@article{panduri2026deep
author = {Panduri, Bharathi and Rao, O. Srinivasa},
title = {{Deep optimization-guided hybrid neural network for accurate detection and segmentation of white matter hyperintensities in clinical MRI images}},
journal = {Scientific reports},
year = {2026},
month = mar,
volume = {16},
number = {1},
pages = {16211},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/
url = {https://
pmid = {41826522},
pmcid = {PMC13201642}
}
RIS
TY - JOUR
AU - Panduri, Bharathi
AU - Rao, O. Srinivasa
TI - Deep optimization-guided hybrid neural network for accurate detection and segmentation of white matter hyperintensities in clinical MRI images
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/
VL - 16
IS - 1
SP - 16211
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Deep optimization-guided hybrid neural network for accurate detection and segmentation of white matter hyperintensities in clinical MRI images",
"container-title": "Scientific reports",
"author": [
{
"family": "Panduri",
"given": "Bharathi"
},
{
"family": "Rao",
"given": "O. Srinivasa"
}
],
"container-title-short":
"volume": "16",
"issue": "1",
"page": "16211",
"DOI": "10.1038/
"PMID": "41826522",
"PMCID": "PMC13201642",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
13
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1186/s12938-026-01555-0 [code]
- Incorporating normal periventricular changes for enhanced pathological white matter hyperintensity segmentation: on multiclass deep learning approaches.Journal: Biomedical engineering onlineIn common: OpenCV, Matplotlib, NumPy, stroke, structural MRI / diffusion, 2 references
- [2] doi:10.1186/s12880-026-02481-2 [code]
- Deep learning-based neuroanatomical profiling reveals population-specific brain changes in multiple sclerosis: a large-scale Middle Eastern study.Journal: BMC medical imagingIn common: OpenCV, Matplotlib, NumPy, structural MRI / diffusion, 1 reference
- [3] doi:10.1002/alz.71649 [code]
- Postmortem brain MRI reveals differential associations of subcortical and limbic volumes with cortical thinning and neurodegenerative pathologies.Journal: Alzheimer's & dementia : the journal of the Alzheimer's AssociationIn common: OpenCV, PyTorch, Matplotlib, 1 other tool, structural MRI / diffusion
- [4] doi:10.1093/braincomms/fcag253 [code]
- Disease detection and classification in temporal lobe epilepsy: step-wise versus simultaneous AI decision models in a multisite neuroimaging study.Journal: Brain communicationsIn common: OpenCV, PyTorch, Matplotlib, 1 other tool, structural MRI / diffusion
- [5] doi:10.1016/j.crmeth.2026.101473 [code]
- AmygdalaGo-BOLT for boundary-aware segmentation of the human amygdala.Journal: Cell reports methodsIn common: OpenCV, PyTorch, Matplotlib, 1 other tool, structural MRI / diffusion
- [6] doi:10.1093/radadv/umag025 [code]
- OpenMAP-BrainAge: generalizable and interpretable brain age predictor from MRI.Journal: Radiology advancesIn common: OpenCV, PyTorch, Matplotlib, 1 other tool, structural MRI / diffusion
- [7] doi:10.1038/s41598-026-55136-1 [code]
- CAHA-Net: A novel MR image classification model based on DenseNet incorporating coordinate attention and hybrid augmentation.Journal: Scientific reportsIn common: OpenCV, PyTorch, Matplotlib, 1 other tool, structural MRI / diffusion
- [8] doi:10.1002/mrm.70431 [code]
- SelExNet: A Self-Supervised Physics-Informed Framework for Multi-Channel Joint RF and Gradient Waveform Optimization in 2D Spatially Selective Excitation.Journal: Magnetic resonance in medicineIn common: OpenCV, PyTorch, Matplotlib, 1 other tool, structural MRI / diffusion
- [9] doi:10.1038/s41598-026-50791-w [code]
- Hybrid Vi+ECNN framework for advanced ADHD diagnostic accuracy in medical imaging.Journal: Scientific reportsIn common: OpenCV, PyTorch, Matplotlib, 1 other tool, structural MRI / diffusion
- [10] doi:10.21037/qims-2026-0792 [code]
- An nnU-Net-based framework with adaptive feature representation for 3D brain tumor segmentation.Journal: Quantitative imaging in medicine and surgeryIn common: OpenCV, PyTorch, Matplotlib, 1 other tool, structural MRI / diffusion
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 4 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:5f42dc9de6c6efac…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[.
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
