{"id":16278808,"url":"https://github.com/anindyadeep/yogaposegnn","last_synced_at":"2025-07-30T00:36:47.312Z","repository":{"id":65295096,"uuid":"465817676","full_name":"Anindyadeep/YogaPoseGNN","owner":"Anindyadeep","description":"When real time Yoga Position classification meets GNN","archived":false,"fork":false,"pushed_at":"2023-09-17T03:33:43.000Z","size":39801,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T08:51:27.173Z","etag":null,"topics":["computer-vision","deep-learning","graph-machine-learning","neural-network","pytorch","pytorch-geometric"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anindyadeep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-03T17:23:24.000Z","updated_at":"2024-12-26T08:24:27.000Z","dependencies_parsed_at":"2024-10-27T21:54:20.911Z","dependency_job_id":null,"html_url":"https://github.com/Anindyadeep/YogaPoseGNN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Anindyadeep/YogaPoseGNN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anindyadeep%2FYogaPoseGNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anindyadeep%2FYogaPoseGNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anindyadeep%2FYogaPoseGNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anindyadeep%2FYogaPoseGNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anindyadeep","download_url":"https://codeload.github.com/Anindyadeep/YogaPoseGNN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anindyadeep%2FYogaPoseGNN/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267785895,"owners_count":24144124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","deep-learning","graph-machine-learning","neural-network","pytorch","pytorch-geometric"],"created_at":"2024-10-10T19:00:06.146Z","updated_at":"2025-07-30T00:36:47.284Z","avatar_url":"https://github.com/Anindyadeep.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **YogaPoseGNN** \n\n![Alt Text](Images/warrior-result_2IogI1xJ.gif)\n\n[GIF credits](https://www.youtube.com/watch?v=k4qaVoAbeHM\u0026ab_channel=Howcast). This is another kinda same project done and made on the top of [SignLangGNN](https://github.com/Anindyadeep/SignLangGNN). But this project is much more robust and accurate and can perform real time Yoga position classification using Graph Neural Networks. The best part of this project is that the CPU utlization. As its just using some pixel co-ordinate changes in the video. Also Graph neural networks are emerging more and more in several aspects of computer vision. So this problem is framed as a graph classification problem. I used a simple two Graph Attention layers and a softmax classifier as the network architecture. In just 20 epochs it gives an accuracy of `0.91` and `0.89` of train and test accuracy respectively. `Better than the previous versions`.\n\n---\n\n## **Contents**\n\n1. [ Running the project locally ](#run_project_locally)\n2. [ How to train a new model or retrain the existing model ](#re_train_model)\n3. [ Results ](#results)\n4. [ Improvements after version 1.0 release ](#improvements)\n5. [ Future Works ](#future_works)\n\n---\n\n\u003ca name=\"run_project_locally\"\u003e\u003c/a\u003e\n## **Running the project Locally**\n\n### **Using Docker**\n\nThe docker image is been released in [**DockerHub**](https://hub.docker.com/repository/docker/anindyadeep/yoga_pose_gnn) 🥳\n```bash\n$ docker run --privileged --device=/dev/video0:/dev/video0 anindyadeep/yoga_pose_gnn:master-3e72318\n```\n\n### **Cloning the repo and building the image**\n\nYou can clone the project using:\n```bash\n$ git clone https://github.com/Anindyadeep/YogaPosGNN.git\n```\nAnd after that if you want to run the build the docker image locally and then run the following.\n\n```bash\n$ docker build -t \u003cimage_name\u003e .\n$ docker run --privileged --device=/dev/video0:/dev/video0 \u003cimage_name\u003e\n```\n\nJust replace the `\u003cimage name\u003e` with the any arbitary name for e.g. `test_image`.\nproviding OS and camera privilages are very much important, so we need to use the additional commands, otherwise, you might not use video based results. \n\n----\n\n### **Runing the project using python**\n\nThis project is using **OpenCV**, **PyTorch**, **PyTorch Geometric**, and **mediapipe**.\n\nFirst clone the project repo. Create a new environment using `conda` or `virtualenv`. Once created, you need to install the following packages. First checkout the whether you have cuda installed in your system or not. Based on that go to the **[PyTorch's](https://pytorch.org/)** website and intall PyTorch. Once done, move over to **[PyTorch Geometric's](https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html)**. Be careful while installing the packages. Make sure you install the current version. \n\nInstall opencv, tensorflow and mediapipe as follows:\n\n```bash\n\n$ pip install mediapipe\n$ pip install opencv-python\n\n```\n\nOr you can directly install this if you want to use CPU but not cuda and compatible with this application package versions. \n\n```bash\n$ pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu\n$ pip3 install torch-scatter torch-sparse torch-cluster \\\n  torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.12.0+cpu.html\n$ pip3 install mediapipe streamlit opencv-python \n```\n\nOnce all the required libraries are installed properly, then there are different ways in which you can run this project. If you just want to run the project using simply web cam then run this command\n\n```bash\n$ python3 run.py\n```\n\nIf you want to run a sample video file, the at first save the video in the `Sample_video` folder and suppose the video name `Warrior2.mp4` then for running that for that specific file, just run this commmand.\n\n```\n$ python3 run.py  --vid_name Warrior2.mp4\n```\n\nIf you want to save the results the just add one more argument like this:\n\n```\n$ python3 run.py  --vid_name Warrior2.mp4 --save_as warrior_result.mp4\n```\nThis will save the resultant video on the directory: `Video_result` automatically.\n\n**Running the results in streamlit Local host.**\n\nFor running the app in local host using streamlit just type.\n\n```bash\n$ streamlit run app.py\n```\nAnd this will run the webapp on the localhost\n\n\n----\n\n\n\u003ca name=\"re_train_model\"\u003e\u003c/a\u003e\n## **How to train a new model or retrain the existing model**\n\nIn order to do that, the run this scipt:\n```py\n\nimport torch\nimport torch_geometric \n\nfrom src.yoga_pos_train import YogaPoseTrain\nfrom Models.base_gnn_model import Model \n\nyoga_train = YogaPoseTrain()\ntrain_loader =  yoga_train.load_data_loader(\"train_data.csv\")\ntest_loader = yoga_train.load_data_loader(\"test_data.csv\")\n\n# either retrain the base model using this\n\nmodel = Model(3, 64, 16, 5)\n\n# or make a new Graph Model and use that\n\ncriterion = torch.nn.CrossEntropyLoss()\noptimizer = torch.optim.Adam(model.parameters(), lr=0.01)\n\nyoga_train.train(model, criterion, optimizer, 30, train_loader, test_loader)\n```\n\nThis will train the model and will save the weights on the `saved_models` directory. \n\n---\n\n\u003ca name=\"results\"\u003e\u003c/a\u003e\n## **Results**\n\nIntial results of the model is pretty good based on the fact it has relatively less training data as its just 250 images (per class). After training the model is giving a train accuracy of `0.89` and a test accuracy of `0.91`. This could be improved by improving the model and adding edge features also. This model is also using limited nodes, as I did't add the face and the palm nodes, in order to make it more realistic. \n\n---\n\n\u003ca name=\"improvements\"\u003e\u003c/a\u003e\n## **Improvements done after release of version 1.0**\n\n**Software improvements**\n\n1. Improved the docker file and solved the issue of streamlit port problem\n2. Set up GitHub actions. Implemented CI/CD pipeline for docker. So every merge to `main` branch will result in improvement in the docker image directly in the DockerHub.\n\n**ML Model Improvements**\n\n1. Minor changes in model, tweaked some hyper parameters and implemented BatchNorm. \n2. GraphAttention Conv increased it's test accuracy by 2 %\n\n---\n\n\u003ca name=\"future_works\"\u003e\u003c/a\u003e\n## **Future Works**\n\nCurrently there are some issues both interms of the Software infrastructure and the AI model. Both of them has a great scope of developement. Some of the works that are currently taking place and can be done in future are listed below. \n\n**Improvements based on software developement**\n\n1. Implementing better CI/CD pipeline that will directly deploy the docker image to DockerHub and required changes to Heroku.\n\n2. Solving the problem of providing OS privilages like camera acess to the user while running on heroku. \n\n**Model based future works and potential improvements**\n\n1. Finding a proper video based dataset providing different actions of Yoga poses. \n2. Implemeting Attention based TGN models for better and much robust performance. \n3. Implementing a mechanism, that will help the user through guiding the switch between one pose to another pose.\n4. An AI based yoga assitant that will asses how much better the user is doing all the poses and what can be done. This can be potentially done by fusing NLP, XAI and Existing Approaches of Computer Vision and Graph ML.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanindyadeep%2Fyogaposegnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanindyadeep%2Fyogaposegnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanindyadeep%2Fyogaposegnn/lists"}