File size: 4,012 Bytes
6ff1e26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6a7336
6ff1e26
c6a7336
6ff1e26
c6a7336
 
6ff1e26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6a7336
 
6ff1e26
 
c6a7336
 
6ff1e26
 
 
c6a7336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ff1e26
 
 
c6a7336
6ff1e26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
license: bsd-3-clause
library_name: braindecode
pipeline_tag: feature-extraction
tags:
  - eeg
  - biosignal
  - pytorch
  - neuroscience
  - braindecode
  - convolutional
---

# EEGNet

EEGNet model from Lawhern et al (2018) [Lawhern2018].

> **Architecture-only repository.** Documents the
> `braindecode.models.EEGNet` class. **No pretrained weights are
> distributed here.** Instantiate the model and train it on your own
> data.

## Quick start

```bash
pip install braindecode
```

```python
from braindecode.models import EEGNet

model = EEGNet(
    n_chans=22,
    sfreq=250,
    input_window_seconds=4.0,
    n_outputs=4,
)
```

The signal-shape arguments above are illustrative defaults — adjust to
match your recording.

## Documentation
- Full API reference: <https://braindecode.org/stable/generated/braindecode.models.EEGNet.html>
- Interactive browser (live instantiation, parameter counts):
  <https://huggingface.co/spaces/braindecode/model-explorer>
- Source on GitHub: <https://github.com/braindecode/braindecode/blob/master/braindecode/models/eegnet.py#L22>


## Architecture

![EEGNet architecture](https://content.cld.iop.org/journals/1741-2552/15/5/056013/revision2/jneaace8cf01_hr.jpg)


## Parameters

| Parameter | Type | Description |
|---|---|---|
| `final_conv_length` | int or "auto", default="auto" | Length of the final convolution layer. If "auto", it is set based on n_times. |
| `pool_mode` | {"mean", "max"}, default="mean" | Pooling method to use in pooling layers. |
| `F1` | int, default=8 | Number of temporal filters in the first convolutional layer. |
| `D` | int, default=2 | Depth multiplier for the depthwise convolution. |
| `F2` | int or None, default=None | Number of pointwise filters in the separable convolution. Usually set to `F1 * D`. |
| `depthwise_kernel_length` | int, default=16 | Length of the depthwise convolution kernel in the separable convolution. |
| `pool1_kernel_size` | int, default=4 | Kernel size of the first pooling layer. |
| `pool2_kernel_size` | int, default=8 | Kernel size of the second pooling layer. |
| `kernel_length` | int, default=64 | Length of the temporal convolution kernel. |
| `conv_spatial_max_norm` | float, default=1 | Maximum norm constraint for the spatial (depthwise) convolution. |
| `activation` | nn.Module, default=nn.ELU | Non-linear activation function to be used in the layers. |
| `batch_norm_momentum` | float, default=0.01 | Momentum for instance normalization in batch norm layers. |
| `batch_norm_affine` | bool, default=True | If True, batch norm has learnable affine parameters. |
| `batch_norm_eps` | float, default=1e-3 | Epsilon for numeric stability in batch norm layers. |
| `drop_prob` | float, default=0.25 | Dropout probability. |
| `final_layer_with_constraint` | bool, default=False | If `False`, uses a convolution-based classification layer. If `True`, apply a flattened linear layer with constraint on the weights norm as the final classification step. |
| `norm_rate` | float, default=0.25 | Max-norm constraint value for the linear layer (used if `final_layer_conv=False`). |


## References

1. Lawhern, V. J., Solon, A. J., Waytowich, N. R., Gordon, S. M., Hung, C. P., & Lance, B. J. (2018). EEGNet: a compact convolutional neural network for EEG-based brain–computer interfaces. Journal of neural engineering, 15(5), 056013.
2. Chollet, F., *Xception: Deep Learning with Depthwise Separable Convolutions*, CVPR, 2017.


## Citation

Cite the original architecture paper (see *References* above) and braindecode:

```bibtex
@article{aristimunha2025braindecode,
  title   = {Braindecode: a deep learning library for raw electrophysiological data},
  author  = {Aristimunha, Bruno and others},
  journal = {Zenodo},
  year    = {2025},
  doi     = {10.5281/zenodo.17699192},
}
```

## License

BSD-3-Clause for the model code (matching braindecode).
Pretraining-derived weights, if you fine-tune from a checkpoint,
inherit the licence of that checkpoint and its training corpus.