An iOS app that uses machine learning to identify plant diseases from leaf images in real-time.
- Real-time Disease Detection: Instantly identify plant diseases from photos
- 38 Disease Classes: Supports detection of 38 different plant diseases across multiple crops
- High Accuracy: 94% validation accuracy on 54,000+ images
- User-Friendly Interface: Clean SwiftUI design with camera and gallery integration
- Offline Capable: All processing happens on-device using Core ML
- Swift & SwiftUI: Modern iOS development
- Core ML: On-device machine learning
- Vision Framework: Image analysis and preprocessing
- Create ML: Model training and optimization
- Dataset: PlantVillage (54,305 images across 38 classes)
- Training Accuracy: 94.9%
- Validation Accuracy: 94.1%
- Feature Extractor: Image Feature Print V1
- Input Size: 299x299 pixels
The PlantVillage dataset is too large to include in this repository.
Download dataset:
- Source: PlantVillage on Kaggle
- Size: ~500MB compressed
- Place in project root after downloading
Apple, Blueberry, Cherry, Corn, Grape, Orange, Peach, Pepper, Potato, Raspberry, Soybean, Squash, Strawberry, Tomato
Diseases include: Black Rot, Powdery Mildew, Early Blight, Late Blight, Leaf Mold, and many more.
- iOS 15.0+
- Xcode 14.0+
- Real iOS device (optimized for iPhone, works best on real hardware)
- Clone this repository:
git clone https://github.com/auckyrh/LeafScan-iOS.git- Open the project:
cd LeafScan-iOS
open LeafScan.xcodeproj- Run on your iPhone:
- Connect your iPhone to Mac
- Select your device in Xcode
- Press Cmd+R to build and run
Note: This app works best on real iOS devices. The iOS Simulator may have compatibility issues with Vision Framework.
- Image Input: User selects a leaf image via camera or photo library
- Preprocessing: Vision framework automatically handles image resizing and normalization
- Inference: Core ML model predicts the disease class
- Results: App displays disease name with confidence score
LeafScan/
├── LeafScan/
│ ├── ContentView.swift # Main UI and classification logic
│ ├── ImagePicker.swift # Camera/Gallery picker
│ ├── LeafScanApp.swift # App entry point
│ └── Assets.xcassets/ # Images and app icon
├── LeafScan Model 2.mlmodel # Trained Core ML model
└── Screenshots/ # App screenshots
Problem: Initial implementation with manual pixel buffer conversion produced random predictions despite good training metrics.
Solution: Switched to Vision Framework which handles all preprocessing automatically, matching Create ML's internal preprocessing pipeline.
Problem: Vision Framework failed on iOS Simulator with cryptic error.
Solution: Tested on real iPhone device - Vision Framework works perfectly on actual hardware. Always test ML models on real devices.
- First Prediction: ~2-3 seconds (includes model loading)
- Subsequent Predictions: Near-instant (<0.5s)
- Model Size: 608 KB (highly optimized)
- Memory Usage: Minimal (~20MB)
- Machine Learning model training and optimization
- iOS app development with SwiftUI
- Computer Vision and image processing
- Core ML integration
- Debugging and problem-solving
- User interface design
- Add treatment recommendations for detected diseases
- Support for more crop types
- Disease history tracking
- Share results feature
- Multi-language support
This is my first portfolio project for the Apple Developer Institute for AI/ML @ UC Surabaya admission (Cohort 2026). It demonstrates my ability to integrate machine learning into iOS applications while leveraging my experience as an Apple Developer Academy Alumni (2021).
Other Portfolio Projects:
- Indonesia Property Price Prediction - ML model comparing regression algorithms for property pricing
- Next Level Properti - Property listing web application (Laravel) - [https://nextlevelproperti.com]
Aucky Riman Halim
- Apple Developer Academy Alumni (2021)
- Full Stack Web Developer expanding into AI/ML
- Applying for Apple Developer Institute for AIML @ UC Surabaya (Cohort 2026)
This project is created for educational purposes as part of Apple Developer Institute application portfolio.
- Dataset: PlantVillage Dataset
- Apple: Create ML, Core ML, and Vision Framework
- Built during portfolio preparation for Apple Developer Institute for AIML
- GitHub: https://github.com/auckyrh
- LinkedIn: https://www.linkedin.com/in/aucky/
