← Nabil Shehadeh

Before the model: X-ray data at GE HealthCare

A vision model only learns from what its data pipeline hands it. At GE HealthCare I worked on that pipeline for X-ray computer vision: one schema across more than 400 datasets, the PyTorch loaders that turn stored images into training batches, and the known-answer suites that check a change hasn’t moved a result. None of it is the model. All of it decides whether the model’s answers can be trusted.

Schema
One shared schema across 400+ X-ray datasets.
Loaders
PyTorch pipelines that read, prepare and batch images for vision models.
Tests
Known-answer suites that check a change against results already established.
Stack
Python, PyTorch
Fig. 1Where each piece sits. The blue ones are what I built, and each one links to its section.

One schema for 400+ datasets

Datasets gathered at different times and in different places rarely describe themselves the same way. The same fact turns up under different names, in different formats and with different vocabularies. A view might be written “PA”, “pa” or “posteroanterior”; an age might be a number, a padded string or a count of months.

A model can only learn from a mix of datasets if they all say things the same way. I standardized the schema across more than 400 of them, so a training run could draw on any combination without a one-off script for each.

Dataset ADataset BDataset C
View View Position"PA"view"PA" ViewPosition"ap"view"AP" projection"posteroanterior"view"PA"
Sex Patient Gender"F"sex"F" PatientSex"M"sex"M" gender"female"sex"F"
Age Patient Age63age_years63 PatientAge"071Y"age_years71 age_months540age_years45
Findings Finding Labels"Effusion|Atelectasis"findings["effusion", "atelectasis"] labels["pleural effusion"]findings["effusion"] effusion, atelectasis0, 1findings["atelectasis"]
Fig. 2Three made-up records saying the same four things, first as they arrive, then on one schema. The names and values are illustrative, not GE’s.

Getting images into the model

A model never sees an X-ray file. It sees whatever the loader makes of it: read, resized, scaled and stacked into a batch. I built those PyTorch data pipelines for the vision models.

The trap is that a pipeline can change what every image looks like and still run without an error. If training and evaluation prepare images even slightly differently, the model is scored on pictures it never learned from, and nothing tells you.

Training

Evaluation

Difference

Fig. 3A synthetic chest image, drawn by this page, prepared for training and for evaluation. Pick a difference to see what it does to the pixels; the difference is brightened 12 times so small changes show.

The simplest guard is structural: one definition of “prepared”, used by both sides.

# Illustrative, not GE code
class XrayDataset(Dataset):
    def __init__(self, index, prepare):
        self.index, self.prepare = index, prepare   # one row per image, on the shared schema

    def __len__(self):
        return len(self.index)

    def __getitem__(self, i):
        row = self.index[i]
        return self.prepare(read_image(row.image_path)), row.findings

prepare = build_prepare()   # the only definition of "prepared"
train = DataLoader(XrayDataset(train_index, prepare), batch_size=32, shuffle=True)
test  = DataLoader(XrayDataset(test_index,  prepare), batch_size=32)

Tests with known answers

Because a pipeline change can fail without a sound, I built known-answer evaluation suites to catch it. Each case has an output that’s already established. After a change the cases run again: if every answer holds, the change can go ahead; if one moves, it stops until someone knows why.

Fig. 4Twelve synthetic cases and a stand-in for a model: the share of each prepared image darker than 0.35, the way a lung field reads dark. The known answers come from the current pipeline. Pick a change to run them again.

Tidying the code without changing its steps passes. Both of the differences from Fig. 3 are caught, though neither raised an error.

What carried over

The people relying on a medical model need to trust its answer before they act on it, and that trust is built long before training: in data that means the same thing everywhere, loaders that never drift, and tests whose answers you already know. It’s the same habit behind Clear and the Quote Engine: show the working, and check it against what you already know.

This describes the work in general terms. The figures run on synthetic images and invented field names, not GE HealthCare data, and the code is illustrative.