Similar to Bicep Curl Detection , we will be using the Mediapipe Pose model this time as well. More about the MediaPipe here:
Now there are several methods to compute the logic for detecting the slouch while sitting. Some are very simple and easy to cheat and other are very complex and hard to understand and implement.
So ,here something which is the SMARTEST SIMPLEST SOLUTION to this particular problem.
A invisible line between your nose and the mid point of your shoulder joints (Nose to Neck). This simple line would determine whether we are slouching or not.
target_ratio).current_frame) , if the PDL is higher or smaller than a particular threshold , that means we are slouching.