Open MShahrukhkhan13 opened 2 weeks ago
👋 Hello @MShahrukhkhan13, thank you for raising an issue about Ultralytics HUB 🚀! An Ultralytics engineer will review your query and provide assistance soon. In the meantime, you might find our HUB Docs helpful for understanding more about the platform and capabilities:
Since you are dealing with posture and motion detection, it might be beneficial to check out sections related to model training for insights.
If this is a 🐛 Bug Report, please provide any additional information or code snippets that can help reproduce the issue. A minimum reproducible example (MRE) would be particularly helpful. You can refer to our guide on creating a minimum reproducible example.
If you have any ❓ questions, please include specifics such as the dataset, any pretrained models used, and details about your environment setup to help us provide the most accurate advice.
Thanks for your patience as we work to assist you! 😊
@MShahrukhkhan13 hello! 😊
Detecting whether a person is walking using pose estimation can be a bit more complex than detecting standing or sitting, as walking involves dynamic movement. Here are a few suggestions to improve your walking detection:
Keypoint Movement Over Time: Walking involves a sequence of movements. You might want to track the movement of keypoints over several frames to detect walking. For instance, you can track the movement of the hips and knees to see if they are moving in a periodic manner.
Velocity and Trajectory Analysis: Calculate the velocity of keypoints like the ankles or knees over consecutive frames. Walking typically involves a consistent forward movement of these keypoints.
Angle Dynamics: Instead of just checking static angles, observe how angles like the knee angle change over time. Walking usually involves alternating flexion and extension of the knees.
Machine Learning Approach: Consider training a simple classifier using features extracted from the pose keypoints over time. This could be a more robust solution if you have access to labeled data of walking vs. non-walking.
Here's a simple example of how you might start tracking keypoint movement over time:
# Example: Track movement of left ankle over time
def track_movement(keypoints_sequence):
movements = []
for i in range(1, len(keypoints_sequence)):
prev_keypoints = keypoints_sequence[i-1]
curr_keypoints = keypoints_sequence[i]
movement = distance(prev_keypoints[15], curr_keypoints[15]) # Left ankle
movements.append(movement)
return movements
# Use this function to analyze the movement pattern
movements = track_movement(keypoints_sequence)
This approach can help you identify patterns characteristic of walking. Remember, the key is to analyze the dynamics over time rather than a single frame.
I hope this helps you enhance your walking detection! If you have further questions or need more assistance, feel free to ask. 😊
Search before asking
Question
I am using yoloV8 and YoloV11 model, Using pose model I can find out easily if person is standing or sitting. But is there any way to figure it out if Person is walking. ?
Additional
For your reference i am using below code, it work's fine for standing and sitting but unable to detect walking.
Thresholds for posture classification
threshold_standing = 70 # Example value for standing posture threshold_sitting = 30 # Example value for sitting posture walking_threshold = 100 # Example value for walking
Function to calculate the distance between two points
def distance(pointA, pointB): return math.sqrt((pointA[0] - pointB[0]) 2 + (pointA[1] - pointB[1]) 2)
Function to calculate the angle between three points
def angle(pointA, pointB, pointC): vectorAB = [pointA[0] - pointB[0], pointA[1] - pointB[1]] vectorCB = [pointC[0] - pointB[0], pointC[1] - pointB[1]]
Function to classify posture based on keypoints
def classify_posture(keypoints):
Check if keypoints is None or if it's a tensor with no elements