R-TF-028-012 Synthetic Data Generation Protocol
Table of contents
Purpose and Scope
This document defines the controlled protocol for generating synthetic dermatological images using AI-based image generation tools. Synthetic data generation is employed exclusively to augment validation and bias-evaluation datasets where real patient images for specific demographic subgroups, in particular Fitzpatrick skin types V–VI, are insufficient to perform a meaningful bias analysis.
Synthetic images produced under this protocol are used only for bias evaluation purposes and are never included in training sets. This constraint ensures that model weights are derived entirely from real clinical data while still enabling a demographic fairness assessment across the full spectrum of skin tones.
Context and Regulatory Rationale
Several AI models within the Legit.Health Plus device require bias analysis across Fitzpatrick skin types to comply with the requirements of MDR 2017/745, Regulation (EU) 2024/1689 (EU AI Act), and the FDA/Health Canada/MHRA Good Machine Learning Practice guiding principles. For certain clinical domains — notably hidradenitis suppurativa — real images of Fitzpatrick V–VI patients are scarce in available datasets.
To address this gap in a controlled, transparent, and auditable manner, we employ an AI-based skin-tone translation tool (internally referred to as Nano Banana) to produce synthetic images that preserve lesion morphology while modifying skin tone appearance. This approach is documented as a known limitation with an explicit validation and quality-control step performed by the Medical Director.
Definitions
- Source image: A real clinical image from the validated dataset, typically of Fitzpatrick I–IV skin type, that serves as the input to the generation pipeline.
- Synthetic image: The output image produced by the skin-tone translation pipeline, intended to represent the same pathology on a darker Fitzpatrick skin type.
- Nano Banana: The internal name for the skin-tone translation pipeline described in this protocol, built on top of the Gemini image generation API.
- Pathology preservation: The requirement that the synthetic image retains the same clinical diagnosis, lesion morphology, lesion count, lesion boundaries, and severity as the source image.
Generation Pipeline
Overview
The synthetic data generation pipeline consists of three sequential phases:
Prompt Engineering and Validation
Objective: Identify the optimal text prompt that, when paired with a source image, produces a synthetic output that modifies skin tone while maximally preserving lesion morphology, count, boundaries, and overall image structure.
Procedure:
- A representative sample of source images (minimum 10, spanning different pathologies and lesion presentations) is selected from the validated dataset.
- Candidate prompts are designed following the general pattern: "Change the skin tone of the person in this image to Fitzpatrick type [V/VI] while preserving all skin lesions, their morphology, size, number, and spatial arrangement exactly as they appear."
- For each candidate prompt, synthetic images are generated at multiple temperature settings (range: 0.2–1.0, step 0.2) to evaluate the trade-off between fidelity and diversity.
- Generated images are reviewed by the AI team for:
- Structural fidelity: The overall image composition, background, and body positioning are preserved.
- Skin-tone plausibility: The resulting skin tone is consistent with Fitzpatrick V–VI.
- Lesion preservation (visual): Lesions appear morphologically unchanged upon visual inspection.
- The prompt and temperature combination that yields the highest structural fidelity and lesion preservation rate across the sample set is selected as the production configuration.
- The selected prompt, temperature, and selection rationale are recorded in the project's experiment log for traceability.
Output: A validated production prompt and temperature setting.
Automated Generation Pipeline
Objective: Produce synthetic images at scale using the validated prompt configuration via an automated, reproducible pipeline.
Procedure:
- Input preparation: Each source image is programmatically resized to comply with the image generation API's accepted input aspect ratios. The original dimensions and the applied transformation are recorded.
- API call: The source image and the validated production prompt are submitted to the Gemini image generation API with the selected temperature setting. The specific API version and model identifier are recorded.
- Output post-processing: The generated image is resized back to the original source image dimensions using the inverse of the transformation applied in step 1.
- Metadata recording: For each synthetic image, the following metadata is stored:
- Source image identifier (traceable to the original dataset)
- Generation timestamp
- API model version and configuration (prompt, temperature, aspect ratio transformation)
- Output image identifier
Output: A set of candidate synthetic images with full provenance metadata.
Medical Review and Acceptance
Objective: Ensure that every synthetic image meets the pathology-preservation criteria before inclusion in any evaluation dataset.
Responsible: Medical Director (or qualified delegate: board-certified dermatologist).
Procedure:
For each candidate synthetic image, the Medical Director performs a structured review against the source image, evaluating:
-
Pathology preservation (mandatory pass): Is the clinical diagnosis (pathology) in the synthetic image the same as in the source image? Has the nature or appearance of the pathology been altered in a clinically meaningful way?
- If NO (pathology altered) → EXCLUDE the image.
-
Annotation integrity (mandatory pass, when applicable): If the source image carries additional annotations (e.g., bounding boxes for object detection, segmentation polygons for surface area), has the shape, spatial extent, or number of annotated lesions changed in the synthetic image?
- If YES (annotations no longer valid) → EXCLUDE the image.
- If the changes are minor and correctable, the Medical Director may update the annotations on the synthetic image. The updated annotations are recorded as a new annotation version linked to the synthetic image.
-
Overall image quality: Is the synthetic image free of generation artifacts (e.g., blurring, hallucinated structures, colour banding) that would make it unsuitable for model evaluation?
- If NO (artifacts present) → EXCLUDE the image.
Decision: Each image receives a binary ACCEPT or EXCLUDE verdict. Only accepted images are included in the evaluation dataset. The review decision and reviewer identity are recorded for traceability.
Output: A validated set of synthetic images, each linked to its source image, provenance metadata, and medical review record.
Quality Control and Traceability
Traceability Requirements
Every synthetic image included in an evaluation dataset must be traceable through the complete chain:
| Artifact | Traceable To |
|---|---|
| Synthetic image | Source image identifier |
| Generation parameters | Prompt, temperature, API version, aspect ratio transformation |
| Medical review | Reviewer identity, review date, ACCEPT/EXCLUDE decision |
| Dataset inclusion | Model name, evaluation dataset version |
Reporting in the Development Report
When synthetic images generated under this protocol are used in the evaluation of a specific model, the AI Development Report (R-TF-028-005) shall document:
- The number of synthetic images included in the evaluation dataset and their purpose (e.g., Fitzpatrick V–VI bias analysis).
- A reference to this protocol (
R-TF-028-012). - The acceptance rate from Medical Review (number of images accepted vs. total generated).
- An explicit statement that synthetic images were used exclusively for bias evaluation and were not included in training data.
- A Known Limitation statement acknowledging that synthetic data may not fully represent the variability of real patient images from the target demographic group.
Limitations and Future Work
The use of synthetic data for bias evaluation is a pragmatic interim measure to enable demographic fairness analysis where real data is unavailable. The following limitations are acknowledged:
- Synthetic images are not real patient data. While the generation pipeline is designed to preserve lesion morphology, subtle clinical features (e.g., erythema presentation on dark skin, lesion-to-skin contrast) may not be fully captured by the skin-tone translation approach.
- Regulatory acceptance is evolving. The regulatory landscape for synthetic data in medical device AI is not yet fully established. This protocol is designed to be transparent and conservative, but regulatory feedback may require adjustments.
- Continuous improvement commitment. As real Fitzpatrick V–VI images become available through targeted data collection efforts (per
R-TF-028-003 Data Collection Instructions), they will progressively replace synthetic images in evaluation datasets.
Reference Documents
GP-028 AI DevelopmentR-TF-028-002 AI Development PlanR-TF-028-003 Data Collection InstructionsR-TF-028-005 AI Development ReportR-TF-028-011 AI Risk Matrix
Signature meaning
The signatures for the approval process of this document can be found in the verified commits at the repository for the QMS. As a reference, the team members who are expected to participate in this document and their roles in the approval process, as defined in Annex I Responsibility Matrix of the GP-001, are:
- Author: Team members involved
- Reviewer: JD-003 Design & Development Manager, JD-004 Quality Manager & PRRC
- Approver: JD-001 General Manager