Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66b5edb

Browse files
Added mode feedback
1 parent c53c427 commit 66b5edb

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

Prototype_2_Electric_Boogalooo.ipynb

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"colab": {
66
"provenance": [],
77
"mount_file_id": "1YJfEK8zha4PfUk2yP9y-XbO4vtmn83gE",
8-
"authorship_tag": "ABX9TyPqC8aZOBxrn5vwvNxHoub4",
8+
"authorship_tag": "ABX9TyPf94t3YgjtLkVRDYA222aU",
99
"include_colab_link": true
1010
},
1111
"kernelspec": {
@@ -107,7 +107,8 @@
107107
"import os\n",
108108
"import glob\n",
109109
"import csv\n",
110-
"import warnings"
110+
"import warnings\n",
111+
"from statistics import mode"
111112
],
112113
"metadata": {
113114
"id": "whZwvEdKIksm"
@@ -278,7 +279,7 @@
278279
"metadata": {
279280
"id": "RHyJwan8acCz"
280281
},
281-
"execution_count": null,
282+
"execution_count": 17,
282283
"outputs": []
283284
},
284285
{
@@ -297,18 +298,18 @@
297298
],
298299
"metadata": {
299300
"id": "Zng2DvUJcJjc",
300-
"outputId": "5e773745-adb7-45d0-fbf6-dc47ad96e633",
301+
"outputId": "06119dd8-3a96-4a01-ef98-a102e9126ca7",
301302
"colab": {
302303
"base_uri": "https://localhost:8080/"
303304
}
304305
},
305-
"execution_count": null,
306+
"execution_count": 18,
306307
"outputs": [
307308
{
308309
"name": "stdout",
309310
"output_type": "stream",
310311
"text": [
311-
"What model to use? heavy\n"
312+
"What model to use? (lite/heavy)heavy\n"
312313
]
313314
}
314315
]
@@ -332,10 +333,23 @@
332333
" vid_path = root_path + '/Fit Form AI Resources/Videos/'"
333334
],
334335
"metadata": {
335-
"id": "brFyKQV5aEuK"
336+
"id": "brFyKQV5aEuK",
337+
"outputId": "29211e6f-c1d4-4e2c-dffe-618c5ebbab0e",
338+
"colab": {
339+
"base_uri": "https://localhost:8080/"
340+
}
336341
},
337-
"execution_count": null,
338-
"outputs": []
342+
"execution_count": 19,
343+
"outputs": [
344+
{
345+
"name": "stdout",
346+
"output_type": "stream",
347+
"text": [
348+
"Would you like to record and save the video you create below? (Y / N)\n",
349+
"Y\n"
350+
]
351+
}
352+
]
339353
},
340354
{
341355
"cell_type": "code",
@@ -349,7 +363,7 @@
349363
"if record:\n",
350364
" out_video = cv.VideoWriter(vid_path + time.asctime(time.localtime()) + '.mp4',cv.VideoWriter_fourcc(*'DIVX'), 24, (640, 480))\n",
351365
"landmarks_list = []\n",
352-
"feedback_list = [\"\"]\n",
366+
"feedback_list = []\n",
353367
"selected_exercise = input(\"What exercise are you tracking?\\n\")\n",
354368
"\n",
355369
"\n",
@@ -371,9 +385,8 @@
371385
" # print(\"Frame\", timestamp_ms)\n",
372386
" working_dstruct = lm_dstruct(landmarks_list[-1])\n",
373387
" feedback_temp = working_dstruct.feedback(selected_exercise)\n",
374-
" if feedback_list[-1] != feedback_temp:\n",
375-
" print(feedback_temp)\n",
376388
" feedback_list.append(feedback_temp)\n",
389+
" print(mode(feedback_list[-1:-4:-1]) if len(feedback_list) > 2 else feedback_temp)\n",
377390
" if record:\n",
378391
" out_video.write(annotated_image)\n",
379392
"\n",
@@ -535,4 +548,4 @@
535548
"outputs": []
536549
}
537550
]
538-
}
551+
}

0 commit comments

Comments
 (0)