Deep learning-enabled versatile shape perception for soft robots via single-ended multimode fiber.
3 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 4 matches
- [1] § MATERIALS AND METHODS › Continuous super-resolution regression strategy ↔ 2-1-code.zip/model.py, lines 57 to 163 · score 0.77 · skip connections, ReLU, block, linear, channel, adaptively · block
oscr:b:H297W9B2Q349K-F· Report a mismatch - [2] § RESULTS › Continuous super-resolution tracking via geometric priors ↔ 2-2-code.zip/class_unet_fan_nosplit.py, lines 609 to 664 · score 0.67 · interval hit rate, adjacent anchors, unseen intervals, predicted angle · block
oscr:b:B3WX5R59GTH9S-A· Report a mismatch - [3] § MATERIALS AND METHODS › Discrete state confirmation ↔ 2-1-code.zip/model.py, lines 57 to 163 · score 0.62 · MaxPool2d, Conv2d, connected, blocks, activation, classifier · block
oscr:b:H297W9B2Q349K-F· Report a mismatch - [4] § MATERIALS AND METHODS › Discrete state confirmation ↔ 1-1-code.zip/code/class180.py, lines 88 to 127 · score 0.58 · MaxPool2d, Conv2d, Dropout, Tanh · block
oscr:b:T9QYEXX0W0ERJ-B· 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 · 163 lines · 6.4 KB · CC-BY-4.0 · 2 matches
- # # model.py
- import torch
- import torch.nn as nn
- import torch.nn.functional as F
- from typing import Optional
- # 定义通道注意力模块
- class ChannelAttentionModule(nn.Module):
- def __init__(self, channel: int, ratio: int = 16):
- super(ChannelAttentionModule, self).__init__()
- self.avg_pool = nn.AdaptiveAvgPool2d(1)
- self.max_pool = nn.AdaptiveMaxPool2d(1)
- # Shared 1×1 MLP implemented as Conv2d for efficiency (same weights for avg/max branches)
- self.shared_mlp = nn.Sequential(
- nn.Conv2d(channel, channel // ratio, kernel_size=1, bias=False),
- nn.ReLU(inplace=True),
- nn.Conv2d(channel // ratio, channel, kernel_size=1, bias=False)
- )
- self.sigmoid = nn.Sigmoid()
- def forward(self, x: torch.Tensor) -> torch.Tensor: # (B,C,H,W)
- avg_out = self.shared_mlp(self.avg_pool(x))
- max_out = self.shared_mlp(self.max_pool(x))
- return self.sigmoid(avg_out + max_out)
- # 定义空间注意力模块
- class SpatialAttentionModule(nn.Module):
- def __init__(self, kernel_size=7):
- super(SpatialAttentionModule, self).__init__()
- self.conv = nn.Conv2d(2, 1, kernel_size=kernel_size, padding=kernel_size//2)
- def forward(self, x):
- avg_out = torch.mean(x, dim=1, keepdim=True)
- max_out, _ = torch.max(x, dim=1, keepdim=True)
- x = torch.cat([avg_out, max_out], dim=1)
- x = self.conv(x)
- return torch.sigmoid(x)
- # 定义CBAM模块
- class CBAM(nn.Module):
- def __init__(self, channels, reduction=16, kernel_size=7):
- super(CBAM, self).__init__()
- self.channel_attention = ChannelAttentionModule(channels, reduction)
- self.spatial_attention = SpatialAttentionModule(kernel_size)
- def forward(self, x):
- x = x * self.channel_attention(x)
- x = x * self.spatial_attention(x)
- return x
- class UNet(nn.Module):
- def __init__(self, input_channels: int = 1, output_channels: int = 1, init_features: int = 64, num_classes: Optional[int] = None):
- super(UNet, self).__init__()
- features = init_features
- self.num_classes = num_classes
- # ---------------- Encoder ----------------
- self.encoder1 = self._block(input_channels, features)
- self.pool1 = nn.MaxPool2d(kernel_size=2, stride=2)
- self.encoder2 = self._block(features, features * 2)
- self.pool2 = nn.MaxPool2d(kernel_size=2, stride=2)
- self.encoder3 = self._block(features * 2, features * 4)
- self.pool3 = nn.MaxPool2d(kernel_size=2, stride=2)
- self.encoder4 = self._block(features * 4, features * 8)
- self.pool4 = nn.MaxPool2d(kernel_size=2, stride=2)
- # ---------------- Bottleneck ----------------
- self.bottleneck = self._block(features * 8, features * 16)
- # ---------------- Decoder ----------------
- self.upconv4 = nn.ConvTranspose2d(features * 16, features * 8, kernel_size=2, stride=2)
- self.decoder4 = self._block(features * 16, features * 8)
- self.upconv3 = nn.ConvTranspose2d(features * 8, features * 4, kernel_size=2, stride=2)
- self.decoder3 = self._block(features * 8, features * 4)
- self.upconv2 = nn.ConvTranspose2d(features * 4, features * 2, kernel_size=2, stride=2)
- self.decoder2 = self._block(features * 4, features * 2)
- self.upconv1 = nn.ConvTranspose2d(features * 2, features, kernel_size=2, stride=2)
- self.decoder1 = self._block(features * 2, features)
- # ---------------- Output ----------------
- self.conv_final = nn.Conv2d(features, output_channels, kernel_size=1)
- self.activation = nn.Sigmoid()
- # ---------------- CBAM Attention ----------------
- self.cbam1 = CBAM(features)
- self.cbam2 = CBAM(features * 2)
- self.cbam3 = CBAM(features * 4)
- self.cbam4 = CBAM(features * 8)
- # ----------- 分类头(阶段1用) -----------
- if num_classes is not None:
- self.gap = nn.AdaptiveAvgPool2d(1)
- self.flatten = nn.Flatten()
- self.classifier = nn.Linear(features * 16, num_classes)
- def _block(self, in_channels, out_channels):
- return nn.Sequential(
- nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1),
- nn.BatchNorm2d(out_channels),
- nn.ReLU(inplace=True),
- nn.Conv2d(out_channels, out_channels, kernel_size=3, padding=1),
- nn.BatchNorm2d(out_channels),
- nn.ReLU(inplace=True)
- )
- def _encode(self, x: torch.Tensor) -> torch.Tensor:
- enc1 = self.encoder1(x)
- enc1 = self.cbam1(enc1) + enc1
- enc2 = self.encoder2(self.pool1(enc1))
- enc2 = self.cbam2(enc2) + enc2
- enc3 = self.encoder3(self.pool2(enc2))
- enc3 = self.cbam3(enc3) + enc3
- enc4 = self.encoder4(self.pool3(enc3))
- enc4 = self.cbam4(enc4) + enc4
- bottleneck = self.bottleneck(self.pool4(enc4))
- return bottleneck
- def forward_classify(self, x: torch.Tensor) -> torch.Tensor:
- feats = self._encode(x)
- pooled = self.gap(feats)
- flat = self.flatten(pooled)
- logits = self.classifier(flat)
- return logits
- def forward(self, x: torch.Tensor) -> torch.Tensor:
- # -------- 编码器 --------
- bottleneck = self._encode(x)
- # -------- 解码器 --------
- # 需要重新获取enc1-enc4用于skip connection
- enc1 = self.encoder1(x)
- enc1 = self.cbam1(enc1) + enc1
- enc2 = self.encoder2(self.pool1(enc1))
- enc2 = self.cbam2(enc2) + enc2
- enc3 = self.encoder3(self.pool2(enc2))
- enc3 = self.cbam3(enc3) + enc3
- enc4 = self.encoder4(self.pool3(enc3))
- enc4 = self.cbam4(enc4) + enc4
- dec4 = self.upconv4(bottleneck)
- dec4 = torch.cat((dec4, enc4), dim=1)
- dec4 = self.decoder4(dec4)
- dec3 = self.upconv3(dec4)
- dec3 = torch.cat((dec3, enc3), dim=1)
- dec3 = self.decoder3(dec3)
- dec2 = self.upconv2(dec3)
- dec2 = torch.cat((dec2, enc2), dim=1)
- dec2 = self.decoder2(dec2)
- dec1 = self.upconv1(dec2)
- dec1 = torch.cat((dec1, enc1), dim=1)
- dec1 = self.decoder1(dec1)
- out = self.conv_final(dec1)
- return self.activation(out)
model.py, under CC-BY-4.0 · at the source
Overview
- Department of Precision Instrument, Tsinghua University, Beijing 100084, China
- State Key Laboratory of Precision Space-time Information Sensing Technology, Beijing 100084, China
- Weixian College, Tsinghua University, Beijing 100084, China
- West China Biomedical Big Data Center, West China Hospital, Sichuan University, Chengdu 610041, China
Abstract
The evolution of soft robots into embodied intelligent systems relies fundamentally on precise proprioception. However, a universal solution for capturing continuous deformations during diverse interactions, particularly in spatially confined interventional scenarios, remains lacking. Here, we introduce a deep learning–enabled versatile shape perception method based on a single-ended multimode fiber (MMF). By leveraging the intrinsic integration advantages of optics, our minimalist reflective architecture physically eliminates the dependence on complex demodulation units and distal devices. Furthermore, treating chaotic optical speckle fields as data streams encoding high-dimensional shape information, reconfigurable neural decoders resolve a single physical channel into versatile perception modes tailored to heterogeneous tasks: discrete state confirmation on soft grippers (>99% accuracy), continuous shape tracking on bionic dexterous hands (~5-fold spatial resolution enhancement), and intuitive 3D morphological reconstruction of soft surgical robots (IoU>0.93). Overall, our work establishes a versatile framework for breaking hardware adaptability limits via computation, laying a solid foundation for closed-loop control in digital twins of soft robots.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 4 matches between paragraphs and lines of code.
Zenodo 19601658
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
28 files
- 1-1-code.zip/
code/ , Python, 336 lines, 1 matchclass180.py - 1-2-code.zip/
WEEL_DAQ.py , Python, 122 lines - 1-2-code.zip/
common.py , Python, 69 lines - 1-2-code.zip/
data_prepare.py , Python, 215 lines - 1-2-code.zip/
test_all.py , Python, 563 lines - 1-2-code.zip/
train.py , Python, 181 lines - 2-1-code.zip/
__init__.py , Python, 1 line - 2-1-code.zip/
class_unet_fan_nosplit.p , Python, 796 linesy - 2-1-code.zip/
decode_fan.py , Python, 227 lines - 2-1-code.zip/
fan_label_utils.py , Python, 318 lines - 2-1-code.zip/
fan_loss_utils.py , Python, 151 lines - 2-1-code.zip/
generate_fan_label_overl , Python, 211 linesay.py - 2-1-code.zip/
model.py , Python, 163 lines, 2 matches - 2-1-code.zip/
test_angle_system.py , Python, 108 lines - 2-1-code.zip/
test_classification_inte , Python, 132 linesgration.py - 2-1-code.zip/
viz_utils.py , Python, 1,065 lines - 2-2-code.zip/
__init__.py , Python, 1 line - 2-2-code.zip/
class_unet_fan_nosplit.p , Python, 1,714 lines, 1 matchy - 2-2-code.zip/
decode_fan.py , Python, 227 lines - 2-2-code.zip/
fan_label_utils.py , Python, 318 lines - 2-2-code.zip/
fan_loss_utils.py , Python, 151 lines - 2-2-code.zip/
plot_error_curves.py , Python, 272 lines - 2-2-code.zip/
visualize_class_masks.py , Python, 285 lines - 2-2-code.zip/
viz_utils.py , Python, 1,033 lines - 3-code2.zip/
1_extract_2d_skeletons_s , Python, 283 linesparse.py - 3-code2.zip/
2_reconstruct_3d_curve.p , Python, 307 linesy - 3-code2.zip/
3_visualization.py , Python, 203 lines - readme.txt, Text, 53 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;
- 27 scripts, each with its path and the digest of its content;
- 4 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, code, and materials availability
All data and code needed to evaluate and reproduce the results in the paper are present in the paper 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, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 14 authors, 2 funders, 33 references.
Cite
This paper
He, Z., Wang, L., Geng, H., Lu, Z., He, T., Zhong, H., Zhang, H., Zhu, R., Zhao, Q., Meng, Y., Li, D., Yan, P., Liu, Q., & Xiao, Q. (2026). Deep learning-enabled versatile shape perception for soft robots via single-ended multimode fiber. Science advances, 12(24), eaef6263. https://
BibTeX
@article{he2026deep,
author = {He, Zhaofan and Wang, Lele and Geng, Haidi and Lu, Zhengyang and He, Tiantian and Zhong, Hongkun and Zhang, Hailong and Zhu, Runfeng and Zhao, Qingxiang and Meng, Yuan and Li, Dan and Yan, Ping and Liu, Qiang and Xiao, Qirong},
title = {{Deep learning-enabled versatile shape perception for soft robots via single-ended multimode fiber}},
journal = {Science advances},
year = {2026},
month = jun,
volume = {12},
number = {24},
pages = {eaef6263},
publisher = {American Association for the Advancement of Science},
issn = {2375-2548},
doi = {10.1126/
url = {https://
pmid = {42284416},
pmcid = {PMC13262633}
}
RIS
TY - JOUR
AU - He, Zhaofan
AU - Wang, Lele
AU - Geng, Haidi
AU - Lu, Zhengyang
AU - He, Tiantian
AU - Zhong, Hongkun
AU - Zhang, Hailong
AU - Zhu, Runfeng
AU - Zhao, Qingxiang
AU - Meng, Yuan
AU - Li, Dan
AU - Yan, Ping
AU - Liu, Qiang
AU - Xiao, Qirong
TI - Deep learning-enabled versatile shape perception for soft robots via single-ended multimode fiber
T2 - Science advances
J2 - Sci Adv
PY - 2026
DA - 2026/
VL - 12
IS - 24
SP - eaef6263
SN - 2375-2548
PB - American Association for the Advancement of Science
DO - 10.1126/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1126/
"type": "article-journal",
"title": "Deep learning-enabled versatile shape perception for soft robots via single-ended multimode fiber",
"container-title": "Science advances",
"author": [
{
"family": "He",
"given": "Zhaofan"
},
{
"family": "Wang",
"given": "Lele"
},
{
"family": "Geng",
"given": "Haidi"
},
{
"family": "Lu",
"given": "Zhengyang"
},
{
"family": "He",
"given": "Tiantian"
},
{
"family": "Zhong",
"given": "Hongkun"
},
{
"family": "Zhang",
"given": "Hailong"
},
{
"family": "Zhu",
"given": "Runfeng"
},
{
"family": "Zhao",
"given": "Qingxiang"
},
{
"family": "Meng",
"given": "Yuan"
},
{
"family": "Li",
"given": "Dan"
},
{
"family": "Yan",
"given": "Ping"
},
{
"family": "Liu",
"given": "Qiang"
},
{
"family": "Xiao",
"given": "Qirong"
}
],
"container-title-short":
"volume": "12",
"issue": "24",
"page": "eaef6263",
"DOI": "10.1126/
"PMID": "42284416",
"PMCID": "PMC13262633",
"ISSN": "2375-2548",
"publisher": "American Association for the Advancement of Science",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
12
]
]
}
}
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/s41467-026-74358-5 [code]
- Brain-inspired spatial intelligence for embodied agents.Journal: Nature communicationsIn common: NetworkX, OpenCV, Pillow, 7 other tools, cognitive, 1 reference
- [2] doi:10.1038/s41467-025-58091-z [code]
- Data-driven design of shape-programmable magnetic soft materials.Journal: Nature communicationsIn common: NetworkX, OpenCV, scikit-image, 7 other tools, 1 reference
- [3] doi:10.1038/s41467-026-68753-1 [code]
- Training tactile sensors to learn force sensing from each other.Journal: Nature communicationsIn common: OpenCV, scikit-image, Pillow, 5 other tools, cognitive, 1 reference
- [4] doi:10.1038/s42256-022-00599-w [code]
- Emergent behaviour and neural dynamics in artificial agents tracking odour plumes.Journal: Nature machine intelligenceIn common: OpenCV, Pillow, PyTorch, 6 other tools, 1 reference
- [5] doi:10.1038/s41586-025-09446-5 [code]
- Optical generative models.Journal: NatureIn common: Pillow, PyTorch, SciPy, 1 other tool, 3 references
- [6] doi:10.1371/journal.pone.0351872 [code]
- Decoding visual object recognition from EEG signals.Journal: PloS oneIn common: Pillow, PyTorch, scikit-learn, 4 other tools, 1 reference
- [7] doi:10.1038/s41467-024-47811-6 [code]
- Spike-based dynamic computing with asynchronous sensing-computing neuromorphic chip.Journal: Nature communicationsIn common: OpenCV, PyTorch, seaborn, 4 other tools, 1 reference
- [8] doi:10.3389/fnins.2024.1439414 [code]
- Spiking representation learning for associative memories.Journal: Frontiers in neuroscienceIn common: OpenCV, PyTorch, scikit-learn, 4 other tools, 1 reference
- [9] doi:10.1038/s41467-025-56739-4 [code]
- The neurobench framework for benchmarking neuromorphic computing algorithms and systems.Journal: Nature communicationsIn common: PyTorch, seaborn, scikit-learn, 4 other tools, 1 reference
- [10] doi:10.1038/s41467-025-65213-0 [code]
- High computational density nanophotonic media for machine learning inference.Journal: Nature communicationsIn common: PyTorch, SciPy, Matplotlib, 1 other tool, 2 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, 27 scripts, and 4 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:e5651c26f581a8ae…
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.1126/sciadv.aef6263)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1126/sciadv.aef6263.svg
:target: https://openscicode.org/badge/doi/10.1126/sciadv.aef6263
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1126/sciadv.aef6263"><img src="https://openscicode.org/badge/doi/10.1126/sciadv.aef6263.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->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)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
