Analysis of the Working Principle of TensorFlow-Based AI Medical Imaging Diagnosis Platform
-
This article analyzes the working principle of the TensorFlow AI medical imaging diagnosis platform, aiming to help readers better understand TensorFlow's application in this field.
Using artificial intelligence to assist pathologists in sample diagnosis can not only significantly improve diagnostic efficiency but also reduce missed diagnoses and enhance accuracy.
Digital pathological imaging allows observation of tissue and cell morphology. At the highest digital scanning resolution, file sizes can reach the gigabyte level, requiring AI and systems engineering techniques to overcome these challenges.
In this article, I will approach from the perspective of AI system construction methods, using the development process of a gastrointestinal pathology assistance system as an example to explain technical details.
Given that this involves relatively unfamiliar medical technology knowledge, the article will also adopt a product manager's perspective to facilitate reader comprehension.
1. What is Pathology?
Pathology involves diagnosing diseases by analyzing patients' tissues, cells, and body fluid samples. It provides clinicians with golden indicators for further treatment strategies.
A common misconception is that all AI medical imaging comes from CT scans, X-rays, or ultrasounds. For example, gastric cancer screening uses pathological images created by scanning and magnifying tissue samples, resulting in approximately 1.4GB images for analysis.
Different diseases have different pathological sources, making this a technical challenge.
Before making pathological judgments, we need to establish a training model using doctor-annotated images for enhanced training and data processing.
2. TensorFlow Working Principle
When explaining TensorFlow's training model, we must understand the entire deep learning workflow.
Data sources typically come from hospital PACS and RIS systems. After forming a data queue, we perform data augmentation to improve image robustness.
We must also consider scanner magnification levels, as they affect image robustness under different magnification conditions.
TensorBoard is then used for model monitoring. It's a visualization tool that effectively displays TensorFlow's computation graphs, various metric trends over time, and training data information during operation.
The trained model is exported via TensorFlow to the production inference framework (TensorFlow Serving) for automated processing.
How does TensorFlow Serving work?
TensorFlow Serving divides pathological slides into coordinate-marked small tiles. Each input tile is processed by a map task, with default HDFS block size (64MB) as a tile, though this can be adjusted.
Map outputs are temporarily stored in a circular memory buffer (default 100MB, controlled by io.sort.mb). When nearing capacity (80% by default, controlled by io.sort.spill.percent), an overflow file is created in local storage. Before disk writing, data is partitioned by reduce task count to ensure balanced distribution.
Each partition is sorted, with optional Combiner operations to minimize disk writes. The MapReduce mechanism then copies partitioned data to corresponding reduce tasks. Reduce tasks receive ordered data from multiple maps.
If reduce input is small, it's stored in memory (buffer size controlled by mapred.job.shuffle.input.buffer.percent). If exceeding threshold (mapred.job.shuffle.merge.percent), data is merged and spilled to disk.
Multiple spill files are merged into larger sorted files to optimize later merging. Both map and reduce phases repeatedly perform sorting and merging operations, with final merged results going directly to reduce functions without disk writing.
The same workflow can be applied through transfer learning, as pathological images share many similarities (glands, polyps, cysts, etc.).