[Python] Project Help: Footsteps Counter for Video Input – Looking for SOTA Models and...

Discussão em 'Python' iniciado por Stack, Outubro 1, 2024.

  1. Stack

    Stack Membro Participativo

    I'm working on a project to count footsteps in an input video and have been experimenting with pose estimation methods like YOLOv8 and MediaPipe. My goal is to cover the following test cases:


    1. Only the upper body of the person is in the frame, but they are walking.


    2. Only the lower body of the person is in the frame.


    3. The solution should be occlusion-proof.

    Here’s the logic I'm currently using to count steps by calculating the distance between the left and right ankles:

    def distanceCalculate(p1, p2):
    """p1 and p2 in format (x1, y1) and (x2, y2) tuples"""
    dis = ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** 0.5
    return dis

    # Calculate distance between ankles (a crude approximation of taking a step)
    if distanceCalculate(leftAnkle, rightAnkle) > 100: # Threshold for step detection
    if not stepStart:
    stepStart = 1
    stepCount += 1

    # Append to output JSON
    output_data["footsteps"].append({
    "step": stepCount,
    "timestamp": round(current_time, 2)
    })

    elif stepStart and distanceCalculate(leftAnkle, rightAnkle) < 50:
    stepStart = 0 # Reset after a complete step


    However, this logic doesn't work for all videos. I'm looking for suggestions on state-of-the-art (SOTA) models and heuristic logic that can help improve the step detection, particularly for the scenarios mentioned above.

    Any advice or suggestions would be greatly appreciated!

    Thanks in advance!

    Continue reading...

Compartilhe esta Página