-
Notifications
You must be signed in to change notification settings - Fork 5
/
process_file.py
26 lines (20 loc) · 690 Bytes
/
process_file.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import matplotlib.pylab as plt
from matplotlib.pyplot import figure
from inference import Inference
from model import SSCDModel
DO_SCD = True
print("Loading model")
model = SSCDModel.load_from_checkpoint("short_scd_bigdata.ckpt")
print("Creating inference object")
inf = Inference(model, scd=DO_SCD)
print("Predicting on audio")
prediction, activations = inf("test_audio_similar.wav", return_scd_points=DO_SCD)
if DO_SCD:
figure(figsize=(15, 3), dpi=80)
plt.plot(activations)
plt.title("SCD Scores per Frame")
plt.xlabel("Frame")
plt.ylabel("Aggregated Score")
plt.savefig("activations.png", bbox_inches="tight")
print("Printing prediction")
print(prediction)