Skip to main content
Version: 1.0.0

Structure

Top-level layout

ARShadesPDKit/
├─ Extensions/ # Math & SceneKit helpers (SCNVector, SCNMatrix)
├─ Services/ # Core services: ImageClassifierService, ResultBundle
├─ TfliteModel/ # TFLite model bindings (EfficientNet-lite variants)
├─ ViewModels/ # Business logic layer (MetricsViewModel)
├─ Views/ # FacialMetricsViewController (PD measurement UI)
├─ Sources/
│ ├─ Constants/ # TFLite model assets (.tflite)
│ ├─ Models/ # Domain models (Consumption, Client)
│ ├─ Repository/ # Read/Write repositories for persistence
│ └─ ReadClient/ # Firebase/Firestore client (optional extension)

Core Components

FacialMetricsViewController

  • Main entry point for PD measurement.
  • Sets up ARSCNView and runs ARFaceTrackingConfiguration.
  • Tracks eye transforms via ARKit and draws 3D nodes.
  • Collects frames, applies classifier, and computes PD in millimeters.
  • Provides real-time feedback:
    • “Come closer” if face is too far.
    • “Rotate your face” if yaw/roll/pitch is misaligned.
    • “Remove glasses” if classifier detects sunglasses.

MetricsViewModel

  • Handles PD business logic and manages collected measurement values.
  • Interfaces between FacialMetricsViewController and data consumers.

ImageClassifierService

  • Wraps TFLite image classifier.
  • Detects glasses vs no glasses using EfficientNet Lite models (efficientnet_lite0.tflite, efficientnet_lite2.tflite).
  • Supports configurable thresholds (score, max results).

TfliteModel

  • Enum wrapper for available TFLite models.
  • Defines supported classification backbones (EfficientNet).

Repository Layer

  • ReadWriteConsumption, ReadClient — designed to persist or sync measurements (Firebase or local).
  • Optional: apps can integrate with Firestore or custom DBs.

Extensions

  • Utility helpers for SCNVector3 and SCNMatrix4 operations.
  • Used for 3D math: cross products, matrix multiplications, coordinate transforms.