debug
Browse files- .idea/workspace.xml +2 -1
- preprocess.py +6 -1
- script.py +1 -1
.idea/workspace.xml
CHANGED
|
@@ -6,6 +6,7 @@
|
|
| 6 |
<component name="ChangeListManager">
|
| 7 |
<list default="true" id="23565123-73ab-4f40-a9ef-1086e0c9e1ec" name="Changes" comment="">
|
| 8 |
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
|
|
| 9 |
<change beforePath="$PROJECT_DIR$/script.py" beforeDir="false" afterPath="$PROJECT_DIR$/script.py" afterDir="false" />
|
| 10 |
</list>
|
| 11 |
<option name="SHOW_DIALOG" value="false" />
|
|
@@ -99,7 +100,7 @@
|
|
| 99 |
<updated>1742573353560</updated>
|
| 100 |
<workItem from="1742573355153" duration="587000" />
|
| 101 |
<workItem from="1742806974298" duration="2741000" />
|
| 102 |
-
<workItem from="1742810431420" duration="
|
| 103 |
</task>
|
| 104 |
<servers />
|
| 105 |
</component>
|
|
|
|
| 6 |
<component name="ChangeListManager">
|
| 7 |
<list default="true" id="23565123-73ab-4f40-a9ef-1086e0c9e1ec" name="Changes" comment="">
|
| 8 |
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
| 9 |
+
<change beforePath="$PROJECT_DIR$/preprocess.py" beforeDir="false" afterPath="$PROJECT_DIR$/preprocess.py" afterDir="false" />
|
| 10 |
<change beforePath="$PROJECT_DIR$/script.py" beforeDir="false" afterPath="$PROJECT_DIR$/script.py" afterDir="false" />
|
| 11 |
</list>
|
| 12 |
<option name="SHOW_DIALOG" value="false" />
|
|
|
|
| 100 |
<updated>1742573353560</updated>
|
| 101 |
<workItem from="1742573355153" duration="587000" />
|
| 102 |
<workItem from="1742806974298" duration="2741000" />
|
| 103 |
+
<workItem from="1742810431420" duration="12114000" />
|
| 104 |
</task>
|
| 105 |
<servers />
|
| 106 |
</component>
|
preprocess.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
|
| 2 |
import librosa
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
import torch
|
| 5 |
|
|
@@ -16,7 +17,11 @@ def pad_audio(x, max_len=48000):
|
|
| 16 |
def preprocess(audio_file):
|
| 17 |
print(f'Preprocessing {audio_file}')
|
| 18 |
# Load the audio file
|
| 19 |
-
y, sr = librosa.load(audio_file, sr=16000)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Evaluate N windows of the audio file
|
| 22 |
num_eval = 5
|
|
|
|
| 1 |
|
| 2 |
import librosa
|
| 3 |
+
import soundfile as sf
|
| 4 |
import numpy as np
|
| 5 |
import torch
|
| 6 |
|
|
|
|
| 17 |
def preprocess(audio_file):
|
| 18 |
print(f'Preprocessing {audio_file}')
|
| 19 |
# Load the audio file
|
| 20 |
+
# y, sr = librosa.load(audio_file, sr=16000)
|
| 21 |
+
|
| 22 |
+
y, sr = sf.read(audio_file)
|
| 23 |
+
y = librosa.resample(y, orig_sr=sr, target_sr=16000)
|
| 24 |
+
sr = 16000
|
| 25 |
|
| 26 |
# Evaluate N windows of the audio file
|
| 27 |
num_eval = 5
|
script.py
CHANGED
|
@@ -94,7 +94,7 @@ for el in tqdm.tqdm(dataset_remote):
|
|
| 94 |
# # OLD MODEL
|
| 95 |
# score = model(tensor.to(device)).cpu().item()
|
| 96 |
# RAWNNET2 MODEL
|
| 97 |
-
score = model(tensor.to(device))[:,
|
| 98 |
print(f'SCORE OUT: {score}')
|
| 99 |
score = score.mean().item()
|
| 100 |
print(f'SCORE FINAL: {score}')
|
|
|
|
| 94 |
# # OLD MODEL
|
| 95 |
# score = model(tensor.to(device)).cpu().item()
|
| 96 |
# RAWNNET2 MODEL
|
| 97 |
+
score = model(tensor.to(device))[:, 1].cpu()
|
| 98 |
print(f'SCORE OUT: {score}')
|
| 99 |
score = score.mean().item()
|
| 100 |
print(f'SCORE FINAL: {score}')
|