Xianfish9 commited on
Commit
f808770
·
verified ·
1 Parent(s): db29e5c

Update Feature_extraction_algorithms/PSTAAP.py

Browse files
Feature_extraction_algorithms/PSTAAP.py CHANGED
@@ -15,21 +15,23 @@ def load_precomputed_fr_matrix(mat_file_path: str):
15
  try:
16
  mat_data = scipy.io.loadmat(mat_file_path)
17
 
18
- # --- !!! 这里是唯一的修改点 !!! ---
19
- # 将 'Fr_train' 修改为 'Fr',以匹配您的 .mat 文件
20
- matrix_key = 'Fr' # <--- 修改这里!
21
 
22
  if matrix_key not in mat_data:
23
  raise KeyError(f"在 {mat_file_path} 中未找到变量名 '{matrix_key}'。 "
24
  f"文件中可用的变量有: {list(mat_data.keys())}")
25
 
26
  _cached_fr_matrix = mat_data[matrix_key]
27
-
28
  _expected_length_after_processing = _cached_fr_matrix.shape[1] + 2
29
 
30
  print(f"Fr 矩阵加载并缓存成功。形状: {_cached_fr_matrix.shape}")
31
  print(f"推断出的序列期望长度 (处理后): {_expected_length_after_processing}")
32
 
 
 
 
 
 
33
 
34
  # --- 模块级缓存 ---
35
  # 这个变量将会在内存中存储计算好的Fr矩阵,避免重复计算和文件IO。
 
15
  try:
16
  mat_data = scipy.io.loadmat(mat_file_path)
17
 
18
+ matrix_key = 'Fr' # 修改后的变量名
 
 
19
 
20
  if matrix_key not in mat_data:
21
  raise KeyError(f"在 {mat_file_path} 中未找到变量名 '{matrix_key}'。 "
22
  f"文件中可用的变量有: {list(mat_data.keys())}")
23
 
24
  _cached_fr_matrix = mat_data[matrix_key]
 
25
  _expected_length_after_processing = _cached_fr_matrix.shape[1] + 2
26
 
27
  print(f"Fr 矩阵加载并缓存成功。形状: {_cached_fr_matrix.shape}")
28
  print(f"推断出的序列期望长度 (处理后): {_expected_length_after_processing}")
29
 
30
+ except Exception as e:
31
+ print(f"❌ 加载 Fr 矩阵失败: {e}")
32
+ raise
33
+
34
+
35
 
36
  # --- 模块级缓存 ---
37
  # 这个变量将会在内存中存储计算好的Fr矩阵,避免重复计算和文件IO。