Build a Personal AI Trainer | OpenCV Python | Computer Vision
Vložit
- čas přidán 29. 05. 2024
- In this project, we will be building an AI Trainer using OpenCV and Python. We will use the pose estimation running on the CPU to find the correct points and using these points we will get the desired angles. Then based on these angles we find many gestures including the number of biceps curls. We will write the code in a way that you will be able to find angles between any 3 points with just a single line of code.
🚀🚀 My Urdu/Hindi AI CZcams Channel 🚀🚀
/ @murtazahassan01
Download Code:
www.computervision.zone/cours...
Premium Courses:
✔️ Computer Vision Game Development Course:
bit.ly/3ttLZ2s
✔️ Computer Vision with Arduino Course:
bit.ly/3wzLB4m
✔️ Advanced Drone Programming Course:
bit.ly/3qs3v5g
✔️ Learn to Build Computer Vision Mobile Apps:
bit.ly/3uioY1J
✔️ Jetson Nano Premium Course:
bit.ly/3L8uIlF
⚙️⚙️⚙️--My Gear - ⚙️⚙️⚙️
👉 Complete Gear 💈: www.computervision.zone/tech-...
👉 My PC Specs 🖥️: www.computervision.zone/tech-...
👉 My Video Shooting Gear📽️ : www.computervision.zone/tech-...
👉 My Laptops 💻: www.computervision.zone/tech-...
👉 Educational Products🧑🎓: www.computervision.zone/tech-...
👉 CZcams Starter Kit 🔴: www.computervision.zone/tech-...
Follow Me:
TikTok: bit.ly/3Vo76OQ
Facebook Group: bit.ly/3irDcb7
Discord: bit.ly/3JvyxAM
Facebook Page: bit.ly/3IvpU7W
Instagram : bit.ly/3NdGME3
Website: bit.ly/3ICFTS0
Github: bit.ly/3woU6PS
#ComputerVision
#OpenCV
#CVZone
Yesterday I watched your previous video with basics of point detection because I needed that knowlege... for my workout auto tracker app :DD Today I got this in my recomended videos and I was like "is he reading my mind or what?" :D You just did a massive amount of work for me by sharing this awesome video! Many thanks! Cherry on top would be also showing the code for webcam, but I will figure it out myself ;) You're the boss! ;)
I didn't find the video, can you please send it
Really cool was waiting for this from a long time 👌
This is the best free stuff on youtube IMO
A SMALL CORRECTION TO THIS WONDERUL WORK: Elbow range of motion starts at 0 with arm stretched and goes all the way to 150 with final flexion.
Murtaza's Workshop - Robotics and AI
NIIICEEEE
bro do u know where to download that posemodule?
Simple and excellent, congrats brooo
Great work!! Can we extend it to real weightlifting with pose correction part? That would be very helpful.
Great work. Very helpful.
Is this video compatible with your mobile app course?
Meaning:
I want to create mobile apps that give live angle measurements.
This tutorial was great but is it possible to use these libraries on unity?
Omg !! This is really amazing 😉
What code can be added to draw the arc of the angle as shown on the thumbnail picture. The drawn arc should follow the position of the knee or elbow and I’d like it to work with a video file or webcam feed. Thanks for your great work and contribution!
This is Awesome! how can we use the model and train and Neural Net to classify which exercise is being done?
Excellent! Thanks!
Excellent video!
thank you sir supp video lots of learning 👍
Another excellent video
Awesome video, Perfect
How did you accomplish to round it to just 2 numbers when it displays the angle?? it shows a long string of numbers?
Congratulations 105k
I've learned lot of things from this video. Thanks. btw your voice is cool.
is your code running??
Yes.@@harshupadhyay964
Can you provide the link of images and videos, which you used in this tutorial
Most amazing
How can I access the angles for the right arm as I have written like this `right_arm=detector.findAngle(frame,12,14,16)`, the value of right_arm is not accessible, how can I access it?
Is it possible to make the app to realise if someone is doing the exercises correctly, and furthermore to advice you?
I Will make this app
@@pedrovic12 good idea, let me know how it goes plz.
@@pedrovic12bro is it started
great!!!
Can this project be implemented as a mobile application?
Is it possible to implement in real life exercise?
how much time I can join and start commenting in Discord? I have been agreeing to the rules in the server-rules
Can you please make something for jumping jacks as well?
FYI - in 2022 the latest version of mediapipe has an additional input for the pose constructor called "model_complexity". The code for PoseModule in this video won't work unless this input is added to the poseDetector constructor (__init__ method).
ty buddy
thats why give (modelComplex=1) in __init__() and declare it in method
PLEASE HELP:
File "C:\Users\Mehdi\Desktop\PYTHON GAMES\Personal Trainer\PoseModule.py", line 102, in
main()
File "C:\Users\Mehdi\Desktop\PYTHON GAMES\Personal Trainer\PoseModule.py", line 81, in main
detector = poseDetector()
File "C:\Users\Mehdi\Desktop\PYTHON GAMES\Personal Trainer\PoseModule.py", line 25, in _init_
self.pose = self.mpPose.Pose(self.mode, self.upBody, self.smooth,
File "C:\Users\Mehdi\AppData\Local\Programs\Python\Python310\Lib\site-packages\mediapipe\python\solutions\pose.py", line 146, in _init_
super().__init__(
File "C:\Users\Mehdi\AppData\Local\Programs\Python\Python310\Lib\site-packages\mediapipe\python\solution_base.py", line 289, in _init_
self._input_side_packets = {
File "C:\Users\Mehdi\AppData\Local\Programs\Python\Python310\Lib\site-packages\mediapipe\python\solution_base.py", line 290, in
name: self._make_packet(self._side_input_type_info[name], data)
File "C:\Users\Mehdi\AppData\Local\Programs\Python\Python310\Lib\site-packages\mediapipe\python\solution_base.py", line 592, in _make_packet
return getattr(packet_creator, 'create_' + packet_data_type.value)(data)
TypeError: create_bool(): incompatible function arguments. The following argument types are supported:
1. (arg0: bool) -> mediapipe.python._framework_bindings.packet.Packet
@@adityapanigrahi892 please how to fix problem?
Hi, thank you for the awesome tutorial! Can i know why does the angle reach up to 300+ when it is clearly seen that the arms can only do up till 180? Is there any way to fix this? I'm trying to do a similar solution but only using the angle as an indicator so this is quite problematic for me
my first time coding bu t how about the the fist angel reaches 180 it disappear and a new 180 angel appear completing the 360
you're taking the external angle. Shift the first and third points with each other and you'll get angles between 0 and 180
Top!!!
V.good 🙋
Really nice tutorial. I am having little fps issues while running on GPU though, how can I run this on my GPU. I have Ryzen 5 4000 series in CPU and Nvidia 1650ti on GPU
check out his latest tutorial on running 60fps real time object detection on gpu
Could you please make a video on mask-rcnn and detectron2
can you make a fight detection system
what do i have to do to run it on gpu ??
Great tutorial...has anyone actually launched an app to do this? Raeda AI and Altiz AI are ongoing projects with no ETA...
Bro ur using mediapipe for android app
Do you create fitness apps for trainers to use for their clients
How to do i get the image and video you using
good
what text editor do you use?
that's pycharm
🔥🔥🔥
Hi, I am encountering this error. What should I do?
Traceback (most recent call last):
File "d:\filepath\AITrainer.py", line 8, in
detector = pm.poseDetector()
File "d:\filepath\PoseModule.py", line 20, in __init__
self.pose = self.mpPose.Pose(self.mode, self.upBody, self.smooth,
File "d:\filepath\lib\site-packages\mediapipe\python\solutions\pose.py", line 146, in __init__
super().__init__(
File "d:\filepath\lib\site-packages\mediapipe\python\solution_base.py", line 289, in __init__
self._input_side_packets = {
File "d:\filepath\lib\site-packages\mediapipe\python\solution_base.py", line 290, in
name: self._make_packet(self._side_input_type_info[name], data)
File "d:\filepath\lib\site-packages\mediapipe\python\solution_base.py", line 592, in _make_packet
return getattr(packet_creator, 'create_' + packet_data_type.value)(data)
TypeError: create_bool(): incompatible function arguments. The following argument types are supported:
1. (arg0: bool) -> mediapipe.python._framework_bindings.packet.Packet
Invoked with: 0.5
👍
i am facing the same problem
@@guddu2400 me too, can someone help me please ?
In PoseModule.py, modify the code as follows:
def __init__(self, mode=False, model_complexity=1, smooth_landmarks=True, upBody=False, smooth=True,
detectionCon=0.5, trackCon=0.5):
self.mode = mode
self.model_complexity=model_complexity #Added
self.smooth_landmarks=smooth_landmarks #Added
self.upBody = upBody
self.smooth = smooth
self.detectionCon = detectionCon
self.trackCon = trackCon
self.mpDraw = mp.solutions.drawing_utils
self.mpPose = mp.solutions.pose
self.pose = self.mpPose.Pose(self.mode,
self.model_complexity, self.smooth_landmarks,
self.upBody, self.smooth,
self.detectionCon, self.trackCon)
@@jajavidup sir, can you help me to create this project??
@@harshupadhyay964 You can start with this simplified code; it works
import cv2
import mediapipe as mp
mp_drawing = mp.solutions.drawing_utils
mp_pose = mp.solutions.pose
cap = cv2.VideoCapture("video_0002.mp4")
#para streaming
#cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
with mp_pose.Pose(static_image_mode=False) as pose:
while True:
ret, frame = cap.read()
if ret == False:
break
#Para streaming invertir los fotogramas
#frame = cv2.flip(frame, 1)
height, width, _ = frame.shape
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
results = pose.process(frame_rgb)
if results.pose_landmarks is not None:
mp_drawing.draw_landmarks(frame, results.pose_landmarks,
mp_pose.POSE_CONNECTIONS,
mp_drawing.DrawingSpec(color=(128, 0, 250),thickness=2, circle_radius=3),
mp_drawing.DrawingSpec(color=(255, 255, 255), thickness=2))
cv2.imshow("Frame", frame)
if cv2.waitKey(1) & 0xFF == 27:
break
cap.release()
cv2.destroyAllWindows()
Bro can you please make a video on AI personal assistant.
Boss 🙏🏻🙏🏻🙏🏻
Personal** (thumbnail)
Great video! :)
Error while importing mediapipe library:Please help me
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/HumanPoseEstimation/main.py", line 3, in
import mediapipe as mp
File "C:\Users\Administrator\PycharmProjects\pythonProject\venv\lib\site-packages\mediapipe\__init__.py", line 16, in
from mediapipe.python import *
File "C:\Users\Administrator\PycharmProjects\pythonProject\venv\lib\site-packages\mediapipe\python\__init__.py", line 17, in
from mediapipe.python._framework_bindings import resource_util
ImportError: DLL load failed while importing _framework_bindings: The specified module could not be found.
You need to make a filename with the name *mediapipe.py*
I had the same error, it changed when I used python 3.8
Thank you. I will try
@@kongaaiguru I had the same problem. It helped me pip install msvc-runtime
where is the previous video??
OMG THIS IS SOME QUALITY STUFF
Hi can this run well real time ?
And do you know if it’d still run well if there are multiple people in the frame?
Use: *cam = cv2.VideoCapture(0)* insted of: *cam = cv2.VideoCapture("VideoPath")* for RealTime Detection. You could use that for more than one people but the bar won't work if you would do it with many people.
can you send to me the video of the person and the image?
please
Is this possible to make in a mobile app
Yes flutter supports opencv so you can do it using that
can you please provide links to the files used in this video? Your website only seems to have code files. Also please post a link to the video you were referencing as a prerequisite in the description.
me too ,please, thank you!
i think you want this video czcams.com/video/brwgBf6VB0I/video.html
@@varngupta1695 can u plz explain me why u are providing the link of the this video we need files in this video as on the site it's showing that link not found
@@JatinderSingh-ki9hi read 2nd part of his comment
@@varngupta1695I m not able to understand can u plz explain?
17:55 I thought Murtaza is going to refactor the code.
does this work on mac
Where we can include the webcams I'd
Use: *cam = cv2.VideoCapture(0)* insted of: *cam = cv2.VideoCapture("VideoPath")*
How can I install the posemodule library?
its not a library, its a module he created in previous video (czcams.com/video/brwgBf6VB0I/video.html)
Can anyone plzz share me the previous video where to execute the showing code from starting
czcams.com/video/brwgBf6VB0I/video.html
@@murtazasworkshop Hi Boss, please can you help me, i have many errors, can not fix it !
hey murtaza its time to opencv for C#,PLEASEEEE
For Running example pls
Sir for left hand its going 180 to 0 for right hand its going 180 to 360 how can a i deal with it.
MediaPipe Holistic
import cv2
import mediapipe as mp
mp_drawing = mp.solutions.drawing_utils
mp_holistic = mp.solutions.holistic
holistic = mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5)
cap = cv2.VideoCapture(0)
while cap.isOpened():
success, image = cap.read()
image = cv2.cvtColor(cv2.flip(image, 1), cv2.COLOR_BGR2RGB)
image.flags.writeable = False
results = holistic.process(image)
image.flags.writeable = True
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
mp_drawing.draw_landmarks(image, results.face_landmarks, mp_holistic.FACE_CONNECTIONS)
mp_drawing.draw_landmarks(image, results.left_hand_landmarks, mp_holistic.HAND_CONNECTIONS)
mp_drawing.draw_landmarks(image, results.right_hand_landmarks, mp_holistic.HAND_CONNECTIONS)
if cv2.waitkey(5) & 0xFF == 27:
break
holistic.close()
cap.release()
cv2.destroyAllwindows()
As you can see holistic has resullts for both right and left hands; you can start working from there....
Can i have your code and your modules?
check his website
Ap source code q nahi share kar tay i request plz share the code
Please drop your email in channel description...i would love to contact you about an AI project i am trying to build which is based on your face recognition project. But i wanted to make some additional features and wanted to know if you could help.
@Murtaza's Workshop - Robotics and AI
22:55 ward
How to convert this into an android app, can you please make an tutorial for that....
Peronal brought me here..
Always make videos from 0 means start from creating new project