Commit 42e7069c authored by NaweenTharuka's avatar NaweenTharuka

updated Audio testing file

parent 8d7ce0c8
...@@ -18,18 +18,9 @@ import time ...@@ -18,18 +18,9 @@ import time
from os import path from os import path
from pydub import AudioSegment from pydub import AudioSegment
#convert video files to .wav format
# src = input("In: ")
# dst = input("Out: ")
# src = input("F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\media\\video\\22")
# dst = input("F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\media\\audio")
# sound = AudioSegment.from_mp3(src)
# sound.export(dst, format="wav")
saved_model_path = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\models\\model8723.json" saved_model_path = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\models\\model8723.json"
saved_weights_path = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\models\\model8723_weights.h5" saved_weights_path = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\models\\model8723_weights.h5"
audio_file = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\media\\audio\\fearful.wav" audio_file = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\media\\audio\\publicspeech.wav"
with open(saved_model_path, 'r') as json_file: with open(saved_model_path, 'r') as json_file:
json_savedModel = json_file.read() json_savedModel = json_file.read()
...@@ -126,6 +117,7 @@ fig = plt.figure(figsize = (10, 2)) ...@@ -126,6 +117,7 @@ fig = plt.figure(figsize = (10, 2))
plt.bar(emo_list, pred_np, color = 'darkturquoise') plt.bar(emo_list, pred_np, color = 'darkturquoise')
plt.ylabel("Probabilty (%)") plt.ylabel("Probabilty (%)")
plt.show() plt.show()
print(emo_list, pred_np)
max_emo = np.argmax(predictions) max_emo = np.argmax(predictions)
print('max emotion:', emotions.get(max_emo,-1)) print('max emotion:', emotions.get(max_emo,-1))
...@@ -145,5 +137,6 @@ plt.bar(emo_list, total_predictions_np, color = 'indigo') ...@@ -145,5 +137,6 @@ plt.bar(emo_list, total_predictions_np, color = 'indigo')
plt.ylabel("Mean probabilty (%)") plt.ylabel("Mean probabilty (%)")
plt.title("Session Summary") plt.title("Session Summary")
plt.show() plt.show()
print(emo_list, total_predictions)
print(f"Emotions analyzed for: {(toc - tic):0.4f} seconds") print(f"Emotions analyzed for: {(toc - tic):0.4f} seconds")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment