The Deep-Match Framework for Event-Related Potential Detection in EEG.
5 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 5 matches · 1 of them tie a paragraph to a whole file without given lines: a weak match, whose lines are not tinted
- [1] § 2. Method ↔ evaluate_matched_filter.py, lines 42 to 119 · score 0.71 · Detected peaks, matched filter, classical, distance, height, metric · block
oscr:b:PMANJZWZP9XYN-3· Report a mismatch - [2] § 2. Method ↔ exportChannelsTemplates.m, the whole file · a weak match · score 0.60 · 0.2–1 s, baseline correction, resampled, epoched, channels, 0.2 s · block
oscr:b:57YV3G2NWB3H5-Q· Report a mismatch - [3] § 2. Method ↔ trainERPDetector.py, lines 50 to 101 · score 0.59 · pretrained models, ERP detectors, position, events · block
oscr:b:THZH56Q8R5CT3-Q· Report a mismatch - [4] § 2. Method ↔ leaveOneOutValidiation.py, lines 111 to 148 · score 0.57 · Detected peaks, distance, height, metric, tolerance, FN · block
oscr:b:9RDF3TPNZ89AN-L· Report a mismatch - [5] § 2. Method ↔ trainEncoderDecoder.py, lines 37 to 60 · score 0.53 · encoder decoder, Adam, loss, optimizer, PyTorch, trained · block
oscr:b:2SKGAXTQM3ZDY-1· 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 · 125 lines · 3.6 KB · MIT · 1 match
- import h5py
- import numpy as np
- import torch
- import scipy.io as sio
- from scipy.signal import find_peaks
- from TraditionalMatchedFilter import TraditionalMatchedFilter
- def compute_metrics(detected_peaks, target_peaks, tolerance=20):
- detected_peaks = sorted(detected_peaks)
- target_peaks = sorted(target_peaks)
- tp = 0
- used_detected = set()
- det_idx = 0
- for target in target_peaks:
- # Move detection index forward if detections are too early
- while det_idx < len(detected_peaks) and detected_peaks[det_idx] < target - tolerance:
- det_idx += 1
- # Try to match first valid detection in window
- match_found = False
- check_idx = det_idx
- while check_idx < len(detected_peaks) and detected_peaks[check_idx] <= target + tolerance:
- if check_idx not in used_detected:
- tp += 1
- used_detected.add(check_idx)
- match_found = True
- break
- check_idx += 1
- # If no match found → FN
- # (we'll compute FN after loop)
- fp = len(detected_peaks) - len(used_detected)
- fn = len(target_peaks) - tp
- return tp, fp, fn
- templateFile = 'channels_templates_HE.mat'
- # Load the file
- # Open the v7.3 file using h5py
- with h5py.File(templateFile, 'r') as f:
- # Option A: Load a specific variable by name
- # Note: h5py loads arrays transposed compared to scipy/MATLAB
- templates = np.array(f['templates']).T
- dataFile = 'ERP_Detector_Dataset.mat'
- with h5py.File(dataFile, 'r') as f:
- cell_refs = f['eeg_segments'][:] # (26,1)
- X_list = []
- Y_list = []
- for i in range(cell_refs.shape[0]):
- struct_ref = cell_refs[i, 0] # get reference
- struct = f[struct_ref] # dereference
- X = f[struct['X'][()]] if isinstance(struct['X'][()], h5py.Reference) else struct['X'][()]
- Y = f[struct['Y'][()]] if isinstance(struct['Y'][()], h5py.Reference) else struct['Y'][()]
- X = np.transpose(X, (2, 1, 0))
- Y = np.transpose(Y, (2, 1, 0))
- X_list.append(np.array(X))
- Y_list.append(np.array(Y))
- tolerance = 30
- #set r peak sensitivity parameter
- R_peak_threshold = 0.25
- min_peak_distance = 30
- result = []
- N = len(X_list)
- classical_MF = TraditionalMatchedFilter(templates=templates)
- classical_MF.eval()
- for i in range(N):
- print(i)
- metrics = {
- "tp_MF": 0,
- "fp_MF": 0,
- "fn_MF": 0,
- }
- Y = Y_list[i]
- X = X_list[i]
- for idx in range(X.shape[0]):
- target = Y[idx,0,:]
- target_peaks, peaks_amplitude = find_peaks(target, height=R_peak_threshold, distance=min_peak_distance)
- x = X[idx,:,:]
- # Convert to tensor if needed
- if not isinstance(x, torch.Tensor):
- x = torch.tensor(x, dtype=torch.float32)
- else:
- x = x.float()
- # Change shape from (500, 4) → (1, 4, 500)
- x = x.unsqueeze(0)
- # Disable gradients for inference
- with torch.no_grad():
- output_MF = classical_MF(x)
- output_MF = output_MF.detach().cpu().numpy().squeeze()
- detected_peaks_deep_MF, peaks_amplitude = find_peaks(output_MF, height=R_peak_threshold, distance=min_peak_distance)
- tp, fp, fn = compute_metrics(detected_peaks_deep_MF, target_peaks, tolerance=tolerance)
- metrics["tp_MF"] += tp
- metrics["fp_MF"] += fp
- metrics["fn_MF"] += fn
- result.append(metrics)
- # convert to numpy array (important!)
- result_array = np.array(result)
- # save to matlab file
- sio.savemat('matched_filter_results.mat', {'results': result_array})
evaluate_matched_filter.py at commit 7ee1653, under MIT · at the source
Overview
Abstract
Reliable detection of event-related potentials (ERPs) at the single-trial level remains a challenge due to low signal-to-noise ratio and high variability in electroencephalography (EEG) recordings. This work investigates the use of the Deep-Match framework (Deep-MF) for ERP detection. We examine whether incorporating prior knowledge of an ERP template into deep learning models improves detection performance. As a proof-of-concept study, the framework was evaluated on a single dataset with multi-channel EEG recordings during laser stimulation. The model was trained in two stages. First, an encoder–decoder architecture was trained to reconstruct input EEG signals in order to learn compact signal representations. In the second stage, the decoder was replaced with a detection module and the network was fine-tuned for ERP identification. Two model variants were evaluated: a standard model with randomly initialized filters and a Deep-MF model in which input kernels were initialized using ERP templates. Models performance was assessed on a single-trial ERP detection task during leave-one-out validation, and then compared with matched filter detector. The neural network models outperformed the matched filter detector and proposed that the Deep-MF model slightly outperformed the detector with standard kernel initialization for the majority of held-out subjects. Although both approaches exhibited substantial inter-subject variability, Deep-MF achieved a higher average F1-score (0.37) compared to the standard network (0.34), indicating improved robustness to cross-subject differences. Performance varied considerably across participants. The best performance obtained by Deep-MF reached an F1-score of 0.71, exceeding the maximum score achieved by the standard model (0.59). These results showed that ERP-informed kernel initialization provides improvements in single-trial ERP detection under subject-independent evaluation. These findings demonstrate that integrating domain knowledge with deep learning architectures can improve single-trial ERP detection. The proposed approach provides a step towards practical wearable EEG and passive brain–computer interface applications, as well as towards real-time monitoring of cognitive processes.
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 5 matches between paragraphs and lines of code.
Marower/DeepMF_ERP_Detection_in_EEG-main
7ee165353de5de02252ac2aac5244c2f7c4292e4, 28 July 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
16 files
- DeepMathedFilterModel.py
, Python, 63 lines - PrepareDataset_ds005284.
m , MATLAB, 62 lines - TraditionalMatchedFilter
.py , Python, 46 lines - evaluate_matched_filter.
py , Python, 125 lines, 1 match - exportChannelsTemplates.
m , MATLAB, 62 lines, 1 match - exportDataForDetector.m, MATLAB, 78 lines
- exportDataForEncoderDeco
der.m , MATLAB, 42 lines - leaveOneOutValidiation.p
y , Python, 154 lines, 1 match - plotERPforChannels.m, MATLAB, 43 lines
- plotERPforSubjects.m, MATLAB, 43 lines
- plotF1scoreForLOO.m, MATLAB, 76 lines
- testERPDetector.ipynb, Jupyter, 131 lines
- trainERPDetector.py, Python, 101 lines, 1 match
- trainEncoderDecoder.py, Python, 72 lines, 1 match
- LICENSE, License, 21 lines
- README.md, Text, 38 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;
- 14 scripts, each with its path and the digest of its content;
- 5 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
- openneuro:ds005284, at OpenNeuro; found in “Data Availability Statement”
Data Availability Statement
For this study we used the ds005284 public dataset from the OpenNeuro repository (https://
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, 3 authors, 3 keywords, 8 MeSH terms, 1 funder, 35 references.
Cite
This paper
Żyliński, M., Śmigielski, B. T., & Cybulski, G. (2026). The Deep-Match Framework for Event-Related Potential Detection in EEG. Sensors (Basel, Switzerland), 26(17), 5444. https://
BibTeX
@article{zylinski2026dee
author = {Żyliński, Marek and Śmigielski, Bartosz Tomasz and Cybulski, Gerard},
title = {{The Deep-Match Framework for Event-Related Potential Detection in EEG}},
journal = {Sensors (Basel, Switzerland)},
year = {2026},
month = aug,
volume = {26},
number = {17},
pages = {5444},
publisher = {Multidisciplinary Digital Publishing Institute (MDPI)},
issn = {1424-8220},
doi = {10.3390/
url = {https://
pmid = {42740064},
pmcid = {PMC13567992}
}
RIS
TY - JOUR
AU - Żyliński, Marek
AU - Śmigielski, Bartosz Tomasz
AU - Cybulski, Gerard
TI - The Deep-Match Framework for Event-Related Potential Detection in EEG
T2 - Sensors (Basel, Switzerland)
J2 - Sensors (Basel)
PY - 2026
DA - 2026/
VL - 26
IS - 17
SP - 5444
SN - 1424-8220
PB - Multidisciplinary Digital Publishing Institute (MDPI)
DO - 10.3390/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.3390/
"type": "article-journal",
"title": "The Deep-Match Framework for Event-Related Potential Detection in EEG",
"container-title": "Sensors (Basel, Switzerland)",
"author": [
{
"family": "Żyliński",
"given": "Marek"
},
{
"family": "Śmigielski",
"given": "Bartosz Tomasz"
},
{
"family": "Cybulski",
"given": "Gerard"
}
],
"container-title-short":
"volume": "26",
"issue": "17",
"page": "5444",
"DOI": "10.3390/
"PMID": "42740064",
"PMCID": "PMC13567992",
"ISSN": "1424-8220",
"publisher": "Multidisciplinary Digital Publishing Institute (MDPI)",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
28
]
]
}
}
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/s41597-021-01094-4 [code]
- Mobile BCI dataset of scalp- and ear-EEGs with ERP and SSVEP paradigms while standing, walking, and running.Journal: Scientific dataIn common: EEGLAB, h5py, PyTorch, 4 other tools, methods / tools, EEG, 1 reference
- [2] doi:10.3390/brainsci14090860 [code]
- Classification of Known and Unknown Study Items in a Memory Task Using Single-Trial Event-Related Potentials and Convolutional Neural Networks.Journal: Brain sciencesIn common: EEGLAB, h5py, Matplotlib, 1 other tool, EEG, 1 reference
- [3] doi:10.1038/s41597-025-05900-1 [code]
- A comprehensive EEG dataset of laser-evoked potentials for pain research.Journal: Scientific dataIn common: EEGLAB, methods / tools, EEG, 2 references
- [4] doi:10.1016/j.nicl.2025.103760 [code]
- Event-related potential markers of subjective cognitive decline and mild cognitive impairment during a sustained visuo-attentive task.Journal: NeuroImage. ClinicalIn common: EEGLAB, SciPy, Matplotlib, 1 other tool, EEG, 1 reference
- [5] doi:10.1016/j.nicl.2021.102914 [code]
- The impact of premature extrauterine exposure on infants' stimulus-evoked brain activity across multiple sensory systems.Journal: NeuroImage. ClinicalIn common: EEGLAB, Statistics and Machine Learning Toolbox, SciPy, 1 other tool, EEG, 1 reference
- [6] doi:10.1002/hbm.70602 [code]
- Neuroimaging Correlates of Post-Stroke Pain After Ischemic Stroke: Secondary Analysis of the INSPiRE-TMS Trial.Journal: Human brain mappingIn common: h5py, Statistics and Machine Learning Toolbox, SciPy, 2 other tools, 1 reference
- [7] doi:10.1038/s41598-025-25576-2
- A direct comparison of simultaneously recorded scalp, around-ear and in-ear EEG for neural selective auditory attention decoding to speech.Journal: Scientific reportsIn common: EEG, 3 references
- [8] doi:10.3390/life13020391 [code]
- On the Influence of Aging on Classification Performance in the Visual EEG Oddball Paradigm Using Statistical and Temporal Features.Journal: Life (Basel, Switzerland)In common: EEGLAB, SciPy, Matplotlib, 1 other tool, EEG, 1 reference
- [9] doi:10.3389/fneur.2024.1358167 [code]
- EEG biomarkers analysis in different cognitive impairment after stroke: an exploration study.Journal: Frontiers in neurologyIn common: h5py, SciPy, Matplotlib, 1 other tool, EEG, 1 reference
- [10] doi:10.1016/j.xcrm.2022.100846 [code]
- Selective and replicable neuroimaging-based indicators of pain discriminability.Journal: Cell reports. MedicineIn common: h5py, SciPy, Matplotlib, 1 other tool, EEG, 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, 14 scripts, and 5 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:d2b43217bc53ee6f…
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.3390/s26175444)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.3390/s26175444.svg
:target: https://openscicode.org/badge/doi/10.3390/s26175444
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.3390/s26175444"><img src="https://openscicode.org/badge/doi/10.3390/s26175444.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.
