bruAristimunha commited on
Commit
7e0acc1
·
verified ·
1 Parent(s): 89c7753

Replace with clean markdown card

Browse files
Files changed (1) hide show
  1. README.md +21 -105
README.md CHANGED
@@ -13,13 +13,12 @@ tags:
13
 
14
  # BDTCN
15
 
16
- Braindecode TCN from Gemein, L et al (2020) .
17
 
18
- > **Architecture-only repository.** This repo documents the
19
  > `braindecode.models.BDTCN` class. **No pretrained weights are
20
- > distributed here** instantiate the model and train it on your own
21
- > data, or fine-tune from a published foundation-model checkpoint
22
- > separately.
23
 
24
  ## Quick start
25
 
@@ -38,123 +37,40 @@ model = BDTCN(
38
  )
39
  ```
40
 
41
- The signal-shape arguments above are example defaults — adjust them
42
- to match your recording.
43
 
44
  ## Documentation
45
-
46
- - Full API reference (parameters, references, architecture figure):
47
- <https://braindecode.org/stable/generated/braindecode.models.BDTCN.html>
48
- - Interactive browser with live instantiation:
49
  <https://huggingface.co/spaces/braindecode/model-explorer>
50
  - Source on GitHub: <https://github.com/braindecode/braindecode/blob/master/braindecode/models/tcn.py#L14>
51
 
52
- ## Architecture description
53
-
54
- The block below is the rendered class docstring (parameters,
55
- references, architecture figure where available).
56
-
57
- <div class='bd-doc'><main>
58
- <p>Braindecode TCN from Gemein, L et al (2020) [gemein2020]_.</p>
59
- <span style="display:inline-block;padding:2px 8px;border-radius:4px;background:#5cb85c;color:white;font-size:11px;font-weight:600;margin-right:4px;">Convolution</span><span style="display:inline-block;padding:2px 8px;border-radius:4px;background:#6c757d;color:white;font-size:11px;font-weight:600;margin-right:4px;">Recurrent</span>
60
-
61
-
62
-
63
- .. figure:: https://ars.els-cdn.com/content/image/1-s2.0-S1053811920305073-gr3_lrg.jpg
64
- :align: center
65
- :alt: Braindecode TCN Architecture
66
-
67
- See [gemein2020]_ for details.
68
-
69
- Parameters
70
- ----------
71
- n_filters: int
72
- number of output filters of each convolution
73
- n_blocks: int
74
- number of temporal blocks in the network
75
- kernel_size: int
76
- kernel size of the convolutions
77
- drop_prob: float
78
- dropout probability
79
- activation: nn.Module, default=nn.ReLU
80
- Activation function class to apply. Should be a PyTorch activation
81
- module class like ``nn.ReLU`` or ``nn.ELU``. Default is ``nn.ReLU``.
82
-
83
- References
84
- ----------
85
- .. [gemein2020] Gemein, L. A., Schirrmeister, R. T., Chrabąszcz, P., Wilson, D.,
86
- Boedecker, J., Schulze-Bonhage, A., ... & Ball, T. (2020). Machine-learning-based
87
- diagnostics of EEG pathology. NeuroImage, 220, 117021.
88
-
89
- .. rubric:: Hugging Face Hub integration
90
-
91
- When the optional ``huggingface_hub`` package is installed, all models
92
- automatically gain the ability to be pushed to and loaded from the
93
- Hugging Face Hub. Install with::
94
-
95
- pip install braindecode[hub]
96
-
97
- **Pushing a model to the Hub:**
98
-
99
- .. code::
100
- from braindecode.models import BDTCN
101
-
102
- # Train your model
103
- model = BDTCN(n_chans=22, n_outputs=4, n_times=1000)
104
- # ... training code ...
105
-
106
- # Push to the Hub
107
- model.push_to_hub(
108
- repo_id="username/my-bdtcn-model",
109
- commit_message="Initial model upload",
110
- )
111
-
112
- **Loading a model from the Hub:**
113
-
114
- .. code::
115
- from braindecode.models import BDTCN
116
-
117
- # Load pretrained model
118
- model = BDTCN.from_pretrained("username/my-bdtcn-model")
119
-
120
- # Load with a different number of outputs (head is rebuilt automatically)
121
- model = BDTCN.from_pretrained("username/my-bdtcn-model", n_outputs=4)
122
-
123
- **Extracting features and replacing the head:**
124
 
125
- .. code::
126
- import torch
127
 
128
- x = torch.randn(1, model.n_chans, model.n_times)
129
- # Extract encoder features (consistent dict across all models)
130
- out = model(x, return_features=True)
131
- features = out["features"]
132
 
133
- # Replace the classification head
134
- model.reset_head(n_outputs=10)
135
 
136
- **Saving and restoring full configuration:**
137
 
138
- .. code::
139
- import json
 
 
 
 
 
140
 
141
- config = model.get_config() # all __init__ params
142
- with open("config.json", "w") as f:
143
- json.dump(config, f)
144
 
145
- model2 = BDTCN.from_config(config) # reconstruct (no weights)
146
 
147
- All model parameters (both EEG-specific and model-specific such as
148
- dropout rates, activation functions, number of filters) are automatically
149
- saved to the Hub and restored when loading.
150
 
151
- See :ref:`load-pretrained-models` for a complete tutorial.</main>
152
- </div>
153
 
154
  ## Citation
155
 
156
- Please cite both the original paper for this architecture (see the
157
- *References* section above) and braindecode:
158
 
159
  ```bibtex
160
  @article{aristimunha2025braindecode,
 
13
 
14
  # BDTCN
15
 
16
+ Braindecode TCN from Gemein, L et al (2020) [gemein2020].
17
 
18
+ > **Architecture-only repository.** Documents the
19
  > `braindecode.models.BDTCN` class. **No pretrained weights are
20
+ > distributed here.** Instantiate the model and train it on your own
21
+ > data.
 
22
 
23
  ## Quick start
24
 
 
37
  )
38
  ```
39
 
40
+ The signal-shape arguments above are illustrative defaults — adjust to
41
+ match your recording.
42
 
43
  ## Documentation
44
+ - Full API reference: <https://braindecode.org/stable/generated/braindecode.models.BDTCN.html>
45
+ - Interactive browser (live instantiation, parameter counts):
 
 
46
  <https://huggingface.co/spaces/braindecode/model-explorer>
47
  - Source on GitHub: <https://github.com/braindecode/braindecode/blob/master/braindecode/models/tcn.py#L14>
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ ## Architecture
 
51
 
52
+ ![BDTCN architecture](https://ars.els-cdn.com/content/image/1-s2.0-S1053811920305073-gr3_lrg.jpg)
 
 
 
53
 
 
 
54
 
55
+ ## Parameters
56
 
57
+ | Parameter | Type | Description |
58
+ |---|---|---|
59
+ | `n_filters: int` | — | number of output filters of each convolution |
60
+ | `n_blocks: int` | — | number of temporal blocks in the network |
61
+ | `kernel_size: int` | — | kernel size of the convolutions |
62
+ | `drop_prob: float` | — | dropout probability |
63
+ | `activation: nn.Module, default=nn.ReLU` | — | Activation function class to apply. Should be a PyTorch activation module class like `nn.ReLU` or `nn.ELU`. Default is `nn.ReLU`. |
64
 
 
 
 
65
 
66
+ ## References
67
 
68
+ 1. Gemein, L. A., Schirrmeister, R. T., Chrabąszcz, P., Wilson, D., Boedecker, J., Schulze-Bonhage, A., ... & Ball, T. (2020). Machine-learning-based diagnostics of EEG pathology. NeuroImage, 220, 117021.
 
 
69
 
 
 
70
 
71
  ## Citation
72
 
73
+ Cite the original architecture paper (see *References* above) and braindecode:
 
74
 
75
  ```bibtex
76
  @article{aristimunha2025braindecode,