Image making · Research feature

AI Generates Synthetic Colon Polyp Images Using Text Prompts to Improve Diagnosis

The study evaluates a diffusion model, PathoPolyp-Diff, that generates synthetic colon polyp images using text prompts to represent different pathologies and imaging modalities.

Adapted from research by Sharma V, Jha D, Bhuyan MK and colleagues.

Journal publication · 2026-05-18 · Attribution & reuse
In this article
Editorial illustration of aperture mechanism.

Editor’s introduction

The study evaluates a diffusion model, PathoPolyp-Diff, that generates synthetic colon polyp images using text prompts to represent different pathologies and imaging modalities. The model uses cross-class label learning to extract features from non-polyp and other polyp classes, reducing reliance on expensive, class-specific annotations. Researchers compared classification performance—measured by balanced accuracy—on adenomatous and hyperplastic polyps using both real and synthetic images. Results show up to 7.91% improvement in balanced accuracy when synthetic images are used for data augmentation. In video-level analysis, cross-class label learning improved performance by up to 18.33%.

Introduction

Colorectal cancer (CRC) is the second most common cause of cancer-related mortality, accounting for about 1 million deaths per year. The precursor lesions of CRC occur in the form of polyps, which in their initial stages are likely to be non-cancerous. However, they could turn into invasive cancer over time. The risk associated with such abnormal growth depends on the pathological characteristics of the lesion. For instance, a hyperplastic polyp is categorized as benign and generally not a cause of concern, whereas an adenomatous polyp might have the potential to become cancerous. Hence, early detection and categorization of polyps are necessary for optimal surgical procedures and effective treatment. Colonoscopy is a gold standard tool widely adopted for this purpose, in which a camera-mounted colonoscope is inserted into the patient’s colon to investigate it for any abnormalities or lesions. This procedure encompasses various optical imaging technologies to capture polyp-specific features. Some such imaging techniques include white light imaging (WLI) and narrow band imaging (NBI). Among these imaging modalities, WLI is the most commonly used technique; however, it fails to capture topographic contrast, such as polyp elevation and pit patterns that increase the lesion miss rate. On the contrary, NBI uses electronically activated filters to limit the wavelengths of red, green and blue lights, which helps accentuate the superficial mucosa and vascular details. Despite its advantageous applicability in differentiating benign and neoplastic polyps, a standard colonoscopy procedure follows WLI. Besides clinical use, the research community is mainly dependent on images captured using a single imaging technique, i.e. WLI. The reason is the unavailability of publicly accessible image data encompassing different imaging modalities and pathological conditions.

The recent breakthrough in generative artificial intelligence (AI) has sparked the potential to obtain realistic medical images spanning diverse sets of classes. Consequently, various tasks in the medical domain, including super-resolution, image reconstruction, segmentation, and image-to-image translation, have witnessed remarkable performance enhancements using generative adversarial network (GAN) based methodologies. GANs are one the prominent types of generative AI techniques; however, they suffer from convergence instability and show limited contributions and control over data generation. The advent of diffusion models marked a significant stride in dealing with such issues. These models facilitate a better control and manipulation ability to generate diverse, realistic images. This control can be achieved using conditioning in the form of text, images, or both. More recently, numerous works, in different fields focused on text-to-image synthesis have been proposed. Such approaches use random noise and text prompts as input to produce synthetic images. These images are expected to represent the conditions provided in the text. The literature utilizes existing text-to-image techniques by fine-tuning foundation models on the downstream tasks. This fine-tuning process requires text prompts that describe the desired synthetic images appropriately.

With the advent of generative AI, several works have been proposed to generate synthetic colonoscopy images. The main focus of existing related works has been to perform synthetic polyp generation irrespective of the pathological characteristics of polyps and the imaging modality. The techniques adopted so far can broadly be divided into two categories, namely, GAN, and Diffusion Models.

Generative adversarial network (GAN) based techniques

The initial frameworks for polyp generation are based on the adversarial concept and adopt different variants of GANs. For example, Shin et al. used a conditional-GAN approach to translate normal colonoscopy images to polyp images. This translation is achieved using an input-conditioned image which is a combination of an edge map and a polyp binary mask. A similar concept of converting normal frames to polyp frames is proposed in. They utilized a conditional GAN architecture to produce polyps with varied characteristics by controlling the input-conditioned binary mask values. Such conditional translation is also reported by Fagereng et al.. They developed a framework called PolypConnect which uses an EdgeConnect model to convert clean colon images to polyps when given an edge map and a polyp mask. Sasmal et al. performed polyp generation using DCGAN and used the obtained synthetic polyps to enhance classifier performance for differentiating adenoma and hyperplastic polyps. An identical augmentation approach is followed by Adjei et al. using synthetic polyps generated using a Pix2Pix model. Unlike the traditional GAN architecture, He et al. introduced an attacker in the framework to obtain false negative images. Sams and Shomee utilized a StyleGAN2-ada to generate random binary masks, which are combined with colon images. This integrated image is used as an input for a conditional GAN to obtain synthetic polyp images. The above methods focused on polyp generation irrespective of the imaging modalities. However, a few works have used GAN-based approaches to transfer styles between different imaging modalities, such as WLI and NBI. Golhar et al. utilized the GAN inversion approach, which uses a latent representation of images to perform translation between NBI and WLI modalities. Following this technique, interpolation methods are used to change the polyp size. Similarly, Bhamre et al. used CycleGAN to convert WLI images to NBI images. Although these few existing works established the significance of NBI images over WLI images in polyp classification, the generation of new synthetic polyp images with different imaging modalities has not been explored in the literature.

Diffusion model based techniques

The related literature involves only a few works focused on polyp image generation. Machacek et al. used a conditional diffusion probabilistic model to produce synthetic polyp images using synthetic masks. They validated the effectiveness of generated data by utilizing it for training polyp segmentation models. Pishva et al. performed polyp generation using two diffusion models. The two models are fine-tuned on cropped-out polyps and clean colon images, respectively. This fine-tuning is followed by performing an inpainting using the latter model and cropped-out images. Du et al. proposed an adaptive refinement semantic diffusion model which considers the polyp and background ratio to adjust the diffusion loss. They also incorporated a pre-trained segmentation model that modifies the refinement loss depending on the difference between the predicted mask of the synthetic polyp and the binary mask used for its generation. The above-mentioned approaches followed a similar pattern of polyp generation using binary masks. The impact of text prompt based training and the generation of colonoscopy images with different imaging modalities still remains unexplored.

Architectural details

Stage-I:(a) Polyp/non-polyp: The polyp frames are fed into the model with a prompt incorporating ‘with polyp’ substring, whereas non-polyp frames are provided with ‘without polyp’ substring. (b) Good-quality/low-quality: The polyp frames have additional information about low-quality (frames with artifacts like ghost colors, fecal depositions, low-illumination, etc.) and good-quality (free from artifacts). The text prompts in the former case involve ‘low-quality, artifacts’ keywords, whereas ‘good-quality, clear’ is part of the latter case.

Stage-II: (a) Adenomatous/hyperplastic: To make the model learn and focus on the pathological features, text prompts depicting appropriate condition, ‘adenomatous polyp’ or ‘hyperplastic polyp’, were provided. (b) WLI/NBI: To generate diverse polyp images with both WLI and NBI modality, the text prompts at this stage also included ‘white light imaging’ or ‘narrow band imaging’ substrings.

Evaluation metrics

In this work, we adopted some standard metrics used for classification. It includes precision, recall, F1-score, and balanced accuracy. The first three are commonly used to evaluate any classification model. The last metric, i.e. balanced accuracy, is generally used when an imbalance is encountered in data distribution, and the objective focuses on both minority and majority classes with equal importance during evaluation. This scenario aligns with our case, where we consider both adenomatous and hyperplastic classes to be equally important, as the clinical treatments depend on the diagnosed pathology class. The balanced accuracy can be defined as an arithmetic mean of specificity (true negative rate) and sensitivity (true positive rate). In addition, we used Kernel Inception Distance (KID) for quality assessment of the generated images. It quantifies the dissimilarity between the generated and real data distributions. Unlike the standard KID metric, which uses Inception-v3 as the feature extractor, we used the DenseNet model inspired by the literature,, where it achieved remarkable performance in a similar domain.

Model performance

Impact of cross-class label learning: We further performed validation and analysis for the cross-label learning approach. It can be observed that in most cases, the balanced accuracy and class-wise F1-scores using text prompt B (cross-class label learning) are comparatively higher than that of text prompt A (without cross-class label learning). Some notable improvements in balanced accuracy include 0.6192 to 0.6614 (difference of +4.22%, 95% CI: 1.5%, 6.91%, p-value = 0.0068) using 64 real samples per video with an equal proportion of synthetic data, 0.5561 to 0.6254 (difference of +6.93%, 95% CI: 5.01%, 8.85%, p-value< 0.0001 ) using 16 real samples per video with two times samples of synthetic data, and 0.6228 to 0.6983 (difference of +7.55%, 95% CI: 2.88%, 12.22%, p-value = 0.0058) using 16 real samples per video with three times samples of synthetic data. These outcomes signify that the quality of generated data can be improved with variations in the input text prompts. The consistent superiority of prompt B serves as an ablation analysis of our two-stage distillation. By incorporating “good-quality, clear” tokens learned in Stage-I, guiding the diffusion process toward clinically relevant features while suppressing uninformative artifacts. Moreover, the labels used in these text prompts can be indirectly inferred from other classes, thus reducing the requirements of annotated data for each scenario.

Qualitative results and interpretability through visualization

In addition to the quantitative analysis, we examined the qualitative results and further studied the related heatmaps for visualization and interpretability. The heatmaps were obtained using GradCAM on EfficientNet-B0. After selecting a target layer, heatmaps were generated by attributing gradients to that layer, highlighting the most influential regions in the input images. The outcomes were then overlaid on the original images. The heatmaps pertaining to the scenarios involving real images and also those related to some cases involving synthetic images are shown in Figs. 9b and 10b. These heatmaps illustrate the region the classification model focuses on before providing the final prediction scores. It can be observed that the classifier learns the complex polyp-specific features better when trained using a more diverse set of polyp images obtained using PathoPolyp-Diff. However, the classifier’s performance drops in identifying polyp features when the count of synthetic images increases. This decline in performance could be because synthetic images might carry noise and can not exactly replicate real image characteristics; thus, added noise could deviate the model after a certain limit.

Discussion and limitations

In this work, our proposed text-controlled polyp generation approach presented a novel technique to generate polyps with different pathologies, which is an underexplored research area in the literature. An exhaustive investigation is conducted to study the training process of diffusion models using iteration-wise t-SNE plots, confusion matrices and quality assessment metrics. Considering the visual outcomes of t-SNE plots and the quantitative outcomes of the classification test, it can be inferred that during the training phase, our diffusion based model gradually performs well with increasing iterations; however, it starts to degrade after a certain extent. Such a trend indicates that over-training of a diffusion model could result in synthetic images with unacceptable characteristics.

Following this assessment, a standard classification test is conducted utilizing pre-trained (on real images) models, including DenseNet-201 and DenseNet-121. This aims to assess the clinical relevance of synthetic images obtained in different iterations by validating if a model trained using real images could identify the synthetic images during the inference phase. These results, along with the outcomes of KID and t-SNE plots assisted in selecting the best training iteration of our proposed diffusion model. In Stage-I, the F1-score improved with every iteration, contradicting both the qualitative results and the KID score. The t-SNE plots suggested that such a scenario occurred because, despite unsatisfactory image generation, the separation between the two classes (polyp and non-polyp) was sufficient to achieve a significantly high F1-score. However, the lack of overlap with their real counterparts resulted in unsatisfactory KID scores at higher iterations. Therefore, our study reveals that the clinical relevance of synthetic images needs to be evaluated using different standard metrics. A similar approach was followed in Stage-II, yielding more convincing outcomes with fewer contradictions. However, a common observation in both stages was that the synthetic image data points began to deviate from the real data points after certain training iterations.

Limitations and future work

It is evident from the above-mentioned analysis that our approach achieved visually appealing outcomes followed by promising quantitative results. However, our model PathoPolyp-Diff also has some limitations. In a few cases, utilizing the cross-class labels resulted in undesired qualitative outcomes due to limited generation control. When the weighted mechanism was incorporated, it improved the qualitative results but at the expense of degraded quantitative outcomes. From a clinical perspective, such undesired outcomes could be critical, as pathologically unrealistic images, if used for training diagnostic models, can lead to inaccurate predictions and misdiagnosis. Further exploration is needed in such cases. For instance, an auxiliary classifier trained separately on good quality and clean samples can be used to guide the diffusion process. In addition, some parameters like guidance and temperature scale can be adjusted for improvement. We also highlight that while our study provides empirical analysis of prompt sensitivity, including negative prompts and weighted mechanism, an exhaustive analysis of prompt sensitivity across all possible linguistic variations represents an important direction for future work. During iteration-wise analysis, we observed that synthetic features begin to deviate from the real data manifold after 6,000-10,000 iterations, resulting in distorted textures and unusual color patterns. Addressing this deviation remains a key priority for future work. Specifically, we intend to implement an auxiliary feedback loop utilizing a pre-trained diagnostic classifier. By penalizing outputs that lack clinical significance during the denoising process, we aim to extend the model’s stability and further enhance the informative gain of the synthetic data.

Regarding computational considerations, our method, being based on diffusion models, inherently involves a complex architecture and computationally intensive processes. Given the current design and objectives of the model, it may not be well-suited for deployment on low-end devices at this time. In a clinical setting, this issue can lead to local adaptation challenges where fine-tuning on a local dataset could be desirable for a specific task. The other consequences can include slow inference speed during emergency scenarios and high memory demands in remote healthcare facilities. To address this issue, some techniques, such as model quantization, pruning, and knowledge distillation, can be explored. Despite the above limitations, we successfully developed a novel diffusion-based technique to generate a diverse set of polyps using cross-class labels; we also provide a roadmap for the research community to build upon our work, extending the synthetic polyp dataset and experimenting with text prompts to enhance overall outcomes. Additionally, as already discussed, other possible exploration directions could include model simplifications, quantization, or developing lightweight variants that maintain performance while being more resource-efficient. Further, clinical validation by experts would help to rigorously assess the quality and realism of the generated images, validating their acceptability in a clinical setting.

Conclusion

In this paper, we developed a novel diffusion based model, PathoPolyp-Diff, which generates a visually appealing diverse set of polyp images in a two-stage process. This set of polyps covers multiple categories, including pathology (adenomatous/hyperplastic), imaging modality (NBI/WLI), and quality (informative/uninformative). In addition, we introduced the concept of cross-class label learning, which allows the generation of diversified polyps exhibiting features from other classes without requiring additional labels. This text-controlled image generation is validated by performing a downstream binary classification task on adenomatous and hyperplastic polyp classes with NBI and WLI modalities. Further, we studied the impact of text prompt variations on colonoscopy image generation by incorporating a weighted control mechanism. The results are analyzed at both frame and video level outcomes with a statistical significant test. Our research also reveals the significance of text prompt formulation on synthetic images’ visual and clinical properties. The proposed approach achieved an improvement of 7.91% and 18.33% in balanced accuracy when used for augmentation and cross-class label learning, respectively.