Spaces:
Build error
Build error
Delete label_encoder.joblib
Browse files- label_encoder.joblib +0 -44
label_encoder.joblib
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
# save_assets.py
|
| 2 |
-
import joblib
|
| 3 |
-
from sklearn.preprocessing import LabelEncoder
|
| 4 |
-
import os
|
| 5 |
-
|
| 6 |
-
# 1. Create and save label encoder
|
| 7 |
-
def create_label_encoder(dataset_path):
|
| 8 |
-
label_encoder = LabelEncoder()
|
| 9 |
-
|
| 10 |
-
# Get user folders (classes)
|
| 11 |
-
user_folders = [d for d in os.listdir(dataset_path)
|
| 12 |
-
if os.path.isdir(os.path.join(dataset_path, d))]
|
| 13 |
-
|
| 14 |
-
# Fit the encoder
|
| 15 |
-
label_encoder.fit(user_folders)
|
| 16 |
-
|
| 17 |
-
# Save it
|
| 18 |
-
joblib.dump(label_encoder, "label_encoder.joblib")
|
| 19 |
-
print(f"Label encoder saved with classes: {label_encoder.classes_}")
|
| 20 |
-
|
| 21 |
-
# 2. Create and save feature parameters
|
| 22 |
-
def create_feature_params():
|
| 23 |
-
feature_params = {
|
| 24 |
-
'max_pad_len': 174, # From your extract_features()
|
| 25 |
-
'sample_rate': 22050,
|
| 26 |
-
'n_mfcc': 40, # From your MFCC extraction
|
| 27 |
-
'augmentation_config': {
|
| 28 |
-
'add_noise': True,
|
| 29 |
-
'time_shift': True,
|
| 30 |
-
'pitch_shift': True,
|
| 31 |
-
'time_stretch': True,
|
| 32 |
-
'volume_change': True,
|
| 33 |
-
'background_noise': True,
|
| 34 |
-
'freq_mask': True,
|
| 35 |
-
'time_mask': True
|
| 36 |
-
}
|
| 37 |
-
}
|
| 38 |
-
joblib.dump(feature_params, "feature_params.joblib")
|
| 39 |
-
print("Feature parameters saved.")
|
| 40 |
-
|
| 41 |
-
if __name__ == "__main__":
|
| 42 |
-
dataset_path = "path/to/your/dataset" # Update this
|
| 43 |
-
create_label_encoder(dataset_path)
|
| 44 |
-
create_feature_params()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|