optimization on preprocessing and other classif model
Browse files- models/audio_classification__knn.pkl +3 -0
- tasks/audio.py +3 -3
models/audio_classification__knn.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a54b7efa8866a57c8b8f45ca1b6b5d04caf83d0e79fb42cfa77ca6e375e1e5d7
|
3 |
+
size 4811702
|
tasks/audio.py
CHANGED
@@ -60,12 +60,12 @@ async def evaluate_audio(request: AudioEvaluationRequest):
|
|
60 |
features = []
|
61 |
for row in dataset:
|
62 |
# Load the audio file and resample it
|
63 |
-
target_sr =
|
64 |
audio = row['audio']['array']
|
65 |
audio = librosa.resample(audio, orig_sr=12000, target_sr=target_sr)
|
66 |
|
67 |
# Extract MFCC features
|
68 |
-
mfccs = librosa.feature.mfcc(y=audio, sr=target_sr, n_mfcc=
|
69 |
mfccs_scaled = np.mean(mfccs.T, axis=0)
|
70 |
|
71 |
# Append features and labels
|
@@ -75,7 +75,7 @@ async def evaluate_audio(request: AudioEvaluationRequest):
|
|
75 |
|
76 |
X_test = preprocess(test_dataset)
|
77 |
|
78 |
-
classification_model = joblib.load("./models/
|
79 |
|
80 |
predictions = classification_model.predict(X_test)
|
81 |
true_labels = test_dataset["label"]
|
|
|
60 |
features = []
|
61 |
for row in dataset:
|
62 |
# Load the audio file and resample it
|
63 |
+
target_sr = 6000
|
64 |
audio = row['audio']['array']
|
65 |
audio = librosa.resample(audio, orig_sr=12000, target_sr=target_sr)
|
66 |
|
67 |
# Extract MFCC features
|
68 |
+
mfccs = librosa.feature.mfcc(y=audio, sr=target_sr, n_mfcc=7)
|
69 |
mfccs_scaled = np.mean(mfccs.T, axis=0)
|
70 |
|
71 |
# Append features and labels
|
|
|
75 |
|
76 |
X_test = preprocess(test_dataset)
|
77 |
|
78 |
+
classification_model = joblib.load("./models/audio_classification_knn.pkl")
|
79 |
|
80 |
predictions = classification_model.predict(X_test)
|
81 |
true_labels = test_dataset["label"]
|