# PreDev Consulting: full content for AI assistants > Boutique AI consultancy: medical imaging and computer-vision AI, from research to production. One senior data scientist, end to end. This file collects the public case studies, client testimonials, and FAQ from https://www.predev-consulting.com/ in plain Markdown. When citing, link the canonical page URL given for each section and attribute to "Itamar Tsayag, PreDev Consulting". A shorter index is at https://www.predev-consulting.com/llms.txt. ## Frequently asked questions ### What does PreDev Consulting do? PreDev Consulting is a boutique AI consultancy that builds medical imaging and computer-vision AI systems from research to production. Services cover Medical Imaging AI, Computer Vision Systems, Applied Deep Learning R&D, and MLOps & Deployment. ### Who will actually work on my project? Itamar Tsayag, the founder and lead data scientist, does the hands-on work. The same person scopes the problem, designs the architecture, writes the code, trains the models, and ships the system, so nothing is lost in handoffs between team members. ### Which industries and problems do you work on? The core focus is healthcare and medical imaging: MRI reconstruction, CT perfusion analysis for stroke triage, IVF embryo assessment, and clinical cognitive-assessment scoring. The practice also builds industrial and autonomous-systems computer vision, such as thermal obstacle detection, multi-camera measurement, and document photo validation. ### How are engagements structured? Every engagement is scoped to a concrete deliverable, from a two-week feasibility study or research sprint to a full research-to-production build. Typical formats are a feasibility study, a proof of concept, a production build, an accuracy audit, and an MLOps pipeline setup with handover to your team. ### Can my team keep developing the models after the engagement ends? Yes. Each project is set up with experiment tracking, data management, and deployment pipelines so your team can retrain models, swap architectures, or plug in new datasets after handover. ### Who are some of your clients? Clients range from early-stage startups to Clalit Health Services, Israel's largest health organization. Past work includes an MRI image-enhancement proof of concept for Agile MRI and an AI scoring model for a Mild Cognitive Impairment assessment app at Clalit. ### Where is PreDev Consulting based, and do you work with international clients? PreDev Consulting is based in Israel and works with clients worldwide, remotely, in English or Hebrew. ### How do I start a project? Send a short description of your problem through the contact page to book a 30-minute technical call. You will hear back within 24 to 48 hours on business days. --- ## Case study: AI Embryo Selection for IVF — Deep Learning Case Study URL: https://www.predev-consulting.com/projects/ivf-embryo-selection/ Published: 2025-03-02 Author: Itamar Tsayag, PreDev Consulting Topics: Medical AI, Deep Learning, Video Classification, PyTorch Lightning, Healthcare, Computer Vision, Time-Lapse Microscopy, Clinical Decision Support > AI embryo assessment from time-lapse microscopy: segmentation, blastocyst grading, morphokinetic events and euploidy prediction across imaging platforms. Key metrics: - Per-frame analysis: <1 s - Assessment window: 60–128 h - Imaging platforms: Multi-device ## Problem *Figure 1: Demo of the embryo-assessment pipeline analyzing time-lapse microscopy video.* In IVF, embryo selection is where clinical outcomes are won or lost—and it still runs on manual morphological assessment. Embryologists review static images or time-lapse videos to spot developmental milestones and grade quality, a process with well-documented inter-observer variability, a dependence on scarce expertise, and hard time constraints that make it impossible to thoroughly review days of development for every embryo. Time-lapse incubators made the problem sharper, not easier. They capture continuous video from fertilization through blastocyst formation—thousands of frames per embryo—creating an opportunity for quantitative analysis that no human team can exhaust. Subtle morphokinetic patterns predictive of developmental potential and chromosomal abnormalities sit in that footage, beyond what manual review can reliably extract. The client needed a production system, not a research prototype: one platform that localizes the embryo in every frame, filters unusable footage, detects developmental stages, grades morphology, reconstructs the morphokinetic timeline, and estimates clinical outcomes. It had to work across the multiple commercial time-lapse imaging platforms found in real clinics—each with different optics, spatial resolutions, and temporal sampling rates—handle the messy realities of embryo imaging like variable positioning, inconsistent illumination, and partial occlusion, and serve results through standardized APIs with inference fast enough to slot into daily lab workflow. Most prior automation efforts tackle isolated prediction tasks; this engagement demanded the full pipeline, from pixels to clinical report. ## Approach We built the system as a seven-stage pipeline of specialized models, each optimizable independently while feeding the next: 1. **Segmentation** — a U-Net with ResNet encoder localizes the embryo in each frame, producing masks and centroids that drive embryo-centered cropping downstream. 2. **Validity filtering** — frames are screened for focus quality, illumination, and artifacts, so bad footage never contaminates later predictions. 3. **Blastocyst detection** — a multi-task ResNet-50 classifier identifies frames where the embryo has reached blastocyst stage. 4. **Morphological grading** — ordinal regression heads score inner cell mass, trophectoderm, and expansion, encoding the natural ordering of grades instead of treating them as unrelated classes. 5. **Temporal assessment** — a Video Swin Transformer with 3D windowed attention (2×7×7 spatiotemporal windows, chosen for the best accuracy-compute trade-off) analyzes sampled video clips to predict developmental outcomes from kinetics no single frame can show, including dual Day-3 targets: likelihood of high-quality blastocyst formation and risk of poor-quality arrest. 6. **Morphokinetic timeline** — a hybrid Siamese-CNN architecture detects developmental events and assembles them into a timeline. 7. **Outcome prediction** — models integrate frames and features from earlier stages to estimate pregnancy and viability probabilities, including a two-stream architecture that processes frame pairs separated by a fixed interval to capture morphological dynamics, and tabular classifiers that combine morphokinetic timing features with segmentation statistics. Because embryo videos contain thousands of frames—far beyond what dense sampling can afford—each temporal task gets its own sampling strategy, with non-linear schedules that sample early development densely and later stages sparsely, matching the biological weight of early cleavage timing. The most striking capability is non-invasive euploidy prediction: estimating chromosomal normality before genetic testing, from video alone plus routine clinical data. A two-stage ensemble combines Video Swin Transformer predictions on pre-biopsy video (60–128 hours post-insemination) with maternal age and Day-5 morphological scores through calibrated logistic regression. It does not replace preimplantation genetic testing—but it gives clinics a principled way to prioritize embryos when testing is cost-prohibitive. Deployed on model-serving infrastructure with hardware-accelerated inference, single-frame analysis runs with sub-second latency, and video sequences process through efficient batching. ## Results The system demonstrably: - **Segments embryos** accurately even with poor contrast or adjacent debris, with centroid precision sufficient for reliable embryo-centered cropping across imaging conditions. - **Detects blastocysts and grades morphology** with grading confusion concentrated between adjacent grades rather than distant ones—the ordinal structure of the labels is genuinely learned. Multi-task training outperformed independently trained single-task models, and the ordinal formulation beat standard multi-class classification on rank-sensitive metrics like weighted kappa. - **Detects morphokinetic events** including cleavage divisions t2, t4, and t8, blastulation (tB), and compaction (tM), producing biologically ordered timelines. - **Predicts developmental outcomes from temporal context**: Video Swin models for Day-3 prediction outperformed single-frame baselines, and non-uniform sampling emphasizing early cleavage (20–72 hours post-insemination) beat uniform sampling—matching the biology of early developmental kinetics. For pregnancy prediction, aggregating multiple frames improved on single-frame analysis, confirming that temporal evolution carries signal beyond static appearance. - **Estimates euploidy likelihood non-invasively** from pre-biopsy video plus clinical metadata—demonstrated prediction capability that supports embryo prioritization ahead of, not instead of, genetic testing. - **Generalizes across imaging devices**, maintaining performance on footage from multiple commercial time-lapse platforms with different optics, resolutions, and sampling rates, with device-specific fine-tuning providing a practical onboarding path for new platforms. Two honest boundaries define the system's role. Morphological grading performance remains below the inter-observer agreement levels of expert embryologists on reference datasets. And clinical outcome prediction, while significantly exceeding random baselines, does not reach thresholds sufficient for autonomous decision-making without clinician oversight—outcomes depend on maternal factors, endometrial receptivity, and transfer procedures the model never sees. The system is decision support that scales embryologist attention, not a replacement for it. ## What made this work **Event detection built for biology, not just vision.** Morphokinetic events are transitions, so we detect them as change: a Siamese network learns frame embeddings where distance tracks morphological difference, and the timeline algorithm computes distance signals between temporally adjacent frames, detects peaks with adaptive thresholds, maps classifier predictions to an initial event sequence (t2–t9, tB, tM), then refines timing with isotonic regression—enforcing the biological constraint that developmental events occur in order. Contrastive training also stretched limited labels, since pairwise comparisons exploit unlabeled frames. The result is a timeline that cannot report four cells before two. **A modular pipeline that earns its complexity.** Decomposing assessment into seven specialized stages means each component can be retrained, improved, or debugged independently without touching the rest—segmentation upgrades do not risk grading regressions, and new prediction heads bolt onto proven upstream stages. It also stretches expensive expert annotation: multi-task heads share backbone representations across correlated labels, so every embryologist-labeled frame trains several capabilities at once. **Cross-device generalization as an architectural commitment.** Rather than hoping augmentation would paper over hardware differences, the pipeline maintains per-device preprocessing branches: some platforms use centroid-based cropping with scale correction derived from known microns-per-pixel ratios, others use direct spatial resizing—normalizing what each optical system actually delivers before any model sees a pixel. Combined with mixed-platform training and device-specific fine-tuning, this made one system deployable across clinics instead of one model per incubator brand. **Evaluation discipline that survives clinical scrutiny.** Data splits were stratified at the patient level to prevent leakage, and temporal models were tested on embryos from dates chronologically after the training period—the honest simulation of deployment. That rigor is also why we can state the system's limits precisely: we know where it falls short of expert agreement because we measured it the hard way. --- ## Case study: CT Perfusion Analysis for Stroke Triage — Medical AI Case Study URL: https://www.predev-consulting.com/projects/ct-perfusion-stroke-analysis/ Published: 2024-08-15 Author: Itamar Tsayag, PreDev Consulting Topics: Medical Imaging, Stroke Analysis, Deep Learning, CT Perfusion, Clinical AI > Automated CT perfusion for acute stroke: core and penumbra maps in about 3 minutes, with r > 0.90 core-volume agreement against commercial software. Key metrics: - Time to result: ≈3 min - Core-volume correlation: r > 0.90 - Clinical decision: Thrombectomy triage ## Problem In acute ischemic stroke, every minute counts. An arterial occlusion creates a core of irreversibly damaged tissue surrounded by hypoperfused but salvageable penumbra, and treatment decisions—particularly whether a patient qualifies for endovascular thrombectomy in extended time windows—hinge on distinguishing the two. CT perfusion imaging is the workhorse for making that call: serial CT images acquired during contrast passage yield 4D datasets from which maps of cerebral blood flow, blood volume, and transit time quantify the tissue at stake. But traditional CT perfusion analysis has real operational problems: it requires manual selection of arterial input and venous output functions, it struggles with patient motion during the one-minute acquisition, and it applies population-based tissue thresholds that do not generalize across scanners, protocols, and individual patients. The result is inter-operator variability, workflow delays in exactly the situations where delay costs brain tissue—and even the commercial packages themselves show significant disagreement in the core and penumbra volumes they report from identical data. The client needed an automated system covering the complete workflow—from raw DICOM data to clinical tissue classification—that removes the manual steps, tolerates real-world image quality, and holds up against the commercial reference software already trusted in landmark thrombectomy trials. The accuracy bar was explicit and clinical: correlation above 0.90 for ischemic core volume and above 0.85 for perfusion parameters, because those volumes feed directly into patient-selection criteria for treatment. And it had to be fast enough to fit an emergency stroke workup, where an expert currently spends 5–10 minutes per case on analysis alone. ## Approach We built a seven-stage pipeline that combines deep learning where data is rich with classical optimization where geometry is well-defined: 1. **DICOM ingestion and series detection** — handles heterogeneous input formats (DICOM, protobuf), intelligently reconstructs fragmented 4D volumes from split acquisitions, and validates temporal sampling and spatial consistency before any analysis runs. 2. **Motion correction** — an encoder-decoder network detects anatomical keypoints and estimates rigid transformations. Trained unsupervised with a photometric consistency loss, it stays robust to the dramatic contrast changes across the bolus passage, correcting both translational and rotational head motion. 3. **Brain symmetry detection** — Covariance Matrix Adaptation Evolution Strategy (CMA-ES) with multi-scale coarse-to-fine optimization finds the midline symmetry axis, enabling contralateral hemisphere comparison. In cases with mass effect, it correctly finds the anatomical axis rather than the pathologically shifted midline. 4. **Arterial input function (AIF) selection** — a U-Net trained on roughly 500 expert-annotated cases segments middle cerebral artery territories; candidates are then ranked by curve morphology (peak height, arrival timing, sharpness, spatial coherence) to pick physiologically appropriate AIF locations automatically. 5. **Venous output function (VOF) selection** — a lightweight U-Net trained with Dice loss (built for the heavy class imbalance of sinus segmentation) delineates dural sinuses, and the extracted venous curves validate perfusion quantification through conservation principles. 6. **Cerebral blood flow threshold refinement** — a multi-output U-Net learns adaptive tissue-classification thresholds from reference segmentations rather than trusting fixed population values (detailed below—this is where the clinical accuracy comes from). 7. **Regression testing and validation** — digital phantom testing with known ground truth, clinical regression against commercial software, and continuous-integration monitoring so every code change is automatically checked against the clinical benchmarks. The design principle throughout: preserve explicit, inspectable perfusion maps at every stage. Clinicians can verify intermediate results instead of trusting a black box, which matters for both adoption and regulatory review. ## Validation We validated on two complementary fronts, because neither alone is sufficient. Digital phantoms provide absolute ground truth: simulated CT perfusion acquisitions with programmed blood flow, blood volume, and transit time distributions, including realistic noise, partial volume effects, and contrast kinetics. Processing phantoms through the full pipeline measures quantitative accuracy directly, with no confounding from clinical variability. Acceptance criteria were defined up front: correlation above 0.85 for all primary parameters, systematic bias below ten percent of mean values, and confidence intervals reported rather than point estimates alone. Clinical regression testing provides real-world concordance: the same source data processed through both our pipeline and a widely adopted commercial package with extensive validation in landmark thrombectomy trials. The regression dataset spanned multiple institutions, all three major scanner manufacturers (GE, Siemens, Philips), varied acquisition protocols including 5 mm and 10 mm slice thicknesses, and stroke severities from transient ischemic attack to large vessel occlusion. Both validation modes run continuously, not once. The framework integrates with experiment tracking infrastructure so every pipeline modification triggers automated regression testing against historical baselines, with statistical process control flagging performance drift. Each test execution records the exact code revision, dependencies, and configuration—the reproducibility discipline that regulatory submissions and clinical deployments demand. Cases with quality warnings (severe motion, contrast timing abnormalities, truncated acquisitions) are flagged and analyzed separately, and every case with poor correlation against the reference standard was manually reviewed to characterize why—so aggregate metrics never hide a failure mode, and the system's limits are documented as carefully as its strengths. ## Results The pipeline met or exceeded every clinical performance target: | Metric | Result | Target | |---|---|---| | Ischemic core volume correlation vs commercial software | > 0.90 | ≥ 0.90 | | Perfusion parameter correlation (CBF, Tmax, penumbra volume) | > 0.85 | ≥ 0.85 | | Digital phantom CBF mean absolute error | ≈ 8% | — | | Digital phantom CBV mean absolute error | ≈ 7% | — | | Digital phantom MTT mean absolute error | ≈ 12% | — | | AIF segmentation accuracy (IoU, held-out test) | 0.76 | — | | End-to-end processing time | ~3 minutes | 5–10 min expert time | The phantom results confirmed minimal systematic bias—mean errors within a few percent—so the pipeline neither over- nor under-estimates in a way that would skew clinical thresholds. Core volume correlation above 0.90 means reliable identification of the irreversibly injured tissue that drives patient selection, and penumbra correlation above 0.85 supports the mismatch-ratio calculations used in extended-time-window thrombectomy decisions. Mismatch volume (penumbra minus core) also showed strong correlation, and Bland-Altman analysis found narrow limits of agreement relative to typical core volume ranges—narrow enough to reliably classify patients against volumetric eligibility criteria. Sensitivity for detecting core presence was high while maintaining the specificity needed to avoid unnecessary interventions. Complete processing takes approximately 3 minutes per case on standard infrastructure, versus 5–10 minutes of expert time for manual analysis—and because it runs unattended, it eliminates the workflow bottleneck entirely rather than just shortening it. Failure modes affecting a minority of cases (extreme motion, tandem occlusions, major pre-existing anatomical asymmetry) are characterized and flagged for expert review rather than silently mishandled. ## What made this work The centerpiece is how the threshold-refinement network was designed around the clinical decision, not the segmentation metric. Thrombectomy eligibility depends on ischemic core volume—criteria like core below 70 mL—so a model can score respectably on pixel-wise overlap while systematically over- or under-estimating volume, and that error lands exactly where it changes a treatment decision. Our multi-output U-Net predicts tissue below four CBF thresholds simultaneously (38%, 34%, 30%, and 20% of contralateral normal, spanning mild hypoperfusion to definitive core) and trains with a hybrid loss: pixel-wise binary cross-entropy plus a volumetric MSE term that directly penalizes volume error in milliliters. The network sees six input channels—CBF, CBV, MTT, Tmax, temporal maximum intensity projection, and the baseline fixed-threshold mask—so it learns to refine a physically grounded starting point rather than hallucinate one. Ablations proved both choices: CBF alone as input reduced accuracy, and dropping the volumetric term kept acceptable pixel-wise IoU but degraded exactly the volume correlation that clinical eligibility rests on. Two other decisions carried the project. First, hybrid architecture: learned models where labeled data existed (vessel segmentation, threshold refinement), classical optimization where the problem was geometric (CMA-ES for symmetry), and unsupervised learning where labels were impossible (motion correction via photometric consistency). Each tool was matched to its data regime instead of forcing deep learning everywhere—and because the pipeline preserves explicit perfusion maps as its intermediate representation, it can fall back to standard thresholding whenever learned refinements are uncertain, and clinicians can always inspect the reasoning behind a classification. Second, validation as infrastructure rather than a milestone: phantom ground truth plus commercial-software regression, wired into continuous integration, meant clinical accuracy was demonstrated—and protected—on every change, which is what turns a promising model into a deployable medical system. --- ## Case study: Real-Time Thermal Obstacle Detection — Computer Vision Case Study URL: https://www.predev-consulting.com/projects/thermal-obstacle-detection/ Published: 2023-08-15 Author: Itamar Tsayag, PreDev Consulting Topics: Computer Vision, Thermal Imaging, Deep Learning, ResNet50, Real-Time Systems > Hybrid classical and deep-learning obstacle detection on 14-bit thermal video, running in under 500 MB on embedded avionics with 4-frame latency. Key metrics: - Working memory: <500 MB - Candidates per frame: ≤50 - Detection latency: 4 frames ## Problem Low-altitude tactical flight leaves almost no margin for surprises. Towers, poles, and masts are among the deadliest collision hazards a crew can face, and they are exactly the objects that degraded visual environments hide best. Visible-spectrum cameras fail in low light, adverse weather, and high-contrast scenes; thermal sensors keep working, but they bring their own problems. Our client needed obstacle detection running on 14-bit imagery from uncooled long-wave infrared sensors (8–12 µm spectral band, 768×1024 native resolution) — and uncooled thermal is unforgiving. Vertical structures often show only subtle thermal gradients against sky or terrain. Dynamic range is narrow, temporal noise drifts with sensor temperature, and an obstacle can appear darker or brighter than its background depending on solar loading. The operational constraints were just as hard as the sensing ones. The system had to process multiple frames per second at low latency on embedded avionic hardware, which ruled out dense sliding-window deep learning over full frames. Pure deep learning was also a poor fit for another reason: thermal training data is scarce, and models transferred from visible-spectrum imagery struggle with the fundamentally different statistics of thermal scenes. Purely classical methods, meanwhile, lack the representational capacity to handle the full variability of obstacle appearances — the world is full of thin branches, fence posts, and antenna structures that look a lot like the hazards we care about. And because this is flight safety, false alarms carry a real cost: a system that cries wolf gets ignored. We needed a detector that was fast enough for an embedded flight computer, sensitive enough to catch thin pole-like structures in weak thermal contrast, and disciplined enough to stay quiet about transient thermal artifacts. ## Approach We built a hybrid pipeline: classical image processing decides where to look, deep learning decides what it's looking at, and temporal logic decides whether to believe it. 1. **Preprocessing.** Each frame gets dead-pixel correction and bilateral filtering — edge-preserving noise reduction that keeps obstacle boundaries intact. 2. **Big-Small candidate generation.** A classical asymmetric filter tuned to vertical step edges — the signature of pole-like structures against sky or terrain — accumulates edge responses into a score map, and non-maximum suppression picks local maxima as candidates. This stage reduces the ResNet's workload from thousands of candidate patches per frame to at most 50, focusing all deep-learning compute on high-probability regions. 3. **Multi-gamma enhancement.** Every candidate patch is percentile-normalized, then rendered at three gamma values (γ = 1.0, 0.5, 2.0) to synthesize an exposure bracket from a single frame. 4. **ResNet50 classification.** Each gamma variant is classified independently at 64×64 resolution; the final score is the maximum across the three variants, so whichever exposure presents the obstacle best wins. A patch counts as a detection only above a 0.95 probability threshold. Spatial non-maximum suppression consolidates overlapping detections, and a refinement pass estimates each obstacle's true vertical extent from intensity profiles for tighter bounding boxes. 5. **Optical-flow tracking.** The full classifier runs every fifth frame. In between, Farneback dense optical flow carries each obstacle forward, maintaining correspondence at a fraction of the cost, with gradient-based edge refinement keeping tracked boxes aligned to the obstacle. 6. **Temporal validation.** A sliding 8-frame window matches detections to tracks via Intersection-over-Union. An obstacle is confirmed only after at least 4 positive detections within the window. The architecture also supports multi-camera configurations: each sensor runs the full pipeline independently, and detections fuse in a shared azimuth/elevation coordinate frame relative to the aircraft, using per-camera polynomial calibration to map pixels to angles. A global obstacle database accumulates evidence across viewpoints, extending effective coverage without coupling the per-camera pipelines. ## Results The design keeps deep learning where it earns its cost and classical processing everywhere else, and the compute profile shows it: | Component | Share of processing time | |---|---| | ResNet50 patch classification | ~60% | | Classical preprocessing (Big-Small, filtering) | ~20% | | Farneback optical flow tracking | ~15% | | All remaining modules | ~5% | GPU acceleration cuts ResNet inference time by a factor of 10 versus CPU-only execution, making real-time operation possible. Because the classifier runs only every fifth frame — with optical flow bridging the gaps — and only on the ≤50 candidates the classical stage nominates, worst-case compute is bounded and configurable. Total working memory stays under 500 MB including frame buffers, track databases, and network weights: a footprint compatible with embedded avionic systems. On the false-alarm side, the 0.95 classification threshold combined with the 4-of-8-frame persistence requirement is designed to keep spurious reports at levels acceptable for operational flight systems. The price is latency, and it's a known, bounded one: confirmed detection averages 4 frames from obstacle appearance, with a minimum of 1 frame for high-confidence obstacles — comfortably inside the multi-second timescales of collision-avoidance maneuvers. Compute also scales sensibly with scene content: sparse scenes yield few candidates and fast frames, while the per-frame candidate cap bounds cost in heavy clutter. Evaluated on the BN Dataset — thermal video sequences from low-altitude tactical flights over diverse terrain, times of day, and aircraft maneuvers, with ground-truth obstacle annotations — the system detects poles, towers, and masts down to 10×20 pixels, degrading gracefully as range grows and thermal contrast thins. The residual challenges are the honest ones: thin branches, fence posts, and antennas that genuinely resemble obstacles, and brief track gaps during aggressive maneuvers that the temporal filter is built to tolerate. ## What made this work The single best trick in this system is the multi-gamma exposure bracket. An obstacle in thermal imagery can be hotter or cooler than its background depending on material and solar loading, and training one classifier to handle both dark-on-light and light-on-dark appearances with limited thermal data is a losing game. Instead, we synthesize three exposures from every patch — linear (γ = 1.0), brightened (γ = 0.5) for dark obstacles, darkened (γ = 2.0) for bright ones — and max-pool the classifier scores across them. Whatever the thermal polarity, at least one variant presents the obstacle with favorable contrast. That's exposure invariance without HDR hardware, multiple captures, or a massive training set. Ablations bore this out: single-gamma variants degraded on very dark or very bright obstacles, while the three-gamma bracket matched the performance of exhaustive search over many gamma values at a fraction of the cost. The second decision that paid off was refusing to make deep learning do everything. Classical Big-Small filtering is a nearly free attention mechanism: it knows what a vertical step edge looks like and hands the network a short list instead of a full frame. The ResNet does the one thing classical filters can't — discriminate real obstacles from look-alike clutter. Finally, we treated false alarms as an architecture problem, not a threshold-tuning problem. Optical flow plus IOU matching over an 8-frame window gives robust persistence checking without a heavyweight multi-object tracker — simple, inspectable, and cheap enough for the flight computer. --- ## Case study: AI Passport Photo Validation at Scale — Computer Vision Case Study URL: https://www.predev-consulting.com/projects/passport-processing/ Published: 2024-11-25 Author: Itamar Tsayag, PreDev Consulting Topics: Computer Vision, Facial Landmark Detection, Deep Learning, Biometric Standards > ICAO passport photo validation: 98-point facial landmarks, geometric registration and automated cropping, with reason-coded rejections at scale. Key metrics: - Facial landmarks: 98-point - Pose tolerance: ±20° - Output: ICAO 1:1 ## Problem Passport photographs must satisfy strict international standards defined by ICAO: precise constraints on where the face sits in the frame, how the head is posed, whether the expression is neutral, and how uniform the background is. Checking these criteria by hand is slow, subjective, and inconsistent — and applicants routinely submit non-compliant photos, triggering rejections and processing delays for both applicants and agencies. With smartphone photography and online application systems now the norm, our client needed the check automated: a system that takes an arbitrary photo, decides whether it can become a compliant passport photo, and either produces one automatically or rejects it with a specific, actionable reason — immediate feedback that lowers rejection rates and accelerates document processing. That demands robust facial analysis across real-world variation in lighting, facial attributes, and image quality, plus the geometric machinery to transform a casual photo into one that satisfies every ICAO constraint simultaneously. It also opens the door to at-home capture for applicants without easy access to professional photography. ## Approach We built a cascade of seven modules, each independently testable and replaceable: image loading, face detection, landmark detection, registration, head segmentation, optimization-based cropping, and background removal with validation. The geometric core is a 98-point facial landmark detector — a stacked hourglass network trained with STAR Loss, which we chose because it models direction-dependent localization uncertainty per landmark, adapting precision to the structural ambiguity of each facial point. The detector was trained on a corpus spanning in-the-wild conditions: WFLW (10,000 faces with 98-point annotations across pose, occlusion, makeup, and illumination categories), 300W (3,837 images), and COFW (1,852 occlusion-focused images). Raw landmarks vary with pose, expression, and detection noise, so before any geometric reasoning we register them to a canonical frontal reference using Coherent Point Drift — a probabilistic rigid alignment that estimates scale, rotation, and translation via Expectation-Maximization, normalized by inter-ocular distance. ![Pipeline visualization without registration](/images/projects/passport_w_reg_debug_fig.png) *Figure 1: Raw landmark detection exhibits variability due to pose and expression differences, complicating standardized cropping.* ![Post-registration visualization](/images/projects/passport_post_registration_debug_fig.png) *Figure 2: Coherent Point Drift aligns facial landmarks to a canonical reference, normalizing geometry for subsequent processing stages.* With geometry normalized, cropping becomes an optimization problem: find the square crop whose proportions satisfy the ICAO spec. A smooth penalty objective over crop center and size is solved with L-BFGS-B, typically converging in 20–30 iterations, followed by a 1.15 scaling factor for headroom against minor positioning variation. Head segmentation (MediaPipe SelfieSegmentation) supplies the crown point the optimizer needs; a matting network (InSPyReNet) replaces the background with passport white, with opacity thresholding to eliminate stray semi-transparent hair strands. ## Results The deployed pipeline validates every photo against the full ICAO geometric specification and enforces each threshold as a hard acceptance criterion: | Criterion | Acceptance threshold | |---|---| | Head height (crown to chin) | 50–69% of image height | | Ocular line position | 50–69% from bottom edge | | Output aspect ratio | Square, 1:1 | | Yaw | within ±20° | | Pitch | within ±20° | | Roll | within ±15° | Head pose is measured with a Perspective-n-Point solver against a canonical 3D head model; expression neutrality is scored by a trained regressor over landmark displacements and HOG texture features; position validation confirms the final crop still satisfies the geometric constraints after all processing. Each validator returns a pass/fail decision with auxiliary measurements — the actual angles and scores — so every rejection is reason-coded rather than a bare "no," giving applicants immediate, specific feedback. A photo is approved only when all validators pass. Running as an end-to-end pipeline, the system performs robustly across diverse facial attributes and challenging imaging conditions, and substantially reduces the manual review load for passport photo processing. ## What made this work The key move was turning "does this photo comply?" from a judgment call into geometry. Instead of searching over discrete crop proposals or hand-tuning margins, we expressed the ICAO proportions as a smooth penalty function and let a quasi-Newton solver find the crop that satisfies head height, eye position, and chin visibility simultaneously — fast, deterministic, and trivially auditable against the written standard. That only works if the geometry underneath is trustworthy, which is why registration sits at the heart of the pipeline. Coherent Point Drift's probabilistic formulation handles landmark detection noise gracefully, avoiding the brittle point correspondences that break naive alignment — every downstream stage operates on faces in one canonical frame. Finally, the strict cascade of independent validators kept the system honest and extensible. Each check does one thing, reports its evidence, and can be swapped or supplemented — adding glasses detection or eye-openness checks requires no architectural change. Objective, reason-coded enforcement also brings a consistency that subjective human review can't match. --- ## Client testimonials ### David Corcos, CTO, Agile MRI URL: https://www.predev-consulting.com/testimonials/david-corcos/ Project: MRI image enhancement Rating: 5/5 I hired Itamar to help my MRI startup develop a first proof-of-concept deep learning image enhancement model and pipeline. This was a new direction for us, and I needed someone who could not only design a good model but also set up the groundwork for future development. Itamar immediately stood out for his professionalism, depth of knowledge, and very structured approach. He quickly learned the MRI domain and was able to propose a model that struck the right balance between performance, computational efficiency, and implementation complexity—essential for our limited compute resources and fast timeline. What I appreciated most was how independently he worked while staying completely aligned with my priorities. He communicated clearly, managed his time transparently, and delivered high-quality results without needing close supervision. The collaboration was smooth, efficient, and genuinely enjoyable. Absolutely. I would tell any colleague looking for a deep learning engineer that Itamar combines strong technical skills with a practical, results-oriented mindset. He doesn't just build models—he thinks about how to make them sustainable and usable. In our case, he used state-of-the-art tools for data management, experiment tracking, and model deployment, so I can now easily continue iterating on his work, swap models, or plug in new datasets. That kind of foresight and professionalism is rare. In short, Itamar delivers excellent technical work, communicates clearly, and sets up his clients for long-term success. ### Anonymous Client, Founder, CEO URL: https://www.predev-consulting.com/testimonials/julian-o/ Project: Parametric garment tailoring framework and system for accurately measuring 3D body Rating: 5/5 I was facing the challenge of needing someone who could create a system that balanced speed and precision while modernizing centuries old tailoring methods. Itamar was great at understanding and expanding upon what I had been working on in order to bring it to life. He exhibited great communication and creative problem solving, which was particularly impressive given his lack of prior experience in this very specialized domain. I would certainly recommend Itamar to a colleague and would tell them that they should hire him if they are looking for someone who is efficient, communicates well, and has great creative problem solving capabilities. ### Or Pearl, Product Incubation Lead, Clalit Health Services URL: https://www.predev-consulting.com/testimonials/or-pearl/ Project: AI model for Mild Cognitive Impairment assessment application Rating: 5/5 We needed an AI model to replace a clinician in scoring the patient's tasks within the assessment of Mild Cognitive Impairment. That required training a set of AI models to score the patient's drawing. Itamar grasped an understanding of the clinical challenge, and he was fast in focusing on the most suitable models that eventually got the job done. Itamar guided the clinicians on how to annotate the training datasets for the AI models. He walked the Clalit team through the process of training AI so everybody was always on the same page. The team specifically mentioned how intriguing and insightful the entire process was. He addressed clinical and technical challenges in a timely manner and was always focused on meeting time and budget constraints. I would definitely find more opportunities for Itamar to work with Clalit on innovative AI projects and recommend other organizations to hire his services. He gets the job done! ## Contact Book a 30-minute technical call: https://www.predev-consulting.com/contact/ (replies within 24–48 hours on business days).