{"id":18016511,"url":"https://github.com/nikhil25803/count-reps","last_synced_at":"2026-05-08T03:42:35.638Z","repository":{"id":109395301,"uuid":"592877735","full_name":"nikhil25803/count-reps","owner":"nikhil25803","description":"A customizable computer vision application to count different exercise reps with database support to track data.","archived":false,"fork":false,"pushed_at":"2023-01-24T19:36:50.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T00:03:50.603Z","etag":null,"topics":["computer-vision","mediapipe","opencv","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikhil25803.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-01-24T18:20:43.000Z","updated_at":"2025-03-17T03:12:48.000Z","dependencies_parsed_at":"2023-04-09T10:34:12.636Z","dependency_job_id":null,"html_url":"https://github.com/nikhil25803/count-reps","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nikhil25803/count-reps","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil25803%2Fcount-reps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil25803%2Fcount-reps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil25803%2Fcount-reps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil25803%2Fcount-reps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikhil25803","download_url":"https://codeload.github.com/nikhil25803/count-reps/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil25803%2Fcount-reps/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281074971,"owners_count":26439564,"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-10-26T02:00:06.575Z","response_time":61,"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","mediapipe","opencv","python3"],"created_at":"2024-10-30T04:18:19.657Z","updated_at":"2025-10-26T08:17:09.874Z","avatar_url":"https://github.com/nikhil25803.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Count Reps\n\nA customizable computer vision application that helps you track and count the reps during the exercises like sit-ups, push-ups, dumble presses, and other exercises. With the support of a database, you can even keep a track of your data. \n\n## Tech stack\n![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54) ![OpenCV](https://img.shields.io/badge/opencv-%23white.svg?style=for-the-badge\u0026logo=opencv\u0026logoColor=white) ![SQLite](https://img.shields.io/badge/sqlite-%2307405e.svg?style=for-the-badge\u0026logo=sqlite\u0026logoColor=white)\n\n## Project Setup\n+ Clone the repository\n```bash\nhttps://github.com/nikhil25803/count-reps.git\n```\n\n+ Create and activate a virtual environment\n```bash\npython -m venv env\n```\n\n```bash\nenv\\scripts\\activate\n```\n\n+ Install the dependencies\n```\npip install -r requirements.txt\n```\n\n## Folder Structure\n```\ncount-reps\n│   \n└───📂database\n│   │   database.py   \n│   │   functions.py  \n│   │   models.py \n│   │ \n📄.gitignore\n📄LICENCE\n📄main.py\n📄README.md\n📄pose_detection.py\n📄helpers.py\n📄requirements.txt\n```\n\nBy default, the application is programmed to count the number of knee bends, useful in ortho exercise. \n\n## Run the program\n```bash\npython main.py\n```\nA window will appear at first as a test, close that for now by pressing `q`, and then the database will automatically get connected (you'll notice, a `database db` file is now created in the root directory of the project) which is responsible for storing a user's data. It will keep counting your reps and will store them in the database once it quits.\n\n\nExample ...\n\n\n![image](https://user-images.githubusercontent.com/93156825/214383344-fc1a251f-17d1-450f-a849-bc1ca0cb2ad6.png)\n\n-----\n\n## Want to customize it? \nHere's how you can do it ... 👀\n\nThis is an image of the landmark model in `MediaPipe` Pose predicts the location of **33** pose landmarks\n\n![image](https://user-images.githubusercontent.com/93156825/214391266-479fad06-23e5-43f0-8ee8-c53a7b5e3a45.png)\n\n\nIn the `/pose_detection.py`, change the `landmarks` accordingly from the picture above\n```python\nlandmarks = results.pose_landmarks.landmark\n                ankle = [\n                    landmarks[mp_pose.PoseLandmark.LEFT_ANKLE.value].x,\n                    landmarks[mp_pose.PoseLandmark.LEFT_ANKLE.value].y,\n                ]\n                knee = [\n                    landmarks[mp_pose.PoseLandmark.LEFT_KNEE.value].x,\n                    landmarks[mp_pose.PoseLandmark.LEFT_KNEE.value].y,\n                ]\n                hip = [\n                    landmarks[mp_pose.PoseLandmark.LEFT_HIP.value].x,\n                    landmarks[mp_pose.PoseLandmark.LEFT_HIP.value].y,\n                ]\n```\n\nFor example, you want to count the number of biceps reps, then change it to **11**, **13** and **15** that is `LEFT_SHOULDER`, `LEFT_ELBOW`, and `LEFT_WRIST`  respectively.\n\nThe angle will be calculated corresponding to the one which is defined in the center by the formula\n```python\n# /helpers.py\n\ndef calculate_angles(a, b, c):\n    a = np.array(a)\n    b = np.array(b)\n    c = np.array(c)\n\n    radians = np.arctan2(c[1] - b[1], c[0] - b[0]) - np.arctan2(\n        a[1] - b[1], a[0] - b[0]\n    )\n    angle = np.abs(radians * 180.0 / np.pi)\n\n    if angle \u003e 180.0:\n        angle = 360 - angle\n\n    return angle\n```\n\nIn the same `/pose_detection.py`, you can define the angle beyond which you want to trigger the counter\n```python\nif angle \u003e 140:\n    stage = \"straight\"\n    if angle \u003c 140 and stage == \"straight\":\n        stage = \"bend\"\n        count += 1\n```\n\nAnd that's it, the model is now customized as per your requirements 🍻\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhil25803%2Fcount-reps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikhil25803%2Fcount-reps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhil25803%2Fcount-reps/lists"}