Computer Vision · Medical imaging

Building AI that Learns and Adapts: A Case Study from MRI Diagnostics

Real-world data rarely stays the same: scanners are replaced, patient groups differ, parameters change. Using a system that detects epilepsy lesions on MRI, we show how continual learning keeps AI reliable as conditions shift.

Aleksandra Osztynowicz 7 min read
Glowing brain made of lines and data points on a dark blue background

Key takeaways

  • Focal cortical dysplasias are a common cause of drug-resistant epilepsy and very hard to detect on MRI.
  • In 2021 the first model version detected 77.8% of lesions compared with 33.3% for visual assessment, but with very low specificity.
  • With continual learning, the model reached 90% sensitivity at 70% specificity in 2024 and outperformed classical training.
  • The principle applies beyond medicine: wherever data changes, systems that keep learning stay reliable for longer.

A lesion without a fixed template

Around 50 million people worldwide live with epilepsy, one of the most common neurological conditions. Seizures are often caused by focal cortical dysplasias (FCDs), subtle malformations of the cerebral cortex that are hard to see on conventional MRI scans. Their appearance varies widely and often blends into surrounding tissue. Even experienced specialists find reliable detection difficult, and the expertise needed exists in only a few centres.

FCDs take many forms: their borders look blurred, the cortex may be thickened, folding deviates from usual patterns, and the junction between grey and white matter shows subtle intensity changes. Even the well-known transmantle sign, a vertical signal change running from the cortex into deeper structures, does not appear in every patient. There is therefore no standard visual template.

When lesions are found, many patients become seizure-free after surgery. When they remain hidden, treatment options shrink. Early detection is essential, and that is exactly where visual assessment alone reaches its limits.

Three MRI brain slices, each with a focal cortical dysplasia circled in red
Fig. 1: How focal cortical dysplasias appear on MRI scans

The example stands for a general technical problem. AI systems that perform well under controlled conditions often lose performance once the data distribution changes in deployment. The lessons from this project therefore apply to any organisation working with complex, changing or expertise-heavy data.

How the system is built

Together with the Hamburg Epilepsy Center at Evangelisches Krankenhaus Alsterdorf and Dr. Patrick House, we explored how AI can support specialists in detecting FCDs early. The system highlights potentially relevant regions so that experts can examine the decisive details faster. The diagnosis stays with them.

MRI data is demanding. A single study contains hundreds of slices from different sequences: T1 shows anatomy sharply, T2 reveals fluids, and FLAIR suppresses fluid signals so abnormalities stand out.

Before training, the data is segmented to remove irrelevant structures. Morphometric maps based on the Huppertz method describe tissue junctions and extensions and reveal features that stay hidden in raw scans. The model receives four channels: T1, FLAIR and two morphometric maps.

Left, an MRI with colour-segmented brain tissue; right, two morphometric maps with highlighted tissue junctions
Fig. 2: Preprocessing. Left, brain tissue segmentation (2D U-Net with ResNet34); right, morphometric analysis based on Huppertz (junction, extension).

The model follows an encoder-decoder design with variational regularisation. The encoder compresses the image data into abstract features, and the decoder reconstructs the target regions by gradually reintroducing spatial detail. This lets the network detect edges, shapes and irregular textures that specialists otherwise search for by hand.

Diagram of the model architecture: encoder levels with skip connections to the decoder, a variational decoder for regularisation and a segmented lesion mask as output
Fig. 3: Model architecture, encoder-decoder with variational regularisation

The first version: high sensitivity, too many false alarms

In the prospective clinical validation of the first version, the model detected 77.8% of FCDs. Conventional visual assessment found 33.3% in the same test, three out of nine lesions. Specificity, however, was only 5.5%, meaning the model flagged many findings that were not confirmed as FCDs. Most of these false alarms came from image noise or other pathologies. This showed how strongly differences in the data themselves shape performance, and it became the starting point for the next phase.

Why continual learning makes the difference

Static models lose performance as soon as their data environment changes, and that happens in almost every real application: scanners are replaced, patient groups differ, acquisition parameters vary. A model that cannot adapt loses accuracy and needs frequent, costly retraining. Continual learning lets a model grow with new conditions without forgetting what it has learned.

Biological brains do this naturally: synapses strengthen with relevant experiences and stabilise as memories form. Common methods borrow from these principles:

MethodPrinciple
Regularisation, e.g. elastic weight consolidation (EWC)Protects parameters that were especially important for earlier tasks.
ReplayReintroduces earlier examples into training to stabilise the model’s memory, much as the brain consolidates learning during sleep.
Architecture-based methodsExpand the network for new tasks while preserving existing capabilities.

The second version: continual learning in clinical routine

For the second study, a dataset of 300 MRIs from daily clinical practice was compiled prospectively: 30 FCD cases, 150 normal scans and 120 cases with other pathologies. It was split into three sequential subsets reflecting real changes in the data. The model was trained further in two phases, once classically across all data and once with continual learning.

Result of the prospective validation

The best model, trained with continual learning, reached 90.0% sensitivity at 70.0% specificity and 72.0% accuracy, with an average of 0.41 false-positive clusters per MRI. Performance improved with each training phase, and continual learning outperformed classical training.

Read the Hamburg Epilepsy Center case study

Adaptive models therefore work robustly under real conditions too. The system stays stable while the data distribution shifts, creating a dependable basis for pre-screening in clinical workflows.

What this means for other industries

The use case comes from the clinic, but the engineering lessons apply almost everywhere. Logistics environments shift, market signals fluctuate, and sensor data changes with the seasons or as equipment wears. Static algorithms quickly reach their limits there, while systems built for continuous adaptation stay reliable.

Every project needs its own strategy, architecture and integration. We analyse the data landscape, identify suitable use cases and design solutions that fit processes, infrastructure and long-term strategy. Our healthcare and MedTech page shows more of our medical projects.

Sources

  1. WHO: Epilepsy, fact sheet
  2. House PM, Kopelyan M, Braniewska N, Silski B, Chudzinska A, Holst B, Sauvigny T, Martens T, Stodieck S, Pelzl S: Automated detection and segmentation of focal cortical dysplasias (FCDs) with artificial intelligence. Epilepsy Research 2021;172:106594. PubMed 33677163
  3. Chanra V, Chudzinska A, Braniewska N, Silski B, Holst B, Sauvigny T, Stodieck S, Pelzl S, House PM: Development and prospective clinical validation of a convolutional neural network for automated detection and segmentation of focal cortical dysplasias. Epilepsy Research 2024;202:107357. PubMed 38582073
  4. Huppertz HJ, Grimm C, Fauser S et al.: Enhanced visualization of blurred gray-white matter junctions in focal cortical dysplasia by voxel-based 3D MRI analysis. Epilepsy Research 2005;67(1-2):35-50. PubMed 16171974

AI for data that keeps changing?

We work out with you how your data changes in operation, which architecture stays reliable and what a first prototype with real data looks like.

Request a process analysis

Frequently asked questions

Malformations of the cerebral cortex and a common cause of drug-resistant epilepsy. They are hard to see on MRI because they have no clear border and their appearance varies widely.

A training approach in which a model takes in new data without forgetting what it learned before. Common methods are regularisation such as elastic weight consolidation, replay of earlier examples and architecture-based extensions.

In the 2024 prospective validation, the model trained with continual learning reached 90% sensitivity at 70% specificity. The first version from 2021 detected 77.8% of lesions, compared with 33.3% for visual assessment.

No. It highlights potentially relevant regions so specialists can examine the decisive details faster. Physicians still make the diagnosis.

Aleksandra Osztynowicz

About the author

Aleksandra Osztynowicz

AI Engineer, theBlue.ai

Aleksandra has been building custom AI solutions at theBlue.ai since 2021, with a focus on agentic implementations and local LLM deployments that precisely fit enterprise needs. As an AI Engineer, she helps organizations automate their processes with production-grade systems, from on-premise open-source models to RAG-based internal knowledge bases for regulated industries, and continuously expands her knowledge in the rapidly changing world of artificial intelligence.

In her articles, she shares practical experience from real enterprise AI projects and shows that deploying AI in companies doesn’t need to be complicated.