Cyclic 2.5D Perceptual Loss for Cross-Modal 3D Medical Image Synthesis: T1w MRI to Tau PET.
2 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 3 matches
- [1] § Methods › Experiment › Training Details ↔ Code/utils/dataset.py, lines 17 to 148 · score 0.79 · Gaussian noise, elastic, magnitude, trilinear, augmentation, flips · block
oscr:b:QTRQ3TT6SWP0Z-D· Report a mismatch - [2] § Methods › Experiment › Training Details ↔ Code/train.py, lines 100 to 156 · score 0.69 · cosine annealing learning, Adam, dropout, channel, cycle, scheduler · block
oscr:b:QGEHYRV5EW51S-4· Report a mismatch - [3] § Methods › Experiment › Benchmark ↔ Code/train.py, lines 100 to 156 · score 0.66 · cosine annealing, combined loss function, min, max, cycle, scheduler · block
oscr:b:QGEHYRV5EW51S-4· 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
Python · 294 lines · 9.6 KB · no license · 2 matches
- # Run this code like python train.py --config example.yaml
- # If you have a checkpoint, run this code like python train.py --config example.yaml --checkpoint /path/to/the/chechpoint.pth
- import os
- import time
- import torch
- from torch import optim
- from torch.optim.lr_scheduler import CosineAnnealingLR
- from monai.networks.nets import UNet
- from utils.dataset import load_data
- from utils.cyclic_perceptual_loss import (
- CombinedLoss,
- update_plane_selection,
- calculate_cycle_epochs,
- )
- from utils.utils import (
- update_checkpoint_and_log,
- load_checkpoint,
- parse_arguments,
- load_config,
- seed_everything,
- )
- def train_one_epoch(
- model, train_loader, optimizer, loss_function, device, selection, grad_accum_steps
- ):
- """
- Train the model for one epoch on the given DataLoader and return the average loss.
- Args:
- model (nn.Module): The neural network model.
- train_loader (DataLoader): The DataLoader for the training set.
- optimizer (Optimizer): The optimizer.
- loss_function (callable): The loss function.
- device (torch.device): The device to use (CPU or GPU).
- selection (str): Which plane is currently selected ("axial", "coronal", or "sagittal").
- grad_accum_steps (int): Number of gradient accumulation steps.
- Returns:
- float: The average training loss for this epoch.
- """
- model.train()
- epoch_loss = 0.0
- for idx, batch_data in enumerate(train_loader):
- inputs = batch_data["image"].to(device)
- targets = batch_data["label"].to(device)
- outputs = model(inputs)
- loss = loss_function(outputs, targets, selection)
- # Gradient Accumulation
- (loss / grad_accum_steps).backward()
- if (idx + 1) % grad_accum_steps == 0 or idx == len(train_loader) - 1:
- optimizer.step()
- optimizer.zero_grad()
- epoch_loss += loss.item()
- # Clear memory for unused tensors
- del inputs, targets, outputs
- average_loss = epoch_loss / len(train_loader)
- return average_loss
- def validate_one_epoch(model, val_loader, loss_function, device, selection):
- """
- Run validation on the given DataLoader for one epoch and return the average validation loss.
- Args:
- model (nn.Module): The neural network model.
- val_loader (DataLoader): The DataLoader for the validation set.
- loss_function (callable): The loss function.
- device (torch.device): The device to use (CPU or GPU).
- selection (str): Which plane is currently selected ("axial", "coronal", or "sagittal").
- Returns:
- float: The average validation loss for this epoch.
- """
- model.eval()
- val_loss = 0.0
- with torch.no_grad():
- for val_data in val_loader:
- val_inputs = val_data["image"].to(device)
- val_targets = val_data["label"].to(device)
- val_outputs = model(val_inputs)
- loss = loss_function(val_outputs, val_targets, selection)
- val_loss += loss.item()
- del val_inputs, val_targets, val_outputs
- average_loss = val_loss / len(val_loader)
- return average_loss
- def train_model(train_loader, val_loader, config, device, checkpoint_path=None):
- """
- Train and validate the model on the provided data loaders. Manages checkpoints and logging.
- Args:
- train_loader (DataLoader): The DataLoader for the training set.
- val_loader (DataLoader): The DataLoader for the validation set.
- config (dict): Configuration dictionary loaded from YAML.
- device (torch.device): The device to use for training.
- checkpoint_path (str, optional): Path to an existing checkpoint to resume from.
- """
- # Prepare directories
- log_dir = config["LOG_DIR"]
- model_dir = config["MODEL_DIR"]
- os.makedirs(log_dir, exist_ok=True)
- os.makedirs(model_dir, exist_ok=True)
- # File for logging
- log_file = os.path.join(log_dir, "log.txt")
- # Load settings
- max_epochs = config["MAX_EPOCHS"]
- learning_rate = float(config["LEARNING_RATE"])
- use_dropout = config["USE_DROPOUT"]
- dropout = config["DROPOUT"]
- early_stopping_patience = config["EARLY_STOPPING_PATIENCE"]
- channels_setting = tuple(config["CHANNELS_SETTING"])
- cycle_duration = config["CYCLE_DURATION"]
- cycle_factor = config["CYCLE_FACTOR"]
- grad_accum_steps = config["GRAD_ACCUM_STEPS"]
- # Model creation
- if use_dropout:
- model = UNet(
- spatial_dims=3,
- in_channels=1,
- out_channels=1,
- channels=channels_setting,
- strides=(2, 2, 2, 2),
- dropout=dropout,
- ).to(device)
- else:
- model = UNet(
- spatial_dims=3,
- in_channels=1,
- out_channels=1,
- channels=channels_setting,
- strides=(2, 2, 2, 2),
- ).to(device)
- loss_function = CombinedLoss(config=config)
- optimizer = optim.Adam(model.parameters(), learning_rate)
- scheduler = CosineAnnealingLR(
- optimizer, T_max=int((cycle_duration + 0.5) / 2), eta_min=0
- )
- # Calculate the plane-switching epochs (Algorithm 2 in the paper)
- ax_epochs, co_epochs, sa_epochs = calculate_cycle_epochs(
- max_epochs, cycle_duration, cycle_factor
- )
- print("ax: ", ax_epochs)
- print("co: ", co_epochs)
- print("sa: ", sa_epochs)
- print("Max Epoch: ", max_epochs)
- # Initialize checkpoint-related variables
- best_val_loss = float("inf")
- no_improvement_epochs = 0
- selection = "axial" # Default plane
- start_epoch = 0
- early_stopping_trigger_epoch = (
- ax_epochs[2] if len(ax_epochs) > 2 else 0
- ) # Early stopping is activated in the late stages to prevent it from activating when the model is overfitted into a specific plane
- print(
- f"Early stopping will start to check after epoch: {early_stopping_trigger_epoch}"
- )
- best_checkpoint_path = None
- # Load checkpoint if provided
- if checkpoint_path:
- start_epoch, best_val_loss, selection, no_improvement_epochs = load_checkpoint(
- checkpoint_path, model, optimizer, scheduler
- )
- else:
- print("No checkpoint provided.")
- log_message = ""
- epoch_time_start = time.time()
- # Main training loop
- for epoch in range(start_epoch, max_epochs):
- # Print elapsed time every 50 epochs
- if epoch > 0 and epoch % 50 == 0:
- epoch_time_end = time.time()
- elapsed = epoch_time_end - epoch_time_start
- hours = int(elapsed // 3600)
- minutes = int((elapsed % 3600) // 60)
- seconds = int(elapsed % 60)
- print(f"{epoch} epochs done: {hours}h {minutes}m {seconds}s elapsed.")
- epoch_time_start = time.time()
- # Check if we need to switch planes
- new_selection, reset_best = update_plane_selection(
- epoch, ax_epochs, co_epochs, sa_epochs, selection
- )
- if new_selection != selection:
- selection = new_selection
- if selection == "axial":
- print("Perceptual Loss is now based on axial slices.")
- elif selection == "coronal":
- print("Perceptual Loss is now based on coronal slices.")
- elif selection == "sagittal":
- print("Perceptual Loss is now based on sagittal slices.")
- if reset_best:
- best_val_loss = float("inf")
- # Train for one epoch
- train_loss = train_one_epoch(
- model=model,
- train_loader=train_loader,
- optimizer=optimizer,
- loss_function=loss_function,
- device=device,
- selection=selection,
- grad_accum_steps=grad_accum_steps,
- )
- # Validate
- val_loss = validate_one_epoch(
- model=model,
- val_loader=val_loader,
- loss_function=loss_function,
- device=device,
- selection=selection,
- )
- print(
- f"Epoch {epoch+1}/{max_epochs} | Train Loss: {train_loss:.4f}, Validation Loss: {val_loss:.4f}"
- )
- log_message += (
- f"Epoch {epoch+1}, Train Loss: {train_loss}, Validation Loss: {val_loss}\n"
- )
- scheduler.step()
- # Update checkpoint and log
- best_val_loss, no_improvement_epochs, stop_training, best_checkpoint_path = (
- update_checkpoint_and_log(
- average_val_loss=val_loss,
- selection=selection,
- epoch=epoch,
- no_improvement_epochs=no_improvement_epochs,
- log_message=log_message,
- model=model,
- optimizer=optimizer,
- scheduler=scheduler,
- best_val_loss=best_val_loss,
- model_dir=model_dir,
- early_stopping_patience=early_stopping_patience,
- log_file=log_file,
- early_stopping_trigger_epoch=early_stopping_trigger_epoch,
- best_checkpoint_path=best_checkpoint_path,
- )
- )
- if stop_training:
- print(f"Early stopping at epoch {epoch+1}")
- break
- def main():
- seed_everything(deterministic=True) # Fix seed
- args = parse_arguments()
- config = load_config(args.config)
- if isinstance(config["CUDA_SETTING"], int):
- torch.cuda.set_device(config["CUDA_SETTING"])
- device = torch.device(
- config["CUDA_SETTING"] if torch.cuda.is_available() else "cpu"
- )
- train_loader, val_loader = load_data(config)
- train_model(
- train_loader=train_loader,
- val_loader=val_loader,
- config=config,
- device=device,
- checkpoint_path=args.checkpoint,
- )
- if __name__ == "__main__":
- main()
train.py at commit 1ff09cd, no license · at the source
Overview
- Department of Artificial Intelligence Semiconductor Engineering, Hanyang University, Seoul, South Korea
- Department of Artificial Intelligence, Hanyang University, Seoul, South Korea
- Department of Electronic Engineering, Hanyang University, Seoul, South Korea
- Division of Computer Engineering, Hankuk University of Foreign Studies, Yongin, South Korea
- Division of AI Data Convergence, Hankuk University of Foreign Studies, Yongin, South Korea
- Division of Language & AI, Hankuk University of Foreign Studies, Seoul, South Korea
Abstract
Positron emission tomography (PET) provides an in vivo molecular marker for various diseases, including Alzheimer's disease and related dementias (ADRD). PET has become increasingly integrated into diagnostic decision‐making, disease staging, and clinical trial enrichment. However, its widespread use remains constrained by high costs, government regulations, and the invasiveness of radiotracer injection. Modern diagnostic frameworks emphasize the importance of multimodal biomarker assessment, such as the “amyloid/
Reproduced under the paper's license (CC BY-NC), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.
labhai/Cyclic-2.5D-Perceptual-Loss
1ff09cd443a70018b6ad45a4656495b6814caef2, 17 April 2026Availability: 2 checks, the latest on 6 November 2026: the link answers
- 6 November 2026: the link answers
- 28 September 2026: the link answers
6 files
- Code/
test.py , Python, 139 lines - Code/
train.py , Python, 294 lines, 2 matches - Code/
utils/ , Python, 213 linescyclic_perceptual_loss.p y - Code/
utils/ , Python, 148 lines, 1 matchdataset.py - Code/
utils/ , Python, 206 linesutils.py - README.md, Text, 110 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;
- 3 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
No dataset and no data link were found in the paper.
Data Availability Statement
The code for the proposed method is available at https://
Reproduced under the paper's license (CC BY-NC), 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, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 5 authors, 7 keywords, 9 MeSH terms, 12 funders, 124 references.
Cite
This paper
Moon, J., Kim, S., Chung, H., Jang, I., & Alzheimer's Disease Neuroimaging Initiative. (2026). Cyclic 2.5D Perceptual Loss for Cross-Modal 3D Medical Image Synthesis: T1w MRI to Tau PET. Human brain mapping, 47(5), e70508. https://
BibTeX
@article{moon2026cyclic,
author = {Moon, Junho and Kim, Symac and Chung, Haejun and Jang, Ikbeom and {Alzheimer's Disease Neuroimaging Initiative}},
title = {{Cyclic 2.5D Perceptual Loss for Cross-Modal 3D Medical Image Synthesis: T1w MRI to Tau PET}},
journal = {Human brain mapping},
year = {2026},
month = apr,
volume = {47},
number = {5},
pages = {e70508},
publisher = {Wiley},
issn = {1065-9471},
doi = {10.1002/
url = {https://
pmid = {41968275},
pmcid = {PMC13070738}
}
RIS
TY - JOUR
AU - Moon, Junho
AU - Kim, Symac
AU - Chung, Haejun
AU - Jang, Ikbeom
AU - Alzheimer's Disease Neuroimaging Initiative
TI - Cyclic 2.5D Perceptual Loss for Cross-Modal 3D Medical Image Synthesis: T1w MRI to Tau PET
T2 - Human brain mapping
J2 - Hum Brain Mapp
PY - 2026
DA - 2026/
VL - 47
IS - 5
SP - e70508
SN - 1065-9471
PB - Wiley
DO - 10.1002/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1002/
"type": "article-journal",
"title": "Cyclic 2.5D Perceptual Loss for Cross-Modal 3D Medical Image Synthesis: T1w MRI to Tau PET",
"container-title": "Human brain mapping",
"author": [
{
"family": "Moon",
"given": "Junho"
},
{
"family": "Kim",
"given": "Symac"
},
{
"family": "Chung",
"given": "Haejun"
},
{
"family": "Jang",
"given": "Ikbeom"
},
{
"literal": "Alzheimer's Disease Neuroimaging Initiative"
}
],
"container-title-short":
"volume": "47",
"issue": "5",
"page": "e70508",
"DOI": "10.1002/
"PMID": "41968275",
"PMCID": "PMC13070738",
"ISSN": "1065-9471",
"publisher": "Wiley",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
1
]
]
}
}
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.64898/2026.05.06.26352540 [code]
- Generating synthetic tau-PET scans in Alzheimer’s disease from MRI, blood biomarkers and demographics with deep learningJournal: medRxiv (preprint)In common: NiBabel, NumPy, PET / SPECT, Alzheimer's / dementia, structural MRI / diffusion, 11 references
- [2] doi:10.1002/alz.14600 [code]
- Machine learning prediction of tau-PET in Alzheimer's disease using plasma, MRI, and clinical data.Journal: Alzheimer's & dementia : the journal of the Alzheimer's AssociationIn common: NumPy, PET / SPECT, Alzheimer's / dementia, structural MRI / diffusion, 12 references
- [3] doi:10.1093/brain/awad346 [code]
- Synthesizing images of tau pathology from cross-modal neuroimaging using deep learning.Journal: Brain : a journal of neurologyIn common: NumPy, PET / SPECT, Alzheimer's / dementia, 9 references
- [4] doi:10.1590/0004-282x-anp-2022-s138
- From clinical phenotype to proteinopathy: molecular neuroimaging in neurodegenerative dementias.Journal: Arquivos de neuro-psiquiatriaIn common: PET / SPECT, Alzheimer's / dementia, 10 references
- [5] doi:10.1038/s41467-025-62590-4 [code]
- AI-driven fusion of multimodal data for Alzheimer's disease biomarker assessment.Journal: Nature communicationsIn common: MONAI, NiBabel, PyTorch, 1 other tool, PET / SPECT, Alzheimer's / dementia, 7 references
- [6] doi:10.64898/2026.01.27.701320
- Dynamical A <i>β</
i> -Tau-Neurodegeneration Model Predicts Alzheimer’s Disease Mechanisms and Biomarker Progression Journal: bioRxiv (preprint)In common: Alzheimer's / dementia, 10 references - [7] doi:10.1038/s41467-025-63564-2 [code]
- Hemispheric asymmetry of tau pathology is related to asymmetric amyloid deposition in Alzheimer's Disease.Journal: Nature communicationsIn common: NiBabel, NumPy, PET / SPECT, Alzheimer's / dementia, structural MRI / diffusion, 9 references
- [8] doi:10.1007/s00259-026-07868-5 [code]
- Bayesian modelling demonstrates clinically relevant heterogeneity in Tau PET patterns in Alzheimer's disease.Journal: European journal of nuclear medicine and molecular imagingIn common: NiBabel, PyTorch, NumPy, PET / SPECT, Alzheimer's / dementia, 7 references
- [9] doi:10.1002/alz.14492 [code]
- A multi-cohort study of longitudinal and cross-sectional Alzheimer's disease biomarkers in cognitively unimpaired older adults.Journal: Alzheimer's & dementia : the journal of the Alzheimer's AssociationIn common: NiBabel, PyTorch, NumPy, PET / SPECT, Alzheimer's / dementia, structural MRI / diffusion, 7 references
- [10] doi:10.1016/j.heliyon.2023.e22647 [code]
- A three-dimensional deep learning model for inter-site harmonization of structural MR images of the brain: Extensive validation with a multicenter dataset.Journal: HeliyonIn common: NiBabel, NumPy, structural MRI / diffusion, 7 references
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 3 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:0ea6fd0aa4cd0746…
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.1002/hbm.70508)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1002/hbm.70508.svg
:target: https://openscicode.org/badge/doi/10.1002/hbm.70508
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1002/hbm.70508"><img src="https://openscicode.org/badge/doi/10.1002/hbm.70508.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.
