## 3 Materials and Methods
### Training Pipeline  
The image processing pipeline starts with a thorough standardization procedure, in which all images are resized to 256 \(\times\) 256 pixels with LANCZOS resampling, subsequently converting them to RGB color space. Resizing to 256 \(\times\) 256 ensures consistent memory usage and fixed network inputs while preserving features for subsequent \(224\times 224\) random cropping during training. All images are stored in PNG format to preserve image quality through lossless compression. The training set is subjected to further augmentation techniques, including color jittering, random rotation of \(\pm\)15 degrees, random horizontal flipping, and random scaled cropping to 224 \(\times\) 224 pixels. The model sees slightly different versions of the same image during training, improving its robustness and generalization capabilities. All images are subsequently normalized using standard ImageNet normalization parameters and processed in batches via PyTorch python library DataLoader with a batch size of 32 for optimal training efficiency. Pytorch was created from Facebook's AI Research lab (FAIR), Menlo Park, California, USA. PyTorch 2.2.x was used in this research. We executed and assessed five cutting-edge models for classification tasks: Vision Transformer (ViT), Big Transfer (BiT), FixResNeXt, Data-efficient Image Transformer (DeiT) and EfficientNet. Each model possesses distinct advantages for the classification challenge, with transformers that deliver strong feature extraction skills and convolutional networks that facilitate effective spatial relationship processing. The segmentation component of our approach employs five distinct architectures, U-Net, PSPNet, Feature Pyramid Network (FPN), LinkNet, and MANet. The models were chosen for their demonstrated efficacy in  
Figure 2: DB fine-tunes text-to-image model with few polyp images to generate personalized colonoscopy images. segmenting medical images and their ability to address the unique problems posed by colonoscopy images. The training methodology utilizes the AdamW optimizer with weight decay and Cross Entropy Loss as a loss function. To avoid overfitting and guarantee optimal model performance, we established an early stopping mechanism based on the plateau of validation loss, consistently retaining the best validation model weights during the training phase. This method guarantees that our models preserve their generalizability while attaining superior performance on the designated task. The binary cross-entropy loss function for classification is defined as  
\[L_{\text{BCE}}=-\frac{1}{N}\sum_{i=1}^{N}[y_{i}\log(\hat{y}_{i})+(1-y_{i})\log( 1-\hat{y}_{i})] \tag{1}\]  
where \(N\) represents the number of samples, \(y_{i}\) is the true label, and \(\hat{y}_{i}\) is the predicted probability for the positive class. For the LoRA adaptation process, the weight matrix transformation is computed as:  
\[W=W_{0}+BA=W_{0}+\Delta W \tag{2}\]  
where \(W_{0}\) represents the original weight matrix, \(B\) and \(A\) are low-rank decomposition matrices and \(\Delta W\) is the update matrix. The Dice coefficient, used for evaluating segmentation performance, is calculated as:  
\[\text{Dice}=\frac{2|X\cap Y|}{|X|+|Y|}=\frac{2\text{TP}}{2\text{TP}+\text{FP}+ \text{FN}} \tag{3}\]  
where \(X\) and \(Y\) represent the predicted segmentation masks and ground truth, respectively, TP denotes true positives, FP denotes false positives and FN denotes false negatives. Our evaluation approach integrates many metrics to thoroughly evaluate distinct facets of the system's performance. The quality of images is assessed by the Inception score (IS) and Frechet Inception Distance (FID), which offer quantifiable metrics for the caliber of synthetic image synthesis. Classification performance is evaluated using many metrics, such as accuracy, precision, recall (sensitivity), F1 score, and area under the ROC curve (AUC-ROC).