Skip to content

Repository files navigation

LiteVision

Swift Platform Xcode

A lightweight SwiftUI application demonstrating on-device image classification using Apple's Vision and Core ML frameworks.

Select a photo from your library and run image classification entirely on-device.

📘 Overview

LiteVision is a lightweight iOS application that demonstrates on-device image classification using Apple's Vision and Core ML frameworks. The app is built with SwiftUI, MVVM, and Swift Concurrency to showcase a clean, modern iOS architecture.

Features

  • SwiftUI-based interface
  • PhotosPicker image selection
  • On-device Core ML inference
  • Async image classification with Swift Concurrency
  • Pre-trained MobileNetV2 model
  • Top 3 prediction display
  • Inference time display
  • Error handling and loading state

Tech Stack

  • UI: SwiftUI
  • Architecture: MVVM
  • Image Picker: PhotosPicker
  • ML Framework: Core ML + Vision
  • ML Model: MobileNetV2
  • Concurrency: Swift Concurrency

Architecture

PhotosPicker
    ↓
UIImage
    ↓
Vision (VNImageRequestHandler)
    ↓
Core ML (MobileNetV2)
    ↓
Predictions
    ↓
SwiftUI

Project Structure

├── LiteVision/
│   └── LiteVisionApp.swift
├── Models/
│   ├── Prediction.swift
│   ├── ImageClassifier.swift       // Protocol
│   ├── CoreMLImageClassifier.swift // Vision + Core ML implementation
│   └── MobileNetV2.mlmodel
├── ViewModels/
│   └── ContentViewModel.swift
├── Views/
│   └── ContentView.swift
├── LiteVisionTests/
└── LiteVisionUITests/

Screenshots

Getting Started

  1. Clone the repository.
  2. Open LiteVision.xcodeproj in Xcode.
  3. Select an iOS Simulator or connected device.
  4. Build and run the app.
  5. Select a photo from your library to start image classification.

Notes

LiteVision focuses on integrating machine learning into a modern iOS application rather than developing or training custom machine learning models.

It demonstrates a responsive on-device inference pipeline using Vision, Core ML, SwiftUI, MVVM, and Swift Concurrency.

The protocol-based image classification architecture also makes it straightforward to add interchangeable inference backends, such as TensorFlow Lite, in the future.

Future Improvements

  • TensorFlow Lite backend
  • Runtime switching between Core ML and TensorFlow Lite
  • Camera-based real-time classification
  • Object Detection
  • Benchmark inference performance

Requirements

  • Xcode 26.x
  • iOS 26.x
  • Swift 6 (as configured by project settings)

Acknowledgements

This project uses Apple's publicly available MobileNetV2 Core ML model for demonstration purposes.

The implementation was inspired by Apple's official Vision and Core ML documentation and sample applications.

License

MIT. See LICENSE.

About

Modern iOS image classification app with SwiftUI, MVVM, and on-device ML inference.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages