AI & AutomationView GitHub Repository

AI-Based Knee Osteoarthritis Detection

Deep Learning and Vision Transformer-Based Medical Image Analysis

Illustrative knee X-ray analysis workflow for KL0 to KL4 osteoarthritis classification
88%
ViT Top-1 Accuracy
100%
ViT Top-5 Accuracy

Project Overview

Developed an academic AI-based medical imaging system for knee osteoarthritis analysis using X-ray images and multiple deep learning architectures. The system classifies severity using the Kellgren-Lawrence grading system (KL0-KL4), compares model performance, and uses Grad-CAM to visualize regions influencing predictions.

The Problem

Manual knee osteoarthritis grading from X-ray images can be time-consuming and requires consistent interpretation of radiographic joint changes.

The Solution & Architecture

Implemented and compared convolutional and transformer-based models, including CNN, ResNet50, Vision Transformer, and YOLOv11, with Grad-CAM visual explainability and an Android interface supported by a Python backend.

System Data Flow:
Knee X-ray Images→Image Preprocessing→Model Comparison→KL0-KL4 Classification→Grad-CAM→Flask/FastAPI→Android App

Key Engineering Highlights

88% Vision Transformer Top-1 Accuracy
Five-Level Kellgren-Lawrence Classification
Explainable AI with Grad-CAM

Project Overview

This final year project explores a computer vision pipeline for knee osteoarthritis severity assessment. It is an academic research project and is not a clinically validated diagnostic system or a replacement for professional medical diagnosis.

Problem Statement

Radiographic osteoarthritis assessment involves interpreting subtle joint-space and structural changes. The project examines whether automated deep learning models can support consistent severity grading across the five Kellgren-Lawrence categories.

  • Standardize image preprocessing for model input.
  • Compare CNN, transformer, and object detection approaches.
  • Provide visual explanations for model predictions.

Proposed Solution

The proposed system preprocesses knee X-ray images, performs KL0-KL4 classification, compares model performance, returns Grad-CAM heatmaps, and exposes predictions through a Python API to an Android interface.

System Architecture

Knee X-ray images move through preprocessing and model inference. Results are mapped to KL0-KL4, Grad-CAM heatmaps are generated for explainability, and the Python API delivers structured predictions to the Android application.

Dataset and Image Processing

The implementation uses knee X-ray imagery and typical image preprocessing steps appropriate to model training and inference. Dataset size, clinical provenance, and validation splits are not publicly asserted here because they are not verified in the portfolio evidence.

  • Normalize and resize images for model input.
  • Prepare training and evaluation partitions.
  • Preserve clinical class information for KL0-KL4.

Model Development

The project compared a conventional CNN, ResNet50 transfer learning, Vision Transformer classification, and YOLOv11. Model development and reported results reflect the academic implementation rather than a clinically evaluated diagnostic workflow.

Model Performance Comparison

The reported Vision Transformer result was 88% Top-1 accuracy, 86.4% precision, 86.7% recall, 86.3% F1-score, and 100% Top-5 accuracy. Other reported approximate accuracies were ResNet50 85%, CNN 82%, and YOLOv11 87%.

  • ViT: 88% Top-1 accuracy.
  • ResNet50: approximately 85% accuracy.
  • CNN: approximately 82% accuracy.
  • YOLOv11: approximately 87% accuracy.

Grad-CAM Explainability

Grad-CAM heatmaps highlight image regions associated with a model's prediction. These visualizations support qualitative review and transparency; they do not establish a clinical explanation or diagnosis.

Android Application

An Android interface was designed around Kotlin and Jetpack Compose for image upload and prediction presentation. A Flask or FastAPI backend provides API integration for model inference and result delivery.

Results and Future Improvements

The project established a working academic comparison of knee X-ray severity models and explainability techniques. Future work would require larger and more representative datasets, external clinical validation, robust uncertainty estimates, and review by qualified medical professionals before any clinical use.

Technologies Used

PythonDeep LearningCNNResNet50Vision TransformerYOLOv11Grad-CAMTensorFlow/PyTorchAndroidKotlinJetpack ComposeFlask/FastAPI

Interested in this Pipeline?

I can build similar production-grade Lakehouse or API data ingestion systems for your organization.

Contact Owais Ahmad