Hybrid Vi+ECNN framework for advanced ADHD diagnostic accuracy in medical imaging.
The 10 matches · 1 of them tie a paragraph to a whole file without given lines: a weak match, whose lines are not tinted
- [1] § Proposed model › Hybrid ViT+ECNN model ↔ Combined.ipynb, lines 119 to 157 · score 0.71 · linearly projected, classification layer, CLS, Patch16, pretrained, token · Report a mismatch
- [2] § Experimental results › Hyperparameter settings ↔ Comments response .ipynb, lines 227 to 299 · score 0.65 · AdamW, cross validation, weight decay, stratified, memory, metrics · Report a mismatch
- [3] § Experimental results › Hyperparameter settings ↔ Comments__response_ v2.ipynb, lines 227 to 299 · score 0.65 · AdamW, cross validation, weight decay, stratified, memory, metrics · Report a mismatch
- [4] § Proposed model › Data preprocessing ↔ Combined.ipynb, lines 24 to 30 · score 0.62 · Quantile Histogram Equalization, median filtering, QHED · Report a mismatch
- [5] § Proposed model › Data preprocessing ↔ ECNN.ipynb, lines 23 to 29 · score 0.62 · Quantile Histogram Equalization, median filtering, QHED · Report a mismatch
- [6] § Proposed model › Hybrid ViT+ECNN model ↔ Combined.ipynb, lines 119 to 157 · score 0.61 · fully connected layer, ReLU, concatenation, module, ViT, ECNN · Report a mismatch
- [7] § Proposed model › Data augmentation ↔ ViT.ipynb, the whole file · a weak match · score 0.56 · cosine annealing learning, scheduler, cross, loss, splits, validation · Report a mismatch
- [8] § Proposed model › Data augmentation ↔ Combined.ipynb, lines 185 to 188 · score 0.52 · cosine annealing learning, scheduler, cross, loss, Model · Report a mismatch
- [9] § Experimental results › Structural ablation study for module necessity validation ↔ Comments__response_ v2.ipynb, lines 663 to 782 · score 0.51 · structural ablation, necessity, score, recall, configuration, precision · Report a mismatch
- [10] § Experimental results › Structural ablation study for module necessity validation ↔ Comments__response_ v2.ipynb, lines 663 to 782 · score 0.51 · structural ablation, QHED preprocessing, necessity, fusion, configuration, modules · Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 260 lines · 9.6 KB · no license · 4 matches
- # %%
- import os
- import numpy as np
- import torch
- import torch.nn as nn
- from torch.optim import AdamW
- from torch.optim.lr_scheduler import CosineAnnealingLR
- from torchvision import datasets, transforms
- from torch.utils.data import DataLoader
- from transformers import ViTForImageClassification
- from PIL import Image, ImageEnhance, ImageFilter
- # --- Preprocessing Functions ---
- def apply_pst(image, alpha=0.1, beta=0.1):
- """Apply Phase Stretch Transform (PST) to the image."""
- image = np.array(image, dtype=np.float32) / 255.0
- fft_image = np.fft.fft2(image)
- magnitude = np.abs(fft_image)
- phase = np.angle(fft_image)
- phase_stretched = phase + alpha * np.tanh(beta * phase)
- pst_image = np.abs(np.fft.ifft2(magnitude * np.exp(1j * phase_stretched)))
- return pst_image
- def apply_qhed(image):
- """Apply Quantile Histogram Equalization and Denoising (QHED) to the image."""
- image = image.convert("RGB")
- enhancer = ImageEnhance.Contrast(image)
- enhanced_image = enhancer.enhance(2.0)
- denoised_image = enhanced_image.filter(ImageFilter.MedianFilter(size=3))
- return denoised_image
- # --- Dataset Class ---
- class TripleInputDataset(datasets.ImageFolder):
- """Dataset that returns raw, PST, and QHED images."""
- def __getitem__(self, index):
- path, label = self.samples[index]
- image = Image.open(path).convert("RGB")
- # Raw Image
- raw_image = self.transform(image)
- # PST Preprocessed Image
- pst_image = apply_pst(image)
- pst_image = Image.fromarray((pst_image * 255).astype(np.uint8)).convert("RGB")
- pst_image = self.transform(pst_image)
- # QHED Preprocessed Image
- qhed_image = apply_qhed(image)
- qhed_image = self.transform(qhed_image)
- return raw_image, pst_image, qhed_image, label
- # --- Residual Block ---
- class ResidualBlock(nn.Module):
- """A residual block with convolutional layers and skip connections."""
- def __init__(self, in_channels, out_channels, stride=1):
- super(ResidualBlock, self).__init__()
- self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=stride, padding=1)
- self.bn1 = nn.BatchNorm2d(out_channels)
- self.relu = nn.ReLU(inplace=True)
- self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=3, stride=1, padding=1)
- self.bn2 = nn.BatchNorm2d(out_channels)
- self.skip = nn.Sequential()
- if stride != 1 or in_channels != out_channels:
- self.skip = nn.Sequential(
- nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=stride, bias=False),
- nn.BatchNorm2d(out_channels)
- )
- def forward(self, x):
- identity = self.skip(x)
- out = self.conv1(x)
- out = self.bn1(out)
- out = self.relu(out)
- out = self.conv2(out)
- out = self.bn2(out)
- out += identity
- return self.relu(out)
- # --- ECNN High-Capacity Model ---
- class ECNNHighCapacity(nn.Module):
- """High-Capacity Ensemble CNN with Residual Blocks."""
- def __init__(self, num_classes):
- super(ECNNHighCapacity, self).__init__()
- self.raw_cnn = self._create_cnn_branch()
- self.pst_cnn = self._create_cnn_branch()
- self.qhed_cnn = self._create_cnn_branch()
- # Combine features from all three branches and reduce to 512
- self.fc = nn.Sequential(
- nn.Linear(256 * 3, 512), # Combine and reduce features to 512
- nn.ReLU(),
- nn.Dropout(0.5),
- )
- def _create_cnn_branch(self):
- return nn.Sequential(
- ResidualBlock(3, 64),
- ResidualBlock(64, 128, stride=2),
- ResidualBlock(128, 128),
- ResidualBlock(128, 256, stride=2),
- nn.AdaptiveAvgPool2d((1, 1))
- )
- def forward(self, raw_x, pst_x, qhed_x):
- # Process each input branch
- raw_features = self.raw_cnn(raw_x).view(raw_x.size(0), -1) # Shape: (batch_size, 256)
- pst_features = self.pst_cnn(pst_x).view(pst_x.size(0), -1) # Shape: (batch_size, 256)
- qhed_features = self.qhed_cnn(qhed_x).view(qhed_x.size(0), -1) # Shape: (batch_size, 256)
- # Concatenate features
- combined_features = torch.cat((raw_features, pst_features, qhed_features), dim=1) # Shape: (batch_size, 768)
- # Reduce to 512
- return self.fc(combined_features) # Shape: (batch_size, 512)
- # --- Combined Fine-Tuned Model ---
- class CombinedFineTunedModel(nn.Module):
- """Fine-tuned model combining ViT and ECNN outputs."""
- def __init__(self, num_classes):
- super(CombinedFineTunedModel, self).__init__()
- # Pretrained ViT with hidden states enabled
- self.vit = ViTForImageClassification.from_pretrained(
- "google/vit-base-patch16-224-in21k",
- output_hidden_states=True # Enable hidden states for feature extraction
- )
- self.vit_hidden_size = 768 # Default hidden size of ViT
- self.ecnn = ECNNHighCapacity(num_classes) # ECNN with raw, PST, and QHED inputs
- # Linear projection to align ViT features with ECNN features
- self.vit_projection = nn.Linear(self.vit_hidden_size, 512)
- # Fully connected layer to combine ViT and ECNN features
- self.fc = nn.Sequential(
- nn.Linear(512 + 512, 256), # Combine ViT (512) + ECNN (512)
- nn.ReLU(),
- nn.Dropout(0.5),
- nn.Linear(256, num_classes) # Final classification layer
- )
- def forward(self, raw_x, pst_x, qhed_x):
- # Extract ViT features from the CLS token
- vit_outputs = self.vit(raw_x, output_hidden_states=True)
- vit_hidden_states = vit_outputs.hidden_states[-1] # Last hidden state
- vit_cls_token = vit_hidden_states[:, 0, :] # CLS token (batch_size, 768)
- vit_features = self.vit_projection(vit_cls_token) # Project to (batch_size, 512)
- # Get ECNN features
- ecnn_features = self.ecnn(raw_x, pst_x, qhed_x) # Output: (batch_size, 512)
- # Concatenate features from ViT and ECNN
- combined_features = torch.cat((vit_features, ecnn_features), dim=1) # Shape: (batch_size, 1024)
- # Pass through the final fully connected layer
- return self.fc(combined_features)
- # --- Training Setup ---
- train_dir = "/kaggle/input/binary-augmented-split-adhd/ADHD - Augmented Split Binary/train"
- val_dir = "/kaggle/input/binary-augmented-split-adhd/ADHD - Augmented Split Binary/validation"
- # Dataset Transform
- transform = transforms.Compose([
- transforms.Resize((224, 224)),
- transforms.ToTensor(),
- transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
- ])
- # Datasets and Loaders
- batch_size = 8
- train_dataset = TripleInputDataset(root=train_dir, transform=transform)
- val_dataset = TripleInputDataset(root=val_dir, transform=transform)
- train_loader = DataLoader(train_dataset, batch_size=batch_size, shuffle=True)
- val_loader = DataLoader(val_dataset, batch_size=batch_size, shuffle=False)
- # Instantiate Model
- num_classes = 2
- model = CombinedFineTunedModel(num_classes)
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
- model.to(device)
- # Optimizer, Scheduler, and Loss
- optimizer = AdamW(model.parameters(), lr=1e-4, weight_decay=1e-4)
- scheduler = CosineAnnealingLR(optimizer, T_max=10)
- criterion = nn.CrossEntropyLoss()
- # --- Save Checkpoint ---
- def save_checkpoint(epoch, model, optimizer, scheduler, train_loss, val_loss, train_acc, val_acc, path):
- checkpoint = {
- "epoch": epoch,
- "model_state_dict": model.state_dict(),
- "optimizer_state_dict": optimizer.state_dict(),
- "scheduler_state_dict": scheduler.state_dict(),
- "train_loss": train_loss,
- "val_loss": val_loss,
- "train_acc": train_acc,
- "val_acc": val_acc,
- }
- torch.save(checkpoint, path)
- print(f"Checkpoint saved: {path}")
- # --- Training Loop ---
- epochs = 10
- for epoch in range(epochs):
- model.train()
- running_loss, correct, total = 0.0, 0, 0
- for raw_x, pst_x, qhed_x, labels in train_loader:
- raw_x, pst_x, qhed_x, labels = raw_x.to(device), pst_x.to(device), qhed_x.to(device), labels.to(device)
- optimizer.zero_grad()
- outputs = model(raw_x, pst_x, qhed_x)
- loss = criterion(outputs, labels)
- loss.backward()
- optimizer.step()
- running_loss += loss.item()
- _, preds = torch.max(outputs, 1)
- correct += (preds == labels).sum().item()
- total += labels.size(0)
- scheduler.step()
- train_loss = running_loss / len(train_loader)
- train_acc = correct / total
- print(f"Epoch {epoch+1}, Train Loss: {train_loss:.4f}, Train Acc: {train_acc:.4f}")
- # Validation Loop
- model.eval()
- val_loss, val_correct, val_total = 0.0, 0, 0
- with torch.no_grad():
- for raw_x, pst_x, qhed_x, labels in val_loader:
- raw_x, pst_x, qhed_x, labels = raw_x.to(device), pst_x.to(device), qhed_x.to(device), labels.to(device)
- outputs = model(raw_x, pst_x, qhed_x)
- loss = criterion(outputs, labels)
- val_loss += loss.item()
- _, preds = torch.max(outputs, 1)
- val_correct += (preds == labels).sum().item()
- val_total += labels.size(0)
- val_loss /= len(val_loader)
- val_acc = val_correct / val_total
- print(f"Epoch {epoch+1}, Val Loss: {val_loss:.4f}, Val Acc: {val_acc:.4f}")
- # Save Model
- checkpoint_path = f"fine_tuned_combined_model_epoch_{epoch+1}.pth"
- save_checkpoint(
- epoch=epoch + 1,
- model=model,
- optimizer=optimizer,
- scheduler=scheduler,
- train_loss=train_loss,
- val_loss=val_loss,
- train_acc=train_acc,
- val_acc=val_acc,
- path=checkpoint_path,
- )
Combined.ipynb at commit 3a399cf, no license · at the source
Overview
- Department of Management Information Systems, School of Business, King Faisal University, 31982 Al-Ahsa, Saudi Arabia
- Department of Advanced Information Technology, Faculty of Information Science and Electrical Engineering, Kyushu University, Fukuoka, 819-0395 Japan
- Research Center of Excellence in Science and Mathematics Education Development, DSR, King Saud University, 2458, 11451 Riyadh, Saudi Arabia
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above, with 10 matches between paragraphs and lines of code.
shaymaasorour/Hybrid-ViT-ECNN-Framework-for-Advanced-ADHD-Diagnostic-Accuracy-in-Medical-Imaging
3a399cf849f18af7132ca1882adc4933baa6b856, 22 April 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
6 files
- Combined.ipynb, Jupyter, 260 lines, 4 matches
- Comments response .ipynb, Jupyter, 425 lines, 1 match
- Comments__response_ v2.ipynb, Jupyter, 982 lines, 3 matches
- ECNN.ipynb, Jupyter, 220 lines, 1 match
- ViT.ipynb, Jupyter, 141 lines, 1 match
- README.md, Text, 86 lines
The paper's code and data availability statement is in the Data section.
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;
- 5 scripts, each with its path and the digest of its content;
- 10 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- 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
Datasets cited
- kaggle.com/
datasets/ , at Kaggle; found in “Data availability”shaymaasorour
Code and data availability statement
The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to a dataset: kaggle.com/
datasets/ shaymaasorour - it points to the authors' code: shaymaasorour/
Hybrid-ViT-ECNN-Framewor k-for-Advanced-ADHD-Diag nostic-Accuracy-in-Medic al-Imaging
Read it in the paper: doi.org/10.1038/s41598-026-50791-w.
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, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 5 authors, 14 keywords, 8 MeSH terms, 1 funder, 61 references.
Cite
This paper
Sorour, S. E., Hassan, L., Elwasila, O., Mine, T., & Elmaadaway, M. A. N. (2026). Hybrid Vi+ECNN framework for advanced ADHD diagnostic accuracy in medical imaging. Scientific reports, 16(1), 19017. https://
BibTeX
@article{sorour2026hybri
author = {Sorour, Shaymaa E and Hassan, Lamia and Elwasila, Osman and Mine, Tsunenori and Elmaadaway, Mohamed Ali Nagy},
title = {{Hybrid Vi+ECNN framework for advanced ADHD diagnostic accuracy in medical imaging}},
journal = {Scientific reports},
year = {2026},
month = may,
volume = {16},
number = {1},
pages = {19017},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/
url = {https://
pmid = {42069836},
pmcid = {PMC13280160}
}
RIS
TY - JOUR
AU - Sorour, Shaymaa E
AU - Hassan, Lamia
AU - Elwasila, Osman
AU - Mine, Tsunenori
AU - Elmaadaway, Mohamed Ali Nagy
TI - Hybrid Vi+ECNN framework for advanced ADHD diagnostic accuracy in medical imaging
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/
VL - 16
IS - 1
SP - 19017
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Hybrid Vi+ECNN framework for advanced ADHD diagnostic accuracy in medical imaging",
"container-title": "Scientific reports",
"author": [
{
"family": "Sorour",
"given": "Shaymaa E"
},
{
"family": "Hassan",
"given": "Lamia"
},
{
"family": "Elwasila",
"given": "Osman"
},
{
"family": "Mine",
"given": "Tsunenori"
},
{
"family": "Elmaadaway",
"given": "Mohamed Ali Nagy"
}
],
"container-title-short":
"volume": "16",
"issue": "1",
"page": "19017",
"DOI": "10.1038/
"PMID": "42069836",
"PMCID": "PMC13280160",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
2
]
]
}
}
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.1038/s41746-025-01773-1 [code]
- Detection of epileptic spasms using foundational AI and smartphone videos.Journal: NPJ digital medicineIn common: Hugging Face Transformers, OpenCV, Pillow, 5 other tools, clinical / translational, 2 references
- [2] doi:10.1038/s41698-024-00632-8 [code]
- Combination of MRI-based prediction and CRISPR/
Cas12a-based detection for IDH genotyping in glioma. Journal: NPJ precision oncologyIn common: OpenCV, Pillow, PyTorch, 5 other tools, structural MRI / diffusion, 2 references - [3] doi:10.1038/s41597-024-03073-x [code]
- Brain tumor segmentation using synthetic MR images - A comparison of GANs and diffusion models.Journal: Scientific dataIn common: Hugging Face Transformers, OpenCV, Pillow, 6 other tools, 1 reference
- [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: Hugging Face Transformers, OpenCV, Pillow, 6 other tools, structural MRI / diffusion, clinical / translational
- [5] doi:10.3390/children12091127 [code]
- The Expanding Frontier: The Role of Artificial Intelligence in Pediatric Neuroradiology.Journal: Children (Basel, Switzerland)In common: Hugging Face Transformers, OpenCV, Pillow, 5 other tools, structural MRI / diffusion, 1 reference
- [6] doi:10.1177/03000605261422820 [code]
- Brain tumor detection on magnetic resonance imaging scans using the artificial intelligence-based You Only Look Once algorithm.Journal: The Journal of international medical researchIn common: Hugging Face Transformers, OpenCV, Pillow, 6 other tools, structural MRI / diffusion
- [7] doi:10.1371/journal.pone.0340286 [code]
- FetCAT: Cross-attention fusion of transformer-CNN architecture for fetal brain plane classification with explainability using motion-degraded MRI.Journal: PloS oneIn common: Hugging Face Transformers, OpenCV, Pillow, 6 other tools, structural MRI / diffusion
- [8] doi:10.1038/s41598-025-28243-8 [code]
- Lightweight Vision Transformer with transfer learning for interpretable Alzheimer's disease severity assessment.Journal: Scientific reportsIn common: Hugging Face Transformers, OpenCV, Pillow, 6 other tools, structural MRI / diffusion
- [9] doi:10.1017/s003329172610405x [code]
- Cortical morphometric inverse divergence in attention-deficit/
hyperactivity disorder correlates with cell-type-specific, laminar-specific and developmental transcriptomic signatures. Journal: Psychological medicineIn common: pandas, Matplotlib, NumPy, ADHD, structural MRI / diffusion, 4 references - [10] doi:10.1371/journal.pcbi.1013674 [code]
- Computational origins of shape perception.Journal: PLoS computational biologyIn common: Hugging Face Transformers, OpenCV, Pillow, 5 other tools, 1 reference
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, 5 scripts, and 10 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:2677e585f031451e…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1038/s41598-026-50791-w)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1038/s41598-026-50791-w.svg
:target: https://openscicode.org/badge/doi/10.1038/s41598-026-50791-w
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41598-026-50791-w"><img src="https://openscicode.org/badge/doi/10.1038/s41598-026-50791-w.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".
If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
