SB/serdar
All projects

Magnosco · 2023 — Present

Magnosco — Diagnostic Imaging Platform

Senior Apple Platform Engineer

The iOS application connecting a dermatological imaging device to an on-device CoreML diagnostic pipeline, built in close collaboration with imaging scientists.

CoreMLOpenCVmTLSMedical ImagingSwift Concurrency
Magnosco — Diagnostic Imaging Platform — screenshot

Problem

Magnosco's research team had validated a computer vision approach to assist dermatologists in early skin cancer detection, developed and trained in PyTorch. The gap was turning that research into a product a clinician could rely on in an exam room — a reliable device connection, consistent image capture, on-device inference within clinical time constraints, and a secure path for results.

Approach

I built the iOS layer that takes the device from research prototype to clinical tool: a resilient Wi-Fi pairing flow to the imaging hardware, an OpenCV preprocessing pipeline that normalizes captures regardless of lighting or device firmware version, and a CoreML inference pipeline running multiple models translated from the team's PyTorch implementations. Every result is transmitted over mutual TLS, with certificates provisioned and rotated on-device.

Architecture

The app is structured around a capture-to-result pipeline: a device-communication layer over the local Wi-Fi network, an image-processing module built on OpenCV and Core Image, a CoreML inference layer managing multiple versioned models, and a networking layer enforcing mTLS for every request. Each stage is isolated behind a protocol so models and preprocessing steps can evolve independently as the science improves.

Technical Decisions

On-device inference over server round-trips

Running CoreML models on-device kept results fast enough for a live exam and avoided transmitting raw diagnostic imagery unless a result required deeper review — a meaningful privacy and latency win.

Isolating the preprocessing pipeline from the model layer

Keeping OpenCV preprocessing as its own testable module meant the imaging scientists and I could iterate on capture quality independently from model updates, without either side blocking the other.

mTLS instead of token-based auth alone

For a medical product, authenticating the device itself — not just the user session — mattered enough to justify the added complexity of on-device certificate lifecycle management.

Actors and conditional execution over brute-force processing

Rather than running every model on every frame, I introduced actor-based concurrency to coordinate pipeline stages safely, an intelligent caching layer to skip recomputing unchanged steps, and conditional model execution so expensive models only ran when their output was actually needed.

Challenges

  • Translating PyTorch model logic into efficient, numerically consistent Swift/CoreML implementations.
  • Handling device pairing and reconnection gracefully on a Wi-Fi network with no internet path.
  • Meeting the accuracy and consistency bar required for a clinical support tool, not just a demo.
  • Redesigning a memory-heavy computer vision workflow on iPad that was causing crashes under sustained use.

Results

  • Cut peak memory usage on iPad from roughly 4GB to 1.2GB and eliminated the device crashes that came with it.
  • Shipped a production pipeline translating the research team's PyTorch models into Swift/CoreML without a loss of clinical accuracy.
  • Built the device-pairing and mTLS networking layer clinicians rely on during live examinations.

Lessons learned

  • The hardest part of shipping AI in a real product is rarely the model — it's the pipeline of unglamorous engineering around it.
  • Working directly with scientists sharpened how I reason about model behavior, uncertainty, and where engineering judgment should and shouldn't override research decisions.
  • Medical-grade reliability requirements make you a better engineer everywhere else, too.