bruAristimunha commited on
Commit
f0c78e2
·
verified ·
1 Parent(s): 7040b07

Replace with clean markdown card

Browse files
Files changed (1) hide show
  1. README.md +24 -125
README.md CHANGED
@@ -13,13 +13,12 @@ tags:
13
 
14
  # TSception
15
 
16
- TSception model from Ding et al. (2020) from .
17
 
18
- > **Architecture-only repository.** This repo documents the
19
  > `braindecode.models.TSception` 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,143 +37,43 @@ model = TSception(
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.TSception.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/tsinception.py#L15>
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>TSception model from Ding et al. (2020) from [ding2020]_.</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>
60
-
61
-
62
-
63
- TSception: A deep learning framework for emotion detection using EEG.
64
-
65
- .. figure:: https://user-images.githubusercontent.com/58539144/74716976-80415e00-526a-11ea-9433-02ab2b753f6b.PNG
66
- :align: center
67
- :alt: TSception Architecture
68
-
69
- The model consists of temporal and spatial convolutional layers
70
- (Tception and Sception) designed to learn temporal and spatial features
71
- from EEG data.
72
-
73
- Parameters
74
- ----------
75
- number_filter_temp : int
76
- Number of temporal convolutional filters.
77
- number_filter_spat : int
78
- Number of spatial convolutional filters.
79
- hidden_size : int
80
- Number of units in the hidden fully connected layer.
81
- drop_prob : float
82
- Dropout rate applied after the hidden layer.
83
- activation : nn.Module, optional
84
- Activation function class to apply. Should be a PyTorch activation
85
- module like ``nn.ReLU`` or ``nn.LeakyReLU``. Default is ``nn.LeakyReLU``.
86
- pool_size : int, optional
87
- Pooling size for the average pooling layers. Default is 8.
88
- inception_windows : list[float], optional
89
- List of window sizes (in seconds) for the inception modules.
90
- Default is [0.5, 0.25, 0.125].
91
-
92
- Notes
93
- -----
94
- This implementation is not guaranteed to be correct, has not been checked
95
- by original authors. The modifications are minimal and the model is expected
96
- to work as intended. the original code from [code2020]_.
97
-
98
- References
99
- ----------
100
- .. [ding2020] Ding, Y., Robinson, N., Zeng, Q., Chen, D., Wai, A. A. P.,
101
- Lee, T. S., & Guan, C. (2020, July). Tsception: a deep learning framework
102
- for emotion detection using EEG. In 2020 international joint conference
103
- on neural networks (IJCNN) (pp. 1-7). IEEE.
104
- .. [code2020] Ding, Y., Robinson, N., Zeng, Q., Chen, D., Wai, A. A. P.,
105
- Lee, T. S., & Guan, C. (2020, July). Tsception: a deep learning framework
106
- for emotion detection using EEG.
107
- https://github.com/deepBrains/TSception/blob/master/Models.py
108
-
109
- .. rubric:: Hugging Face Hub integration
110
-
111
- When the optional ``huggingface_hub`` package is installed, all models
112
- automatically gain the ability to be pushed to and loaded from the
113
- Hugging Face Hub. Install with::
114
-
115
- pip install braindecode[hub]
116
-
117
- **Pushing a model to the Hub:**
118
-
119
- .. code::
120
- from braindecode.models import TSception
121
-
122
- # Train your model
123
- model = TSception(n_chans=22, n_outputs=4, n_times=1000)
124
- # ... training code ...
125
-
126
- # Push to the Hub
127
- model.push_to_hub(
128
- repo_id="username/my-tsception-model",
129
- commit_message="Initial model upload",
130
- )
131
-
132
- **Loading a model from the Hub:**
133
-
134
- .. code::
135
- from braindecode.models import TSception
136
-
137
- # Load pretrained model
138
- model = TSception.from_pretrained("username/my-tsception-model")
139
 
140
- # Load with a different number of outputs (head is rebuilt automatically)
141
- model = TSception.from_pretrained("username/my-tsception-model", n_outputs=4)
142
 
143
- **Extracting features and replacing the head:**
144
 
145
- .. code::
146
- import torch
147
 
148
- x = torch.randn(1, model.n_chans, model.n_times)
149
- # Extract encoder features (consistent dict across all models)
150
- out = model(x, return_features=True)
151
- features = out["features"]
152
 
153
- # Replace the classification head
154
- model.reset_head(n_outputs=10)
 
 
 
 
 
 
 
155
 
156
- **Saving and restoring full configuration:**
157
 
158
- .. code::
159
- import json
160
 
161
- config = model.get_config() # all __init__ params
162
- with open("config.json", "w") as f:
163
- json.dump(config, f)
164
 
165
- model2 = TSception.from_config(config) # reconstruct (no weights)
166
-
167
- All model parameters (both EEG-specific and model-specific such as
168
- dropout rates, activation functions, number of filters) are automatically
169
- saved to the Hub and restored when loading.
170
-
171
- See :ref:`load-pretrained-models` for a complete tutorial.</main>
172
- </div>
173
 
174
  ## Citation
175
 
176
- Please cite both the original paper for this architecture (see the
177
- *References* section above) and braindecode:
178
 
179
  ```bibtex
180
  @article{aristimunha2025braindecode,
 
13
 
14
  # TSception
15
 
16
+ TSception model from Ding et al. (2020) from [ding2020].
17
 
18
+ > **Architecture-only repository.** Documents the
19
  > `braindecode.models.TSception` 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.TSception.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/tsinception.py#L15>
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ ## Architecture
 
51
 
52
+ ![TSception architecture](https://user-images.githubusercontent.com/58539144/74716976-80415e00-526a-11ea-9433-02ab2b753f6b.PNG)
53
 
 
 
54
 
55
+ ## Parameters
 
 
 
56
 
57
+ | Parameter | Type | Description |
58
+ |---|---|---|
59
+ | `number_filter_temp` | int | Number of temporal convolutional filters. |
60
+ | `number_filter_spat` | int | Number of spatial convolutional filters. |
61
+ | `hidden_size` | int | Number of units in the hidden fully connected layer. |
62
+ | `drop_prob` | float | Dropout rate applied after the hidden layer. |
63
+ | `activation` | nn.Module, optional | Activation function class to apply. Should be a PyTorch activation module like `nn.ReLU` or `nn.LeakyReLU`. Default is `nn.LeakyReLU`. |
64
+ | `pool_size` | int, optional | Pooling size for the average pooling layers. Default is 8. |
65
+ | `inception_windows` | list[float], optional | List of window sizes (in seconds) for the inception modules. Default is [0.5, 0.25, 0.125]. |
66
 
 
67
 
68
+ ## References
 
69
 
70
+ 1. Ding, Y., Robinson, N., Zeng, Q., Chen, D., Wai, A. A. P., Lee, T. S., & Guan, C. (2020, July). Tsception: a deep learning framework for emotion detection using EEG. In 2020 international joint conference on neural networks (IJCNN) (pp. 1-7). IEEE.
71
+ 2. Ding, Y., Robinson, N., Zeng, Q., Chen, D., Wai, A. A. P., Lee, T. S., & Guan, C. (2020, July). Tsception: a deep learning framework for emotion detection using EEG. https://github.com/deepBrains/TSception/blob/master/Models.py
 
72
 
 
 
 
 
 
 
 
 
73
 
74
  ## Citation
75
 
76
+ Cite the original architecture paper (see *References* above) and braindecode:
 
77
 
78
  ```bibtex
79
  @article{aristimunha2025braindecode,