Commit 60c5d95b authored by Gamage B.G.J's avatar Gamage B.G.J

Merge branch 'IT20005276' into 'master'

It20005276

See merge request !23
parents b8e51d59 18295706
{"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": [null, 48, 48, 1], "dtype": "float32", "sparse": false, "ragged": false, "name": "conv2d_input"}}, {"class_name": "Conv2D", "config": {"name": "conv2d", "trainable": true, "batch_input_shape": [null, 48, 48, 1], "dtype": "float32", "filters": 32, "kernel_size": [3, 3], "strides": [1, 1], "padding": "valid", "data_format": "channels_last", "dilation_rate": [1, 1], "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Conv2D", "config": {"name": "conv2d_1", "trainable": true, "dtype": "float32", "filters": 64, "kernel_size": [3, 3], "strides": [1, 1], "padding": "valid", "data_format": "channels_last", "dilation_rate": [1, 1], "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d", "trainable": true, "dtype": "float32", "pool_size": [2, 2], "padding": "valid", "strides": [2, 2], "data_format": "channels_last"}}, {"class_name": "Dropout", "config": {"name": "dropout", "trainable": true, "dtype": "float32", "rate": 0.25, "noise_shape": null, "seed": null}}, {"class_name": "Conv2D", "config": {"name": "conv2d_2", "trainable": true, "dtype": "float32", "filters": 128, "kernel_size": [3, 3], "strides": [1, 1], "padding": "valid", "data_format": "channels_last", "dilation_rate": [1, 1], "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_1", "trainable": true, "dtype": "float32", "pool_size": [2, 2], "padding": "valid", "strides": [2, 2], "data_format": "channels_last"}}, {"class_name": "Conv2D", "config": {"name": "conv2d_3", "trainable": true, "dtype": "float32", "filters": 128, "kernel_size": [3, 3], "strides": [1, 1], "padding": "valid", "data_format": "channels_last", "dilation_rate": [1, 1], "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_2", "trainable": true, "dtype": "float32", "pool_size": [2, 2], "padding": "valid", "strides": [2, 2], "data_format": "channels_last"}}, {"class_name": "Dropout", "config": {"name": "dropout_1", "trainable": true, "dtype": "float32", "rate": 0.25, "noise_shape": null, "seed": null}}, {"class_name": "Flatten", "config": {"name": "flatten", "trainable": true, "dtype": "float32", "data_format": "channels_last"}}, {"class_name": "Dense", "config": {"name": "dense", "trainable": true, "dtype": "float32", "units": 1024, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dropout", "config": {"name": "dropout_2", "trainable": true, "dtype": "float32", "rate": 0.5, "noise_shape": null, "seed": null}}, {"class_name": "Dense", "config": {"name": "dense_1", "trainable": true, "dtype": "float32", "units": 7, "activation": "softmax", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}, "keras_version": "2.4.0", "backend": "tensorflow"}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -37,23 +37,263 @@
2023-08-03 06:00:41,626 - INFO - Error.
2023-08-03 06:00:41,626 - INFO - Error.
2023-08-03 06:00:41,626 - INFO - Error.
2023-08-30 22:39:49,234 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/2023-08-14 21.51.mov'
2023-08-30 22:39:49,234 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/2023-08-14 21.51.mov'
2023-08-30 22:39:49,234 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/2023-08-14 21.51.mov'
2023-08-30 22:39:49,259 - INFO - Error.
2023-08-30 22:39:49,259 - INFO - Error.
2023-08-30 22:39:49,259 - INFO - Error.
2023-08-30 22:40:09,426 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/2023-08-14 21.51.mov'
2023-08-30 22:40:09,426 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/2023-08-14 21.51.mov'
2023-08-30 22:40:09,426 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/2023-08-14 21.51.mov'
2023-08-30 22:40:09,427 - INFO - Error.
2023-08-30 22:40:09,427 - INFO - Error.
2023-08-30 22:40:09,427 - INFO - Error.
2023-09-02 18:07:23,625 - INFO - Failed to make predictions. 'NoneType' object has no attribute 'predict'
2023-09-02 18:07:23,625 - INFO - Failed to make predictions. 'NoneType' object has no attribute 'predict'
2023-09-02 18:07:23,625 - INFO - Failed to make predictions. 'NoneType' object has no attribute 'predict'
2023-09-02 18:07:23,625 - INFO - Failed to make predictions. 'NoneType' object has no attribute 'predict'
2023-09-02 18:07:23,627 - INFO - Error.
2023-09-02 18:07:23,627 - INFO - Error.
2023-09-02 18:07:23,627 - INFO - Error.
2023-09-02 18:07:23,627 - INFO - Error.
2023-09-02 15:24:16,102 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/E6.mp4'
2023-09-02 15:24:16,102 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/E6.mp4'
2023-09-02 15:24:16,102 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/E6.mp4'
2023-09-02 15:24:16,553 - INFO - Error.
2023-09-02 15:24:16,553 - INFO - Error.
2023-09-02 15:24:16,553 - INFO - Error.
2023-09-02 15:24:53,767 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/E6.mp4'
2023-09-02 15:24:53,767 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/E6.mp4'
2023-09-02 15:24:53,767 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/E6.mp4'
2023-09-02 15:24:53,768 - INFO - Error.
2023-09-02 15:24:53,768 - INFO - Error.
2023-09-02 15:24:53,768 - INFO - Error.
2023-09-02 15:25:37,381 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/Y2Mate.is - React Native Tutorial for Beginners - Build a React Native App-0-S5a0eXPoc-360p-1657268484983.mp4'
2023-09-02 15:25:37,381 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/Y2Mate.is - React Native Tutorial for Beginners - Build a React Native App-0-S5a0eXPoc-360p-1657268484983.mp4'
2023-09-02 15:25:37,381 - INFO - Failed to make predictions. [Errno 2] No such file or directory: 'files/Y2Mate.is - React Native Tutorial for Beginners - Build a React Native App-0-S5a0eXPoc-360p-1657268484983.mp4'
2023-09-02 15:25:37,384 - INFO - Error.
2023-09-02 15:25:37,384 - INFO - Error.
2023-09-02 15:25:37,384 - INFO - Error.
2023-09-02 18:55:18,412 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/videoplayback.mp4'
2023-09-02 18:55:18,412 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/videoplayback.mp4'
2023-09-02 18:55:18,412 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/videoplayback.mp4'
2023-09-03 03:00:21,346 - INFO - Error. name 'audio_request' is not defined
2023-09-03 03:00:21,346 - INFO - Error. name 'audio_request' is not defined
2023-09-03 03:00:21,346 - INFO - Error. name 'audio_request' is not defined
2023-09-03 03:00:21,346 - INFO - Error. name 'audio_request' is not defined
2023-09-03 03:00:21,346 - INFO - Error. name 'audio_request' is not defined
2023-09-03 04:43:22,666 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:43:22,666 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:43:22,666 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:43:22,666 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:43:22,666 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:43:22,669 - INFO - Error.
2023-09-03 04:43:22,669 - INFO - Error.
2023-09-03 04:43:22,669 - INFO - Error.
2023-09-03 04:43:22,669 - INFO - Error.
2023-09-03 04:43:22,669 - INFO - Error.
2023-09-03 04:49:57,058 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:49:57,058 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:49:57,058 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:49:57,058 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:49:57,058 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:49:57,059 - INFO - Error.
2023-09-03 04:49:57,059 - INFO - Error.
2023-09-03 04:49:57,059 - INFO - Error.
2023-09-03 04:49:57,059 - INFO - Error.
2023-09-03 04:49:57,059 - INFO - Error.
2023-09-03 04:55:20,430 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:55:20,430 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:55:20,430 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:55:20,430 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:55:20,430 - INFO - Failed to make predictions. type object 'dict' has no attribute 'predict'
2023-09-03 04:55:20,740 - INFO - Error.
2023-09-03 04:55:20,740 - INFO - Error.
2023-09-03 04:55:20,740 - INFO - Error.
2023-09-03 04:55:20,740 - INFO - Error.
2023-09-03 04:55:20,740 - INFO - Error.
2023-09-03 05:06:41,091 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:41,091 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:41,091 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:41,091 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:41,091 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:41,093 - INFO - Error.
2023-09-03 05:06:41,093 - INFO - Error.
2023-09-03 05:06:41,093 - INFO - Error.
2023-09-03 05:06:41,093 - INFO - Error.
2023-09-03 05:06:41,093 - INFO - Error.
2023-09-03 05:06:43,311 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:43,311 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:43,311 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:43,311 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:43,311 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:43,313 - INFO - Error.
2023-09-03 05:06:43,313 - INFO - Error.
2023-09-03 05:06:43,313 - INFO - Error.
2023-09-03 05:06:43,313 - INFO - Error.
2023-09-03 05:06:43,313 - INFO - Error.
2023-09-03 05:06:53,621 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:53,621 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:53,621 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:53,621 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:53,621 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:06:53,623 - INFO - Error.
2023-09-03 05:06:53,623 - INFO - Error.
2023-09-03 05:06:53,623 - INFO - Error.
2023-09-03 05:06:53,623 - INFO - Error.
2023-09-03 05:06:53,623 - INFO - Error.
2023-09-03 05:07:04,712 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:07:04,712 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:07:04,712 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:07:04,712 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:07:04,712 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:07:04,714 - INFO - Error.
2023-09-03 05:07:04,714 - INFO - Error.
2023-09-03 05:07:04,714 - INFO - Error.
2023-09-03 05:07:04,714 - INFO - Error.
2023-09-03 05:07:04,714 - INFO - Error.
2023-09-03 05:19:00,190 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:19:00,190 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:19:00,190 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:19:00,190 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:19:00,190 - ERROR - Failed to make predictions. 'SpooledTemporaryFile' object has no attribute 'file'
2023-09-03 05:19:00,196 - INFO - Error.
2023-09-03 05:19:00,196 - INFO - Error.
2023-09-03 05:19:00,196 - INFO - Error.
2023-09-03 05:19:00,196 - INFO - Error.
2023-09-03 05:19:00,196 - INFO - Error.
2023-09-03 11:45:44,281 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:45:44,281 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:45:44,281 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:45:44,281 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:45:44,281 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:45:44,281 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:45:44,281 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:56:04,494 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:56:04,494 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:56:04,494 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:56:04,494 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:56:04,494 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:56:04,494 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 11:56:04,494 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:01:05,183 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:01:05,183 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:01:05,183 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:01:05,183 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:01:05,183 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:01:05,183 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:01:05,183 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:02:53,354 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:02:53,354 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:02:53,354 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:02:53,354 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:02:53,354 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:02:53,354 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:02:53,354 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:10:00,371 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:10:00,371 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:10:00,371 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:10:00,371 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:10:00,371 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:10:00,371 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:10:00,371 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:11:35,221 - INFO - Failed to upload file. name 'video' is not defined
2023-09-03 12:11:35,221 - INFO - Failed to upload file. name 'video' is not defined
2023-09-03 12:11:35,221 - INFO - Failed to upload file. name 'video' is not defined
2023-09-03 12:11:35,221 - INFO - Failed to upload file. name 'video' is not defined
2023-09-03 12:11:35,221 - INFO - Failed to upload file. name 'video' is not defined
2023-09-03 12:11:35,221 - INFO - Failed to upload file. name 'video' is not defined
2023-09-03 12:11:35,221 - INFO - Failed to upload file. name 'video' is not defined
2023-09-03 12:12:45,404 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:12:45,404 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:12:45,404 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:12:45,404 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:12:45,404 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:12:45,404 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:12:45,404 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:16:23,545 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:16:23,545 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:16:23,545 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:16:23,545 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:16:23,545 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:16:23,545 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-03 12:16:23,545 - INFO - Failed to upload file. [Errno 2] No such file or directory: 'files/emotion/video/yt5s.com-Python for Beginners - Learn Python in 1 Hour(720p)_21.7.41.mp4'
2023-09-04 11:12:15,007 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 11:12:15,007 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 11:12:15,007 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 11:12:15,007 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 11:12:15,007 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 11:12:15,007 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 11:12:15,007 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:20:24,925 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:20:24,925 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:20:24,925 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:20:24,925 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:20:24,925 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:20:24,925 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:20:24,925 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:26:31,754 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:26:31,754 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:26:31,754 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:26:31,754 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:26:31,754 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:26:31,754 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:26:31,754 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:33:25,502 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:33:25,502 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:33:25,502 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:33:25,502 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:33:25,502 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:33:25,502 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:33:25,502 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:37:57,525 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:37:57,525 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:37:57,525 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:37:57,525 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:37:57,525 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:37:57,525 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:37:57,525 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:44:54,370 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:44:54,370 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:44:54,370 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:44:54,370 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:44:54,370 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:44:54,370 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 16:44:54,370 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:16:14,891 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:16:14,891 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:16:14,891 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:16:14,891 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:16:14,891 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:16:14,891 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:16:14,891 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:20:21,692 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:20:21,692 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:20:21,692 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:20:21,692 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:20:21,692 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:20:21,692 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:20:21,692 - INFO - Error. 'EmotionPredictionService' object has no attribute 'predict_emotion_detection_video_new'
2023-09-04 19:25:29,787 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() takes 1 positional argument but 2 were given
2023-09-04 19:25:29,787 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() takes 1 positional argument but 2 were given
2023-09-04 19:25:29,787 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() takes 1 positional argument but 2 were given
2023-09-04 19:25:29,787 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() takes 1 positional argument but 2 were given
2023-09-04 19:25:29,787 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() takes 1 positional argument but 2 were given
2023-09-04 19:25:29,787 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() takes 1 positional argument but 2 were given
2023-09-04 19:25:29,787 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() takes 1 positional argument but 2 were given
2023-09-04 19:28:49,829 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() got multiple values for argument 'video_request'
2023-09-04 19:28:49,829 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() got multiple values for argument 'video_request'
2023-09-04 19:28:49,829 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() got multiple values for argument 'video_request'
2023-09-04 19:28:49,829 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() got multiple values for argument 'video_request'
2023-09-04 19:28:49,829 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() got multiple values for argument 'video_request'
2023-09-04 19:28:49,829 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() got multiple values for argument 'video_request'
2023-09-04 19:28:49,829 - INFO - Error. EmotionPredictionService.predict_emotion_detection_video_new() got multiple values for argument 'video_request'
2023-09-04 19:32:58,715 - ERROR - Failed to make predictions. name 'predict_emotion_from_frame' is not defined
2023-09-04 19:32:58,715 - ERROR - Failed to make predictions. name 'predict_emotion_from_frame' is not defined
2023-09-04 19:32:58,715 - ERROR - Failed to make predictions. name 'predict_emotion_from_frame' is not defined
2023-09-04 19:32:58,715 - ERROR - Failed to make predictions. name 'predict_emotion_from_frame' is not defined
2023-09-04 19:32:58,715 - ERROR - Failed to make predictions. name 'predict_emotion_from_frame' is not defined
2023-09-04 19:32:58,715 - ERROR - Failed to make predictions. name 'predict_emotion_from_frame' is not defined
2023-09-04 19:32:58,715 - ERROR - Failed to make predictions. name 'predict_emotion_from_frame' is not defined
2023-09-04 19:32:58,726 - INFO - Error.
2023-09-04 19:32:58,726 - INFO - Error.
2023-09-04 19:32:58,726 - INFO - Error.
2023-09-04 19:32:58,726 - INFO - Error.
2023-09-04 19:32:58,726 - INFO - Error.
2023-09-04 19:32:58,726 - INFO - Error.
2023-09-04 19:32:58,726 - INFO - Error.
2023-09-04 19:46:11,286 - ERROR - Failed to make predictions. name 'cropped_img' is not defined
2023-09-04 19:46:11,286 - ERROR - Failed to make predictions. name 'cropped_img' is not defined
2023-09-04 19:46:11,286 - ERROR - Failed to make predictions. name 'cropped_img' is not defined
2023-09-04 19:46:11,286 - ERROR - Failed to make predictions. name 'cropped_img' is not defined
2023-09-04 19:46:11,286 - ERROR - Failed to make predictions. name 'cropped_img' is not defined
2023-09-04 19:46:11,286 - ERROR - Failed to make predictions. name 'cropped_img' is not defined
2023-09-04 19:46:11,286 - ERROR - Failed to make predictions. name 'cropped_img' is not defined
2023-09-04 19:46:11,290 - INFO - Error.
2023-09-04 19:46:11,290 - INFO - Error.
2023-09-04 19:46:11,290 - INFO - Error.
2023-09-04 19:46:11,290 - INFO - Error.
2023-09-04 19:46:11,290 - INFO - Error.
2023-09-04 19:46:11,290 - INFO - Error.
2023-09-04 19:46:11,290 - INFO - Error.
from fastapi import APIRouter,FastAPI, UploadFile ,File,HTTPException
from fastapi.responses import FileResponse
import os
from core.logger import setup_logger
from services.audio_detect_service import EmotionPredictionService
import tensorflow as tf
app = FastAPI()
router = APIRouter()
audio: UploadFile
logger = setup_logger()
model = tf.keras.models.load_model('../ML_Models/Emotion_Detection_Model/mymodel.h5')
prediction_service = EmotionPredictionService(model)
@router.post("/upload_emotion/audio", tags=["Emotion Detection"])
async def upload_audio(audio: UploadFile = File(...)):
try:
file_location = f"files/emotion/audio/{audio.filename}"
with open(file_location, "wb") as file:
file.write(audio.file.read())
return {"text": "OK"}
except Exception as e:
logger.info(f"Failed to upload file. {e}")
raise HTTPException(
status_code=500,
detail="Failed to upload the audio"
)
@router.post('/predict_emotion/audio', tags=["Emotion Detection"])
def predict_using_audio(audio_request: UploadFile = File(...)):
try:
return prediction_service.predict_emotion_detection_audio_new(audio_request)
except Exception as e:
logger.info(f"Error. {e}")
raise HTTPException(
status_code=500,
detail="Request Failed."
)
from fastapi import APIRouter,FastAPI, UploadFile ,File,HTTPException
from fastapi.responses import FileResponse
from keras.models import model_from_json
import os
from core.logger import setup_logger
from services.video_detection_service import EmotionPredictionService
import tensorflow as tf
import os
# Get the absolute path to the 'model' directory
model_directory = os.path.abspath('model')
# Construct the absolute path to 'emotion_model.json'
json_file_path = os.path.join(model_directory, 'emotion_model.json')
# Open the JSON file
# json_file = open(json_file_path, 'r')
app = FastAPI()
router = APIRouter()
video: UploadFile
logger = setup_logger()
# Load emotion detection model
json_file = open('../ML_Models/Emotion_Detection_Model/emotion_model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
emotion_model = model_from_json(loaded_model_json)
emotion_model.load_weights("../ML_Models/Emotion_Detection_Model/emotion_model.h5")
prediction_service = EmotionPredictionService(emotion_model)
@router.post("/upload_emotion/video", tags=["Emotion Detection"])
async def upload_video(video: UploadFile = File(...)):
try:
file_location = f"files/emotion/video/{video.filename}"
with open(file_location, "wb") as file:
file.write(video.file.read())
return {"text": "OK2"}
except Exception as e:
logger.info(f"Failed to upload file. {e}")
raise HTTPException(
status_code=500,
detail="Failed to upload the video"
)
@router.post('/predict_emotion/video', tags=["Emotion Detection"])
def predict_using_video(video_request: UploadFile = File(...)):
try:
return prediction_service.predict_emotion_detection_video_new(video_request= video_request)
return {"text": "OK5"}
except Exception as e:
logger.info(f"Error. {e}")
raise HTTPException(
status_code=500,
detail="Request Failed."
)
......@@ -3,6 +3,8 @@ from controllers import (
translate_controler,
users_controller,
video_to_sign_language_controller,
audio_detect_controler,
video_detect_controler
)
from fastapi.responses import RedirectResponse
from fastapi.middleware.cors import CORSMiddleware
......@@ -42,6 +44,8 @@ logger = setup_logger()
app.include_router(users_controller.router)
app.include_router(translate_controler.router)
app.include_router(video_to_sign_language_controller.router)
app.include_router(audio_detect_controler.router)
app.include_router(video_detect_controler.router)
# Add cores middleware
......@@ -72,4 +76,4 @@ app.add_middleware(
@app.get("/")
async def root():
url = app.docs_url or "/docs"
return RedirectResponse(url)
return RedirectResponse(url)
\ No newline at end of file
from fastapi.types import ModelNameMap
from sklearn import model_selection
import tensorflow as tf
import numpy as np
import librosa
from fastapi import HTTPException, UploadFile
from typing import Dict
import os
from core.logger import setup_logger
logger = setup_logger()
class EmotionPredictionService:
def __init__(self, model):
self.model = model
def predict_emotion_detection_audio(self,audio_request: UploadFile) -> Dict[str, str]:
try:
# Create a temporary file to save the audio
audio_location = f"files/emotion/audio/{audio_request.filename}"
with open(audio_location, "wb") as file:
file.write(audio_request.file.read())
# Load the audio data from the saved file
y, sr = librosa.load(audio_location)
mfccs = np.mean(librosa.feature.mfcc(y=y, sr=sr, n_mfcc=40).T, axis=0)
test_point = np.reshape(mfccs, newshape=(1, 40, 1))
predictions = self.model.predict(test_point)
emotions = {
1: 'neutral', 2: 'calm', 3: 'happy', 4: 'sad',
5: 'angry', 6: 'fearful', 7: 'disgust', 8: 'surprised'
}
predicted_emotion = emotions[np.argmax(predictions[0]) + 1]
return {"predicted_emotion": predicted_emotion}
except Exception as e:
logger.error(f"Failed to make predictions. {str(e)}")
raise HTTPException(
status_code=500,
detail=f"Failed to make predictions. Error: {str(e)}"
)
def predict_emotion_detection_audio_new(self, audio_request: UploadFile) -> Dict[str, str]:
try:
# Create a temporary file to save the audio
audio_location = f"files/emotion/audio/{audio_request.filename}"
with open(audio_location, "wb") as file:
file.write(audio_request.file.read())
# Load the audio data from the saved file
y, sr = librosa.load(audio_location)
mfccs = np.mean(librosa.feature.mfcc(y=y, sr=sr, n_mfcc=40).T, axis=0)
test_point = np.reshape(mfccs, newshape=(1, 40, 1))
predictions = self.model.predict(test_point)
emotions = {
1: 'neutral', 2: 'calm', 3: 'happy', 4: 'sad',
5: 'angry', 6: 'fearful', 7: 'disgust', 8: 'surprised'
}
predicted_emotion = emotions[np.argmax(predictions[0]) + 1]
return {"predicted_emotion": predicted_emotion}
except Exception as e:
logger.error(f"Failed to make predictions. {str(e)}")
raise HTTPException(
status_code=500,
detail=f"Failed to make predictions. Error: {str(e)}"
)
from fastapi import FastAPI, UploadFile, HTTPException
from typing import Dict
import cv2
import numpy as np
from keras.models import model_from_json
import os
app = FastAPI()
from core.logger import setup_logger
logger = setup_logger()
# Define the emotion labels
emotion_dict = {0: "Angry", 1: "Disgusted", 2: "Fearful", 3: "Happy", 4: "Neutral", 5: "Sad", 6: "Surprised"}
# Load the emotion detection model
json_file = open('../ML_Models/Emotion_Detection_Model/emotion_model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
emotion_model = model_from_json(loaded_model_json)
emotion_model.load_weights("../ML_Models/Emotion_Detection_Model/emotion_model.h5")
class EmotionPredictionService:
def __init__(self, model):
self.model = model
def predict_emotion_detection_video(video_request: UploadFile) -> Dict[str, str]:
try:
# Create a temporary file to save the video
video_location = f"files/emotion/video/{video_request.filename}"
with open(video_location, "wb") as file:
file.write(video_request.file.read())
# Initialize video capture
cap = cv2.VideoCapture(video_location)
if not cap.isOpened():
raise HTTPException(
status_code=400,
detail="Failed to open video file."
)
predicted_emotions = []
while True:
ret, frame = cap.read()
if not ret:
break
emotions = predict_emotion_from_frame(frame)
predicted_emotions.extend(emotions)
cap.release()
os.remove(video_location)
return {"predicted_emotions": predicted_emotions}
except Exception as e:
logger.error(f"Failed to make predictions. {str(e)}")
raise HTTPException(
status_code=500,
detail=f"Failed to make predictions. Error: {str(e)}"
)
def predict_emotion_detection_video_new(self,video_request: UploadFile) -> Dict[str, str]:
try:
# Create a temporary file to save the video
video_location = f"files/emotion/video/{video_request.filename}"
with open(video_location, "wb") as file:
file.write(video_request.file.read())
# Initialize video capture
cap = cv2.VideoCapture(video_location)
if not cap.isOpened():
raise HTTPException(
status_code=400,
detail="Failed to open video file."
)
predicted_emotions = []
while True:
ret, frame = cap.read()
if not ret:
break
emotions = predict_emotion_from_frame(frame)
predicted_emotions.extend(emotions)
cap.release()
os.remove(video_location)
return {"predicted_emotions": predicted_emotions}
except Exception as e:
logger.error(f"Failed to make predictions. {str(e)}")
raise HTTPException(
status_code=500,
detail=f"Failed to make predictions. Error: {str(e)}"
)
# Function to predict emotion from a video frame
def predict_emotion_from_frame(frame):
gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
face_detector = cv2.CascadeClassifier('../ML_Models/Emotion_Detection_Model/haarcascade_frontalface_default.xml')
num_faces = face_detector.detectMultiScale(gray_frame, scaleFactor=1.3, minNeighbors=5)
emotions = []
for (x, y, w, h) in num_faces:
roi_gray_frame = gray_frame[y:y + h, x:x + w]
cropped_img = np.expand_dims(np.expand_dims(cv2.resize(roi_gray_frame, (48, 48)), -1), 0)
emotion_prediction = emotion_model.predict(cropped_img)
maxindex = int(np.argmax(emotion_prediction))
emotions.append(emotion_dict[maxindex])
return emotions
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