Skip to main content

Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Advertisement

Scientific Reports
  • View all journals
  • Search
  • My Account Login
  • Content Explore content
  • About the journal
  • Publish with us
  • Sign up for alerts
  • RSS feed
  1. nature
  2. scientific reports
  3. articles
  4. article
Few-shot cross-episode adaptive memory for metal surface defect semantic segmentation
Download PDF
Download PDF
  • Article
  • Open access
  • Published: 18 January 2026

Few-shot cross-episode adaptive memory for metal surface defect semantic segmentation

  • Jiyan Zhang1,
  • Hanze Ding1,
  • Ming Peng1,
  • Shuzhen Tu1,
  • Guiping Chen2 &
  • …
  • Yanfang Liu1 

Scientific Reports , Article number:  (2026) Cite this article

  • 901 Accesses

  • Metrics details

We are providing an unedited version of this manuscript to give early access to its findings. Before final publication, the manuscript will undergo further editing. Please note there may be errors present which affect the content, and all legal disclaimers apply.

Subjects

  • Computational biology and bioinformatics
  • Mathematics and computing

Abstract

Few-shot semantic segmentation has gained significant attention in metal surface defect detection due to its ability to segment unseen object classes with only a few annotated defect samples. Previous methods constrained to single-episode training suffer from limited adaptability in semantic description of defect regions and coarse segmentation granularity. In this paper, we propose an episode-adaptive memory network (EAMNet) that specifically addresses subtle variances between episodes during training. The episode adaptive memory unit (EAMU) leverages an adaptive factor to model semantic dependencies across different episodes. The context adaptation module (CAM) aggregates hierarchical features of support-query pairs for fine-grained segmentation. The proposed global response mask average pooling (GRMAP) introduces a global response normalization to obtain fine-grained cues directly from the support prototype. We also introduce an attention distillation (AD), which leverages fine-grained semantic attention correspondence to process defect region cues and stabilize the cross-episode adaptation in EAMU. Extensive experiments demonstrate that our approach establishes new state-of-the-art performance on both Surface Defect-\(4^i\) and FSSD-12 datasets.

Similar content being viewed by others

Research on the performance of the SegFormer model with fusion of edge feature extraction for metal corrosion detection

Article Open access 08 March 2025

Adaptive compression as a unifying framework for episodic and semantic memory

Article 05 June 2025

Adaptive recognition of machining features in sheet metal parts based on a graph class-incremental learning strategy

Article Open access 09 May 2024

Data availability

All data and codes underlying the results of this study are available at the following URL: https://doi.org/10.5281/zenodo.18174740.

References

  1. Liu, Y., Liu, Y., Guo, X., Ling, X. & Geng, Q. Metal surface defect detection using slf-yolo enhanced yolov8 model. Sci. Rep. 15, 11105 (2025).

    Google Scholar 

  2. Chan, S. et al. Feature optimization-guided high-precision and real-time metal surface defect detection network. Sci. Rep. 14, 31941 (2024).

    Google Scholar 

  3. Zhou, C. et al. Metal surface defect detection based on improved yolov5. Sci. Rep. 13, 20803 (2023).

    Google Scholar 

  4. Lv, X., Duan, F., Jiang, J.-J., Fu, X. & Gan, L. Deep metallic surface defect detection: The new benchmark and detection network. Sensors 20, 1562 (2020).

    Google Scholar 

  5. Wang, W., Han, C., Zhou, T. & Liu, D. Visual recognition with deep nearest centroids. In the Eleventh International Conference on Learning Representations, 1–30 (2023).

  6. Han, C. et al.\({\rm E}\hat{\,}{\rm 2vpt}\): An effective and efficient approach for visual prompt tuning. In: Proc. IEEE/CVF International Conference on Computer Vision, 17491–17502 (2023).

  7. Lu, Y. et al. Transflow: Transformer as flow learner. In: Proc. IEEE/CVF Conference on Computer Vision and Pattern Recognition, 18063–18073 (2023).

  8. Liu, Q., Liu, M., Jonathan, Q. & Shen, W. A real-time anchor-free defect detector with global and local feature enhancement for surface defect detection. Expert Syst. Appl. 246, 123199 (2024).

    Google Scholar 

  9. Tabernik, D., Šela, S., Skvarč, J. & Skočaj, D. Segmentation-based deep-learning approach for surface-defect detection. J. Intell. Manuf. 31, 759–776 (2020).

    Google Scholar 

  10. Guo, B., Wang, Y., Zhen, S., Yu, R. & Su, Z. Speed: Semantic prior and extremely efficient dilated convolution network for real-time metal surface defects detection. IEEE Trans. Industr. Inf. 19, 11380–11390 (2023).

    Google Scholar 

  11. Ma, J., Xie, G.-S., Zhao, F. & Li, Z. Afanet: Adaptive frequency-aware network for weakly-supervised few-shot semantic segmentation. IEEE Transactions on Multimedia 1–11 (2025).

  12. Wang, C. et al. Taylor series-inspired local structure fitting network for few-shot point cloud semantic segmentation. In: Proc. AAAI Conference on Artificial Intelligence, 7527–7535 (2025).

  13. Mai, H., Sun, R., Zhang, T. & Wu, F. Rankmatch: Exploring the better consistency regularization for semi-supervised semantic segmentation. In: Proc. IEEE/CVF Conference on Computer Vision and Pattern Recognition, 3391–3401 (2024).

  14. Woo, S. et al. Convnext v2: Co-designing and scaling convnets with masked autoencoders. In: Proc. IEEE/CVF Conference on Computer Vision and Pattern Recognition, 16133–16142 (2023).

  15. Chao, C. et al. Iamf-yolo: Metal surface defect detection based on improved yolov8. IEEE Trans. Instrum. Meas. 74, 1–17 (2025).

    Google Scholar 

  16. Zhang, X., Fang, T., Saniie, J., Bakhtiari, S. & Heifetz, A. Unsupervised learning-enabled pulsed infrared thermographic microscopy of subsurface defects in stainless steel. Sci. Rep. 14, 14865 (2024).

    Google Scholar 

  17. Panić, B., Borovinšek, M., Vesenjak, M., Oman, S. & Nagode, M. A guide to unsupervised image segmentation of mct-scanned cellular metals with mixture modelling and markov random fields. Mater. Design 239, 112750 (2024).

    Google Scholar 

  18. Song, Z., Yao, H., Tian, D., Zhan, G. & Gu, Y. Segmentation method of u-net sheet metal engineering drawing based on cbam attention mechanism. Artif. Intell. Eng. Des. Anal. Manuf. 39, e14 (2025).

    Google Scholar 

  19. Zhang, H. et al. An efficient model for metal surface defect detection based on attention mechanism and multi-scale feature. J. Supercomput. 81, 40 (2025).

    Google Scholar 

  20. Zhang, L., Li, X., Sun, Y. & Guo, H. Triple-attentions based salient object detector for strip steel surface defects. Sci. Rep. 15, 2537 (2025).

    Google Scholar 

  21. Wei, H., Zhao, L., Li, R. & Zhang, M. Rfaconv-cbm-vit: enhanced vision transformer for metal surface defect detection. J. Supercomput. 81, 1–38 (2025).

    Google Scholar 

  22. Zhang, G. et al. Lggformer: A dual-branch local-guided global self-attention network for surface defect segmentation. Adv. Eng. Inform. 64, 103099 (2025).

    Google Scholar 

  23. Jin, Y., Zhang, Y., Shan, D. & Wu, Z. Human-guided zero-shot surface defect semantic segmentation. IEEE Trans. Instrum. Meas. 74, 1–13 (2025).

    Google Scholar 

  24. Zhao, L., Zhang, Y., Duan, J. & Yu, J. Cross-supervised contrastive learning domain adaptation network for steel defect segmentation. Adv. Eng. Inform. 64, 102964 (2025).

    Google Scholar 

  25. Snell, J., Swersky, K. & Zemel, R. Prototypical networks for few-shot learning. Adv. Neural Inf. Process. Syst. 30, 4077–4087 (2017).

    Google Scholar 

  26. Ye, M. & Zhang, T. Sanet: similarity aggregation and semantic fusion for few-shot semantic segmentation. Appl. Intell. 55, 1–12 (2025).

    Google Scholar 

  27. Gong, W. et al. Cgnet: Few-shot learning for intracranial hemorrhage segmentation. Computerized Medical Imaging and Graphics 102505 (2025).

  28. Yang, A., Sang, Z., Zhou, Y., Cao, J. & Liu, L. Bi-orientated rectification few-shot segmentation network based on fine-grained prototypes. Neurocomputing 620, 129160 (2025).

    Google Scholar 

  29. Chen, S., Yu, Y., Li, Y., Lu, Z. & Zhou, Y. Mask-free iterative refinement network for weakly-supervised few-shot semantic segmentation. Neurocomputing 611, 128600 (2025).

    Google Scholar 

  30. Wang, X., Chen, Q. & Yang, Y. Word vector embedding and self-supplementing network for generalized few-shot semantic segmentation. Neurocomputing 613, 128737 (2025).

    Google Scholar 

  31. Xiang, Q. et al. Dkdm: Data-free knowledge distillation for diffusion models with any architecture. In: Proc. IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2955–2965 (2025).

  32. Cai, S. et al. Diffusion self-distillation for zero-shot customized image generation. In: Proc. IEEE/CVF Conference on Computer Vision and Pattern Recognition, 18434–18443 (2025).

  33. Li, Q., Wang, Y., Meng, L., Qin, Y. & Tang, B. Sdmc-net: A lightweight and deployable fault diagnosis network using self-distillation and multiscale-depth convolution. IEEE Trans. Instrum. Meas. 74, 1–13 (2025).

    Google Scholar 

  34. Lu, Z. et al. Self-distillation attention for efficient and accurate motion prediction in autonomous driving. IEEE Trans. Intell. Transp. Syst. 26, 7262–7274 (2025).

    Google Scholar 

  35. Peng, B. et al. Hierarchical dense correlation distillation for few-shot segmentation. In: Proc. IEEE/CVF Conference on Computer Vision and Pattern Recognition, 23641–23651 (2023).

  36. Lang, C., Tu, B., Cheng, G. & Han, J. Beyond the prototype: divide-and-conquer proxies for few-shot segmentation. In: Proc. Thirty-First International Joint Conference on Artificial Intelligence, 1024–1030 (2022).

  37. Bao, Y. et al. Triplet-graph reasoning network for few-shot metal generic surface defect segmentation. IEEE Trans. Instrum. Meas. 70, 1–11 (2021).

    Google Scholar 

  38. Zhang, X., Wei, Y., Yang, Y. & Huang, T. S. Sg-one: Similarity guidance network for one-shot semantic segmentation. IEEE Trans. Cybern. 50, 3855–3865 (2020).

    Google Scholar 

  39. Song, K., Feng, H., Cao, T., Cui, W. & Yan, Y. Mfanet: multifeature aggregation network for cross-granularity few-shot seamless steel tubes surface defect segmentation. IEEE Trans. Industr. Inf. 20, 9725–9735 (2024).

    Google Scholar 

  40. Yu, R., Guo, B. & Yang, K. Selective prototype network for few-shot metal surface defect segmentation. IEEE Trans. Instrum. Meas. 71, 1–10 (2022).

    Google Scholar 

  41. Hochreiter, S. & Schmidhuber, J. Long short-term memory. Neural Comput. 9, 1735–1780 (1997).

    Google Scholar 

  42. Bulatov, A., Kuratov, Y. & Burtsev, M. Recurrent memory transformer. Adv. Neural Inf. Process. Syst. 35, 11079–11091 (2022).

    Google Scholar 

  43. Lin, T.Y. et al. Feature pyramid networks for object detection. In: Proc. IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2117–2125 (2017).

  44. Roy, A. G., Navab, N. & Wachinger, C. Concurrent spatial and channel ‘squeeze & excitation’ in fully convolutional networks. In Medical Image Computing and Computer Assisted Intervention, 421–429 (2018).

  45. Feng, H., Song, K., Cui, W., Zhang, Y. & Yan, Y. Cross position aggregation network for few-shot strip steel surface defect segmentation. IEEE Trans. Instrum. Meas. 72, 1–10 (2023).

    Google Scholar 

  46. Huang, J. et al. Multiscale adaptive prototype transformer network for few-shot strip steel surface defect segmentation. IEEE Trans. Instrum. Meas. 74, 1–14 (2025).

    Google Scholar 

  47. Tian, Z. et al. Prior guided feature enrichment network for few-shot segmentation. IEEE Trans. Pattern Anal. Mach. Intell. 44, 1050–1065 (2022).

    Google Scholar 

  48. He, K., Zhang, X., Ren, S. & Sun, J. Deep residual learning for image recognition. In: Proc. IEEE/CVF Conference on Computer Vision and Pattern Recognition, 770–778 (2016).

  49. Simonyan, K. & Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv:1409.1556 (2014).

  50. Xu, Q. et al. Hybrid mamba for few-shot segmentation. Adv. Neural Inform. Process. Syst. 37, 73858–73883 (2024).

    Google Scholar 

Download references

Funding

This work was supported in part by the Fujian Natural Science Foundation under Grants 2023J01978, 2023J01979 and 2024J01855, in part by the Fujian International Cooperation Program in Science and Technology under Grant 2024I0024, in part by the Fujian Regional Development Project under Grant 2025Y3009, and in part by the Doctoral Research Project of Longyan University under Grants LB2023008 and LB2023015.

Author information

Authors and Affiliations

  1. College of Mathematics and Information Engineering, Longyan University, Longyan, 364012, China

    Jiyan Zhang, Hanze Ding, Ming Peng, Shuzhen Tu & Yanfang Liu

  2. Longyan Tobacco Industrial Co. Ltd., Longyan, 364000, China

    Guiping Chen

Authors
  1. Jiyan Zhang
    View author publications

    Search author on:PubMed Google Scholar

  2. Hanze Ding
    View author publications

    Search author on:PubMed Google Scholar

  3. Ming Peng
    View author publications

    Search author on:PubMed Google Scholar

  4. Shuzhen Tu
    View author publications

    Search author on:PubMed Google Scholar

  5. Guiping Chen
    View author publications

    Search author on:PubMed Google Scholar

  6. Yanfang Liu
    View author publications

    Search author on:PubMed Google Scholar

Contributions

J.Z. and H.D. wrote the main manuscript text, J.Z. and M.P. prepared figures 1-2, H.D., M.P. and S.T. designed the experiments, G.C. and Y.L. provided critical revisions. All authors reviewed the manuscript.

Corresponding authors

Correspondence to Guiping Chen or Yanfang Liu.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Zhang, J., Ding, H., Peng, M. et al. Few-shot cross-episode adaptive memory for metal surface defect semantic segmentation. Sci Rep (2026). https://doi.org/10.1038/s41598-026-36445-x

Download citation

  • Received: 16 July 2025

  • Accepted: 13 January 2026

  • Published: 18 January 2026

  • DOI: https://doi.org/10.1038/s41598-026-36445-x

Share this article

Anyone you share the following link with will be able to read this content:

Sorry, a shareable link is not currently available for this article.

Provided by the Springer Nature SharedIt content-sharing initiative

Keywords

  • Few-shot semantic segmentation
  • Metal surface defect
  • Cross-episode semantic dependence
  • Global response mask average pooling
  • Attention distillation
Download PDF

Advertisement

Explore content

  • Research articles
  • News & Comment
  • Collections
  • Subjects
  • Follow us on Facebook
  • Follow us on Twitter
  • Sign up for alerts
  • RSS feed

About the journal

  • About Scientific Reports
  • Contact
  • Journal policies
  • Guide to referees
  • Calls for Papers
  • Editor's Choice
  • Journal highlights
  • Open Access Fees and Funding

Publish with us

  • For authors
  • Language editing services
  • Open access funding
  • Submit manuscript

Search

Advanced search

Quick links

  • Explore articles by subject
  • Find a job
  • Guide to authors
  • Editorial policies

Scientific Reports (Sci Rep)

ISSN 2045-2322 (online)

nature.com sitemap

About Nature Portfolio

  • About us
  • Press releases
  • Press office
  • Contact us

Discover content

  • Journals A-Z
  • Articles by subject
  • protocols.io
  • Nature Index

Publishing policies

  • Nature portfolio policies
  • Open access

Author & Researcher services

  • Reprints & permissions
  • Research data
  • Language editing
  • Scientific editing
  • Nature Masterclasses
  • Research Solutions

Libraries & institutions

  • Librarian service & tools
  • Librarian portal
  • Open research
  • Recommend to library

Advertising & partnerships

  • Advertising
  • Partnerships & Services
  • Media kits
  • Branded content

Professional development

  • Nature Awards
  • Nature Careers
  • Nature Conferences

Regional websites

  • Nature Africa
  • Nature China
  • Nature India
  • Nature Japan
  • Nature Middle East
  • Privacy Policy
  • Use of cookies
  • Legal notice
  • Accessibility statement
  • Terms & Conditions
  • Your US state privacy rights
Springer Nature

© 2026 Springer Nature Limited

Nature Briefing AI and Robotics

Sign up for the Nature Briefing: AI and Robotics newsletter — what matters in AI and robotics research, free to your inbox weekly.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing: AI and Robotics