OSCR

SegAnyNeuron: a neural image segmentation network with strong generalization performance by modeling image intensity variation.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § Methods › Model training and loss function ↔ net.py, lines 50–141 · score 0.56 · Dice Loss, Focal Loss, training, Model
  2. [2] § Methods › Model training and loss function ↔ models/UnetModel.py, lines 8–124 · score 0.51 · UNet, PyTorch, batch, Windows, training, network

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

Python · 141 lines · 5.5 KB · no license · 1 match

  1. import os
  2. import random
  3. import numpy as np
  4. import tifffile
  5. import torch
  6. class TakeNotesLoss:
  7. def __init__(self):
  8. self.sum = 0
  9. self.count = 0
  10. self.id = -1
  11. def update(self, value):
  12. self.sum += value
  13. self.count += 1
  14. def update2(self):
  15. tmp = self.sum / self.count
  16. self.sum = 0
  17. self.count = 0
  18. self.id += 1
  19. return tmp
  20. class TakeNotesLoss2:
  21. def __init__(self):
  22. self.dice = 0
  23. self.focal = 0
  24. self.count = 0
  25. self.id = -1
  26. def update(self, tmp_dice, tmp_focal_loss):
  27. self.dice += tmp_dice
  28. self.focal += tmp_focal_loss
  29. self.count += 1
  30. def update2(self):
  31. tmp_dice = self.dice / self.count
  32. tmp_focal = self.focal / self.count
  33. self.dice = 0
  34. self.focal = 0
  35. self.count = 0
  36. self.id += 1
  37. return tmp_dice, tmp_focal
  38. class Trainer:
  39. def __init__(self, datalodader, test_loader, model, loss_criterion, optimizer, lr_scheduler, eval_metric,
  40. modelPath=None, device=torch.device('cpu'), batchSize=1):
  41. self.batchSize = batchSize
  42. self.device = device
  43. self.test_loader = test_loader
  44. self.dataloader = datalodader
  45. self.valCount = 50
  46. self.model = model
  47. self.model.to(self.device)
  48. #损失函数
  49. self.loss_criterion = loss_criterion
  50. self.optimizer = optimizer
  51. self.lr_scheduler = lr_scheduler
  52. self.eval_metric = eval_metric
  53. self.modelPath = modelPath
  54. # if self.modelPath is not None:
  55. # self.modelPath = './saved_models/'
  56. if not os.path.isdir(self.modelPath):
  57. os.makedirs(self.modelPath)
  58. def Train(self, turn=2, writer=None):
  59. train_small_losses = TakeNotesLoss2()
  60. train_big_losses = TakeNotesLoss2()
  61. evalVal = TakeNotesLoss()
  62. lastEvalVal = 0
  63. self.valCount = min(len(self.dataloader), self.valCount)
  64. iter_count = 0
  65. updated_turn = 0
  66. for t in range(turn+1):
  67. if t - updated_turn > 20:
  68. print("no update for 20 epochs, training done.")
  69. exit(-1)
  70. torch.cuda.empty_cache()
  71. torch.set_grad_enabled(True)
  72. self.model.train()
  73. for i, (img, mask, name) in enumerate(self.dataloader):
  74. if img.shape[0] != self.batchSize:
  75. continue
  76. torch.cuda.empty_cache()
  77. img = img.to(self.device)
  78. mask = mask.to(self.device)
  79. seg = self.model(img)
  80. dice_loss, focal_loss = self.loss_criterion(seg, mask)
  81. loss = dice_loss + focal_loss
  82. train_small_losses.update(dice_loss.item(), focal_loss.item())
  83. train_big_losses.update(dice_loss.item(), focal_loss.item())
  84. self.optimizer.zero_grad() # 梯度清零
  85. loss.backward()
  86. self.optimizer.step() # 参数更新
  87. if (iter_count + 1) % 10 == 0:
  88. tmp_dice, tmp_focal = train_small_losses.update2()
  89. print('TRAIN [Epoch %d | %d] [Process %d | %d] [DiceLoss %.4f, FocalLoss %.4f, learning rate %.4f]'
  90. % (t, turn, i, len(self.dataloader), tmp_dice, tmp_focal, self.optimizer.param_groups[0]['lr'])
  91. )
  92. writer.add_scalar('Loss/TrainSmallLoss', tmp_dice, tmp_focal, train_small_losses.id)
  93. if (iter_count + 1) % self.valCount == 0:
  94. torch.cuda.empty_cache()
  95. tmp_dice, tmp_focal = train_big_losses.update2()
  96. writer.add_scalar('Loss/TrainBigLoss', tmp_dice, tmp_focal, train_big_losses.id)
  97. self.model.eval()
  98. with torch.no_grad():
  99. for i, (img, mask, name) in enumerate(self.test_loader):
  100. if img.shape[0] != self.batchSize:
  101. continue
  102. img = img.to(self.device)
  103. mask = mask.to(self.device)
  104. seg = self.model(img)
  105. COUT = False
  106. if i == 0:
  107. COUT= True
  108. eval = self.eval_metric(seg, mask, COUT=COUT)
  109. evalVal.update(eval)
  110. curEvalVal = evalVal.update2()
  111. writer.add_scalar('Eval/EvalVal', curEvalVal, evalVal.id)
  112. if curEvalVal > lastEvalVal:
  113. print("save model")
  114. updated_turn = t
  115. torch.save({"state_dict": self.model.state_dict(), "param": self.optimizer}, os.path.join(self.modelPath,
  116. "betnet_%s.pth" % (str(t).zfill(5))))
  117. lastEvalVal = curEvalVal
  118. self.lr_scheduler.step(curEvalVal)
  119. lr = self.optimizer.param_groups[0]['lr']
  120. writer.add_scalar('TrainParam/lr', lr, evalVal.id)
  121. print('VAL [Epoch %d | %d] [EvalVal; %.4f] [Lr: %f]' % (t, turn, curEvalVal, lr))
  122. torch.cuda.empty_cache()
  123. self.model.train()
  124. iter_count += 1
  125. torch.save({"state_dict": self.model.state_dict(), "param": self.optimizer}, os.path.join(self.modelPath, "%s_final.pth" % (str(t).zfill(5))))

net.py at commit a104077, no license · at the source

Overview

Authors: Lin Cai1,2, Ying Zhang1,2, Quanwei Ding1,2, Xiaojun Wang3, Pei Sun4, Shaoqun Zeng1,2, Tingwei Quan1,2
  1. Britton Chance Center for Biomedical Photonics, Wuhan National Laboratory for Optoelectronics, Huazhong University of Science and Technology,Wuhan, 430074 Hubei China
  2. MOE Key Laboratory for Biomedical Photonics, Wuhan National Laboratory for Optoelectronics, Huazhong University of Science and Technology,Wuhan, 430074 Hubei China
  3. Key Laboratory of Biomedical Engineering of Hainan Province, School of Biomedical Engineering, Hainan University,Sanya, China
  4. Department of Clinical Research Institute, Central People’s Hospital of Zhanjiang,Zhanjiang, Guangdong China
Journal: Brain informatics, volume 13, issue 1, article 11
Dates: received 8 July 2025; accepted 10 March 2026; published online 17 April 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1186/s40708-026-00298-x · PMID 41995951 · PMCID PMC13103207 · OpenAlex W7154732854
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: methods / tools (subfield)
Keywords: Neuronal image segmentation, Domain generalization, Image intensity variation, Neurite segmentation, Multi-modal neuroimaging
Topic: Cell Image Analysis Techniques (Biophysics, Biochemistry, Genetics and Molecular Biology), according to OpenAlex
Funding: Key R&D Projects in Hainan Province (ZDYF2024SHFZ265); Brain Science and Brain-like Intelligence Technology - National Science and Technology Major Project (No. 2021ZD0201004); Collaborative Innovation Center of Life and Health, Hainan University (XTCX2022JKB10); National Natural Science Foundation of China (National Science Foundation of China) (32471146)
Citations: not cited yet (Europe PMC); 51 references in the paper

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.

Repositories

Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.

FateUBW0227/Feature_generation_for_SegAnyNeuron

License: none: the authors keep all their rights
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: 21628da63ac41ecb3ab5912e24ee3e112b05f78a, 6 May 2025
Languages: C/C++ (796), C++ (106), CUDA (12)
Size: 1,318 files, 914 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, tests, documentation
Not found: license file, CITATION.cff, environment file, continuous integration
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
915 files

FateUBW0227/Training_code_for_SegAnyNeuron

License: none: the authors keep all their rights
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: a10407746f1b25ab670c7c09b7ad6c34d947ce5f, 6 May 2025
Languages: Python (22)
Size: 39 files, 22 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, environment (requirements.txt)
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: PyTorch (18 files), NumPy (12 files), tifffile (6 files), Matplotlib (1 file), SciPy (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
23 files

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1186/s40708-026-00298-x.

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:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 936 scripts, each with its path and the digest of its content;
  • 2 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

Data availability statement

The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1186/s40708-026-00298-x.

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, 29 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 7 authors, 5 keywords, 4 funders, 49 references.

Cite

This paper

Cai, L., Zhang, Y., Ding, Q., Wang, X., Sun, P., Zeng, S., & Quan, T. (2026). SegAnyNeuron: a neural image segmentation network with strong generalization performance by modeling image intensity variation. Brain informatics, 13(1), 11. https://doi.org/10.1186/s40708-026-00298-x

BibTeX

@article{cai2026seganyneuron,
author = {Cai, Lin and Zhang, Ying and Ding, Quanwei and Wang, Xiaojun and Sun, Pei and Zeng, Shaoqun and Quan, Tingwei},
title = {{SegAnyNeuron: a neural image segmentation network with strong generalization performance by modeling image intensity variation}},
journal = {Brain informatics},
year = {2026},
month = apr,
volume = {13},
number = {1},
pages = {11},
publisher = {Springer},
issn = {2198-4018},
doi = {10.1186/s40708-026-00298-x},
url = {https://doi.org/10.1186/s40708-026-00298-x},
pmid = {41995951},
pmcid = {PMC13103207}
}

RIS

TY - JOUR
AU - Cai, Lin
AU - Zhang, Ying
AU - Ding, Quanwei
AU - Wang, Xiaojun
AU - Sun, Pei
AU - Zeng, Shaoqun
AU - Quan, Tingwei
TI - SegAnyNeuron: a neural image segmentation network with strong generalization performance by modeling image intensity variation
T2 - Brain informatics
J2 - Brain Inform
PY - 2026
DA - 2026/04/17
VL - 13
IS - 1
SP - 11
SN - 2198-4018
PB - Springer
DO - 10.1186/s40708-026-00298-x
UR - https://doi.org/10.1186/s40708-026-00298-x
LA - en
ER -

CSL-JSON

{
"id": "10.1186/s40708-026-00298-x",
"type": "article-journal",
"title": "SegAnyNeuron: a neural image segmentation network with strong generalization performance by modeling image intensity variation",
"container-title": "Brain informatics",
"author": [
{
"family": "Cai",
"given": "Lin"
},
{
"family": "Zhang",
"given": "Ying"
},
{
"family": "Ding",
"given": "Quanwei"
},
{
"family": "Wang",
"given": "Xiaojun"
},
{
"family": "Sun",
"given": "Pei"
},
{
"family": "Zeng",
"given": "Shaoqun"
},
{
"family": "Quan",
"given": "Tingwei"
}
],
"container-title-short": "Brain Inform",
"volume": "13",
"issue": "1",
"page": "11",
"DOI": "10.1186/s40708-026-00298-x",
"PMID": "41995951",
"PMCID": "PMC13103207",
"ISSN": "2198-4018",
"publisher": "Springer",
"URL": "https://doi.org/10.1186/s40708-026-00298-x",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
17
]
]
}
}

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.21769/bioprotoc.5616 [code]
Reconstruction of Axonal Projections of Single Neurons Using PointTree.
Journal: Bio-protocol
In common: tifffile, PyTorch, SciPy, 2 other tools, 5 references
[2] doi:10.1186/s40708-026-00314-0 [code]
A quantitative and precision‑oriented neuronal reconstruction approach based on data grading.
Journal: Brain informatics
In common: 7 references
[3] doi:10.1016/j.crmeth.2026.101476 [code]
Unsupervised deep learning enables blur-free resolution enhancement in two-photon microscopy.
Journal: Cell reports methods
In common: tifffile, PyTorch, SciPy, 2 other tools, 3 references
[4] 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 surgery
In common: tifffile, PyTorch, SciPy, 2 other tools, methods / tools, 2 references
[5] doi:10.7554/elife.105081 [code]
Movie reconstruction from mouse visual cortex activity.
Journal: eLife
In common: tifffile, PyTorch, SciPy, 2 other tools, 2 references
[6] doi:10.1126/sciadv.aef9926 [code]
aDISCO: A clearing method to enable 3D microscopy of large archival paraffin-embedded human tissue blocks.
Journal: Science advances
In common: tifffile, PyTorch, SciPy, 2 other tools, methods / tools, 1 reference
[7] doi:10.3389/fmed.2026.1875760 [code]
Adaptive multi-stage domain unlearning for white-matter lesion segmentation.
Journal: Frontiers in medicine
In common: tifffile, PyTorch, SciPy, 2 other tools, methods / tools, 1 reference
[8] doi:10.1038/s41467-026-73476-4 [code]
Developmental molecular signatures define de novo cortico-brainstem circuit for skilled forelimb movement.
Journal: Nature communications
In common: tifffile, PyTorch, Matplotlib, 1 other tool, 2 references
[9] doi:10.1371/journal.pcbi.1014571 [code]
SynAPSeg: A novel dataset and image analysis framework for deep learning-based synapse detection and quantification.
Journal: PLoS computational biology
In common: tifffile, PyTorch, SciPy, 2 other tools, 1 reference
[10] doi:10.1038/s41593-026-02376-z [code]
A framework for comparative analysis of human and mouse cortical neuron dendrites in corresponding brain regions.
Journal: Nature neuroscience
In common: SciPy, Matplotlib, NumPy, 3 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.

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: 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.