N Neurarch Architectures Checks Docs Open the app

Architectures / Biosignal

๐Ÿง  EEGNet

Compact CNN for EEG/BCI โ€” depthwise + separable convs make it 10ร— lighter than standard CNNs (Lawhern 2018)

Layers
16
Parameters
2.7K
Input
1 ร— 22 ร— 1000
Output
4
Verifier
Clean

Every number on this page is computed from the graph by the same functions the app runs, not written by hand.

Open EEGNet on the canvas Free, no account needed

When to pick it

Pick when channel count is low (4โ€“8) and labelled trials are scarce (<400). Strong default for motor imagery / P300 BCI on consumer headsets.

Structure

16 layers. Output shapes are propagated from the input shape, batch dimension excluded.

LayerTypeParametersOutput shape
1eeg_windowInputshape=[1, 22, 1000]1 ร— 22 ร— 1000
2temporal_convConv2DoutChannels=8, kernelSize=[1, 64], stride=18 ร— 22 ร— 1001
3normBatchNormnormalizedShape=88 ร— 22 ร— 1001
4spatial_depthwiseDepthwiseConv2DoutChannels=16, kernelSize=[22, 1], stride=116 ร— 1 ร— 1001
5normBatchNormnormalizedShape=1616 ร— 1 ร— 1001
6actELU16 ร— 1 ร— 1001
7poolAvgPool2DkernelSize=[1, 4], stride=[1, 4]16 ร— 1 ร— 250
8dropDropoutp=0.2516 ร— 1 ร— 250
9separable_convSeparableConv2DoutChannels=16, kernelSize=[1, 16], stride=116 ร— 1 ร— 251
10normBatchNormnormalizedShape=1616 ร— 1 ร— 251
11actELU16 ร— 1 ร— 251
12poolAvgPool2DkernelSize=[1, 8], stride=[1, 8]16 ร— 1 ร— 31
13dropDropoutp=0.2516 ร— 1 ร— 31
14flattenFlatten496
15classifierLinearoutFeatures=44
16logitsOutput4

What the verifier says

The same 41 structural checks that run on every edit in the app, on this graph.

No finding. Shapes propagate end to end, every divisibility condition holds, and no advisory rule fires. See the checks.

The PyTorch it exports

Generated from the graph above. First 46 lines; the app exports the whole file, plus the training loop, the data contract and a deploy bundle.

# Architecture designed with Neurarch: https://neurarch.com
# PyTorch: compatible with Python 3.8+ and torch>=1.12
# Colab: pip install torch torchvision  (usually pre-installed)

import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple

class EEGNet(nn.Module):
    def __init__(self):
        super().__init__()

        self.conv2d_1 = nn.Conv2d(1, 8, kernel_size=(1, 64), stride=1, padding=(0, 32))
        self.batchNorm_1 = nn.BatchNorm2d(8)
        self.depthwiseConv2d_1 = nn.Conv2d(8, 8*2, kernel_size=(22, 1), groups=8, bias=True)
        self.batchNorm_2 = nn.BatchNorm2d(16)
        self.elu_1 = nn.ELU(alpha=1)
        self.avgpool2d_1 = nn.AvgPool2d(kernel_size=(1, 4), stride=(1, 4), padding=0)
        self.dropout_1 = nn.Dropout(p=0.25)
        self.separableConv2d_1 = nn.Sequential(
            nn.Conv2d(16, 16, kernel_size=(1, 16), groups=16, bias=False),
            nn.Conv2d(16, 16, kernel_size=1)
        )
        self.batchNorm_3 = nn.BatchNorm2d(16)
        self.elu_2 = nn.ELU(alpha=1)
        self.avgpool2d_2 = nn.AvgPool2d(kernel_size=(1, 8), stride=(1, 8), padding=0)
        self.dropout_2 = nn.Dropout(p=0.25)
        self.linear_1 = nn.Linear(496, 4)

    def forward(self, x):
        # eeg_window shape: [1,22,1000]
        conv2d_mporal = self.conv2d_1(x)
        batch_norm_bn_1 = self.batchNorm_1(conv2d_mporal)
        depthwise_conv2d_patial = self.depthwiseConv2d_1(batch_norm_bn_1)
        batch_norm_bn_2 = self.batchNorm_2(depthwise_conv2d_patial)
        elu_elu_1 = F.elu(batch_norm_bn_2)
        avgpool2d_pool_1 = self.avgpool2d_1(elu_elu_1)
        dropout_drop_1 = self.dropout_1(avgpool2d_pool_1)
        separable_conv2d_arable = self.separableConv2d_1(dropout_drop_1)
        batch_norm_bn_3 = self.batchNorm_3(separable_conv2d_arable)
        elu_elu_2 = F.elu(batch_norm_bn_3)
        avgpool2d_pool_2 = self.avgpool2d_2(elu_elu_2)
        dropout_drop_2 = self.dropout_2(avgpool2d_pool_2)
        flatten_tten_1 = torch.flatten(dropout_drop_2, 1)
        linear_near_1 = self.linear_1(flatten_tten_1)

For agents

This architecture is machine-readable end to end. An agent can list the set, fetch this graph, edit it, and have the edit verified before any GPU time is spent.

Also in Biosignal

๐Ÿง  EEG Conformer
Conv stem + Transformer encoder โ€” SOTA for high-channel motor imagery EEG
23 layers ยท 78.6K