diff --git a/Models/face_landmarks.dat b/Models/face_landmarks.dat new file mode 100644 index 0000000..e0ec20d Binary files /dev/null and b/Models/face_landmarks.dat differ diff --git a/Models/video.h5 b/Models/video.h5 new file mode 100644 index 0000000..8e0b39d Binary files /dev/null and b/Models/video.h5 differ diff --git a/Presentation/Images/Face.gif b/Presentation/Images/Face.gif new file mode 100644 index 0000000..25b308c Binary files /dev/null and b/Presentation/Images/Face.gif differ diff --git a/Presentation/P3/FilRouge.key b/Presentation/P3/FilRouge.key index ab58ade..a0a7002 100644 Binary files a/Presentation/P3/FilRouge.key and b/Presentation/P3/FilRouge.key differ diff --git a/Video/.ipynb_checkpoints/09-Prediction-checkpoint.ipynb b/Video/.ipynb_checkpoints/09-Prediction-checkpoint.ipynb index fc4590e..1e1d6f7 100644 --- a/Video/.ipynb_checkpoints/09-Prediction-checkpoint.ipynb +++ b/Video/.ipynb_checkpoints/09-Prediction-checkpoint.ipynb @@ -64,11 +64,11 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:40:16.044062Z", - "start_time": "2019-04-11T11:40:14.706497Z" + "end_time": "2019-04-12T08:02:16.987262Z", + "start_time": "2019-04-12T08:02:09.395144Z" } }, "outputs": [ @@ -76,6 +76,11 @@ "name": "stderr", "output_type": "stream", "text": [ + "/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n", + " from ._conv import register_converters as _register_converters\n", + "/anaconda3/lib/python3.6/site-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.21.1) or chardet (2.3.0) doesn't match a supported version!\n", + " RequestsDependencyWarning)\n", + "Using TensorFlow backend.\n", "/anaconda3/lib/python3.6/site-packages/ggplot/utils.py:81: FutureWarning: pandas.tslib is deprecated and will be removed in a future version.\n", "You can access Timestamp as pandas.Timestamp\n", " pd.tslib.Timestamp,\n" @@ -152,11 +157,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:00.044292Z", - "start_time": "2019-04-11T11:25:00.038288Z" + "end_time": "2019-04-12T08:02:16.994861Z", + "start_time": "2019-04-12T08:02:16.990061Z" } }, "outputs": [], @@ -167,11 +172,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:00.777127Z", - "start_time": "2019-04-11T11:25:00.281779Z" + "end_time": "2019-04-12T08:02:17.654243Z", + "start_time": "2019-04-12T08:02:16.998104Z" } }, "outputs": [], @@ -184,11 +189,11 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:00.792830Z", - "start_time": "2019-04-11T11:25:00.781075Z" + "end_time": "2019-04-12T08:02:17.671405Z", + "start_time": "2019-04-12T08:02:17.659758Z" } }, "outputs": [], @@ -201,6 +206,31 @@ "nClasses = len(classes)" ] }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": { + "ExecuteTime": { + "end_time": "2019-04-12T10:13:28.596082Z", + "start_time": "2019-04-12T10:13:28.585736Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "(48, 48, 1)" + ] + }, + "execution_count": 78, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "nRows, nCols, nDims" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -223,11 +253,11 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:01.150101Z", - "start_time": "2019-04-11T11:25:01.138374Z" + "end_time": "2019-04-12T08:02:17.684740Z", + "start_time": "2019-04-12T08:02:17.673881Z" } }, "outputs": [], @@ -258,11 +288,11 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:01.377168Z", - "start_time": "2019-04-11T11:25:01.355858Z" + "end_time": "2019-04-12T08:02:17.706127Z", + "start_time": "2019-04-12T08:02:17.689299Z" } }, "outputs": [], @@ -309,21 +339,21 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:02.613178Z", - "start_time": "2019-04-11T11:25:02.107792Z" + "end_time": "2019-04-12T08:02:18.762144Z", + "start_time": "2019-04-12T08:02:18.380019Z" } }, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 12, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" }, @@ -353,21 +383,21 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 8, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:03.406884Z", - "start_time": "2019-04-11T11:25:03.011014Z" + "end_time": "2019-04-12T08:02:19.753207Z", + "start_time": "2019-04-12T08:02:19.375728Z" } }, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 13, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" }, @@ -396,11 +426,11 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 9, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:38:29.623429Z", - "start_time": "2019-04-11T11:38:29.605230Z" + "end_time": "2019-04-12T08:02:20.095739Z", + "start_time": "2019-04-12T08:02:20.076416Z" } }, "outputs": [], @@ -439,11 +469,11 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 10, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:38:40.366050Z", - "start_time": "2019-04-11T11:38:40.353614Z" + "end_time": "2019-04-12T08:02:20.649026Z", + "start_time": "2019-04-12T08:02:20.637249Z" } }, "outputs": [], @@ -474,11 +504,11 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 11, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:38:50.594309Z", - "start_time": "2019-04-11T11:38:50.576207Z" + "end_time": "2019-04-12T08:02:21.428426Z", + "start_time": "2019-04-12T08:02:21.403582Z" } }, "outputs": [], @@ -517,11 +547,11 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 12, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:40:23.898408Z", - "start_time": "2019-04-11T11:40:20.780722Z" + "end_time": "2019-04-12T08:02:25.367196Z", + "start_time": "2019-04-12T08:02:22.181178Z" } }, "outputs": [], @@ -533,11 +563,11 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 14, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:40:40.918822Z", - "start_time": "2019-04-11T11:40:40.411765Z" + "end_time": "2019-04-12T08:02:30.654061Z", + "start_time": "2019-04-12T08:02:29.952183Z" } }, "outputs": [], @@ -547,52 +577,72 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 79, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:37:24.117596Z", - "start_time": "2019-04-11T11:37:24.016700Z" + "end_time": "2019-04-12T10:36:03.692014Z", + "start_time": "2019-04-12T10:35:59.760212Z" } }, "outputs": [], + "source": [ + "model.save(local_path +'final_xception.h5') # creates a HDF5 file 'my_model.h5'" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": { + "ExecuteTime": { + "end_time": "2019-04-12T10:36:32.470614Z", + "start_time": "2019-04-12T10:36:26.242860Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "WARNING:tensorflow:No training configuration found in save file: the model was *not* compiled. Compile it manually.\n" + ] + } + ], + "source": [ + "# returns a compiled model\n", + "# identical to the previous one\n", + "from tensorflow.keras.models import load_model\n", + "model = load_model(local_path +'final_xception.h5')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model." + ] + }, + { + "cell_type": "raw", + "metadata": { + "ExecuteTime": { + "end_time": "2019-04-12T08:02:28.378991Z", + "start_time": "2019-04-12T08:02:23.982Z" + } + }, "source": [ "with open(local_path + 'savedmodels/xception_2.h5','r') as f:\n", " json = f.read()\n", "model = model_from_json(json)\n", "\n", "model.load_weights(local_path + 'savedmodels/xception_2.h5')\n", - "print(\"Loaded model from disk\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "ExecuteTime": { - "end_time": "2019-04-11T11:37:31.063661Z", - "start_time": "2019-04-11T11:37:30.972405Z" - } - }, - "outputs": [], - "source": [ + "print(\"Loaded model from disk\")\n", + "\n", "model.load_weights(local_path + 'savedmodels/xception_2.h5')\n", - "print(\"Loaded model from disk\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "ExecuteTime": { - "end_time": "2019-04-11T11:37:08.174905Z", - "start_time": "2019-04-11T11:37:08.142010Z" - } - }, - "outputs": [], - "source": [ - "model = load_model(local_path + 'savedmodels/xception_2.h5')\n", - " \n", - "#model = keras.models.load_model(local_path + 'savedmodels/xception_2.hdf5')" + "print(\"Loaded model from disk\")\n", + "\n", + "model = load_model(local_path + 'savedmodels/xception_2.h5')" ] }, { @@ -897,165 +947,6 @@ "This corresponds to the Happy Labels which is a good prediction." ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# VIII. Making live predictions from Webcam" - ] - }, - { - "cell_type": "code", - "execution_count": 57, - "metadata": { - "ExecuteTime": { - "end_time": "2019-04-11T11:41:30.881712Z", - "start_time": "2019-04-11T11:41:27.553045Z" - } - }, - "outputs": [ - { - "ename": "KeyboardInterrupt", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0mface_index\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0mgray\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdetected_faces\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcoord\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdetect_face\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;32mtry\u001b[0m \u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36mdetect_face\u001b[0;34m(frame)\u001b[0m\n\u001b[1;32m 11\u001b[0m detected_faces = faceCascade.detectMultiScale(gray,scaleFactor=1.1,minNeighbors=6,\n\u001b[1;32m 12\u001b[0m \u001b[0mminSize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mshape_x\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mshape_y\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 13\u001b[0;31m flags=cv2.CASCADE_SCALE_IMAGE)\n\u001b[0m\u001b[1;32m 14\u001b[0m \u001b[0mcoord\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " - ] - } - ], - "source": [ - "#Lancer la capture video\n", - "video_capture = cv2.VideoCapture(0)\n", - "font = cv2.FONT_HERSHEY_SIMPLEX\n", - "\n", - "emotion = []\n", - "\n", - "xs = []\n", - "ys = []\n", - "\n", - "i = 0\n", - "\n", - "while True:\n", - " # Capture frame-by-frame\n", - " # sleep(0.8)\n", - " ret, frame = video_capture.read()\n", - " \n", - " face_index = 0\n", - " gray, detected_faces, coord = detect_face(frame)\n", - "\n", - " try :\n", - " for face in detected_faces :\n", - " face = extract_face_features(gray, face)\n", - " face = np.reshape(face.flatten(), (1,48,48,1))\n", - " x,y,w,h = detect_face(frame)[2][face_index]\n", - " \n", - " #if w > 200 : \n", - " #Dessiner rectangle autour de la tête\n", - " cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)\n", - " \n", - " # predict smile\n", - " prediction = model.predict(face)\n", - " prediction_result = np.argmax(prediction)\n", - " \n", - " cv2.putText(frame, \"Angry : \" + str(round(prediction[0][0],3)),(10,30), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Disgust : \" + str(round(prediction[0][1],3)),(10,50), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Fear : \" + str(round(prediction[0][2],3)),(10,70), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Happy : \" + str(round(prediction[0][3],3)),(10,90), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Sad : \" + str(round(prediction[0][4],3)),(10,110), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Surprise : \" + str(round(prediction[0][5],3)),(10,130), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Neutral : \" + str(round(prediction[0][6],3)),(10,150), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " \n", - " # draw extracted face in the top right corner\n", - " #frame[face_index * shape_x: (face_index + 1) * shape_x, -1 * shape_y - 1:-1, :] = cv2.cvtColor(extracted_face * 255, cv2.COLOR_GRAY2RGB)\n", - "\n", - " # annotate main image with a label\n", - " if prediction_result == 0 :\n", - " cv2.putText(frame, \"Angry\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 1 :\n", - " cv2.putText(frame, \"Disgust\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 2 :\n", - " cv2.putText(frame, \"Fear\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 3 :\n", - " cv2.putText(frame, \"Happy\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 4 :\n", - " cv2.putText(frame, \"Sad\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 5 :\n", - " cv2.putText(frame, \"Surprise\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " else :\n", - " cv2.putText(frame, \"Neutral\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " \n", - " #emotion.append(prediction_result)\n", - " #xs.append(i)\n", - " #ys.append(prediction_result)\n", - " \n", - " #line1, = ax.plot(i, prediction_result, 'b-') \n", - " # line1.set_ydata(prediction_result)\n", - " # fig.canvas.draw()\n", - " \n", - " #print(prediction_result)\n", - " \n", - " face_index += 1\n", - " i = i + 1\n", - " except :\n", - " continue \n", - " # Display the resulting frame\n", - " cv2.imshow('Video', frame)\n", - "\n", - " if cv2.waitKey(1) & 0xFF == ord('q'):\n", - " break\n", - "\n", - "\n", - "# When everything is done, release the capture\n", - "video_capture.release()\n", - "cv2.destroyAllWindows()\n", - "\n", - "#%matplotlib qt\n", - "#plt.bar(xs, ys)" - ] - }, - { - "cell_type": "code", - "execution_count": 368, - "metadata": { - "ExecuteTime": { - "end_time": "2018-12-27T11:11:01.475946Z", - "start_time": "2018-12-27T11:11:01.129845Z" - } - }, - "outputs": [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6G4AZ5n5ea9jaQbdxF0biCgK4M8B/BtmXvA6Hhci+gCAHDMf9jqWLQgC2A/gG8z8NgBFeF9OKOPUre+G/SV0GYAIEX3Y26i2xxl9qWzmSUT/AXZZ8ztex+JCREMA/j2A+7c7VjV0E3d3ELfLHucxpSCiftjC/h1m/guv46niHQDuIqJXYZe13kNE3/Y2pEs4A+AMM7tXPA/DFntVuA3AK8xsMfMagL8A8I89jqkeM0S0CwCcf3Mex1MTIroHwAcA/CvF5i+nYX+JP++cM3sAPEtEE55G1QC6ifvfA3gTEV1BRAOwF7Ee9TimN0BEBLtWfIyZ/9DreKph5vuYeQ8zT8J+/55kZqWyTmY+B+A0EV3lPHQrgKMehlTNKQA3EdGQ8/e+FQot+FZRObz+owD+t4ex1ISI7oRdJryLmZe8jqcSZn6RmRPMPOmcM2cA7Hc+o0qjlbg7iy6/C+BvYJ9M32fmX3gb1SW8A8Bvw86Ijzg/7/M6KA35FIDvENELAG4A8F89jqeMc0XxMIBnAbwI+zzyfBcjEf0ZgP8H4CoiOkNEHwfwRQC3E9HLsK84vqhgjF8DMAxg2jlfHlAsPi2RHaqCIAgGolXmLgiCIDSGiLsgCIKBiLgLgiAYiIi7IAiCgYi4C4IgGIiIuyAIgoGIuAuCIBiIiLsgCIKB/H/o+ZdN5SJpNgAAAABJRU5ErkJggg==\n", - "text/plain": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "fig = plt.figure()\n", - "ax1 = fig.add_subplot(1,1,1)\n", - "\n", - "def animate(i) :\n", - " graph_data = emotion\n", - " xs = []\n", - " ys = []\n", - " for emo in graph_data:\n", - " xs.append(emo[0])\n", - " ys.append(emo[1])\n", - " ax1.clear()\n", - " ax1.plot(xs,ys)\n", - "\n", - "ani = animation.FuncAnimation(fig, animate, interval=1000)\n", - "plt.show()" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -1085,11 +976,11 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 15, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:41:34.125030Z", - "start_time": "2019-04-11T11:41:34.119600Z" + "end_time": "2019-04-12T08:03:06.260908Z", + "start_time": "2019-04-12T08:03:06.255895Z" } }, "outputs": [], @@ -1104,11 +995,11 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 16, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:41:42.622287Z", - "start_time": "2019-04-11T11:41:41.283939Z" + "end_time": "2019-04-12T08:03:08.266052Z", + "start_time": "2019-04-12T08:03:06.899425Z" } }, "outputs": [], @@ -1121,11 +1012,11 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 17, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:41:42.628971Z", - "start_time": "2019-04-11T11:41:42.625462Z" + "end_time": "2019-04-12T08:03:08.273518Z", + "start_time": "2019-04-12T08:03:08.268387Z" } }, "outputs": [], @@ -1143,11 +1034,11 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 18, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:41:43.844962Z", - "start_time": "2019-04-11T11:41:43.838308Z" + "end_time": "2019-04-12T08:03:08.482924Z", + "start_time": "2019-04-12T08:03:08.474775Z" } }, "outputs": [], @@ -1169,11 +1060,11 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 25, "metadata": { "ExecuteTime": { - "end_time": "2019-02-25T14:38:19.928738Z", - "start_time": "2019-02-25T14:38:19.875145Z" + "end_time": "2019-04-12T08:34:57.918025Z", + "start_time": "2019-04-12T08:34:57.872654Z" }, "code_folding": [] }, @@ -1250,35 +1141,38 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 84, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T14:43:22.125542Z", - "start_time": "2019-04-11T14:42:00.138151Z" + "end_time": "2019-04-12T12:02:16.815567Z", + "start_time": "2019-04-12T12:01:56.890569Z" }, - "scrolled": false + "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", - " \"the returned array has changed.\", UserWarning)\n", - "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", - " \"the returned array has changed.\", UserWarning)\n", - "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", - " \"the returned array has changed.\", UserWarning)\n", "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", " \"the returned array has changed.\", UserWarning)\n" ] + }, + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mgray\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcv2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcvtColor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframe\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcv2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCOLOR_BGR2GRAY\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mrects\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mface_detect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgray\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 12\u001b[0m \u001b[0;31m#gray, detected_faces, coord = detect_face(frame)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;32mtry\u001b[0m \u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] } ], "source": [ "#Lancer la capture video\n", "video_capture = cv2.VideoCapture(0)\n", - "flag = 0\n", - "j = 1\n", "\n", "while True:\n", " # Capture frame-by-frame\n", @@ -1289,112 +1183,118 @@ " gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\n", " rects = face_detect(gray, 1)\n", " #gray, detected_faces, coord = detect_face(frame)\n", - " \n", - " for (i, rect) in enumerate(rects):\n", - " \n", - " shape = predictor_landmarks(gray, rect)\n", - " shape = face_utils.shape_to_np(shape)\n", - " \n", - " (x, y, w, h) = face_utils.rect_to_bb(rect)\n", - " face = gray[y:y+h,x:x+w]\n", - " \n", - " #Zoom sur la face extraite\n", - " face = zoom(face, (shape_x / face.shape[0],shape_y / face.shape[1]))\n", - " #cast type float\n", - " face = face.astype(np.float32)\n", - " #scale\n", - " face /= float(face.max())\n", - " face = np.reshape(face.flatten(), (1, 48, 48, 1))\n", - " prediction = model.predict(face)\n", - " prediction_result = np.argmax(prediction)\n", - " \n", - " # Rectangle around the face\n", - " cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)\n", - " \n", - " cv2.putText(frame, \"Face #{}\".format(i + 1), (x - 10, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)\n", - " \n", - " for (j, k) in shape:\n", - " cv2.circle(frame, (j, k), 1, (0, 0, 255), -1)\n", + " try : \n", + " for (i, rect) in enumerate(rects):\n", "\n", - " # 12. Add prediction probabilities\n", - " cv2.putText(frame, \"Emotional report : \",(40,120), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Angry : \" + str(round(prediction[0][0],3)),(40,140), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Disgust : \" + str(round(prediction[0][1],3)),(40,160), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Fear : \" + str(round(prediction[0][2],3)),(40,180), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Happy : \" + str(round(prediction[0][3],3)),(40,200), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Sad : \" + str(round(prediction[0][4],3)),(40,220), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Surprise : \" + str(round(prediction[0][5],3)),(40,240), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Neutral : \" + str(round(prediction[0][6],3)),(40,260), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " \n", - " # draw extracted face in the top right corner\n", - " #frame[face_index * shape_x: (face_index + 1) * shape_x, -1 * shape_y - 1:-1, :] = cv2.cvtColor(face * 255, cv2.COLOR_GRAY2RGB)\n", + " shape = predictor_landmarks(gray, rect)\n", + " shape = face_utils.shape_to_np(shape)\n", "\n", - " # 13. Annotate main image with a label\n", - " if prediction_result == 0 :\n", - " cv2.putText(frame, \"Angry\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 1 :\n", - " cv2.putText(frame, \"Disgust\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 2 :\n", - " cv2.putText(frame, \"Fear\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 3 :\n", - " cv2.putText(frame, \"Happy\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 4 :\n", - " cv2.putText(frame, \"Sad\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 5 :\n", - " cv2.putText(frame, \"Surprise\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " else :\n", - " cv2.putText(frame, \"Neutral\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " \n", - " \n", - " # 5. Eye Detection and Blink Count\n", - " leftEye = shape[lStart:lEnd]\n", - " rightEye = shape[rStart:rEnd]\n", - " \n", - " # Compute Eye Aspect Ratio\n", - " leftEAR = eye_aspect_ratio(leftEye)\n", - " rightEAR = eye_aspect_ratio(rightEye)\n", - " ear = (leftEAR + rightEAR) / 2.0\n", - " \n", - " # And plot its contours\n", - " leftEyeHull = cv2.convexHull(leftEye)\n", - " rightEyeHull = cv2.convexHull(rightEye)\n", - " cv2.drawContours(frame, [leftEyeHull], -1, (0, 255, 0), 1)\n", - " cv2.drawContours(frame, [rightEyeHull], -1, (0, 255, 0), 1)\n", - " \n", - " # Compute total blinks and frequency\n", - " if ear < thresh:\n", - " flag += 1\n", - " #cv2.putText(frame, \"Blink\", (10, 200), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " \n", - " cv2.putText(frame, \"Total blinks : \" + str(flag), (40, 70), cv2.FONT_HERSHEY_SIMPLEX, 1, 155, 1)\n", - " #cv2.putText(frame, \"Blink Frequency : \" + str(int(flag/j)), (40, 220), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " \n", - " # 6. Detect Nose\n", - " nose = shape[nStart:nEnd]\n", - " noseHull = cv2.convexHull(nose)\n", - " cv2.drawContours(frame, [noseHull], -1, (0, 255, 0), 1)\n", + " # Identify face coordinates\n", + " (x, y, w, h) = face_utils.rect_to_bb(rect)\n", + " face = gray[y:y+h,x:x+w]\n", "\n", - " # 7. Detect Mouth\n", - " mouth = shape[mStart:mEnd]\n", - " mouthHull = cv2.convexHull(mouth)\n", - " cv2.drawContours(frame, [mouthHull], -1, (0, 255, 0), 1)\n", - " \n", - " # 8. Detect Jaw\n", - " jaw = shape[jStart:jEnd]\n", - " jawHull = cv2.convexHull(jaw)\n", - " cv2.drawContours(frame, [jawHull], -1, (0, 255, 0), 1)\n", - " \n", - " # 9. Detect Eyebrows\n", - " ebr = shape[ebrStart:ebrEnd]\n", - " ebrHull = cv2.convexHull(ebr)\n", - " cv2.drawContours(frame, [ebrHull], -1, (0, 255, 0), 1)\n", - " ebl = shape[eblStart:eblEnd]\n", - " eblHull = cv2.convexHull(ebl)\n", - " cv2.drawContours(frame, [eblHull], -1, (0, 255, 0), 1)\n", - " \n", - " cv2.putText(frame,'Number of Faces : ' + str(i+1),(40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, 155, 1)\n", - " j = j + 1\n", - " cv2.imshow('Video', frame)\n", + " #Zoom on extracted face\n", + " face = zoom(face, (shape_x / face.shape[0],shape_y / face.shape[1]))\n", + "\n", + " #Cast type float\n", + " face = face.astype(np.float32)\n", + "\n", + " #Scale\n", + " face /= float(face.max())\n", + " face = np.reshape(face.flatten(), (1, 48, 48, 1))\n", + "\n", + " #Make Prediction\n", + " prediction = model.predict(face)\n", + " prediction_result = np.argmax(prediction)\n", + "\n", + " # Rectangle around the face\n", + " cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)\n", + "\n", + " cv2.putText(frame, \"Face #{}\".format(i + 1), (x - 10, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)\n", + "\n", + " for (j, k) in shape:\n", + " cv2.circle(frame, (j, k), 1, (0, 0, 255), -1)\n", + "\n", + " # 12. Add prediction probabilities\n", + " cv2.putText(frame, \"----------------\",(40,100 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " cv2.putText(frame, \"Emotional report : Face #\" + str(i+1),(40,120 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " cv2.putText(frame, \"Angry : \" + str(round(prediction[0][0],3)),(40,140 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " cv2.putText(frame, \"Disgust : \" + str(round(prediction[0][1],3)),(40,160 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " cv2.putText(frame, \"Fear : \" + str(round(prediction[0][2],3)),(40,180 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + " cv2.putText(frame, \"Happy : \" + str(round(prediction[0][3],3)),(40,200 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + " cv2.putText(frame, \"Sad : \" + str(round(prediction[0][4],3)),(40,220 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + " cv2.putText(frame, \"Surprise : \" + str(round(prediction[0][5],3)),(40,240 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + " cv2.putText(frame, \"Neutral : \" + str(round(prediction[0][6],3)),(40,260 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + "\n", + " # draw extracted face in the top right corner\n", + " #frame[face_index * shape_x: (face_index + 1) * shape_x, -1 * shape_y - 1:-1, :] = cv2.cvtColor(face * 255, cv2.COLOR_GRAY2RGB)\n", + "\n", + " # 13. Annotate main image with a label\n", + " if prediction_result == 0 :\n", + " cv2.putText(frame, \"Angry\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 1 :\n", + " cv2.putText(frame, \"Disgust\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 2 :\n", + " cv2.putText(frame, \"Fear\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 3 :\n", + " cv2.putText(frame, \"Happy\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 4 :\n", + " cv2.putText(frame, \"Sad\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 5 :\n", + " cv2.putText(frame, \"Surprise\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " else :\n", + " cv2.putText(frame, \"Neutral\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + "\n", + " # 5. Eye Detection and Blink Count\n", + " leftEye = shape[lStart:lEnd]\n", + " rightEye = shape[rStart:rEnd]\n", + "\n", + " # Compute Eye Aspect Ratio\n", + " leftEAR = eye_aspect_ratio(leftEye)\n", + " rightEAR = eye_aspect_ratio(rightEye)\n", + " ear = (leftEAR + rightEAR) / 2.0\n", + "\n", + " # And plot its contours\n", + " leftEyeHull = cv2.convexHull(leftEye)\n", + " rightEyeHull = cv2.convexHull(rightEye)\n", + " cv2.drawContours(frame, [leftEyeHull], -1, (0, 255, 0), 1)\n", + " cv2.drawContours(frame, [rightEyeHull], -1, (0, 255, 0), 1)\n", + "\n", + " # Compute total blinks and frequency\n", + " #if ear < thresh:\n", + " #flag += 1\n", + " #cv2.putText(frame, \"Blink\", (10, 200), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + "\n", + " #cv2.putText(frame, \"Total blinks : \" + str(flag), (40, 280 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " #cv2.putText(frame, \"Blink Frequency : \" + str(int(flag/j)), (40, 220), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + "\n", + " # 6. Detect Nose\n", + " nose = shape[nStart:nEnd]\n", + " noseHull = cv2.convexHull(nose)\n", + " cv2.drawContours(frame, [noseHull], -1, (0, 255, 0), 1)\n", + "\n", + " # 7. Detect Mouth\n", + " mouth = shape[mStart:mEnd]\n", + " mouthHull = cv2.convexHull(mouth)\n", + " cv2.drawContours(frame, [mouthHull], -1, (0, 255, 0), 1)\n", + "\n", + " # 8. Detect Jaw\n", + " jaw = shape[jStart:jEnd]\n", + " jawHull = cv2.convexHull(jaw)\n", + " cv2.drawContours(frame, [jawHull], -1, (0, 255, 0), 1)\n", + "\n", + " # 9. Detect Eyebrows\n", + " ebr = shape[ebrStart:ebrEnd]\n", + " ebrHull = cv2.convexHull(ebr)\n", + " cv2.drawContours(frame, [ebrHull], -1, (0, 255, 0), 1)\n", + " ebl = shape[eblStart:eblEnd]\n", + " eblHull = cv2.convexHull(ebl)\n", + " cv2.drawContours(frame, [eblHull], -1, (0, 255, 0), 1)\n", + "\n", + " cv2.putText(frame,'Number of Faces : ' + str(len(rects)),(40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, 155, 1)\n", + " cv2.imshow('Video', frame)\n", + " except :\n", + " pass\n", " \n", " if cv2.waitKey(1) & 0xFF == ord('q'):\n", " break\n", @@ -1404,6 +1304,45 @@ "cv2.destroyAllWindows()" ] }, + { + "cell_type": "code", + "execution_count": 368, + "metadata": { + "ExecuteTime": { + "end_time": "2018-12-27T11:11:01.475946Z", + "start_time": "2018-12-27T11:11:01.129845Z" + } + }, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHd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ex+JCREMA/j2A+7c7VjV0E3d3ELfLHucxpSCiftjC/h1m/guv46niHQDuIqJXYZe13kNE3/Y2pEs4A+AMM7tXPA/DFntVuA3AK8xsMfMagL8A8I89jqkeM0S0CwCcf3Mex1MTIroHwAcA/CvF5i+nYX+JP++cM3sAPEtEE55G1QC6ifvfA3gTEV1BRAOwF7Ee9TimN0BEBLtWfIyZ/9DreKph5vuYeQ8zT8J+/55kZqWyTmY+B+A0EV3lPHQrgKMehlTNKQA3EdGQ8/e+FQot+FZRObz+owD+t4ex1ISI7oRdJryLmZe8jqcSZn6RmRPMPOmcM2cA7Hc+o0qjlbg7iy6/C+BvYJ9M32fmX3gb1SW8A8Bvw86Ijzg/7/M6KA35FIDvENELAG4A8F89jqeMc0XxMIBnAbwI+zzyfBcjEf0ZgP8H4CoiOkNEHwfwRQC3E9HLsK84vqhgjF8DMAxg2jlfHlAsPi2RHaqCIAgGolXmLgiCIDSGiLsgCIKBiLgLgiAYiIi7IAiCgYi4C4IgGIiIuyAIgoGIuAuCIBiIiLsgCIKB/H/o+ZdN5SJpNgAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fig = plt.figure()\n", + "ax1 = fig.add_subplot(1,1,1)\n", + "\n", + "def animate(i) :\n", + " graph_data = emotion\n", + " xs = []\n", + " ys = []\n", + " for emo in graph_data:\n", + " xs.append(emo[0])\n", + " ys.append(emo[1])\n", + " ax1.clear()\n", + " ax1.plot(xs,ys)\n", + "\n", + "ani = animation.FuncAnimation(fig, animate, interval=1000)\n", + "plt.show()" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/Video/09-Prediction.ipynb b/Video/09-Prediction.ipynb index fc4590e..8c6c0f9 100644 --- a/Video/09-Prediction.ipynb +++ b/Video/09-Prediction.ipynb @@ -64,11 +64,11 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:40:16.044062Z", - "start_time": "2019-04-11T11:40:14.706497Z" + "end_time": "2019-04-12T08:02:16.987262Z", + "start_time": "2019-04-12T08:02:09.395144Z" } }, "outputs": [ @@ -76,6 +76,11 @@ "name": "stderr", "output_type": "stream", "text": [ + "/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n", + " from ._conv import register_converters as _register_converters\n", + "/anaconda3/lib/python3.6/site-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.21.1) or chardet (2.3.0) doesn't match a supported version!\n", + " RequestsDependencyWarning)\n", + "Using TensorFlow backend.\n", "/anaconda3/lib/python3.6/site-packages/ggplot/utils.py:81: FutureWarning: pandas.tslib is deprecated and will be removed in a future version.\n", "You can access Timestamp as pandas.Timestamp\n", " pd.tslib.Timestamp,\n" @@ -152,11 +157,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:00.044292Z", - "start_time": "2019-04-11T11:25:00.038288Z" + "end_time": "2019-04-12T08:02:16.994861Z", + "start_time": "2019-04-12T08:02:16.990061Z" } }, "outputs": [], @@ -167,11 +172,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:00.777127Z", - "start_time": "2019-04-11T11:25:00.281779Z" + "end_time": "2019-04-12T08:02:17.654243Z", + "start_time": "2019-04-12T08:02:16.998104Z" } }, "outputs": [], @@ -184,11 +189,11 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:00.792830Z", - "start_time": "2019-04-11T11:25:00.781075Z" + "end_time": "2019-04-12T08:02:17.671405Z", + "start_time": "2019-04-12T08:02:17.659758Z" } }, "outputs": [], @@ -201,6 +206,31 @@ "nClasses = len(classes)" ] }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": { + "ExecuteTime": { + "end_time": "2019-04-12T10:13:28.596082Z", + "start_time": "2019-04-12T10:13:28.585736Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "(48, 48, 1)" + ] + }, + "execution_count": 78, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "nRows, nCols, nDims" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -223,11 +253,11 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:01.150101Z", - "start_time": "2019-04-11T11:25:01.138374Z" + "end_time": "2019-04-12T08:02:17.684740Z", + "start_time": "2019-04-12T08:02:17.673881Z" } }, "outputs": [], @@ -258,11 +288,11 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:01.377168Z", - "start_time": "2019-04-11T11:25:01.355858Z" + "end_time": "2019-04-12T08:02:17.706127Z", + "start_time": "2019-04-12T08:02:17.689299Z" } }, "outputs": [], @@ -309,21 +339,21 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:02.613178Z", - "start_time": "2019-04-11T11:25:02.107792Z" + "end_time": "2019-04-12T08:02:18.762144Z", + "start_time": "2019-04-12T08:02:18.380019Z" } }, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 12, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" }, @@ -353,21 +383,21 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 8, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:25:03.406884Z", - "start_time": "2019-04-11T11:25:03.011014Z" + "end_time": "2019-04-12T08:02:19.753207Z", + "start_time": "2019-04-12T08:02:19.375728Z" } }, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 13, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" }, @@ -396,11 +426,11 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 9, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:38:29.623429Z", - "start_time": "2019-04-11T11:38:29.605230Z" + "end_time": "2019-04-12T08:02:20.095739Z", + "start_time": "2019-04-12T08:02:20.076416Z" } }, "outputs": [], @@ -439,11 +469,11 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 10, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:38:40.366050Z", - "start_time": "2019-04-11T11:38:40.353614Z" + "end_time": "2019-04-12T08:02:20.649026Z", + "start_time": "2019-04-12T08:02:20.637249Z" } }, "outputs": [], @@ -474,11 +504,11 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 11, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:38:50.594309Z", - "start_time": "2019-04-11T11:38:50.576207Z" + "end_time": "2019-04-12T08:02:21.428426Z", + "start_time": "2019-04-12T08:02:21.403582Z" } }, "outputs": [], @@ -517,11 +547,11 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 12, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:40:23.898408Z", - "start_time": "2019-04-11T11:40:20.780722Z" + "end_time": "2019-04-12T08:02:25.367196Z", + "start_time": "2019-04-12T08:02:22.181178Z" } }, "outputs": [], @@ -533,11 +563,11 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 14, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:40:40.918822Z", - "start_time": "2019-04-11T11:40:40.411765Z" + "end_time": "2019-04-12T08:02:30.654061Z", + "start_time": "2019-04-12T08:02:29.952183Z" } }, "outputs": [], @@ -547,52 +577,72 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 79, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:37:24.117596Z", - "start_time": "2019-04-11T11:37:24.016700Z" + "end_time": "2019-04-12T10:36:03.692014Z", + "start_time": "2019-04-12T10:35:59.760212Z" } }, "outputs": [], + "source": [ + "model.save(local_path +'final_xception.h5') # creates a HDF5 file 'my_model.h5'" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": { + "ExecuteTime": { + "end_time": "2019-04-12T10:36:32.470614Z", + "start_time": "2019-04-12T10:36:26.242860Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "WARNING:tensorflow:No training configuration found in save file: the model was *not* compiled. Compile it manually.\n" + ] + } + ], + "source": [ + "# returns a compiled model\n", + "# identical to the previous one\n", + "from tensorflow.keras.models import load_model\n", + "model = load_model(local_path +'final_xception.h5')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model." + ] + }, + { + "cell_type": "raw", + "metadata": { + "ExecuteTime": { + "end_time": "2019-04-12T08:02:28.378991Z", + "start_time": "2019-04-12T08:02:23.982Z" + } + }, "source": [ "with open(local_path + 'savedmodels/xception_2.h5','r') as f:\n", " json = f.read()\n", "model = model_from_json(json)\n", "\n", "model.load_weights(local_path + 'savedmodels/xception_2.h5')\n", - "print(\"Loaded model from disk\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "ExecuteTime": { - "end_time": "2019-04-11T11:37:31.063661Z", - "start_time": "2019-04-11T11:37:30.972405Z" - } - }, - "outputs": [], - "source": [ + "print(\"Loaded model from disk\")\n", + "\n", "model.load_weights(local_path + 'savedmodels/xception_2.h5')\n", - "print(\"Loaded model from disk\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "ExecuteTime": { - "end_time": "2019-04-11T11:37:08.174905Z", - "start_time": "2019-04-11T11:37:08.142010Z" - } - }, - "outputs": [], - "source": [ - "model = load_model(local_path + 'savedmodels/xception_2.h5')\n", - " \n", - "#model = keras.models.load_model(local_path + 'savedmodels/xception_2.hdf5')" + "print(\"Loaded model from disk\")\n", + "\n", + "model = load_model(local_path + 'savedmodels/xception_2.h5')" ] }, { @@ -897,165 +947,6 @@ "This corresponds to the Happy Labels which is a good prediction." ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# VIII. Making live predictions from Webcam" - ] - }, - { - "cell_type": "code", - "execution_count": 57, - "metadata": { - "ExecuteTime": { - "end_time": "2019-04-11T11:41:30.881712Z", - "start_time": "2019-04-11T11:41:27.553045Z" - } - }, - "outputs": [ - { - "ename": "KeyboardInterrupt", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0mface_index\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0mgray\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdetected_faces\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcoord\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdetect_face\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;32mtry\u001b[0m \u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36mdetect_face\u001b[0;34m(frame)\u001b[0m\n\u001b[1;32m 11\u001b[0m detected_faces = faceCascade.detectMultiScale(gray,scaleFactor=1.1,minNeighbors=6,\n\u001b[1;32m 12\u001b[0m \u001b[0mminSize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mshape_x\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mshape_y\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 13\u001b[0;31m flags=cv2.CASCADE_SCALE_IMAGE)\n\u001b[0m\u001b[1;32m 14\u001b[0m \u001b[0mcoord\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " - ] - } - ], - "source": [ - "#Lancer la capture video\n", - "video_capture = cv2.VideoCapture(0)\n", - "font = cv2.FONT_HERSHEY_SIMPLEX\n", - "\n", - "emotion = []\n", - "\n", - "xs = []\n", - "ys = []\n", - "\n", - "i = 0\n", - "\n", - "while True:\n", - " # Capture frame-by-frame\n", - " # sleep(0.8)\n", - " ret, frame = video_capture.read()\n", - " \n", - " face_index = 0\n", - " gray, detected_faces, coord = detect_face(frame)\n", - "\n", - " try :\n", - " for face in detected_faces :\n", - " face = extract_face_features(gray, face)\n", - " face = np.reshape(face.flatten(), (1,48,48,1))\n", - " x,y,w,h = detect_face(frame)[2][face_index]\n", - " \n", - " #if w > 200 : \n", - " #Dessiner rectangle autour de la tête\n", - " cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)\n", - " \n", - " # predict smile\n", - " prediction = model.predict(face)\n", - " prediction_result = np.argmax(prediction)\n", - " \n", - " cv2.putText(frame, \"Angry : \" + str(round(prediction[0][0],3)),(10,30), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Disgust : \" + str(round(prediction[0][1],3)),(10,50), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Fear : \" + str(round(prediction[0][2],3)),(10,70), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Happy : \" + str(round(prediction[0][3],3)),(10,90), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Sad : \" + str(round(prediction[0][4],3)),(10,110), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Surprise : \" + str(round(prediction[0][5],3)),(10,130), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Neutral : \" + str(round(prediction[0][6],3)),(10,150), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " \n", - " # draw extracted face in the top right corner\n", - " #frame[face_index * shape_x: (face_index + 1) * shape_x, -1 * shape_y - 1:-1, :] = cv2.cvtColor(extracted_face * 255, cv2.COLOR_GRAY2RGB)\n", - "\n", - " # annotate main image with a label\n", - " if prediction_result == 0 :\n", - " cv2.putText(frame, \"Angry\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 1 :\n", - " cv2.putText(frame, \"Disgust\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 2 :\n", - " cv2.putText(frame, \"Fear\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 3 :\n", - " cv2.putText(frame, \"Happy\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 4 :\n", - " cv2.putText(frame, \"Sad\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " elif prediction_result == 5 :\n", - " cv2.putText(frame, \"Surprise\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " else :\n", - " cv2.putText(frame, \"Neutral\",(x,y), cv2.FONT_HERSHEY_SIMPLEX, 2, 155, 10)\n", - " \n", - " #emotion.append(prediction_result)\n", - " #xs.append(i)\n", - " #ys.append(prediction_result)\n", - " \n", - " #line1, = ax.plot(i, prediction_result, 'b-') \n", - " # line1.set_ydata(prediction_result)\n", - " # fig.canvas.draw()\n", - " \n", - " #print(prediction_result)\n", - " \n", - " face_index += 1\n", - " i = i + 1\n", - " except :\n", - " continue \n", - " # Display the resulting frame\n", - " cv2.imshow('Video', frame)\n", - "\n", - " if cv2.waitKey(1) & 0xFF == ord('q'):\n", - " break\n", - "\n", - "\n", - "# When everything is done, release the capture\n", - "video_capture.release()\n", - "cv2.destroyAllWindows()\n", - "\n", - "#%matplotlib qt\n", - "#plt.bar(xs, ys)" - ] - }, - { - "cell_type": "code", - "execution_count": 368, - "metadata": { - "ExecuteTime": { - "end_time": "2018-12-27T11:11:01.475946Z", - "start_time": "2018-12-27T11:11:01.129845Z" - } - }, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4wLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvqOYd8AAAIABJREFUeJztnXtwY/d1378HBAmQAMFdkgC42ocoQLasRyx5w8pS7XEs61H5UamTOK3TOrYce3Y8VWy346nH6kMzcTutM+nEj9pjzY6cWInd2K4SpYpjO6IkK7XSWs6utHp4dx0tIO1LWuKC3CUJcPnE6R/3XhDCAiTe9/f73fOZ4SweV+ARiPvFued3ft9DzAxBEATBLAJeByAIgiB0HhF3QRAEAxFxFwRBMBARd0EQBAMRcRcEQTAQEXdBEAQDEXEXBEEwEBF3QRAEAxFxFwRBMJCgV794fHycJycnvfr1giAIWnL48OE8M8e3O84zcZ+cnMShQ4e8+vWCIAhaQkQnGzlOyjKCIAgGIuIuCIJgICLugiAIBiLiLgiCYCAi7oIgCAbSkLgT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MAxg2jlfHlAsPi2RHaqCIAgGolXmLgiCIDSGiLsgCIKBiLgLgiAYiIi7IAiCgYi4C4IgGIiIuyAIgoGIuAuCIBiIiLsgCIKB/H/o+ZdN5SJpNgAAAABJRU5ErkJggg==\n", - "text/plain": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "fig = plt.figure()\n", - "ax1 = fig.add_subplot(1,1,1)\n", - "\n", - "def animate(i) :\n", - " graph_data = emotion\n", - " xs = []\n", - " ys = []\n", - " for emo in graph_data:\n", - " xs.append(emo[0])\n", - " ys.append(emo[1])\n", - " ax1.clear()\n", - " ax1.plot(xs,ys)\n", - "\n", - "ani = animation.FuncAnimation(fig, animate, interval=1000)\n", - "plt.show()" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -1085,11 +976,11 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 15, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:41:34.125030Z", - "start_time": "2019-04-11T11:41:34.119600Z" + "end_time": "2019-04-12T08:03:06.260908Z", + "start_time": "2019-04-12T08:03:06.255895Z" } }, "outputs": [], @@ -1104,11 +995,11 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 16, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:41:42.622287Z", - "start_time": "2019-04-11T11:41:41.283939Z" + "end_time": "2019-04-12T08:03:08.266052Z", + "start_time": "2019-04-12T08:03:06.899425Z" } }, "outputs": [], @@ -1121,11 +1012,11 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 17, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:41:42.628971Z", - "start_time": "2019-04-11T11:41:42.625462Z" + "end_time": "2019-04-12T08:03:08.273518Z", + "start_time": "2019-04-12T08:03:08.268387Z" } }, "outputs": [], @@ -1143,11 +1034,11 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 18, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T11:41:43.844962Z", - "start_time": "2019-04-11T11:41:43.838308Z" + "end_time": "2019-04-12T08:03:08.482924Z", + "start_time": "2019-04-12T08:03:08.474775Z" } }, "outputs": [], @@ -1169,11 +1060,11 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 25, "metadata": { "ExecuteTime": { - "end_time": "2019-02-25T14:38:19.928738Z", - "start_time": "2019-02-25T14:38:19.875145Z" + "end_time": "2019-04-12T08:34:57.918025Z", + "start_time": "2019-04-12T08:34:57.872654Z" }, "code_folding": [] }, @@ -1250,19 +1141,69 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 85, "metadata": { "ExecuteTime": { - "end_time": "2019-04-11T14:43:22.125542Z", - "start_time": "2019-04-11T14:42:00.138151Z" + "end_time": "2019-04-12T15:54:04.930299Z", + "start_time": "2019-04-12T15:47:02.465807Z" }, - "scrolled": false + "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", " \"the returned array has changed.\", UserWarning)\n", "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", @@ -1272,13 +1213,314 @@ "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", " \"the returned array has changed.\", UserWarning)\n" ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n", + "/anaconda3/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:583: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n", + " \"the returned array has changed.\", UserWarning)\n" + ] + }, + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 124\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 125\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 126\u001b[0;31m \u001b[0;32mif\u001b[0m \u001b[0mcv2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwaitKey\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m&\u001b[0m \u001b[0;36m0xFF\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mord\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'q'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 127\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] } ], "source": [ "#Lancer la capture video\n", "video_capture = cv2.VideoCapture(0)\n", - "flag = 0\n", - "j = 1\n", "\n", "while True:\n", " # Capture frame-by-frame\n", @@ -1289,112 +1531,118 @@ " gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\n", " rects = face_detect(gray, 1)\n", " #gray, detected_faces, coord = detect_face(frame)\n", - " \n", - " for (i, rect) in enumerate(rects):\n", - " \n", - " shape = predictor_landmarks(gray, rect)\n", - " shape = face_utils.shape_to_np(shape)\n", - " \n", - " (x, y, w, h) = face_utils.rect_to_bb(rect)\n", - " face = gray[y:y+h,x:x+w]\n", - " \n", - " #Zoom sur la face extraite\n", - " face = zoom(face, (shape_x / face.shape[0],shape_y / face.shape[1]))\n", - " #cast type float\n", - " face = face.astype(np.float32)\n", - " #scale\n", - " face /= float(face.max())\n", - " face = np.reshape(face.flatten(), (1, 48, 48, 1))\n", - " prediction = model.predict(face)\n", - " prediction_result = np.argmax(prediction)\n", - " \n", - " # Rectangle around the face\n", - " cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)\n", - " \n", - " cv2.putText(frame, \"Face #{}\".format(i + 1), (x - 10, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)\n", - " \n", - " for (j, k) in shape:\n", - " cv2.circle(frame, (j, k), 1, (0, 0, 255), -1)\n", + " try : \n", + " for (i, rect) in enumerate(rects):\n", "\n", - " # 12. Add prediction probabilities\n", - " cv2.putText(frame, \"Emotional report : \",(40,120), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Angry : \" + str(round(prediction[0][0],3)),(40,140), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Disgust : \" + str(round(prediction[0][1],3)),(40,160), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " cv2.putText(frame, \"Fear : \" + str(round(prediction[0][2],3)),(40,180), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Happy : \" + str(round(prediction[0][3],3)),(40,200), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Sad : \" + str(round(prediction[0][4],3)),(40,220), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Surprise : \" + str(round(prediction[0][5],3)),(40,240), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " cv2.putText(frame, \"Neutral : \" + str(round(prediction[0][6],3)),(40,260), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", - " \n", - " # draw extracted face in the top right corner\n", - " #frame[face_index * shape_x: (face_index + 1) * shape_x, -1 * shape_y - 1:-1, :] = cv2.cvtColor(face * 255, cv2.COLOR_GRAY2RGB)\n", + " shape = predictor_landmarks(gray, rect)\n", + " shape = face_utils.shape_to_np(shape)\n", "\n", - " # 13. Annotate main image with a label\n", - " if prediction_result == 0 :\n", - " cv2.putText(frame, \"Angry\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 1 :\n", - " cv2.putText(frame, \"Disgust\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 2 :\n", - " cv2.putText(frame, \"Fear\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 3 :\n", - " cv2.putText(frame, \"Happy\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 4 :\n", - " cv2.putText(frame, \"Sad\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " elif prediction_result == 5 :\n", - " cv2.putText(frame, \"Surprise\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " else :\n", - " cv2.putText(frame, \"Neutral\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", - " \n", - " \n", - " # 5. Eye Detection and Blink Count\n", - " leftEye = shape[lStart:lEnd]\n", - " rightEye = shape[rStart:rEnd]\n", - " \n", - " # Compute Eye Aspect Ratio\n", - " leftEAR = eye_aspect_ratio(leftEye)\n", - " rightEAR = eye_aspect_ratio(rightEye)\n", - " ear = (leftEAR + rightEAR) / 2.0\n", - " \n", - " # And plot its contours\n", - " leftEyeHull = cv2.convexHull(leftEye)\n", - " rightEyeHull = cv2.convexHull(rightEye)\n", - " cv2.drawContours(frame, [leftEyeHull], -1, (0, 255, 0), 1)\n", - " cv2.drawContours(frame, [rightEyeHull], -1, (0, 255, 0), 1)\n", - " \n", - " # Compute total blinks and frequency\n", - " if ear < thresh:\n", - " flag += 1\n", - " #cv2.putText(frame, \"Blink\", (10, 200), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " \n", - " cv2.putText(frame, \"Total blinks : \" + str(flag), (40, 70), cv2.FONT_HERSHEY_SIMPLEX, 1, 155, 1)\n", - " #cv2.putText(frame, \"Blink Frequency : \" + str(int(flag/j)), (40, 220), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", - " \n", - " # 6. Detect Nose\n", - " nose = shape[nStart:nEnd]\n", - " noseHull = cv2.convexHull(nose)\n", - " cv2.drawContours(frame, [noseHull], -1, (0, 255, 0), 1)\n", + " # Identify face coordinates\n", + " (x, y, w, h) = face_utils.rect_to_bb(rect)\n", + " face = gray[y:y+h,x:x+w]\n", "\n", - " # 7. Detect Mouth\n", - " mouth = shape[mStart:mEnd]\n", - " mouthHull = cv2.convexHull(mouth)\n", - " cv2.drawContours(frame, [mouthHull], -1, (0, 255, 0), 1)\n", - " \n", - " # 8. Detect Jaw\n", - " jaw = shape[jStart:jEnd]\n", - " jawHull = cv2.convexHull(jaw)\n", - " cv2.drawContours(frame, [jawHull], -1, (0, 255, 0), 1)\n", - " \n", - " # 9. Detect Eyebrows\n", - " ebr = shape[ebrStart:ebrEnd]\n", - " ebrHull = cv2.convexHull(ebr)\n", - " cv2.drawContours(frame, [ebrHull], -1, (0, 255, 0), 1)\n", - " ebl = shape[eblStart:eblEnd]\n", - " eblHull = cv2.convexHull(ebl)\n", - " cv2.drawContours(frame, [eblHull], -1, (0, 255, 0), 1)\n", - " \n", - " cv2.putText(frame,'Number of Faces : ' + str(i+1),(40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, 155, 1)\n", - " j = j + 1\n", - " cv2.imshow('Video', frame)\n", + " #Zoom on extracted face\n", + " face = zoom(face, (shape_x / face.shape[0],shape_y / face.shape[1]))\n", + "\n", + " #Cast type float\n", + " face = face.astype(np.float32)\n", + "\n", + " #Scale\n", + " face /= float(face.max())\n", + " face = np.reshape(face.flatten(), (1, 48, 48, 1))\n", + "\n", + " #Make Prediction\n", + " prediction = model.predict(face)\n", + " prediction_result = np.argmax(prediction)\n", + "\n", + " # Rectangle around the face\n", + " cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)\n", + "\n", + " cv2.putText(frame, \"Face #{}\".format(i + 1), (x - 10, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)\n", + "\n", + " for (j, k) in shape:\n", + " cv2.circle(frame, (j, k), 1, (0, 0, 255), -1)\n", + "\n", + " # 12. Add prediction probabilities\n", + " cv2.putText(frame, \"----------------\",(40,100 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " cv2.putText(frame, \"Emotional report : Face #\" + str(i+1),(40,120 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " cv2.putText(frame, \"Angry : \" + str(round(prediction[0][0],3)),(40,140 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " cv2.putText(frame, \"Disgust : \" + str(round(prediction[0][1],3)),(40,160 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " cv2.putText(frame, \"Fear : \" + str(round(prediction[0][2],3)),(40,180 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + " cv2.putText(frame, \"Happy : \" + str(round(prediction[0][3],3)),(40,200 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + " cv2.putText(frame, \"Sad : \" + str(round(prediction[0][4],3)),(40,220 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + " cv2.putText(frame, \"Surprise : \" + str(round(prediction[0][5],3)),(40,240 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + " cv2.putText(frame, \"Neutral : \" + str(round(prediction[0][6],3)),(40,260 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1)\n", + "\n", + " # draw extracted face in the top right corner\n", + " #frame[face_index * shape_x: (face_index + 1) * shape_x, -1 * shape_y - 1:-1, :] = cv2.cvtColor(face * 255, cv2.COLOR_GRAY2RGB)\n", + "\n", + " # 13. Annotate main image with a label\n", + " if prediction_result == 0 :\n", + " cv2.putText(frame, \"Angry\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 1 :\n", + " cv2.putText(frame, \"Disgust\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 2 :\n", + " cv2.putText(frame, \"Fear\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 3 :\n", + " cv2.putText(frame, \"Happy\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 4 :\n", + " cv2.putText(frame, \"Sad\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " elif prediction_result == 5 :\n", + " cv2.putText(frame, \"Surprise\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + " else :\n", + " cv2.putText(frame, \"Neutral\",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)\n", + "\n", + " # 5. Eye Detection and Blink Count\n", + " leftEye = shape[lStart:lEnd]\n", + " rightEye = shape[rStart:rEnd]\n", + "\n", + " # Compute Eye Aspect Ratio\n", + " leftEAR = eye_aspect_ratio(leftEye)\n", + " rightEAR = eye_aspect_ratio(rightEye)\n", + " ear = (leftEAR + rightEAR) / 2.0\n", + "\n", + " # And plot its contours\n", + " leftEyeHull = cv2.convexHull(leftEye)\n", + " rightEyeHull = cv2.convexHull(rightEye)\n", + " cv2.drawContours(frame, [leftEyeHull], -1, (0, 255, 0), 1)\n", + " cv2.drawContours(frame, [rightEyeHull], -1, (0, 255, 0), 1)\n", + "\n", + " # Compute total blinks and frequency\n", + " #if ear < thresh:\n", + " #flag += 1\n", + " #cv2.putText(frame, \"Blink\", (10, 200), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + "\n", + " #cv2.putText(frame, \"Total blinks : \" + str(flag), (40, 280 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + " #cv2.putText(frame, \"Blink Frequency : \" + str(int(flag/j)), (40, 220), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0)\n", + "\n", + " # 6. Detect Nose\n", + " nose = shape[nStart:nEnd]\n", + " noseHull = cv2.convexHull(nose)\n", + " cv2.drawContours(frame, [noseHull], -1, (0, 255, 0), 1)\n", + "\n", + " # 7. Detect Mouth\n", + " mouth = shape[mStart:mEnd]\n", + " mouthHull = cv2.convexHull(mouth)\n", + " cv2.drawContours(frame, [mouthHull], -1, (0, 255, 0), 1)\n", + "\n", + " # 8. Detect Jaw\n", + " jaw = shape[jStart:jEnd]\n", + " jawHull = cv2.convexHull(jaw)\n", + " cv2.drawContours(frame, [jawHull], -1, (0, 255, 0), 1)\n", + "\n", + " # 9. Detect Eyebrows\n", + " ebr = shape[ebrStart:ebrEnd]\n", + " ebrHull = cv2.convexHull(ebr)\n", + " cv2.drawContours(frame, [ebrHull], -1, (0, 255, 0), 1)\n", + " ebl = shape[eblStart:eblEnd]\n", + " eblHull = cv2.convexHull(ebl)\n", + " cv2.drawContours(frame, [eblHull], -1, (0, 255, 0), 1)\n", + "\n", + " cv2.putText(frame,'Number of Faces : ' + str(len(rects)),(40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, 155, 1)\n", + " cv2.imshow('Video', frame)\n", + " except :\n", + " pass\n", " \n", " if cv2.waitKey(1) & 0xFF == ord('q'):\n", " break\n", @@ -1404,6 +1652,45 @@ "cv2.destroyAllWindows()" ] }, + { + "cell_type": "code", + "execution_count": 368, + "metadata": { + "ExecuteTime": { + "end_time": "2018-12-27T11:11:01.475946Z", + "start_time": "2018-12-27T11:11:01.129845Z" + } + }, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4wLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvqOYd8AAAIABJREFUeJztnXtwY/d1378HBAmQAMFdkgC42ocoQLasRyx5w8pS7XEs61H5UamTOK3TOrYce3Y8VWy346nH6kMzcTutM+nEj9pjzY6cWInd2K4SpYpjO6IkK7XSWs6utHp4dx0tIO1LWuKC3CUJcPnE6R/3Xh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WyTmY+B+A0EV3lPHQrgKMehlTNKQA3EdGQ8/e+FQot+FZRObz+owD+t4ex1ISI7oRdJryLmZe8jqcSZn6RmRPMPOmcM2cA7Hc+o0qjlbg7iy6/C+BvYJ9M32fmX3gb1SW8A8Bvw86Ijzg/7/M6KA35FIDvENELAG4A8F89jqeMc0XxMIBnAbwI+zzyfBcjEf0ZgP8H4CoiOkNEHwfwRQC3E9HLsK84vqhgjF8DMAxg2jlfHlAsPi2RHaqCIAgGolXmLgiCIDSGiLsgCIKBiLgLgiAYiIi7IAiCgYi4C4IgGIiIuyAIgoGIuAuCIBiIiLsgCIKB/H/o+ZdN5SJpNgAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fig = plt.figure()\n", + "ax1 = fig.add_subplot(1,1,1)\n", + "\n", + "def animate(i) :\n", + " graph_data = emotion\n", + " xs = []\n", + " ys = []\n", + " for emo in graph_data:\n", + " xs.append(emo[0])\n", + " ys.append(emo[1])\n", + " ax1.clear()\n", + " ax1.plot(xs,ys)\n", + "\n", + "ani = animation.FuncAnimation(fig, animate, interval=1000)\n", + "plt.show()" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/live_face.py b/live_face.py new file mode 100644 index 0000000..b8aa696 --- /dev/null +++ b/live_face.py @@ -0,0 +1,239 @@ +### General imports ### +import numpy as np +import pandas as pd +import cv2 + +from time import time +from time import sleep +import re +import os + +import argparse +from collections import OrderedDict +import matplotlib.animation as animation + +### Image processing ### +from scipy.ndimage import zoom +from scipy.spatial import distance +import imutils +from scipy import ndimage + +import dlib +from __future__ import division + +from tensorflow.keras.models import load_model +from imutils import face_utils + +import requests + +class ModelPredict() : + + def __init__(self, path, model, image) : + self.image = image + self.path = path + self.model = model + + def detect_face(frame): + + global shape_x + global shape_y + global input_shape + global nClasses + + shape_x = 48 + shape_y = 48 + input_shape = (shape_x, shape_y, 1) + nClasses = 7 + + #Cascade classifier pre-trained model + cascPath = 'Models/face_landmarks.dat' + faceCascade = cv2.CascadeClassifier(cascPath) + + #BGR -> Gray conversion + gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) + + #Cascade MultiScale classifier + detected_faces = faceCascade.detectMultiScale(gray,scaleFactor=1.1,minNeighbors=6, + minSize=(shape_x, shape_y), + flags=cv2.CASCADE_SCALE_IMAGE) + coord = [] + + for x, y, w, h in detected_faces : + if w > 100 : + sub_img=frame[y:y+h,x:x+w] + cv2.rectangle(frame,(x,y),(x+w,y+h),(0, 255,255),1) + coord.append([x,y,w,h]) + + return gray, detected_faces, coord + + def extract_face_features(faces, offset_coefficients=(0.075, 0.05)): + gray = faces[0] + detected_face = faces[1] + + new_face = [] + + for det in detected_face : + #Region dans laquelle la face est détectée + x, y, w, h = det + #X et y correspondent à la conversion en gris par gray, et w, h correspondent à la hauteur/largeur + + #Offset coefficient, np.floor takes the lowest integer (delete border of the image) + horizontal_offset = np.int(np.floor(offset_coefficients[0] * w)) + vertical_offset = np.int(np.floor(offset_coefficients[1] * h)) + + #gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) + #gray transforme l'image + extracted_face = gray[y+vertical_offset:y+h, x+horizontal_offset:x-horizontal_offset+w] + + #Zoom sur la face extraite + new_extracted_face = zoom(extracted_face, (shape_x / extracted_face.shape[0],shape_y / extracted_face.shape[1])) + #cast type float + new_extracted_face = new_extracted_face.astype(np.float32) + #scale + new_extracted_face /= float(new_extracted_face.max()) + #print(new_extracted_face) + + new_face.append(new_extracted_face) + + return new_face + + def start_live() : + + (nStart, nEnd) = face_utils.FACIAL_LANDMARKS_IDXS["nose"] + (mStart, mEnd) = face_utils.FACIAL_LANDMARKS_IDXS["mouth"] + (jStart, jEnd) = face_utils.FACIAL_LANDMARKS_IDXS["jaw"] + + (eblStart, eblEnd) = face_utils.FACIAL_LANDMARKS_IDXS["left_eyebrow"] + (ebrStart, ebrEnd) = face_utils.FACIAL_LANDMARKS_IDXS["right_eyebrow"] + + model = load_model('Models/video.h5') + #Lancer la capture video + video_capture = cv2.VideoCapture(0) + + while True: + # Capture frame-by-frame + ret, frame = video_capture.read() + + face_index = 0 + + gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) + rects = face_detect(gray, 1) + #gray, detected_faces, coord = detect_face(frame) + + for (i, rect) in enumerate(rects): + + shape = predictor_landmarks(gray, rect) + shape = face_utils.shape_to_np(shape) + + # Identify face coordinates + (x, y, w, h) = face_utils.rect_to_bb(rect) + face = gray[y:y+h,x:x+w] + + #Zoom on extracted face + face = zoom(face, (shape_x / face.shape[0],shape_y / face.shape[1])) + + #Cast type float + face = face.astype(np.float32) + + #Scale + face /= float(face.max()) + face = np.reshape(face.flatten(), (1, 48, 48, 1)) + + #Make Prediction + prediction = model.predict(face) + prediction_result = np.argmax(prediction) + + # Rectangle around the face + cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2) + + cv2.putText(frame, "Face #{}".format(i + 1), (x - 10, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2) + + for (j, k) in shape: + cv2.circle(frame, (j, k), 1, (0, 0, 255), -1) + + # 1. Add prediction probabilities + cv2.putText(frame, "----------------",(40,100 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0) + cv2.putText(frame, "Emotional report : Face #" + str(i+1),(40,120 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0) + cv2.putText(frame, "Angry : " + str(round(prediction[0][0],3)),(40,140 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0) + cv2.putText(frame, "Disgust : " + str(round(prediction[0][1],3)),(40,160 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 0) + cv2.putText(frame, "Fear : " + str(round(prediction[0][2],3)),(40,180 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1) + cv2.putText(frame, "Happy : " + str(round(prediction[0][3],3)),(40,200 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1) + cv2.putText(frame, "Sad : " + str(round(prediction[0][4],3)),(40,220 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1) + cv2.putText(frame, "Surprise : " + str(round(prediction[0][5],3)),(40,240 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1) + cv2.putText(frame, "Neutral : " + str(round(prediction[0][6],3)),(40,260 + 180*i), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 155, 1) + + # 2. Annotate main image with a label + if prediction_result == 0 : + cv2.putText(frame, "Angry",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) + elif prediction_result == 1 : + cv2.putText(frame, "Disgust",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) + elif prediction_result == 2 : + cv2.putText(frame, "Fear",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) + elif prediction_result == 3 : + cv2.putText(frame, "Happy",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) + elif prediction_result == 4 : + cv2.putText(frame, "Sad",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) + elif prediction_result == 5 : + cv2.putText(frame, "Surprise",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) + else : + cv2.putText(frame, "Neutral",(x+w-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) + + # 3. Eye Detection and Blink Count + leftEye = shape[lStart:lEnd] + rightEye = shape[rStart:rEnd] + + # Compute Eye Aspect Ratio + leftEAR = eye_aspect_ratio(leftEye) + rightEAR = eye_aspect_ratio(rightEye) + ear = (leftEAR + rightEAR) / 2.0 + + # And plot its contours + leftEyeHull = cv2.convexHull(leftEye) + rightEyeHull = cv2.convexHull(rightEye) + cv2.drawContours(frame, [leftEyeHull], -1, (0, 255, 0), 1) + cv2.drawContours(frame, [rightEyeHull], -1, (0, 255, 0), 1) + + # 4. Detect Nose + nose = shape[nStart:nEnd] + noseHull = cv2.convexHull(nose) + cv2.drawContours(frame, [noseHull], -1, (0, 255, 0), 1) + + # 5. Detect Mouth + mouth = shape[mStart:mEnd] + mouthHull = cv2.convexHull(mouth) + cv2.drawContours(frame, [mouthHull], -1, (0, 255, 0), 1) + + # 6. Detect Jaw + jaw = shape[jStart:jEnd] + jawHull = cv2.convexHull(jaw) + cv2.drawContours(frame, [jawHull], -1, (0, 255, 0), 1) + + # 7. Detect Eyebrows + ebr = shape[ebrStart:ebrEnd] + ebrHull = cv2.convexHull(ebr) + cv2.drawContours(frame, [ebrHull], -1, (0, 255, 0), 1) + ebl = shape[eblStart:eblEnd] + eblHull = cv2.convexHull(ebl) + cv2.drawContours(frame, [eblHull], -1, (0, 255, 0), 1) + + cv2.putText(frame,'Number of Faces : ' + str(len(rects)),(40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, 155, 1) + cv2.imshow('Video', frame) + + if cv2.waitKey(1) & 0xFF == ord('q'): + break + + # When everything is done, release the capture + video_capture.release() + cv2.destroyAllWindows() + +if __name__ == "__main__": + import sys + if len(sys.argv) is not 3: + print("Usage: python google_drive.py drive_file_id destination_file_path") + else: + # TAKE ID FROM SHAREABLE LINK + file_id = sys.argv[1] + # DESTINATION FILE ON YOUR DISK + destination = sys.argv[2] + download_file_from_google_drive(file_id, destination) +