diff --git a/src/controller/__pycache__/general_controller.cpython-38.pyc b/src/controller/__pycache__/general_controller.cpython-38.pyc index 2623481..f13adf3 100644 Binary files a/src/controller/__pycache__/general_controller.cpython-38.pyc and b/src/controller/__pycache__/general_controller.cpython-38.pyc differ diff --git a/src/controller/__pycache__/prediction_controller.cpython-38.pyc b/src/controller/__pycache__/prediction_controller.cpython-38.pyc index 6f02c03..290ad6e 100644 Binary files a/src/controller/__pycache__/prediction_controller.cpython-38.pyc and b/src/controller/__pycache__/prediction_controller.cpython-38.pyc differ diff --git a/src/controller/general_controller.py b/src/controller/general_controller.py index 2c8c4ae..1fbee31 100644 --- a/src/controller/general_controller.py +++ b/src/controller/general_controller.py @@ -9,41 +9,6 @@ import copy api = Namespace('general', path='/', description='general information related to app') -# @api.route('/get-breed-info') -# class BreedList(Resource): -# @api.doc('get breed information from csv') -# def get(self): -# """ -# return the breed information, which gets from wikipedia -# :return: list of breed information -# """ -# breed_info = {} -# for animal_type in CONSTANTS['ANIMAL_TYPE']: -# with open('wikiFile/' + animal_type + '.csv') as csv_file: -# csv_reader = csv.reader(csv_file, delimiter=',') -# line_count = 0 -# json_title = [] -# animal_list = [] -# for row in csv_reader: -# if line_count == 0: -# json_title = row -# line_count += 1 -# else: -# info_obj = { -# json_title[0]: row[0], -# json_title[1]: row[1], -# json_title[2]: row[2], -# json_title[3]: row[3], -# json_title[4]: row[4], -# } -# animal_list.append(info_obj) -# line_count += 1 -# csv_file.close() -# breed_info[animal_type] = animal_list - -# return send_json_response(breed_info, 200) - - @api.route('/get-app-info') class AppInfo(Resource): @api.doc('return the app developer information') diff --git a/src/deepface/DeepFaceLite.py b/src/deepface/DeepFaceLite.py index ce78975..3d0c3ff 100644 --- a/src/deepface/DeepFaceLite.py +++ b/src/deepface/DeepFaceLite.py @@ -60,19 +60,24 @@ class DeepFaceLite(object): sum_of_predictions = emotion_predictions.sum() - all_emotions = {} + all_emotions = [] for j in range(0, len(emotion_labels)): emotion_label = emotion_labels[j] emotion_prediction = 100 * emotion_predictions[j] / sum_of_predictions - all_emotions[emotion_label] = emotion_prediction + # all_emotions[emotion_label] = '{:.4f}'.format(emotion_prediction) + max_score = 100 * np.max(emotion_predictions) / sum_of_predictions + + all_emotions.append('{}: {:.4f}'.format(emotion_label, emotion_prediction)) emotion = { 'all': all_emotions, 'dominant': emotion_labels[np.argmax(emotion_predictions)], - 'dominant_score': np.max(emotion_predictions) + 'dominant_score': '{:.4f}'.format(max_score) } + print(emotion) + # --- age --- age_predictions = self.age_model.predict(imgs_224[i])[0,:] apparent_age = Age.findApparentAge(age_predictions) @@ -88,7 +93,8 @@ class DeepFaceLite(object): # resp_obj = json.loads(resp_obj) resp_obj = { - 'age': apparent_age, + 'id': i, + 'age': np.round(apparent_age), 'gender': gender, 'emotion': emotion } diff --git a/src/deepface/__pycache__/DeepFaceLite.cpython-38.pyc b/src/deepface/__pycache__/DeepFaceLite.cpython-38.pyc index 145ab70..12dad7d 100644 Binary files a/src/deepface/__pycache__/DeepFaceLite.cpython-38.pyc and b/src/deepface/__pycache__/DeepFaceLite.cpython-38.pyc differ diff --git a/src/deepface_lite.ipynb b/src/deepface_lite.ipynb index 2f8f055..d6e11c2 100644 --- a/src/deepface_lite.ipynb +++ b/src/deepface_lite.ipynb @@ -40,10 +40,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 3, "outputs": [], "source": [ - "im = Image.open(imgs[0])\n", + "im = Image.open(imgs[1])\n", "# im.show()" ], "metadata": { @@ -55,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 4, "outputs": [], "source": [ "deepface = DeepFaceLite()" @@ -69,17 +69,15 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "metadata": { - "tags": [ - "outputPrepend" - ] + "tags": [] }, "outputs": [ { "output_type": "stream", "name": "stdout", - "text": "low.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x152fa7ca0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x152b31430> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x152b31430> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:10 out of the last 12 calls to <function Model.make_predict_function.<locals>.predict_function at 0x152b31430> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x153537670> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1525614c0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1525614c0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1525614c0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x15351d280> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1537ed1f0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1533f8b80> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1533f8b80> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:10 out of the last 12 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1533f8b80> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x153d7c790> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x15383e3a0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x15383e3a0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:10 out of the last 12 calls to <function Model.make_predict_function.<locals>.predict_function at 0x15383e3a0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1541c0790> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x153d7c160> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x153d7c160> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x153d7c160> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:8 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1543510d0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:8 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x154351ee0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:8 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x154399ca0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 12 calls to <function Model.make_predict_function.<locals>.predict_function at 0x1542f9f70> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:9 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x15383e8b0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\n" + "text": "WARNING:tensorflow:5 out of the last 10 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14e9df040> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\n0\nWARNING:tensorflow:6 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14e3b3430> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:6 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14e3b3430> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:6 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14e3b3430> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:7 out of the last 16 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14eb3bd30> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:7 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14eb3b8b0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:7 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14e9dfca0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\n{'all': {'angry': '0.0000', 'disgust': '0.0000', 'fear': '0.0000', 'happy': '0.0000', 'sad': '0.0000', 'surprise': '0.0000', 'neutral': '100.0000'}, 'dominant': 'neutral', 'dominant_score': '100.0000'}\nWARNING:tensorflow:7 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14eb758b0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\nWARNING:tensorflow:7 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x14ebf55e0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.\n" } ], "source": [ @@ -88,16 +86,16 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { - "text/plain": "[{'age': 30.7075993044274,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 0.06512477993965149,\n 'disgust': 6.7842829132303e-07,\n 'fear': 1.709260232746601,\n 'happy': 96.76294326782227,\n 'sad': 0.15622316859662533,\n 'surprise': 0.004155550777795725,\n 'neutral': 1.3022944331169128},\n 'dominant': 'happy',\n 'dominant_score': 0.96762943}},\n {'age': 26.767930865363326,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 5.277312623955668e-07,\n 'disgust': 1.187022442278122e-16,\n 'fear': 3.87036667650891e-06,\n 'happy': 99.98644590539385,\n 'sad': 0.0006582994171507187,\n 'surprise': 0.0004150258933820861,\n 'neutral': 0.012470538754734247},\n 'dominant': 'happy',\n 'dominant_score': 0.9998646}},\n {'age': 32.83087182831849,\n 'gender': 'Woman',\n 'emotion': {'all': {'angry': 5.924798493660467e-17,\n 'disgust': 2.8012250014011216e-35,\n 'fear': 2.5669633820345634e-19,\n 'happy': 99.99052286148071,\n 'sad': 5.5502548552887276e-15,\n 'surprise': 4.5748366032938304e-10,\n 'neutral': 0.009481033339397982},\n 'dominant': 'happy',\n 'dominant_score': 0.9999052}},\n {'age': 23.797269748967757,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 2.014957210169301e-08,\n 'disgust': 1.4977098088557938e-22,\n 'fear': 1.4982995172865604e-13,\n 'happy': 99.97287988501071,\n 'sad': 2.770427553063583e-11,\n 'surprise': 1.3885342488821505e-09,\n 'neutral': 0.02712251896582657},\n 'dominant': 'happy',\n 'dominant_score': 0.99972874}},\n {'age': 24.393267559334838,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 2.516199693047838e-06,\n 'disgust': 4.153522671557008e-14,\n 'fear': 1.7720998002346278e-07,\n 'happy': 99.90577101707458,\n 'sad': 8.373182008858393e-09,\n 'surprise': 0.0014167230801831465,\n 'neutral': 0.09281422244384885},\n 'dominant': 'happy',\n 'dominant_score': 0.9990577}},\n {'age': 24.043515765118595,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 3.060047870579233e-14,\n 'disgust': 4.820702791899682e-32,\n 'fear': 2.730741222681364e-22,\n 'happy': 100.0,\n 'sad': 8.458075567249855e-18,\n 'surprise': 1.5083737731577966e-16,\n 'neutral': 1.637165403245433e-08},\n 'dominant': 'happy',\n 'dominant_score': 1.0}},\n {'age': 26.059357802833954,\n 'gender': 'Woman',\n 'emotion': {'all': {'angry': 2.206428399362248e-10,\n 'disgust': 3.020534017268343e-17,\n 'fear': 4.0115764138000994e-13,\n 'happy': 99.56392049789429,\n 'sad': 1.6978233263742482e-07,\n 'surprise': 2.148198147144953e-08,\n 'neutral': 0.43608020059764385},\n 'dominant': 'happy',\n 'dominant_score': 0.9956392}},\n {'age': 28.582532340085052,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 1.4657273847992167e-14,\n 'disgust': 3.884353069460525e-23,\n 'fear': 2.3620467654580146e-21,\n 'happy': 99.99973773956299,\n 'sad': 4.371422386399704e-11,\n 'surprise': 6.279944093195153e-14,\n 'neutral': 0.0002616236315589049},\n 'dominant': 'happy',\n 'dominant_score': 0.9999974}},\n {'age': 33.15181962717794,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 0.0005804318680376881,\n 'disgust': 1.5282411664450355e-09,\n 'fear': 4.49397240672534e-08,\n 'happy': 99.45535060497228,\n 'sad': 0.014507297010595919,\n 'surprise': 4.529519043923959e-09,\n 'neutral': 0.5295606180018555},\n 'dominant': 'happy',\n 'dominant_score': 0.99455345}},\n {'age': 24.973316125330875,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 1.0479751511027757e-07,\n 'disgust': 3.158302499252698e-17,\n 'fear': 8.899390252503636e-09,\n 'happy': 99.97872710227966,\n 'sad': 2.67038746670778e-07,\n 'surprise': 9.554952315471432e-10,\n 'neutral': 0.021272928279358894},\n 'dominant': 'happy',\n 'dominant_score': 0.9997873}},\n {'age': 29.062780761673267,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 6.818367918881574e-10,\n 'disgust': 1.0034776457889713e-20,\n 'fear': 1.8157855774525444e-08,\n 'happy': 100.0,\n 'sad': 2.5700747953438796e-10,\n 'surprise': 4.366894756913098e-06,\n 'neutral': 5.087406884651813e-09},\n 'dominant': 'happy',\n 'dominant_score': 1.0}},\n {'age': 29.64669995951802,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 6.7188082744309595e-15,\n 'disgust': 1.7538130760053728e-26,\n 'fear': 1.2517986581115512e-17,\n 'happy': 99.83847141265869,\n 'sad': 2.9362746517661064e-13,\n 'surprise': 2.2689903775297005e-09,\n 'neutral': 0.16152729513123631},\n 'dominant': 'happy',\n 'dominant_score': 0.9983847}},\n {'age': 35.83046389021009,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 2.6497252337791303e-16,\n 'disgust': 3.0136605102381477e-25,\n 'fear': 1.6340595552331688e-19,\n 'happy': 99.99663829803467,\n 'sad': 7.615165008995062e-11,\n 'surprise': 1.2639162264621633e-14,\n 'neutral': 0.003362429197295569},\n 'dominant': 'happy',\n 'dominant_score': 0.9999664}},\n {'age': 31.814163574056245,\n 'gender': 'Woman',\n 'emotion': {'all': {'angry': 4.494366250690218e-10,\n 'disgust': 8.417488787272204e-18,\n 'fear': 3.603830846617877e-14,\n 'happy': 99.00215268135071,\n 'sad': 3.2365238961107323e-09,\n 'surprise': 8.50359516135768e-07,\n 'neutral': 0.9978472255170345},\n 'dominant': 'happy',\n 'dominant_score': 0.9900215}},\n {'age': 32.5989310960335,\n 'gender': 'Woman',\n 'emotion': {'all': {'angry': 3.1245277297778515e-19,\n 'disgust': 1.2937012401507033e-36,\n 'fear': 2.2782449858426532e-30,\n 'happy': 99.9996364116452,\n 'sad': 7.895841427225173e-16,\n 'surprise': 1.1545087159574724e-17,\n 'neutral': 0.00036441538112042183},\n 'dominant': 'happy',\n 'dominant_score': 0.9999963}},\n {'age': 24.026988302519023,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 1.8193476255262485e-05,\n 'disgust': 5.971556267693282e-17,\n 'fear': 0.0009965600523269673,\n 'happy': 98.41691842180005,\n 'sad': 1.5820401732349498,\n 'surprise': 4.240301505225534e-10,\n 'neutral': 3.161194872220283e-05},\n 'dominant': 'happy',\n 'dominant_score': 0.9841691}},\n {'age': 30.569167771902148,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 1.6858996970533964,\n 'disgust': 0.019059079293685173,\n 'fear': 18.5241214661743,\n 'happy': 71.2277556929297,\n 'sad': 0.17017258497149765,\n 'surprise': 1.9624094024192575,\n 'neutral': 6.410582382748411},\n 'dominant': 'happy',\n 'dominant_score': 0.7122775}},\n {'age': 29.31149959101849,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 0.0333790696458891,\n 'disgust': 6.592448375392079e-10,\n 'fear': 2.2593388848690665e-05,\n 'happy': 0.002748208680714015,\n 'sad': 0.03049092774745077,\n 'surprise': 0.00048487490857951343,\n 'neutral': 99.93287324905396},\n 'dominant': 'neutral',\n 'dominant_score': 0.99932873}},\n {'age': 30.93848611997489,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 1.025754358026116e-13,\n 'disgust': 1.0377452882230766e-23,\n 'fear': 5.5629669669424425e-15,\n 'happy': 98.41204285621643,\n 'sad': 1.6239027483822e-09,\n 'surprise': 2.8596558454552223e-08,\n 'neutral': 1.5879573300480843},\n 'dominant': 'happy',\n 'dominant_score': 0.9841204}},\n {'age': 26.33239561643032,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 0.0005101358812093802,\n 'disgust': 1.1568618814660217e-09,\n 'fear': 0.01678552598594937,\n 'happy': 71.41002757429747,\n 'sad': 26.935684450187154,\n 'surprise': 2.0935702940201322e-05,\n 'neutral': 1.636966867808477},\n 'dominant': 'happy',\n 'dominant_score': 0.71410036}},\n {'age': 39.32041485268002,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 2.877078898539948e-07,\n 'disgust': 4.4046487276784636e-13,\n 'fear': 8.965399086843909e-06,\n 'happy': 99.96016622064516,\n 'sad': 0.02959908681112983,\n 'surprise': 1.2347091320742592e-08,\n 'neutral': 0.010217042527830747},\n 'dominant': 'happy',\n 'dominant_score': 0.9996018}},\n {'age': 40.37978850208853,\n 'gender': 'Woman',\n 'emotion': {'all': {'angry': 0.00047871189963188954,\n 'disgust': 1.3000094583975266e-15,\n 'fear': 44.150567054748535,\n 'happy': 55.65846562385559,\n 'sad': 0.19049039110541344,\n 'surprise': 2.4604217330193023e-06,\n 'neutral': 1.3664036568883375e-07},\n 'dominant': 'happy',\n 'dominant_score': 0.55658466}},\n {'age': 30.463646335025455,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': 99.03399359774666,\n 'disgust': 0.06636489788563277,\n 'fear': 0.7675393035215969,\n 'happy': 0.010410940226772475,\n 'sad': 0.12015095876592889,\n 'surprise': 0.00021555328816884813,\n 'neutral': 0.001325008112261036},\n 'dominant': 'angry',\n 'dominant_score': 0.99034005}}]" + "text/plain": "[{'age': 36.0,\n 'gender': 'Man',\n 'emotion': {'all': {'angry': '0.0000',\n 'disgust': '0.0000',\n 'fear': '0.0000',\n 'happy': '0.0000',\n 'sad': '0.0000',\n 'surprise': '0.0000',\n 'neutral': '100.0000'},\n 'dominant': 'neutral',\n 'dominant_score': '100.0000'}}]" }, "metadata": {}, - "execution_count": 11 + "execution_count": 6 } ], "source": [ @@ -106,7 +104,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ diff --git a/src/models/__pycache__/__init__.cpython-38.pyc b/src/models/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..d70a385 Binary files /dev/null and b/src/models/__pycache__/__init__.cpython-38.pyc differ diff --git a/src/models/__pycache__/feedback.cpython-38.pyc b/src/models/__pycache__/feedback.cpython-38.pyc new file mode 100644 index 0000000..36a4019 Binary files /dev/null and b/src/models/__pycache__/feedback.cpython-38.pyc differ diff --git a/src/models/__pycache__/prediction.cpython-38.pyc b/src/models/__pycache__/prediction.cpython-38.pyc new file mode 100644 index 0000000..ff4ef70 Binary files /dev/null and b/src/models/__pycache__/prediction.cpython-38.pyc differ diff --git a/src/templates/base.html b/src/templates/base.html index 2199960..94cb13c 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -2,7 +2,7 @@
-