Antonio
commited on
Commit
•
29104ae
1
Parent(s):
c5e4c7d
Fixed weighted average method
Browse files
app.py
CHANGED
@@ -131,8 +131,7 @@ def averaging_method(video_prediction, audio_prediction):
|
|
131 |
consensus_label = max(combined_probabilities, key=combined_probabilities.get)
|
132 |
return consensus_label
|
133 |
|
134 |
-
def weighted_average_method(video_prediction, audio_prediction):
|
135 |
-
video_weight = 0.88
|
136 |
audio_weight = 0.6
|
137 |
combined_probabilities = {}
|
138 |
for label in set(video_prediction) | set(audio_prediction):
|
@@ -222,7 +221,13 @@ def predict(video_file, video_model_name, audio_model_name, framework_name):
|
|
222 |
highest_audio_emotion = max(audio_prediction, key=audio_prediction.get)
|
223 |
|
224 |
framework_function = decision_frameworks[framework_name]
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
delete_files_in_directory(delete_directory_path)
|
228 |
|
|
|
131 |
consensus_label = max(combined_probabilities, key=combined_probabilities.get)
|
132 |
return consensus_label
|
133 |
|
134 |
+
def weighted_average_method(video_prediction, audio_prediction, video_weight):
|
|
|
135 |
audio_weight = 0.6
|
136 |
combined_probabilities = {}
|
137 |
for label in set(video_prediction) | set(audio_prediction):
|
|
|
221 |
highest_audio_emotion = max(audio_prediction, key=audio_prediction.get)
|
222 |
|
223 |
framework_function = decision_frameworks[framework_name]
|
224 |
+
|
225 |
+
if framework_function == weighted_average_method and video_model_name == "60% Accuracy":
|
226 |
+
consensus_label = framework_function(video_prediction, audio_prediction, 0.6)
|
227 |
+
elif framework_function == weighted_average_method and video_model_name == "80% Accuracy":
|
228 |
+
consensus_label = framework_function(video_prediction, audio_prediction, 0.88)
|
229 |
+
else:
|
230 |
+
consensus_label = framework_function(video_prediction, audio_prediction)
|
231 |
|
232 |
delete_files_in_directory(delete_directory_path)
|
233 |
|