xttmp 2.3.0.7__tar.gz → 2.3.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xttmp-2.3.0.7/src/xttmp.egg-info → xttmp-2.3.0.8}/PKG-INFO +1 -1
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/pyproject.toml +1 -1
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/math_operator.py +10 -15
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/model/feedback_model.py +7 -11
- {xttmp-2.3.0.7 → xttmp-2.3.0.8/src/xttmp.egg-info}/PKG-INFO +1 -1
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/LICENSE +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/README.md +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/setup.cfg +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/__init__.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/api/__init__.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/api/evaluate.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/api/get_visualize_handle.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/api/instancing_model.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/__init__.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/apgstmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/apgstmdv2_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/base_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/dstmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/estmd_backbone.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/estmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/feedbackstmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/fracstmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/fstmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/fstmdv2_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/haarstmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/stfeedbackstmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/stmdplus_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/stmdplusv2_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/core/vstmd_core.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/demo/evaluate_model.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/demo/inference_gui.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/demo/inference_gui_single_process.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/demo/inference_image_stream.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/demo/inference_video.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/main.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/model/__init__.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/model/backbone.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/model/facilitated_model.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/model/haarstmd.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/model/vstmd.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/util/__init__.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/util/compute_module.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/util/create_kernel.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/util/evaluate_module.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/util/iostream.py +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp/util/stmd.ico +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp.egg-info/SOURCES.txt +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp.egg-info/dependency_links.txt +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp.egg-info/entry_points.txt +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp.egg-info/requires.txt +0 -0
- {xttmp-2.3.0.7 → xttmp-2.3.0.8}/src/xttmp.egg-info/top_level.txt +0 -0
|
@@ -114,31 +114,30 @@ class GammaDelay(BaseCore):
|
|
|
114
114
|
Implements a gamma filter used in the lamina layer of the ESTMD neural network
|
|
115
115
|
using pure PyTorch and collections.deque for efficient temporal sliding windows.
|
|
116
116
|
"""
|
|
117
|
-
def __init__(self, order=1, tau=1.0
|
|
117
|
+
def __init__(self, order=1, tau=1.0):
|
|
118
118
|
"""
|
|
119
119
|
Constructor method.
|
|
120
120
|
|
|
121
121
|
Parameters:
|
|
122
122
|
order (int): Order of the gamma filter (n). Default is 1.
|
|
123
123
|
tau (float): Time constant of the filter (\tau).
|
|
124
|
-
kernel_len (int): Length of the filter kernel (T).
|
|
125
124
|
"""
|
|
126
125
|
super().__init__()
|
|
127
126
|
self.order = max(1, int(order))
|
|
128
127
|
self.tau = tau
|
|
129
|
-
|
|
130
|
-
self.kernel_len = int(3 * tau) if kernel_len is None else kernel_len
|
|
128
|
+
|
|
131
129
|
|
|
132
130
|
self.setup()
|
|
133
131
|
|
|
134
132
|
def setup(self):
|
|
133
|
+
_kernel_len = int(3 * self.tau)
|
|
135
134
|
# 1. 预计算 Gamma 滤波器的时域权重
|
|
136
|
-
kernel = create_gamma_kernel(self.order, self.tau,
|
|
135
|
+
kernel = create_gamma_kernel(self.order, self.tau, _kernel_len)
|
|
137
136
|
# 注册为 buffer,随模型自动转移设备 (如 .cuda())
|
|
138
137
|
self.register_buffer('gamma_kernel', kernel)
|
|
139
138
|
|
|
140
139
|
# 2. 初始化双端队列作为时序状态缓存区
|
|
141
|
-
self.buffer = deque(maxlen=
|
|
140
|
+
self.buffer = deque(maxlen=_kernel_len)
|
|
142
141
|
|
|
143
142
|
def reset_buffer(self):
|
|
144
143
|
"""
|
|
@@ -179,15 +178,13 @@ class GammaBandPassFilter(BaseCore):
|
|
|
179
178
|
|
|
180
179
|
def __init__(self,
|
|
181
180
|
order1=2, tau1=3.0,
|
|
182
|
-
order2=6, tau2=9.0
|
|
183
|
-
kernel_len=None):
|
|
181
|
+
order2=6, tau2=9.0):
|
|
184
182
|
"""
|
|
185
183
|
Constructor method.
|
|
186
184
|
|
|
187
185
|
Parameters:
|
|
188
186
|
- order1, tau1: Parameters for the excitatory (positive) Gamma filter.
|
|
189
187
|
- order2, tau2: Parameters for the inhibitory (negative) Gamma filter.
|
|
190
|
-
- kernel_len: Temporal length of the filter. If None, auto-calculated.
|
|
191
188
|
"""
|
|
192
189
|
super().__init__()
|
|
193
190
|
|
|
@@ -196,17 +193,15 @@ class GammaBandPassFilter(BaseCore):
|
|
|
196
193
|
self.order2 = max(1, int(order2))
|
|
197
194
|
self.tau2 = tau2
|
|
198
195
|
|
|
199
|
-
# 自动计算所需的历史帧缓存最大长度
|
|
200
|
-
self.kernel_len = kernel_len if kernel_len is not None else max(int(3 * tau1), int(3 * tau2))
|
|
201
|
-
|
|
202
196
|
self.in_loop = False # 默认不覆盖历史帧,直接追加
|
|
203
197
|
|
|
204
198
|
self.setup()
|
|
205
199
|
|
|
206
200
|
def setup(self):
|
|
201
|
+
_kernel_len = max(int(3 * self.tau1), int(3 * self.tau2))
|
|
207
202
|
# 1. 预计算两个 Gamma 滤波器的权重,并补齐到相同的长度 self.T
|
|
208
|
-
k1 = create_gamma_kernel(self.order1, self.tau1,
|
|
209
|
-
k2 = create_gamma_kernel(self.order2, self.tau2,
|
|
203
|
+
k1 = create_gamma_kernel(self.order1, self.tau1, _kernel_len)
|
|
204
|
+
k2 = create_gamma_kernel(self.order2, self.tau2, _kernel_len)
|
|
210
205
|
|
|
211
206
|
# 2. 算子融合 (Operator Fusion):W_bandpass = W1 - W2
|
|
212
207
|
# 直接将差值注册为模型的 buffer,前向传播只需计算一次
|
|
@@ -214,7 +209,7 @@ class GammaBandPassFilter(BaseCore):
|
|
|
214
209
|
self.register_buffer('bandpass_kernel', bandpass_kernel)
|
|
215
210
|
|
|
216
211
|
# 3. 初始化单一的高效时序状态缓存区
|
|
217
|
-
self.buffer = deque(maxlen=
|
|
212
|
+
self.buffer = deque(maxlen=_kernel_len)
|
|
218
213
|
|
|
219
214
|
def reset_buffer(self):
|
|
220
215
|
"""
|
|
@@ -41,8 +41,8 @@ class FeedbackSTMD(ESTMDBackbone):
|
|
|
41
41
|
# lamina
|
|
42
42
|
'n1' : 'lamina.order1', # Eq. (3)
|
|
43
43
|
'tau1' : 'lamina.tau1',
|
|
44
|
-
'n2' : 'lamina.
|
|
45
|
-
'tau2' : 'lamina.
|
|
44
|
+
'n2' : 'lamina.order2',
|
|
45
|
+
'tau2' : 'lamina.tau2',
|
|
46
46
|
# medulla
|
|
47
47
|
'n3' : ('medulla.tm1.order', 'medulla.mi1.order'), # Eq. (7)
|
|
48
48
|
'tau3' : ('medulla.tm1.tau', 'medulla.mi1.tau'),
|
|
@@ -70,15 +70,11 @@ class FeedbackSTMD(ESTMDBackbone):
|
|
|
70
70
|
# Customize Lobula component
|
|
71
71
|
self.lobula = feedbackstmd_core.Lobula()
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
self.
|
|
78
|
-
|
|
79
|
-
# Customize Medulla's Tm1 component properties
|
|
80
|
-
self.medulla.tm1.order = 9
|
|
81
|
-
self.medulla.tm1.tau = 45
|
|
73
|
+
self.set_para(n1=4, tau1=8,
|
|
74
|
+
n2=16, tau2=32,
|
|
75
|
+
n3=9, tau3=45)
|
|
76
|
+
|
|
77
|
+
self.setup()
|
|
82
78
|
|
|
83
79
|
def forward(self, x):
|
|
84
80
|
""" MODEL_STRUCTURE Method
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|