FrAnKu34t23 commited on
Commit
b94cd58
·
verified ·
1 Parent(s): f8ed33a

Update new_approach/spa_ensemble.py

Browse files
Files changed (1) hide show
  1. new_approach/spa_ensemble.py +9 -2
new_approach/spa_ensemble.py CHANGED
@@ -69,8 +69,15 @@ class FeatureExtractor:
69
 
70
  @staticmethod
71
  def extract_frequency_features(img):
72
- img_np = np.array(img); gray = cv2.cvtColor(img_np, cv2.COLOR_RGB2GRAY); gray_small = cv2.resize(gray, (64, 64)); dct_coeffs = dct(dct(gray_small.T, norm='ortho').T, norm='ortho'); features = {}
73
- for i, v in enumerate(dct_coeffs.flatten()[:10]): features[f'freq_dct_{i}'] = float(v); return features
 
 
 
 
 
 
 
74
 
75
  @staticmethod
76
  def extract_statistical_features(img):
 
69
 
70
  @staticmethod
71
  def extract_frequency_features(img):
72
+ img_np = np.array(img)
73
+ gray = cv2.cvtColor(img_np, cv2.COLOR_RGB2GRAY)
74
+ gray_small = cv2.resize(gray, (64, 64))
75
+ dct_coeffs = dct(dct(gray_small.T, norm='ortho').T, norm='ortho')
76
+ features = {}
77
+ # FIX: Loop must finish before returning!
78
+ for i, v in enumerate(dct_coeffs.flatten()[:10]):
79
+ features[f'freq_dct_{i}'] = float(v)
80
+ return features
81
 
82
  @staticmethod
83
  def extract_statistical_features(img):