OSCR

A lightweight deep convolutional neural network for detecting artifacts in continuous EEG signals.

Code ↔ Paper

14 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 14 matches · 2 of them tie a paragraph to a whole file without given lines: weak matches, whose lines are not tinted
  1. [1] § Materials and methods › Data description › Signal standardization ↔ artifact_identification/preprocessing.py, lines 48 to 94 · score 0.90 · bipolar montage, canonical, resampling, filtering, channel, EEG · Report a mismatch
  2. [2] § Materials and methods › Deep learning method › Model architecture and training ↔ artifact_identification/detectors/eye_movement.py, lines 132 to 190 · score 0.86 · BatchNormalization, MaxPooling1D, Conv1D, Dropout, inferred, kernel · Report a mismatch
  3. [3] § Materials and methods › Deep learning method › Model architecture and training ↔ artifact_identification/detectors/muscle.py, lines 177 to 238 · score 0.86 · BatchNormalization, MaxPooling1D, Conv1D, Dropout, inferred, kernel · Report a mismatch
  4. [4] § Materials and methods › Data description › Referencing and normalization ↔ artifact_identification/preprocessing.py, lines 1 to 45 · score 0.79 · DC offsets, RobustScaler, global normalization, deep learning, preprocessing, filtering · Report a mismatch
  5. [5] § Materials and methods › Performance analysis › Prevalence-adjusted metrics ↔ artifact_identification/detectors/eye_movement.py, lines 232 to 366 · score 0.70 · precision recall curve, target prevalence, PR AUC, metrics · Report a mismatch
  6. [6] § Materials and methods › Performance analysis › Prevalence-adjusted metrics ↔ artifact_identification/detectors/muscle.py, lines 286 to 423 · score 0.70 · precision recall curve, target prevalence, PR AUC, metrics · Report a mismatch
  7. [7] § Materials and methods › Performance analysis › Prevalence-adjusted metrics ↔ artifact_identification/detectors/eye_movement.py, lines 232 to 366 · score 0.70 · partial ROC AUC, target prevalence, FPR limit, metrics · Report a mismatch
  8. [8] § Materials and methods › Performance analysis › Prevalence-adjusted metrics ↔ artifact_identification/detectors/muscle.py, lines 286 to 423 · score 0.70 · partial ROC AUC, target prevalence, FPR limit, metrics · Report a mismatch
  9. [9] § Materials and methods › Data description › Data preprocessing ↔ artifact_identification/preprocessing.py, lines 1 to 45 · score 0.70 · variable sampling rates, channel configurations, deep learning, artifact detection, 250 Hz, preprocessing · Report a mismatch
  10. [10] § Materials and methods › Data description › Data preprocessing ↔ artifact_identification/__init__.py, the whole file · a weak match · score 0.69 · focal loss, model training, EEG artifact detection, network, convolution, eye movement · Report a mismatch
  11. [11] § Materials and methods › Data description › Data preprocessing ↔ artifact_identification/data_preparation.py, lines 1 to 36 · score 0.68 · focal loss parameters, model training, EEG artifact detection, preparation, eye movement, muscle artifact · Report a mismatch
  12. [12] § CRediT authorship contribution statement ↔ artifact_identification/__init__.py, the whole file · a weak match · score 0.65 · Evans Nyanney, Shyam Visweswaran, Zhaohui Geng, Parthasarathy, Thirumala · Report a mismatch
  13. [13] § CRediT authorship contribution statement ↔ artifact_identification/data_preparation.py, lines 1 to 36 · score 0.65 · Evans Nyanney, Shyam Visweswaran, Zhaohui Geng, Parthasarathy, Thirumala · Report a mismatch
  14. [14] § Materials and methods › Data description › Adaptive segmentation and labeling ↔ artifact_identification/preprocessing.py, lines 48 to 94 · score 0.51 · EYEM, MUSC, ELEC, ELPP, SHIV, chewing · 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 · 517 lines · 20 KB · MIT · 4 matches

  1. #!/usr/bin/env python3
  2. """
  3. EEG Preprocessing Pipeline for Deep Lightweight CNN (DLCNN)
  4. A comprehensive pipeline for preprocessing EEG data for deep learning-based artifact detection.
  5. Handles variable sampling rates, channel configurations, and implements standardized steps
  6. for optimal model performance.
  7. Key Features:
  8. - Standardizes sampling rates (250, 256, 400, 512, 1000 Hz)
  9. - Creates bipolar montage and standardizes to 22 canonical channels
  10. - Applies filtering, referencing, and DC offset removal
  11. - Extracts non-overlapping 1s time windows with artifact labeling
  12. - Implements patient-level data splitting to prevent leakage
  13. - Global normalization using RobustScaler for consistent preprocessing
  14. Authors: Evans Nyanney, Parthasarathy D Thirumala, Shyam Visweswaran, Zhaohui Geng
  15. Year: 2025
  16. License: MIT
  17. """
  18. import os
  19. import glob
  20. import logging
  21. from typing import List, Tuple, Dict, Any, Optional
  22. from collections import defaultdict
  23. from pathlib import Path
  24. import numpy as np
  25. import pandas as pd
  26. import mne
  27. from sklearn.preprocessing import RobustScaler
  28. from joblib import Parallel, delayed
  29. from sklearn.model_selection import GroupShuffleSplit
  30. import warnings
  31. warnings.filterwarnings('ignore')
  32. logging.basicConfig(
  33. level=logging.INFO,
  34. format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
  35. )
  36. logger = logging.getLogger(__name__)
  37. __all__ = ['EEGPreprocessingPipeline']
  38. class EEGPreprocessingPipeline:
  39. """
  40. EEG preprocessing pipeline for artifact detection using DLCNN.
  41. This class handles end-to-end preprocessing of EEG data:
  42. - Bipolar montage creation
  43. - Channel standardization (22 canonical channels)
  44. - Resampling, filtering, and referencing
  45. - Windowing and labeling with artifact annotations
  46. - Patient-level train/val/test splitting
  47. - Global normalization for deep learning
  48. Attributes:
  49. target_sampling_rate: Target sampling rate in Hz.
  50. target_channels: Target number of channels.
  51. window_size: Window duration in seconds.
  52. overlap: Fractional overlap between windows.
  53. min_artifact_duration: Minimum duration for valid artifacts.
  54. include_clean_windows: Whether to include clean segments.
  55. clean_label: Label assigned to clean windows.
  56. """
  57. CONFIG = {
  58. 'canonical_channels': [
  59. 'FP1-F7', 'F7-T3', 'T3-T5', 'T5-O1',
  60. 'FP2-F8', 'F8-T4', 'T4-T6', 'T6-O2',
  61. 'A1-T3', 'T3-C3', 'C3-CZ', 'CZ-C4',
  62. 'C4-T4', 'T4-A2',
  63. 'FP1-F3', 'F3-C3', 'C3-P3', 'P3-O1',
  64. 'FP2-F4', 'F4-C4', 'C4-P4', 'P4-O2'
  65. ],
  66. 'bipolar_pairs': [
  67. ('FP1', 'F7'), ('F7', 'T3'), ('T3', 'T5'), ('T5', 'O1'),
  68. ('FP2', 'F8'), ('F8', 'T4'), ('T4', 'T6'), ('T6', 'O2'),
  69. ('A1', 'T3'), ('T3', 'C3'), ('C3', 'CZ'), ('CZ', 'C4'),
  70. ('C4', 'T4'), ('T4', 'A2'),
  71. ('FP1', 'F3'), ('F3', 'C3'), ('C3', 'P3'), ('P3', 'O1'),
  72. ('FP2', 'F4'), ('F4', 'C4'), ('C4', 'P4'), ('P4', 'O2')
  73. ],
  74. 'artifact_mapping': {
  75. 'eyem': 0, 'musc': 1, 'elec': 2, 'chew': 3, 'shiv': 4, 'elpp': 5,
  76. 'eyem_musc': 0, 'eyem_elec': 0, 'musc_elec': 1,
  77. 'eyem_chew': 0, 'chew_musc': 3, 'chew_elec': 3,
  78. 'eyem_shiv': 0, 'shiv_elec': 4,
  79. 'bckg': -1, 'cpsz': -1, 'fnsz': -1, 'gnsz': -1, 'tcsz': -1,
  80. }
  81. }
  82. def __init__(
  83. self,
  84. target_sampling_rate: int = 250,
  85. target_channels: int = 22,
  86. window_size: float = 1.0,
  87. overlap: float = 0.0,
  88. min_artifact_duration: float = 0.1,
  89. include_clean_windows: bool = True,
  90. clean_label: int = 6,
  91. verbose: bool = True,
  92. use_logging: bool = True
  93. ) -> None:
  94. self.target_sampling_rate = target_sampling_rate
  95. self.target_channels = target_channels
  96. self.window_size = window_size
  97. self.overlap = overlap
  98. self.min_artifact_duration = min_artifact_duration
  99. self.include_clean_windows = include_clean_windows
  100. self.clean_label = clean_label
  101. self.verbose = verbose
  102. self.use_logging = use_logging
  103. self.window_samples = int(window_size * target_sampling_rate)
  104. self.step_samples = int(self.window_samples * (1 - overlap))
  105. if use_logging:
  106. self.logger = logging.getLogger(self.__class__.__name__)
  107. self.logger.setLevel(logging.INFO if verbose else logging.WARNING)
  108. else:
  109. self.logger = None
  110. seen: set = set()
  111. self.canonical_channels = [
  112. ch for ch in self.CONFIG['canonical_channels'] if not (ch in seen or seen.add(ch))
  113. ]
  114. self.artifact_mapping = self.CONFIG['artifact_mapping']
  115. self.scaler: Optional[RobustScaler] = None
  116. self.missing_channels_count = 0
  117. self.zero_window_files = 0
  118. def create_bipolar_montage(self, raw: mne.io.Raw) -> mne.io.Raw:
  119. """Create bipolar montage from raw EEG channels."""
  120. clean_ch_names = {}
  121. for ch in raw.ch_names:
  122. if ch.startswith('EEG ') and ch.endswith('-REF'):
  123. clean_ch_names[ch] = ch[4:-4].upper()
  124. else:
  125. clean_ch_names[ch] = ch.upper()
  126. raw.rename_channels(clean_ch_names)
  127. available = set(raw.ch_names)
  128. bipolar_channels = []
  129. for anode, cathode in self.CONFIG['bipolar_pairs']:
  130. if anode in available and cathode in available:
  131. bipolar_channels.append((anode, cathode, f'{anode}-{cathode}'))
  132. if not bipolar_channels:
  133. if self.logger:
  134. self.logger.warning("No valid bipolar pairs found; using original channels.")
  135. return raw
  136. result = mne.set_bipolar_reference(
  137. raw,
  138. anode=[p[0] for p in bipolar_channels],
  139. cathode=[p[1] for p in bipolar_channels],
  140. ch_name=[p[2] for p in bipolar_channels],
  141. verbose=False
  142. )
  143. return result[0] if isinstance(result, tuple) else result
  144. def load_and_validate_file(
  145. self, edf_path: str, csv_path: str
  146. ) -> Tuple[Optional[mne.io.Raw], Optional[pd.DataFrame]]:
  147. """Load and validate EDF and CSV files."""
  148. if csv_path.endswith('_seiz.csv'):
  149. if self.logger:
  150. self.logger.info(f"Skipping seizure file: {csv_path}")
  151. return None, None
  152. try:
  153. raw = mne.io.read_raw_edf(edf_path, preload=True, verbose=False)
  154. annotations = pd.read_csv(csv_path, comment='#')
  155. required_cols = {'start_time', 'stop_time', 'label'}
  156. if not required_cols.issubset(annotations.columns):
  157. raise ValueError(f"Missing columns in {csv_path}")
  158. annotations['label'] = annotations['label'].str.lower()
  159. edf_duration = raw.times[-1]
  160. if annotations['stop_time'].max() > edf_duration + 1.0:
  161. if self.logger:
  162. self.logger.warning(f"Annotations exceed EDF duration in {csv_path}")
  163. if len(annotations) == 0:
  164. if self.logger:
  165. self.logger.warning(f"No annotations in {csv_path}")
  166. return None, None
  167. valid_artifacts = annotations[annotations['label'].isin(self.artifact_mapping)]
  168. if len(valid_artifacts) == 0:
  169. if self.logger:
  170. self.logger.warning(f"No valid artifacts in {csv_path}")
  171. return None, None
  172. return raw, annotations
  173. except Exception as e:
  174. if self.logger:
  175. self.logger.error(f"Error loading {edf_path}: {e}")
  176. return None, None
  177. def resample_eeg(self, raw: mne.io.Raw) -> mne.io.Raw:
  178. """Resample EEG to target sampling rate."""
  179. if raw.info['sfreq'] != self.target_sampling_rate:
  180. if self.logger:
  181. self.logger.info(
  182. f"Resampling from {raw.info['sfreq']} Hz to {self.target_sampling_rate} Hz"
  183. )
  184. raw.resample(self.target_sampling_rate, verbose=False)
  185. return raw
  186. def standardize_channels(self, raw: mne.io.Raw) -> mne.io.Raw:
  187. """Standardize channels to canonical 22-channel bipolar montage."""
  188. raw.rename_channels(lambda x: x.replace('EEG ', '').replace('-REF', '').upper())
  189. has_bipolar = all('-' in ch and not ch.endswith('-REF') for ch in raw.ch_names)
  190. if not has_bipolar:
  191. raw = self.create_bipolar_montage(raw)
  192. current_names = [ch.upper() for ch in raw.ch_names]
  193. available_channels = []
  194. for canonical in self.canonical_channels:
  195. if canonical in current_names:
  196. idx = current_names.index(canonical)
  197. available_channels.append(raw.ch_names[idx])
  198. n_pick = min(len(available_channels), self.target_channels)
  199. if n_pick > 0:
  200. selected = available_channels[:n_pick]
  201. raw.pick_channels(selected, ordered=True, verbose=False)
  202. data, times = raw[:, :]
  203. else:
  204. raw.pick_channels(raw.ch_names[:min(5, len(raw.ch_names))], verbose=False)
  205. data, times = raw[:, :]
  206. selected = raw.ch_names[:len(data)]
  207. if data.shape[0] < self.target_channels:
  208. n_pad = self.target_channels - data.shape[0]
  209. padding = np.zeros((n_pad, data.shape[1]))
  210. combined_data = np.vstack([data, padding])
  211. new_ch_names = selected + [f'PAD_{i}' for i in range(n_pad)]
  212. else:
  213. combined_data = data
  214. new_ch_names = selected[:self.target_channels]
  215. assert combined_data.shape[0] == len(new_ch_names) == self.target_channels
  216. new_info = mne.create_info(new_ch_names, self.target_sampling_rate, ch_types='eeg')
  217. return mne.io.RawArray(combined_data, new_info, verbose=False)
  218. def apply_preprocessing(self, raw: mne.io.Raw) -> mne.io.Raw:
  219. """Apply bandpass (1-40 Hz), notch (50/60 Hz), average reference, and DC removal."""
  220. if self.logger:
  221. self.logger.info("Applying bandpass (1-40 Hz) and notch (50/60 Hz) filters...")
  222. raw.filter(1, 40, verbose=False)
  223. raw.notch_filter([50, 60], verbose=False)
  224. if self.logger:
  225. self.logger.info("Setting average reference and removing DC offset...")
  226. raw.set_eeg_reference('average', verbose=False)
  227. data, times = raw[:, :]
  228. data = data - np.mean(data, axis=1, keepdims=True)
  229. info = mne.create_info(raw.ch_names, self.target_sampling_rate, ch_types='eeg')
  230. return mne.io.RawArray(data, info, verbose=False)
  231. def get_window_label(
  232. self, annotations: pd.DataFrame, start_time: float, end_time: float
  233. ) -> Optional[int]:
  234. """Determine the dominant artifact label in a time window."""
  235. overlapping = annotations[
  236. (annotations['start_time'] <= end_time) &
  237. (annotations['stop_time'] >= start_time)
  238. ]
  239. valid_artifacts = []
  240. for _, row in overlapping.iterrows():
  241. if row['label'] in self.artifact_mapping:
  242. duration = row['stop_time'] - row['start_time']
  243. if duration >= self.min_artifact_duration:
  244. valid_artifacts.append(row)
  245. if not valid_artifacts:
  246. return None
  247. artifact_counts: Dict[int, int] = defaultdict(int)
  248. for row in valid_artifacts:
  249. label = self.artifact_mapping[row['label']]
  250. if label >= 0:
  251. artifact_counts[label] += 1
  252. return max(artifact_counts.items(), key=lambda x: x[1])[0] if artifact_counts else None
  253. def create_time_windows(
  254. self, raw: mne.io.Raw, annotations: pd.DataFrame
  255. ) -> List[Tuple[np.ndarray, int]]:
  256. """Extract non-overlapping time windows with labels."""
  257. data, times = raw[:, :]
  258. data = data.T
  259. windows = []
  260. for start_idx in range(0, len(data) - self.window_samples + 1, self.step_samples):
  261. end_idx = start_idx + self.window_samples
  262. start_time = times[start_idx]
  263. end_time = times[end_idx - 1]
  264. window_data = data[start_idx:end_idx, :]
  265. label = self.get_window_label(annotations, start_time, end_time)
  266. if label is not None:
  267. windows.append((window_data, label))
  268. elif self.include_clean_windows:
  269. windows.append((window_data, self.clean_label))
  270. return windows
  271. def process_single_file(self, edf_path: str, csv_path: str) -> List[Tuple[np.ndarray, int]]:
  272. """Process a single EDF+CSV pair."""
  273. if self.logger:
  274. self.logger.info(f"Processing {Path(edf_path).name}...")
  275. raw, annotations = self.load_and_validate_file(edf_path, csv_path)
  276. if raw is None:
  277. return []
  278. raw = self.resample_eeg(raw)
  279. raw = self.standardize_channels(raw)
  280. raw = self.apply_preprocessing(raw)
  281. windows = self.create_time_windows(raw, annotations)
  282. if len(windows) == 0:
  283. self.zero_window_files += 1
  284. if self.logger:
  285. self.logger.warning(f"No windows extracted from {Path(edf_path).name}")
  286. if self.logger:
  287. self.logger.info(f"Extracted {len(windows)} windows")
  288. return windows
  289. def process_dataset(
  290. self,
  291. edf_dir: str = 'edf/01_tcp_ar',
  292. max_files: Optional[int] = None,
  293. n_jobs: int = 1
  294. ) -> Dict[str, Any]:
  295. """Process all EDF+CSV file pairs in the directory."""
  296. if self.logger:
  297. self.logger.info(f"Processing dataset from {edf_dir}...")
  298. self.missing_channels_count = 0
  299. self.zero_window_files = 0
  300. edf_files = glob.glob(os.path.join(edf_dir, "*.edf"))
  301. if max_files:
  302. edf_files = edf_files[:max_files]
  303. file_pairs = []
  304. for edf_file in edf_files:
  305. base = os.path.splitext(edf_file)[0]
  306. csv_file = base + ".csv"
  307. if os.path.exists(csv_file) and not csv_file.endswith('_seiz.csv'):
  308. file_pairs.append((edf_file, csv_file))
  309. if self.logger:
  310. self.logger.info(f"Found {len(file_pairs)} valid file pairs")
  311. if n_jobs > 1:
  312. if self.logger:
  313. self.logger.info(f"Processing with {n_jobs} parallel jobs...")
  314. results = Parallel(n_jobs=n_jobs)(
  315. delayed(self.process_single_file)(edf, csv) for edf, csv in file_pairs
  316. )
  317. else:
  318. results = []
  319. for i, (edf, csv) in enumerate(file_pairs):
  320. if (i + 1) % 20 == 0 and self.logger:
  321. self.logger.info(f"Processed {i + 1}/{len(file_pairs)} files...")
  322. results.append(self.process_single_file(edf, csv))
  323. all_windows: List[Tuple[np.ndarray, int]] = []
  324. all_sources: List[str] = []
  325. class_counts: Dict[int, int] = defaultdict(int)
  326. file_stats = []
  327. for i, windows in enumerate(results):
  328. for _, label in windows:
  329. class_counts[label] += 1
  330. file_stats.append({
  331. 'file': Path(file_pairs[i][0]).name,
  332. 'windows': len(windows),
  333. 'classes': list(set(w[1] for w in windows))
  334. })
  335. all_windows.extend(windows)
  336. src_id = Path(file_pairs[i][0]).stem
  337. all_sources.extend([src_id] * len(windows))
  338. if self.logger:
  339. self.logger.info(f"Processing Summary:")
  340. self.logger.info(f" Files with missing canonical channels: {self.missing_channels_count}")
  341. self.logger.info(f" Files with zero windows: {self.zero_window_files}")
  342. return {
  343. 'windows': all_windows,
  344. 'window_sources': all_sources,
  345. 'class_counts': dict(class_counts),
  346. 'file_stats': file_stats,
  347. 'total_files': len(edf_files),
  348. 'processed_files': len(file_stats),
  349. 'total_windows': len(all_windows),
  350. 'missing_channels_count': self.missing_channels_count,
  351. 'zero_window_files': self.zero_window_files
  352. }
  353. def prepare_training_data(self, results: Dict[str, Any]) -> Dict[str, Any]:
  354. """Prepare data for DLCNN training with patient-level splitting."""
  355. if self.logger:
  356. self.logger.info("Preparing training data for DLCNN...")
  357. data_list = [w[0] for w in results['windows']]
  358. labels = [w[1] for w in results['windows']]
  359. X = np.array(data_list, dtype=np.float32)
  360. y = np.array(labels, dtype=np.int32)
  361. if self.logger:
  362. self.logger.info(f"Data shape: {X.shape}")
  363. self.logger.info("Applying RobustScaler normalization...")
  364. flat = X.reshape(-1, X.shape[2])
  365. self.scaler = RobustScaler().fit(flat)
  366. X_norm = self.scaler.transform(flat).reshape(X.shape)
  367. groups = np.array(results['window_sources'])
  368. indices = np.arange(len(y))
  369. gss1 = GroupShuffleSplit(n_splits=1, test_size=0.2, random_state=42)
  370. train_val_idx, test_idx = next(gss1.split(indices, y, groups=groups))
  371. gss2 = GroupShuffleSplit(n_splits=1, test_size=0.25, random_state=42)
  372. tv_idx = indices[train_val_idx]
  373. tv_groups = groups[train_val_idx]
  374. tv_y = y[train_val_idx]
  375. train_rel, val_rel = next(gss2.split(tv_idx, tv_y, groups=tv_groups))
  376. train_idx = tv_idx[train_rel]
  377. val_idx = tv_idx[val_rel]
  378. return {
  379. 'X_train_3d': X_norm[train_idx],
  380. 'X_val_3d': X_norm[val_idx],
  381. 'X_test_3d': X_norm[test_idx],
  382. 'y_train': y[train_idx],
  383. 'y_val': y[val_idx],
  384. 'y_test': y[test_idx],
  385. 'idx_train': train_idx,
  386. 'idx_val': val_idx,
  387. 'idx_test': test_idx,
  388. 'X_all_3d': X_norm,
  389. 'y_all': y,
  390. 'original_shape': X.shape,
  391. 'n_classes': len(np.unique(y))
  392. }
  393. def save_data(
  394. self, data_dict: Dict[str, Any], results: Dict[str, Any], output_path: str = '.'
  395. ) -> None:
  396. """Save preprocessed data and metadata."""
  397. if self.logger:
  398. self.logger.info(f"Saving data to {output_path}...")
  399. os.makedirs(output_path, exist_ok=True)
  400. for key in ['X_train_3d', 'X_val_3d', 'X_test_3d', 'X_all_3d']:
  401. if key in data_dict:
  402. np.save(os.path.join(output_path, f"{key}.npy"), data_dict[key])
  403. if self.logger:
  404. self.logger.info(f"Saved {key}.npy")
  405. for key in ['y_train', 'y_val', 'y_test', 'y_all']:
  406. if key in data_dict:
  407. df = pd.DataFrame({key: data_dict[key]})
  408. df.to_csv(os.path.join(output_path, f"{key}.csv"), index=False)
  409. if self.logger:
  410. self.logger.info(f"Saved {key}.csv")
  411. pd.DataFrame(results['file_stats']).to_csv(
  412. os.path.join(output_path, 'file_statistics.csv'), index=False
  413. )
  414. pd.DataFrame(
  415. list(results['class_counts'].items()), columns=['class', 'count']
  416. ).to_csv(os.path.join(output_path, 'class_distribution.csv'), index=False)
  417. summary = {
  418. k: results[k] for k in [
  419. 'total_files', 'processed_files', 'total_windows',
  420. 'missing_channels_count', 'zero_window_files'
  421. ]
  422. }
  423. pd.DataFrame([summary]).to_csv(
  424. os.path.join(output_path, 'processing_summary.csv'), index=False
  425. )
  426. from joblib import dump
  427. dump(self.scaler, os.path.join(output_path, 'robust_scaler.joblib'))
  428. np.savez_compressed(
  429. os.path.join(output_path, 'split_indices.npz'),
  430. idx_train=data_dict['idx_train'],
  431. idx_val=data_dict['idx_val'],
  432. idx_test=data_dict['idx_test']
  433. )
  434. if self.logger:
  435. self.logger.info("Preprocessing completed and data saved.")

preprocessing.py at commit 5d0e234, under MIT · at the source

Overview

  1. Ohio University, Department of Industrial and Systems Engineering, 1 Ohio University Drive, 276 Stocker Center, Athens, 45701, OH, USA
  2. University of Pittsburgh, Department of Neurological Surgery, 3550 Terrace Street, Pittsburgh, 15261, PA, USA
  3. University of Pittsburgh, Department of Biomedical Informatics, 5607 Baum Boulevard, Pittsburgh, 15232, PA, USA
Institutions: Ohio University (United States); University of Pittsburgh (United States)
Journal: Clinical neurophysiology practice, volume 11, pages 208-215
Dates: received 12 November 2025; accepted 20 March 2026; published online 24 March 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1016/j.cnp.2026.03.005 · PMID 41953081 · PMCID PMC13054435 · OpenAlex W7140193811
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: EEG (modality), human (organism), clinical / translational (subfield)
Methods: Spectral & time-frequency, Preprocessing, Connectivity, Machine learning, Statistics, Physiology & signal measures
Keywords: Continuous EEG, Artifact detection, Deep learning, Convolutional neural network, Clinical neurophysiology, Signal processing
Topic: EEG and Brain-Computer Interfaces (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 27 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 14 matches between paragraphs and lines of code.

evansnyanney/EEG-Artifact-Detection-DLCNN

License: MIT
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: 5d0e234c4fa22be602101f270353e1ca57b962aa, 14 June 2026
Languages: Python (30)
Size: 59 files, 30 scripts
Software Heritage: not archived
Found in: “Code and data availability”
Holds: README, license file, environment (pyproject.toml, requirements.txt), tests, documentation
Not found: CITATION.cff, continuous integration
Tools: NumPy (11 files), scikit-learn (7 files), TensorFlow (6 files), MNE-Python (4 files), Keras (3 files), Matplotlib (3 files), pandas (3 files), seaborn (3 files), SciPy (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
32 files

Zenodo 19554507

License: MIT
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: DataCite
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (11 files), scikit-learn (7 files), TensorFlow (6 files), MNE-Python (4 files), Keras (3 files), Matplotlib (3 files), pandas (3 files), seaborn (3 files), SciPy (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
  • 30 September 2026: the link answers (HTTP 200)
32 files

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:

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

Code and data availability statement

The paper has a code and 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.1016/j.cnp.2026.03.005.

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

Recorded: type, language, journal, volume, pages, dates, 4 authors, 6 keywords, 21 references.

Cite

This paper

Nyanney, E., Thirumala, P. D., Visweswaran, S., & Geng, Z. (2026). A lightweight deep convolutional neural network for detecting artifacts in continuous EEG signals. Clinical neurophysiology practice, 11, 208-215. https://doi.org/10.1016/j.cnp.2026.03.005

BibTeX

@article{nyanney2026lightweight,
author = {Nyanney, Evans and Thirumala, Parthasarathy D and Visweswaran, Shyam and Geng, Zhaohui},
title = {{A lightweight deep convolutional neural network for detecting artifacts in continuous EEG signals}},
journal = {Clinical neurophysiology practice},
year = {2026},
month = mar,
volume = {11},
pages = {208--215},
publisher = {Elsevier},
issn = {2467-981X},
doi = {10.1016/j.cnp.2026.03.005},
url = {https://doi.org/10.1016/j.cnp.2026.03.005},
pmid = {41953081},
pmcid = {PMC13054435}
}

RIS

TY - JOUR
AU - Nyanney, Evans
AU - Thirumala, Parthasarathy D
AU - Visweswaran, Shyam
AU - Geng, Zhaohui
TI - A lightweight deep convolutional neural network for detecting artifacts in continuous EEG signals
T2 - Clinical neurophysiology practice
J2 - Clin Neurophysiol Pract
PY - 2026
DA - 2026/03/24
VL - 11
SP - 208
EP - 215
SN - 2467-981X
PB - Elsevier
DO - 10.1016/j.cnp.2026.03.005
UR - https://doi.org/10.1016/j.cnp.2026.03.005
LA - en
ER -

CSL-JSON

{
"id": "10.1016/j.cnp.2026.03.005",
"type": "article-journal",
"title": "A lightweight deep convolutional neural network for detecting artifacts in continuous EEG signals",
"container-title": "Clinical neurophysiology practice",
"author": [
{
"family": "Nyanney",
"given": "Evans"
},
{
"family": "Thirumala",
"given": "Parthasarathy D"
},
{
"family": "Visweswaran",
"given": "Shyam"
},
{
"family": "Geng",
"given": "Zhaohui"
}
],
"container-title-short": "Clin Neurophysiol Pract",
"volume": "11",
"page": "208-215",
"DOI": "10.1016/j.cnp.2026.03.005",
"PMID": "41953081",
"PMCID": "PMC13054435",
"ISSN": "2467-981X",
"publisher": "Elsevier",
"URL": "https://doi.org/10.1016/j.cnp.2026.03.005",
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
24
]
]
}
}

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.1186/s40708-024-00239-6 [code]
Advancing EEG prediction with deep learning and uncertainty estimation.
Journal: Brain informatics
In common: MNE-Python, Keras, TensorFlow, 6 other tools, EEG, 2 references
[2] doi:10.1038/s41598-025-18479-9 [code]
Epileptic seizure detection from electroencephalogram signals based on 1D CNN-LSTM deep learning model using discrete wavelet transform.
Journal: Scientific reports
In common: MNE-Python, Keras, TensorFlow, 5 other tools, EEG, 2 references
[3] doi:10.1002/hbm.26417 [code]
Sex-related patterns in the electroencephalogram and their relevance in machine learning classifiers.
Journal: Human brain mapping
In common: MNE-Python, Keras, TensorFlow, 6 other tools, EEG, 1 reference
[4] doi:10.1097/js9.0000000000003143 [code]
Multimodal deep learning to predict postoperative major adverse cardiac and cerebrovascular events after noncardiac surgery.
Journal: International journal of surgery (London, England)
In common: Keras, TensorFlow, seaborn, 5 other tools, clinical / translational, 2 references
[5] doi:10.1038/s42003-025-08464-3 [code]
How EEG preprocessing shapes decoding performance.
Journal: Communications biology
In common: MNE-Python, seaborn, scikit-learn, 4 other tools, EEG, 3 references
[6] doi:10.1523/eneuro.0160-22.2022 [code]
Improved Manual Annotation of EEG Signals through Convolutional Neural Network Guidance.
Journal: eNeuro
In common: MNE-Python, scikit-learn, pandas, 3 other tools, EEG, 3 references
[7] doi:10.1038/s41597-022-01524-x [code]
EPIC: Annotated epileptic EEG independent components for artifact reduction.
Journal: Scientific data
In common: Keras, TensorFlow, NumPy, EEG, 4 references
[8] doi:10.1038/s41597-026-07120-7 [code]
PhysioMotion Artifact: A task-driven EEG dataset with point-wise motion artifact annotations.
Journal: Scientific data
In common: MNE-Python, scikit-learn, pandas, 2 other tools, EEG, 3 references
[9] doi:10.3390/s25010231 [code]
DHCT-GAN: Improving EEG Signal Quality with a Dual-Branch Hybrid CNN-Transformer Network.
Journal: Sensors (Basel, Switzerland)
In common: Keras, TensorFlow, scikit-learn, 3 other tools, EEG, 2 references
[10] doi:10.1371/journal.pcbi.1010863 [code]
maxATAC: Genome-scale transcription-factor binding prediction from ATAC-seq with deep neural networks.
Journal: PLoS computational biology
In common: Keras, TensorFlow, seaborn, 5 other tools, 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.

Add the badge to the code's README

OSCR: the badge of this paper

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 -->
[![OSCR](https://openscicode.org/badge/doi/10.1016/j.cnp.2026.03.005.svg)](https://openscicode.org/badge/doi/10.1016/j.cnp.2026.03.005)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1016/j.cnp.2026.03.005.svg
   :target: https://openscicode.org/badge/doi/10.1016/j.cnp.2026.03.005
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1016/j.cnp.2026.03.005"><img src="https://openscicode.org/badge/doi/10.1016/j.cnp.2026.03.005.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.