The Deep-Match Framework for Event-Related Potential Detection in EEG.
The 5 matches · 1 of them tie a paragraph to a whole file, not to given lines: a weak match, whose lines are not tinted
- [1] § 2. Method ↔ evaluate_matched_filter.py, lines 42–119 · score 0.71 · Detected peaks, matched filter, classical, distance, height, metric
- [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
- [3] § 2. Method ↔ trainERPDetector.py, lines 50–101 · score 0.59 · pretrained models, ERP detectors, position, events
- [4] § 2. Method ↔ leaveOneOutValidiation.py, lines 111–148 · score 0.57 · Detected peaks, distance, height, metric, tolerance, FN
- [5] § 2. Method ↔ trainEncoderDecoder.py, lines 37–60 · score 0.53 · encoder decoder, Adam, loss, optimizer, PyTorch, trained
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 · 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.1016/j.neuron.2026.03.034 [code]
- Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice.Journal: NeuronIn common: EEGLAB, h5py, PyTorch, 4 other tools
- [2] doi:10.1371/journal.pone.0352191 [code]
- Bayesian Uncertainty-aware Deep Learning with noisy labels: Tackling annotation ambiguity in EEG seizure detection.Journal: PloS oneIn common: EEGLAB, PyTorch, Statistics and Machine Learning Toolbox, 3 other tools, methods / tools, EEG
- [3] doi:10.1016/j.ebiom.2026.106375 [code]
- Brainwaves under medication: revealing class-specific neural signatures of psychotropic medication from 24,000 EEGs.Journal: EBioMedicineIn common: EEGLAB, h5py, Statistics and Machine Learning Toolbox, 3 other tools, EEG
- [4] doi:10.1038/s41597-026-07244-w [code]
- An Open Non-Invasive EEG Dataset for Spontaneous Auditory Attention Switch Decoding.Journal: Scientific dataIn common: EEGLAB, h5py, PyTorch, 2 other tools, methods / tools, EEG
- [5] doi:10.1038/s41467-026-73106-z [code]
- Respiratory pauses highlight sleep architecture in mice.Journal: Nature communicationsIn common: EEGLAB, h5py, Statistics and Machine Learning Toolbox, 3 other tools, EEG
- [6] doi:10.1016/j.crmeth.2026.101473 [code]
- AmygdalaGo-BOLT for boundary-aware segmentation of the human amygdala.Journal: Cell reports methodsIn common: EEGLAB, PyTorch, Statistics and Machine Learning Toolbox, 3 other tools, methods / tools
- [7] 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
- [8] doi:10.64898/2026.03.12.710517 [code]
- Cortical excitability inversely modulates fMRI connectivity via low-frequency neuronal couplingJournal: bioRxiv (preprint)In common: EEGLAB, h5py, Statistics and Machine Learning Toolbox, 3 other tools
- [9] doi:10.1038/s41597-026-07807-x [code]
- A Multimodal fNIRS-EEG Dataset for Unilateral Limb Motor Imagery.Journal: Scientific dataIn common: EEGLAB, Statistics and Machine Learning Toolbox, SciPy, 2 other tools, methods / tools, EEG
- [10] doi:10.2196/80286 [code]
- At-Home Sleep Electroencephalography Assessment in Young and Older Adults Using a Novel Wireless Soft Electronics Sleep Monitoring System: Experimental Study.Journal: JMIR formative researchIn common: EEGLAB, Statistics and Machine Learning Toolbox, SciPy, 2 other tools, methods / tools, EEG
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:fe864ff9597d82fa…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
