RETURN TO ALL PROJECTS

Pūioio

Honours Project | Mobile cross-platform

A novel mobile application capable of automatically detecting and counting workout exercise repetitions using only a mobile smartphone and its camera. Engineered with an on-device pipeline, it empowers users to track physical performance without reliance on external wearables.

01/ The Challenge

Automated exercise repetition counting (AERC) systems traditionally rely on physical wearables or computationally heavy cloud-based Computer Vision (CV) models that suffer from network latency. The engineering challenge was to build an AERC system capable of running entirely offline and in real-time on a computationally limited smartphone. This required processing live video from a front-facing camera to accurately track complex human movements across various body types, angles, and lighting conditions without draining device resources.

02/ Architecture & Pipeline

To process video input on a frame-by-frame basis without remote servers, we engineered a custom 5-component architecture:

  1. 1 / Pose Detection

    Utilises Google's lightweight BlazePose Convolutional Neural Network (CNN) to extract a 33-point 2D skeleton from the video feed in real-time.

  2. 2 / Thresholding

    Applies the mathematical cosine rule to the coordinate data to calculate internal joint angles, categorising the user's real-time movement phase against predefined exercise thresholds.

  3. 3 / Optical Flow

    Acts as a fallback mechanism utilising Lucas-Kanade Sparse Optical Flow. If the pose model loses confidence, it tracks pixel movement direction to maintain system state.

  4. 4 / State Machine

    Evaluates the movement phase to determine the exact exercise moment.

  5. 5 / Counter

    Increments the user's repetition count only upon the successful completion of a full state cycle.

Pose and thresholding run on the current frame. Optical flow is the fallback. Both feed the state machine, which only counts a full cycle.

03/ Mobile Application Development

As a mobile engineer, deploying a Python-based ML prototype into a consumer-ready application required solving several platform-specific challenges. The application, named Pūioio, was built using Flutter to ensure cross-platform availability on both the Google Play Store and Apple App Store from a single codebase.

Offline first

The app is self-contained: BlazePose and the rest of the pipeline run on the phone, with no cloud round-trip. That removes network latency, so the counter can stay in time with the movement, in the gym or anywhere without a signal.

Pūioio Quick Start screen for choosing an exercise and rep count

Live overlays

A custom camera view paints a 2D skeleton on the live feed without blocking the UI thread. A phase tracker on the right shows depth: top, moving, or bottom.

Pūioio camera view overlaying a 2D skeleton and phase tracker during squats

The name

Inspired by a te reo Māori word.

  • Pūioio

    (verb) to be strong, tough, hard, muscular.

Edge cases

Onboarding covers the exercise carousel, rep target, and a 10-second setup countdown. If pose confidence drops, the workout pauses with a 'We've lost you!' warning and resumes when the user is back in frame.

Pūioio workout screen showing a We've lost you warning during squats

04/ Optimising the On-Device Pipeline

Enforcing Strict Exercise Form

A common flaw in workout tracking is counting "half-reps" or bad form. We designed a strict, unidirectional state machine that prevents backward transitions. If a user fails to reach the required joint angle threshold (e.g., squatting to ≤130° internal knee angle), the state machine halts. The user is mathematically required to complete the full sequence to earn the repetition, ensuring data integrity.

Overcoming Hardware Constraints & Latency

To achieve real-time CV performance on a mobile device, we strictly avoided multi-modal heavy architectures. We utilised a lightweight CNN and implemented a battery-saving pause feature: if the in-frame pose confidence falls below a 0.75 threshold for more than 1.5 seconds, the system dynamically halts inference and state transitions until the user is confidently relocated.

Filtering Sensor Noise in CV Data

Raw pose estimation data is inherently jittery, leading to false positives. To stabilise the input, we implemented a sliding window algorithm to average movement phases across multiple frames. By tuning the sliding window size to 1 for thresholding and 3 for optical flow, we successfully filtered out anomalous sensor noise without introducing UI lag.

05/ Outcomes & Impact

98.89%

Real-world accuracy

1st Place

AI & Machine Learning category at UoA (2022)

100%

Off-by-one accuracy for squats and push-ups

NEXT PROJECT: inkle