AI Yoga Pose Detection App using Flutter and TensorFlow Lite for Image Classification

Introduction

Artificial Intelligence is transforming fitness and wellness applications by enabling real-time activity recognition and personalized user experiences. In this project, we developed a Yoga Pose Detection application using Flutter and TensorFlow Lite that can identify yoga poses from uploaded images.

The application leverages a custom-trained machine learning model created using Google’s Teachable Machine platform and integrates it into a Flutter application following the MVVM (Model-View-ViewModel) architecture.

Project Objective

The primary goal of this project was to create a mobile application capable of:

  • Detecting yoga poses from images.
  • Classifying poses into predefined categories.
  • Displaying prediction confidence scores.
  • Providing an extensible architecture for future fitness and wellness enhancements.

Model Development

Dataset Preparation

A custom dataset was created by collecting multiple images for each yoga pose category. Images were organized into separate classes and uploaded to Google’s Teachable Machine platform.

Example Classes:

  • Triangle Pose
  • Tree Pose
  • Plank Pose
  • Cobra Pose
  • Chair Pose

To improve model generalization, images with different backgrounds, lighting conditions, and user variations were included.

Model Training

The dataset was trained using Google’s Teachable Machine image classification platform.

The training process automatically generated a TensorFlow Lite model consisting of:

  • model_unquant.tflite
  • labels.txt

After training, the model was exported in TensorFlow Lite format for mobile deployment.

Model Specifications

After loading the model into Flutter, the following characteristics were identified:

  • Input Shape: [1, 224, 224, 3]
  • Output Shape: [1, 5]
  • Input Type: Float32

The prediction arrays represent the confidence scores returned by the TensorFlow Lite model for each yoga pose class. The application identifies the class with the highest confidence score and displays it as the detected pose to the user.

This indicates that:

  • The model accepts one RGB image.
  • The image must be resized to 224×224 pixels.
  • The output contains prediction scores for five yoga pose classes.

Image Classification Workflow

The application follows the workflow below:


User Uploads Image
        ↓
Image Preprocessing
        ↓
TensorFlow Lite Model
        ↓
Prediction Scores
        ↓
Label Mapping
        ↓
Result Display

Image Preprocessing

Before inference, the selected image undergoes the following preprocessing steps:

  1. Image decoding
  2. Resizing to 224 × 224 pixels
  3. RGB extraction
  4. Pixel normalization
  5. Conversion to a Float32 tensor

These preprocessing steps ensure that the input image matches the format expected by the TensorFlow Lite model, enabling accurate yoga pose classification.

This ensures compatibility with the TensorFlow Lite model.

Prediction Process

The model returns an array containing confidence scores for each yoga pose.

Example Prediction Output:

[0.02, 0.91, 0.01, 0.03, 0.03]

Label Mapping:

  • 0 → Triangle Pose
  • 1 → Tree Pose
  • 2 → Plank Pose
  • 3 → Cobra Pose
  • 4 → Chair Pose

The application identifies the highest confidence score and maps it to the corresponding yoga pose.

Result Example:

  • Detected Pose: Tree Pose
  • Confidence: 91%
yoga pose detection

User Experience

The application provides a simple workflow:

  1. Select image from gallery.
  2. Process image using TensorFlow Lite.
  3. Display detected yoga pose.
  4. Show prediction confidence.

This creates a lightweight and responsive user experience suitable for mobile devices.

Conclusion

This project demonstrates how TensorFlow Lite can be seamlessly integrated with Flutter to create intelligent mobile applications. By combining Teachable Machine, TensorFlow Lite, and Flutter’s MVVM architecture, we successfully developed a yoga pose detection system capable of classifying multiple yoga poses directly on-device.

The solution is lightweight, scalable, and serves as a strong foundation for future AI-powered fitness and wellness applications.

Leave A Comment

All fields marked with an asterisk (*) are required