diff --git a/IMG/Mesa de trabajo 2.png b/IMG/Mesa de trabajo 2.png new file mode 100644 index 0000000..03a0d6a Binary files /dev/null and b/IMG/Mesa de trabajo 2.png differ diff --git a/IMG/Video_1.gif b/IMG/Video_1.gif new file mode 100644 index 0000000..ab2d17a Binary files /dev/null and b/IMG/Video_1.gif differ diff --git a/README.md b/README.md index 2e96cf7..de00ba1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ In this repository you'll find: - `ML_Sequence_Recognition.ipynb` a Jupyter notebook with all the steps since the data collection and treatment to the training and real-time predictions - `Real_Time_Pred.py` a python file with just the predictions in real time, in case you just want to test how it works - `actions.h5` the model already trained -- `IMGS` folder, with the images for this documentation +- `IMG` folder, with the images for this documentation - `CSVs` for you to see how the data will look like during it's collection and treatment ## References @@ -30,9 +30,23 @@ In this part I'm going to walk you through the different steps followed by my co ### 1st step: Get your data -To be able to detect sequences the first part will be to know where to extract them from. For that you'll need a video. I highly recommend a high quality video where the light is good so the hands and body recognition will work best. +Before starting, the first thing to do is to install and import the used dependencies. The first two blocks of the code will do that. We will mediapipe to detect all the points on our hands and body, Opencv to access the camera or video and pandas, numpy and matplotlib to prepare our data. Later we will install our dependencies for the training. + +After installing and importing, if our goal is to be able to detect sequences the follow up part will be to know where to extract them from. For that you'll need a video. I highly recommend a high quality video where the light is good so the hands and body recognition will work best. If not the script is sited up for you to use your webcam, just as I did for the example of this repo. + +The first big block of code (Cell 3) will make sure that your laptop can access your camera and draw the landmarks generated by mediapipe. The landmarks generated will be all the points detected in hands and body (Additionally you can also detect the points of your face, as I haven't made use of them here I haven't included them but if you're interested I recommend you to check on the mediapipe documentation). Once you test that the camera is working press `q` to exit the video. + +***NOTE:** A common error will be that executing the cell gives you an error or opens up a camera you don't want to use, if this happens try to change the number on `cap = cv2.VideoCapture(0)` as depending on the cameras set up on your computer the number will be different. (On my MacBook number `0` corresponds to my webcam) + +![](/Users/jorgemuyo/Desktop/ML_Craftsmanship/IMG/Video_1.gif) + +Next up you'll record your video on Cell 4. If you have your video already recorded go straight to the next Cell. Cell 4 will be similar to cell 3 but this one won't show the landmarks of mediapipe. Here you will need to do the movements you want to capture. In other to use them for machine learning you will have to repeat them a bunch of times in the right and wrong way (In my test I captured two different movements and inside of each I captured around 30 times each way(right and wrong)). If you want to detect more than one movement right and wrong I will recommend to re-execute the cell and save different videos for different movements so that way can be more organized, even though it will work fine if it's just with one video. + +Here's and schematic of how I recommend to do the video capturing so it will be easier to work with that later: + +![](/Users/jorgemuyo/Desktop/ML_Craftsmanship/IMG/Mesa de trabajo 2.png) + -The first part of the code will consist on the collection of your data. The code allows you to record your own video wit your laptop webcam (or any other camera connected to your laptop) or if you already have a video