Build a Personal AI Trainer | OpenCV Python | Computer Vision

Sdílet
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

Komentáře • 116

  • @Bartek9391
    @Bartek9391 Před 2 lety +5

    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! ;)

    • @ilhembekkar3043
      @ilhembekkar3043 Před 2 lety +2

      I didn't find the video, can you please send it

  • @howtogamedev_
    @howtogamedev_ Před 3 lety +1

    Really cool was waiting for this from a long time 👌

  • @olayemiabimbola611
    @olayemiabimbola611 Před 3 lety

    This is the best free stuff on youtube IMO

  • @wgalloPT
    @wgalloPT Před 2 lety +2

    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.

  • @actionkey8042
    @actionkey8042 Před 3 lety +6

    Murtaza's Workshop - Robotics and AI
    NIIICEEEE

    • @nithinsai2250
      @nithinsai2250 Před 3 lety

      bro do u know where to download that posemodule?

  • @tomasmartin6517
    @tomasmartin6517 Před 3 lety

    Simple and excellent, congrats brooo

  • @shivamsingh-vv9vm
    @shivamsingh-vv9vm Před 2 lety +2

    Great work!! Can we extend it to real weightlifting with pose correction part? That would be very helpful.

  • @rajjitlaishram8282
    @rajjitlaishram8282 Před 3 lety

    Great work. Very helpful.

  • @zimbim6218
    @zimbim6218 Před 2 lety +9

    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?

  • @notes3602
    @notes3602 Před 3 lety +2

    Omg !! This is really amazing 😉

  • @davidleigh6196
    @davidleigh6196 Před rokem

    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!

  • @ronyra
    @ronyra Před 3 lety +1

    This is Awesome! how can we use the model and train and Neural Net to classify which exercise is being done?

  • @antoninbarta3347
    @antoninbarta3347 Před 3 lety

    Excellent! Thanks!

  • @stefanguiton
    @stefanguiton Před 3 lety

    Excellent video!

  • @ashishmallah9067
    @ashishmallah9067 Před rokem

    thank you sir supp video lots of learning 👍

  • @davidallan6036
    @davidallan6036 Před 3 lety

    Another excellent video

  • @ginggeli9783
    @ginggeli9783 Před 2 lety

    Awesome video, Perfect

  • @wgalloPT
    @wgalloPT Před 2 lety

    How did you accomplish to round it to just 2 numbers when it displays the angle?? it shows a long string of numbers?

  • @__________________________6910

    Congratulations 105k

  • @aninexclusive466
    @aninexclusive466 Před rokem

    I've learned lot of things from this video. Thanks. btw your voice is cool.

  • @harshitpant5080
    @harshitpant5080 Před rokem +1

    Can you provide the link of images and videos, which you used in this tutorial

  • @Alaz21
    @Alaz21 Před 3 lety

    Most amazing

  • @kanikagola9613
    @kanikagola9613 Před 2 lety

    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?

  • @blackspitit
    @blackspitit Před 3 lety +17

    Is it possible to make the app to realise if someone is doing the exercises correctly, and furthermore to advice you?

    • @pedrovic12
      @pedrovic12 Před 3 měsíci

      I Will make this app

    • @blackspitit
      @blackspitit Před 3 měsíci

      @@pedrovic12 good idea, let me know how it goes plz.

    • @rabeeh.klr007
      @rabeeh.klr007 Před 2 měsíci

      ​@@pedrovic12bro is it started

  • @changelife2179
    @changelife2179 Před 3 lety

    great!!!

  • @alhanoufalkadi2435
    @alhanoufalkadi2435 Před 2 lety

    Can this project be implemented as a mobile application?

  • @febinrajan1637
    @febinrajan1637 Před rokem

    Is it possible to implement in real life exercise?

  • @ayarzuki
    @ayarzuki Před 3 lety

    how much time I can join and start commenting in Discord? I have been agreeing to the rules in the server-rules

  • @yoman9446
    @yoman9446 Před 3 lety

    Can you please make something for jumping jacks as well?

  • @michaelzonneveldt8977
    @michaelzonneveldt8977 Před 2 lety +2

    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).

    • @unfortunately816
      @unfortunately816 Před 2 lety

      ty buddy

    • @adityapanigrahi892
      @adityapanigrahi892 Před rokem

      thats why give (modelComplex=1) in __init__() and declare it in method

    • @drm8164
      @drm8164 Před rokem

      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

    • @drm8164
      @drm8164 Před rokem

      @@adityapanigrahi892 please how to fix problem?

  • @perfect2468
    @perfect2468 Před 3 lety

    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

    • @mars420tame9
      @mars420tame9 Před rokem

      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

    • @yashsandansing9341
      @yashsandansing9341 Před rokem

      you're taking the external angle. Shift the first and third points with each other and you'll get angles between 0 and 180

  • @dangalimov7435
    @dangalimov7435 Před 3 lety

    Top!!!

  • @shahbazali5582
    @shahbazali5582 Před 3 lety

    V.good 🙋

  • @manurajput5348
    @manurajput5348 Před 3 lety +1

    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

    • @paulkiragu8120
      @paulkiragu8120 Před 3 lety +1

      check out his latest tutorial on running 60fps real time object detection on gpu

  • @gauravsharma1399
    @gauravsharma1399 Před 3 lety

    Could you please make a video on mask-rcnn and detectron2

  • @muhammadafnan2141
    @muhammadafnan2141 Před 3 lety +2

    can you make a fight detection system

  • @howtogamedev_
    @howtogamedev_ Před 3 lety

    what do i have to do to run it on gpu ??

  • @Arturostunes
    @Arturostunes Před 2 lety

    Great tutorial...has anyone actually launched an app to do this? Raeda AI and Altiz AI are ongoing projects with no ETA...

  • @ebrahimbadusha1677
    @ebrahimbadusha1677 Před 3 lety

    Bro ur using mediapipe for android app

  • @juliogeorgiou8210
    @juliogeorgiou8210 Před měsícem

    Do you create fitness apps for trainers to use for their clients

  • @sadhinmohd6345
    @sadhinmohd6345 Před 7 měsíci

    How to do i get the image and video you using

  • @rishabhsharma7261
    @rishabhsharma7261 Před 3 lety +1

    good

  • @GunaDermawan
    @GunaDermawan Před 3 lety +2

    what text editor do you use?

  • @sushruths8475
    @sushruths8475 Před 3 lety

    🔥🔥🔥

  • @metehanyildirim
    @metehanyildirim Před rokem +3

    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
    👍

    • @guddu2400
      @guddu2400 Před rokem

      i am facing the same problem

    • @nhatlehuutran6267
      @nhatlehuutran6267 Před rokem

      @@guddu2400 me too, can someone help me please ?

    • @jajavidup
      @jajavidup Před 6 měsíci +1

      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)

    • @harshupadhyay964
      @harshupadhyay964 Před 3 měsíci

      ​@@jajavidup sir, can you help me to create this project??

    • @jajavidup
      @jajavidup Před 3 měsíci

      @@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()

  • @Devil-wv5yo
    @Devil-wv5yo Před 3 lety

    Bro can you please make a video on AI personal assistant.

  • @PubgMobile-tc9uv
    @PubgMobile-tc9uv Před 3 lety

    Boss 🙏🏻🙏🏻🙏🏻

  • @hamzzashaffi
    @hamzzashaffi Před 3 lety +1

    Personal** (thumbnail)
    Great video! :)

  • @kongaaiguru
    @kongaaiguru Před 3 lety +4

    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.

    • @coderx8634
      @coderx8634 Před 3 lety

      You need to make a filename with the name *mediapipe.py*

    • @viko4148
      @viko4148 Před 3 lety

      I had the same error, it changed when I used python 3.8

    • @kongaaiguru
      @kongaaiguru Před 3 lety

      Thank you. I will try

    • @T1railleuR47
      @T1railleuR47 Před 3 lety +1

      @@kongaaiguru I had the same problem. It helped me pip install msvc-runtime

  • @amoora2235
    @amoora2235 Před 5 měsíci

    where is the previous video??

  • @Abcsciencemusic
    @Abcsciencemusic Před 3 lety

    OMG THIS IS SOME QUALITY STUFF

  • @geraldmusandirire5446
    @geraldmusandirire5446 Před 3 lety +1

    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?

    • @coderx8634
      @coderx8634 Před 3 lety +12

      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.

  • @yazanalkhabbaz276
    @yazanalkhabbaz276 Před 2 lety

    can you send to me the video of the person and the image?
    please

  • @jochem8744
    @jochem8744 Před 3 lety +2

    Is this possible to make in a mobile app

    • @lukeBalmar
      @lukeBalmar Před 3 lety

      Yes flutter supports opencv so you can do it using that

  • @christopherirazat8250
    @christopherirazat8250 Před 2 lety

    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.

    • @kit00001
      @kit00001 Před 2 lety

      me too ,please, thank you!

    • @varngupta1695
      @varngupta1695 Před 2 lety

      i think you want this video czcams.com/video/brwgBf6VB0I/video.html

    • @JatinderSingh-ki9hi
      @JatinderSingh-ki9hi Před 2 lety

      @@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

    • @varngupta1695
      @varngupta1695 Před 2 lety

      @@JatinderSingh-ki9hi read 2nd part of his comment

    • @JatinderSingh-ki9hi
      @JatinderSingh-ki9hi Před 2 lety

      @@varngupta1695I m not able to understand can u plz explain?

  • @andytheodorko9874
    @andytheodorko9874 Před 2 lety

    17:55 I thought Murtaza is going to refactor the code.

  • @adityadhanani828
    @adityadhanani828 Před rokem

    does this work on mac

  • @vinayalsa1144
    @vinayalsa1144 Před 3 lety +1

    Where we can include the webcams I'd

    • @coderx8634
      @coderx8634 Před 3 lety +1

      Use: *cam = cv2.VideoCapture(0)* insted of: *cam = cv2.VideoCapture("VideoPath")*

  • @sakibbinislam158
    @sakibbinislam158 Před 2 lety

    How can I install the posemodule library?

    • @varngupta1695
      @varngupta1695 Před 2 lety

      its not a library, its a module he created in previous video (czcams.com/video/brwgBf6VB0I/video.html)

  • @mithunraj1792
    @mithunraj1792 Před 2 lety

    Can anyone plzz share me the previous video where to execute the showing code from starting

    • @murtazasworkshop
      @murtazasworkshop  Před 2 lety

      czcams.com/video/brwgBf6VB0I/video.html

    • @drm8164
      @drm8164 Před rokem

      @@murtazasworkshop Hi Boss, please can you help me, i have many errors, can not fix it !

  • @yashdggjs
    @yashdggjs Před 3 lety

    hey murtaza its time to opencv for C#,PLEASEEEE

  • @MrNaiall
    @MrNaiall Před 2 měsíci

    For Running example pls

  • @anime_on_data7594
    @anime_on_data7594 Před 3 lety

    Sir for left hand its going 180 to 0 for right hand its going 180 to 360 how can a i deal with it.

    • @averno6174
      @averno6174 Před 3 lety +1

      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....

  • @hse9406
    @hse9406 Před 2 lety

    Can i have your code and your modules?

  • @syedhafeezulrehman6768
    @syedhafeezulrehman6768 Před 9 měsíci

    Ap source code q nahi share kar tay i request plz share the code

  • @arrowa3910
    @arrowa3910 Před 3 lety

    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

  • @user-nb5km1iv9x
    @user-nb5km1iv9x Před 3 lety

    22:55 ward

  • @maheshvicky6078
    @maheshvicky6078 Před 3 lety

    How to convert this into an android app, can you please make an tutorial for that....

  • @dilnawazsiddiqui8765
    @dilnawazsiddiqui8765 Před 3 lety

    Peronal brought me here..

  • @PubgMobile-tc9uv
    @PubgMobile-tc9uv Před 3 lety

    Always make videos from 0 means start from creating new project