A professional iOS application designed to make early detection of diabetic retinopathy more accessible through real-time, on-device machine learning. This app enables healthcare providers and patients to perform preliminary retinal screening using standard iOS devices, helping identify diabetic retinopathy in its early stages when treatment is most effective.
Making Early Detection Accessible: Diabetic retinopathy is a leading cause of blindness, but early detection and treatment can prevent up to 90% of vision loss. This application aims to democratize access to early screening by bringing advanced AI-powered detection capabilities to standard mobile devices, making it available in underserved communities and remote areas where specialized equipment may not be readily available.
This iOS application leverages Core ML and real-time camera processing to perform instant classification of retinal images. The system can identify diabetic retinopathy across five severity levels, providing immediate feedback to help guide clinical decision-making and patient care.
- No Diabetic Retinopathy Detected: Healthy retina with no signs of diabetic retinopathy
- Early Stage DR Detected - Stage 1: Mild non-proliferative diabetic retinopathy
- Moderate DR Detected - Stage 2: Moderate non-proliferative diabetic retinopathy
- Severe DR Detected - Stage 3: Severe non-proliferative diabetic retinopathy
- Proliferative DR Detected - Stage 4: Advanced proliferative diabetic retinopathy
- Image Quality Feedback: Guidance for optimal image capture
- Real-time Analysis: Instant classification as images are captured
- On-Device Processing: Privacy-preserving, no data transmission required
- Accessible Technology: Works on standard iOS devices with built-in cameras
- Intuitive Interface: Clean, professional design optimized for clinical use
- Clear Visual Feedback: Color-coded diagnostic results for quick interpretation
- Live Camera Preview: Real-time view of retinal images being analyzed
- Core ML Integration: Optimized machine learning models for mobile devices
- Multiple Model Support: Flexible architecture supporting different model versions
- Continuous Improvement: Framework supports model updates and enhancements
- Local Processing: All analysis performed on-device
- No Data Transmission: Images never leave the device
- HIPAA Considerations: Designed with healthcare privacy requirements in mind
- iOS: 16.0 or later
- Device: iPhone or iPad with camera
- Storage: Minimal space required (app + models)
- Camera Permission: Required for image capture
- Xcode: Latest version (15.0+ recommended)
- Swift: 5.0 or later
- Apple Developer Account: For device deployment
- Download from App Store (when available)
- Search for "Diabetic Retinopathy Early Detection"
- Install and launch the application
- Grant camera permissions when prompted
-
Clone the Repository
git clone <repository-url> cd DR_Project
-
Open in Xcode
open VideoContinuousImageDetection.xcodeproj
-
Configure Project Settings
- Update Development Team in project settings
- Verify bundle identifier:
com.gprof.DR2 - Ensure camera permissions are configured
-
Build and Run
- Select target device (iPhone/iPad)
- Press
Cmd + Rto build and run - Test on physical device for camera functionality
-
Launch Application: Open the app on your iOS device
-
Grant Permissions: Allow camera access when prompted
-
Position Retinal Image:
- Use with fundus camera or retinal imaging device
- Ensure proper lighting and image clarity
- Position image within camera frame
-
Start Analysis:
- Tap "Start Analysis" button
- Camera feed will begin processing frames
- Results appear in real-time
-
Interpret Results:
- Green: No diabetic retinopathy detected
- Orange: Early stage detection (Stage 1)
- Red: Moderate to severe detection (Stages 2-4)
- Blue: Image quality feedback
-
Stop Analysis: Tap "Stop Analysis" when finished
- Image Quality: Ensure retinal images are clear and well-lit
- Positioning: Maintain consistent distance and angle
- Multiple Readings: Consider multiple analyses for confirmation
- Professional Consultation: Always consult with ophthalmologists for final diagnosis
DR_Project/
├── VideoContinuousImageDetection/ # Main iOS application
│ ├── ContentView.swift # Main UI and camera integration
│ ├── VideoContinuousImageDetectionApp.swift # Application entry point
│ ├── Assets.xcassets/ # Application assets and icons
│ ├── DR_Image_Classifer 1.mlmodel # Alternative ML model
│ └── DRDetection 1.mlmodel # Alternative ML model
│
├── Images 2/ # Training dataset
│ ├── DR_1/ # Stage 1 DR images (50+)
│ ├── DR_2/ # Stage 2 DR images (50+)
│ ├── DR_3/ # Stage 3 DR images (50)
│ ├── DR_4/ # Stage 4 DR images (50)
│ ├── DR_Healthy/ # Healthy retinal images (50)
│ └── Zoom_In/ # Quality control images (47)
│
├── Images_2024_0509.mlproj/ # Core ML training project
│ ├── Models/ # Trained model files
│ ├── Data Sources/ # Training data configuration
│ └── Checkpoints/ # Model training checkpoints
│
└── VideoContinuousImageDetection.xcodeproj/ # Xcode project configuration
- SwiftUI: Modern declarative UI framework
- AVFoundation: Camera capture and video processing
- Core ML: On-device machine learning inference
- Vision Framework: Image processing capabilities
The application currently uses the Images_2024_0509_1 model, trained on a comprehensive dataset of retinal images. The model architecture supports:
- Real-time inference on mobile devices
- Low latency processing (< 100ms per frame)
- High accuracy classification across DR stages
- Efficient memory usage
- Capture: Continuous video frame capture via AVFoundation
- Preprocessing: Frame extraction and pixel buffer conversion
- Inference: Core ML model prediction on each frame
- Post-processing: Result mapping to user-friendly messages
- Display: Real-time UI updates with diagnostic feedback
- Background Processing: ML inference on dedicated queue
- Frame Dropping: Late frames discarded to maintain responsiveness
- Memory Management: Efficient buffer handling
- Battery Optimization: Optimized processing to minimize power consumption
The models were trained using Create ML on a curated dataset of retinal images:
- Total Images: 300+ annotated retinal images
- Distribution: Balanced across all DR stages
- Quality Control: Images validated for diagnostic accuracy
- Augmentation: Data augmentation techniques applied
To update or retrain models:
- Open
Images_2024_0509.mlprojin Xcode - Import updated training data from
Images 2/ - Configure training parameters
- Train and validate model performance
- Export new
.mlmodelfile - Replace model in application bundle
- MARK Comments: Organized code sections for navigation
- Documentation: Comprehensive inline documentation
- Error Handling: Robust error handling throughout
- Type Safety: Strong typing and Swift best practices
- Manages camera session lifecycle
- Handles real-time frame processing
- Coordinates ML model inference
- Publishes results for UI updates
- Main user interface
- Camera preview integration
- Diagnostic result display
- User interaction handling
The codebase is structured to support:
- Additional ML models
- Enhanced UI components
- Export functionality
- Historical tracking
- Confidence score display
- Camera Access (
NSCameraUsageDescription)- Purpose: Capture retinal images for analysis
- Usage: Real-time video frame processing
- Privacy: All processing occurs on-device
This application is intended for screening and educational purposes only. It is NOT a replacement for professional medical diagnosis, evaluation, or treatment.
- Not a Diagnostic Tool: This app provides preliminary screening results only
- Professional Consultation Required: All results must be reviewed by qualified ophthalmologists
- No Medical Advice: The application does not provide medical advice or treatment recommendations
- Limitations: Results may not be accurate in all cases and should not be used as the sole basis for medical decisions
- Regulatory Status: This application is for research and educational use
Always consult with qualified healthcare professionals for proper diagnosis and treatment of diabetic retinopathy or any other medical condition.
We welcome contributions that improve accessibility, accuracy, and usability. Areas of interest:
- Model accuracy improvements
- User experience enhancements
- Accessibility features
- Documentation improvements
- Performance optimizations
- Localization support
- Fork the repository
- Create a feature branch
- Make your changes with proper documentation
- Test thoroughly on physical devices
- Submit a pull request with detailed description
- Danika Gupta - Core Development, ML Integration
- Amit Gupta - Application Architecture, UI/UX
- Medical professionals who provided guidance on diabetic retinopathy classification
- Research community for open datasets and methodologies
- Apple for Core ML and SwiftUI frameworks
- Confidence scores and probability distributions
- Image capture and save functionality
- Historical analysis tracking
- Export results with metadata
- Enhanced UI/UX with accessibility features
- Model accuracy metrics and calibration
- Support for photo library import
- Multi-language support
- Integration with electronic health records
- Telemedicine capabilities
- Improved model accuracy through larger datasets
- Faster inference times
- Support for additional retinal conditions
- Integration with wearable devices
- Cloud-based model updates
[Specify license - Consider MIT, Apache 2.0, or proprietary license]
For technical support, feature requests, or medical inquiries:
- Technical Issues: [GitHub Issues]
- Medical Questions: Consult with qualified healthcare professionals
- General Inquiries: [Contact Information]
- v1.0 (Current): Initial release with real-time detection capabilities
- Core ML integration
- Real-time camera processing
- Five-stage DR classification
- Professional UI/UX
Making early detection accessible, one device at a time.