[go: up one dir, main page]

0% found this document useful (0 votes)
222 views19 pages

Tài Liệu Không Có Tiêu Đề-2

Uploaded by

lqua92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
222 views19 pages

Tài Liệu Không Có Tiêu Đề-2

Uploaded by

lqua92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Colorectal cancer prediction

Abstract
This paper presents an implementation of a deep learning-based colorectal
segmentation system using a Simple U-Net architecture. The proposed system processes
medical images by leveraging convolutional neural networks (CNNs) for automated
segmentation. The methodology includes dataset preparation, model architecture definition,
training strategies, and evaluation mechanisms.

1. Introduction
1.1. Overview
Facial recognition technology, propelled by advancements in Artificial Intelligence
(AI) and Machine Learning (ML), has emerged as a pivotal tool across various domains,
revolutionising how we interact with technology and ensuring heightened security measures.
This report delves into the development and implementation of a real-time detection system,
leveraging AI or ML techniques to achieve accurate and efficient detection and classification
of medical information.
Colorectal surgery encompasses a range of procedures addressing critical issues in the
lower digestive tract, including the bowel, colon, rectum, and anus. These surgeries are vital
for treating conditions like Crohn's disease, diverticulitis, and, crucially, colorectal cancer.
However, the complexity and variability of these conditions, coupled with the urgent need for
early and accurate intervention, highlight the pressing need for advanced analytical tools.
Colorectal surgeries aim to repair damaged or diseased sections of the lower intestinal
tract. Causes can range from cancer and congenital malformations to inflammatory diseases,
injuries, and infections. The sheer diversity of underlying causes and patient-specific factors
makes timely and precise diagnosis and treatment planning exceptionally challenging.
Surgeons employ various techniques, including laparoscopic, robotic, and open
surgery. The choice depends on the patient's overall health and the specifics of their
condition. While minimally invasive approaches (laparoscopic and robotic) offer lower
complication rates, open surgery remains necessary in complex cases. This decision-making
process, involving risk assessment and personalized treatment selection, is precisely where
AI can offer transformative support.

1.2. Importance and Applications

The significance of real-time colorectal recognition extends beyond mere


identification; it encompasses a spectrum of applications critical to modern healthcare and
diagnostics. In medical imaging, these systems enhance the accuracy of colorectal cancer
detection, polyp classification, and early diagnosis, improving patient outcomes. Researchers
and clinicians utilise colorectal recognition for automated screening, personalised treatment
planning, and monitoring disease progression. Furthermore, advancements in AI-driven
colorectal analysis contribute to more efficient workflows in hospitals and diagnostic centers,
reducing manual workload and increasing diagnostic consistency. As technology evolves,

Vo Bao Long
Colorectal cancer prediction

colorectal recognition continues to revolutionise gastroenterology, enabling faster and more


precise medical decision-making.

Technological Foundation
At its core, the system developed in this project leverages deep learning
methodologies, particularly convolutional neural networks (CNNs) like U-Net, which are
highly effective in medical image analysis. By training on extensive colorectal imaging
datasets and employing techniques such as image augmentation, the model learns to
accurately identify and segment colorectal polyps and abnormalities. Augmentation
techniques, facilitated by libraries like Albumentations, enhance dataset diversity, allowing
the model to generalize effectively across variations in imaging conditions, patient anatomy,
and polyp morphology.
1.3. Objectives and Scope

The primary objective of this project is to design, implement, and evaluate a real-time
colorectal recognition system capable of accurately identifying and segmenting abnormalities
in medical imaging. The scope encompasses the entire development lifecycle, from data
collection and preprocessing to model training, evaluation, and deployment. By exploring the
capabilities and limitations of AI/ML in colorectal image analysis, this report aims to provide
valuable insights into the practical application and future advancements of these technologies
in medical diagnostics.

In summary, this report offers a comprehensive exploration of the methodologies,


experimentation, results, and implications of real-time colorectal recognition using AI/ML. It
highlights the transformative potential of these technologies in improving early detection,
diagnosis, and treatment planning, ultimately enhancing the efficiency and accuracy of
gastroenterological healthcare.

2. Methodology

2.1 Overview
This study employs a deep learning-based approach for colorectal cancer prediction. The
methodology consists of dataset preprocessing, feature extraction, and the implementation of
a segmentation algorithm to classify different tumor differentiation stages. Convolutional
Neural Networks (CNNs) and other advanced segmentation techniques are utilized to
improve prediction accuracy.

2.2 Dataset using for pre-trained model


The EBHI-SEG dataset is a publicly available dataset that contains 5,710
histopathology images, including:
2,855 histopathology section images representing different tumor differentiation stages.
2,855 ground truth images corresponding to the histopathology section images, providing
labeled data for segmentation tasks. This dataset provides a valuable resource for researchers
developing new segmentation algorithms to improve colorectal cancer diagnosis in clinical
settings.

Vo Bao Long
Colorectal cancer prediction

2.3. Model U-net

2.3.1 Dataset Preparation

The dataset is structured using a custom ColorectalSegmentationDataset class, which extends


torch.utils.data.Dataset. This class is responsible for:

Loading images and corresponding labels from a specified directory.


Resizing images to a fixed size of 256×256 pixels.
Converting grayscale masks into binary segmentation labels.
Normalizing images to the range [0,1] for better training stability.

class ColorectalSegmentationDataset(Dataset):
def __init__(self, root_dir, transform=None):
self.root_dir = root_dir
self.transform = transform
self.image_paths = []
self.label_paths = []

class_dirs = [d for d in os.listdir(root_dir) if os.path.isdir(os.path.join(root_dir, d))]


for class_name in class_dirs:
image_dir = os.path.join(root_dir, class_name, 'image')
label_dir = os.path.join(root_dir, class_name, 'label')

if os.path.exists(image_dir) and os.path.exists(label_dir):


images = sorted(os.listdir(image_dir))
labels = sorted(os.listdir(label_dir))

for img_name in images:


if img_name in labels:
self.image_paths.append(os.path.join(image_dir, img_name))
self.label_paths.append(os.path.join(label_dir, img_name))

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

def __getitem__(self, idx):


img_path = self.image_paths[idx]
label_path = self.label_paths[idx]

image = cv2.imread(img_path, cv2.IMREAD_COLOR)


label = cv2.imread(label_path, cv2.IMREAD_GRAYSCALE)

image = cv2.resize(image, (256, 256))


label = cv2.resize(label, (256, 256))

label = (label > 0).astype(np.float32) # Chuyển label thành nhị phân

image = torch.tensor(image, dtype=torch.float32).permute(2, 0, 1) / 255.0


label = torch.tensor(label, dtype=torch.float32).unsqueeze(0)

Vo Bao Long
Colorectal cancer prediction

return image, label

2.3.2. Split data

root_dir = "/Volumes/Home/Desktop/ML/env/Model_ML/EBHI-SEG" # Path of folder


dataset
dataset = ColorectalSegmentationDataset(root_dir)

train_size = int(0.7 * len(dataset))


val_size = int(0.15 * len(dataset))
test_size = len(dataset) - train_size - val_size

train_dataset, val_dataset, test_dataset = random_split(dataset, [train_size, val_size,


test_size])

train_loader = DataLoader(train_dataset, batch_size=8, shuffle=True)


val_loader = DataLoader(val_dataset, batch_size=8, shuffle=False)
test_loader = DataLoader(test_dataset, batch_size=8, shuffle=False)

2.3.3. Design model architecture for Simple U-Net

class SimpleUNet(nn.Module):
def __init__(self):
super(SimpleUNet, self).__init__()
self.encoder = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=3, padding=1),
nn.ReLU(),
nn.Conv2d(64, 128, kernel_size=3, padding=1),
nn.ReLU()
)
self.decoder = nn.Sequential(
nn.Conv2d(128, 64, kernel_size=3, padding=1),
nn.ReLU(),
nn.Conv2d(64, 1, kernel_size=3, padding=1),
nn.Sigmoid()
)

def forward(self, x):


x = self.encoder(x)
x = self.decoder(x)
return x

2.3.4. Training model

def train_model(model, train_loader, criterion, optimizer, num_epochs=40):

Vo Bao Long
Colorectal cancer prediction

for epoch in range(num_epochs):


model.train()
running_loss = 0.0
for images, labels in train_loader:
images, labels = images.float(), labels.float()
optimizer.zero_grad()
outputs = model(images)
loss = criterion(outputs, labels)
loss.backward()
optimizer.step()
running_loss += loss.item()
print(f"Epoch {epoch+1}/{num_epochs}, Loss: {running_loss/len(train_loader):.4f}")
torch.save(model.state_dict(), "colorectal_segmentation_model.pth")
print("Model saved successfully!")

train_model(model, train_loader, criterion, optimizer)

2.4. U-Net 3+
2.4.1. Dataset Preparation
The dataset is structured into subdirectories containing images and corresponding
labels for segmentation. The function load_data retrieves file paths and organizes them for
processing. Included:
Scans the dataset directory.
Extracts images and corresponding labels.
Returns lists of image and label paths.
def load_data(root_dir):
image_paths = []
label_paths = []

class_dirs = [d for d in os.listdir(root_dir) if os.path.isdir(os.path.join(root_dir, d))]


for class_name in class_dirs:
image_dir = os.path.join(root_dir, class_name, 'image')
label_dir = os.path.join(root_dir, class_name, 'label')

if os.path.exists(image_dir) and os.path.exists(label_dir):


images = sorted(os.listdir(image_dir))
labels = sorted(os.listdir(label_dir))

for img_name in images:


if img_name in labels:
image_paths.append(os.path.join(image_dir, img_name))
label_paths.append(os.path.join(label_dir, img_name))

return image_paths, label_paths

2.4.1. Data Preprocessing


Resizing to (256 × 256) pixels.
Normalization of pixel values to [0,1] for stable training.

Vo Bao Long
Colorectal cancer prediction

Binary conversion of segmentation masks.

def preprocess_image(image_path, label_path):


image = cv2.imread(image_path, cv2.IMREAD_COLOR)
label = cv2.imread(label_path, cv2.IMREAD_GRAYSCALE)

image = cv2.resize(image, (256, 256)) / 255.0


label = cv2.resize(label, (256, 256))
label = (label > 0).astype(np.float32)

return image, label

2.4.2. Data Splitting

root_dir = "/kaggle/input/ebhi-seg/EBHI-SEG"
image_paths, label_paths = load_data(root_dir)

images = []
labels = []
for img_path, lbl_path in zip(image_paths, label_paths):
img, lbl = preprocess_image(img_path, lbl_path)
images.append(img)
labels.append(lbl)

images = np.array(images)
labels = np.array(labels)
labels = np.expand_dims(labels, axis=-1)

train_images, test_images, train_labels, test_labels = train_test_split(images, labels,


test_size=0.2, random_state=42)
train_images, val_images, train_labels, val_labels = train_test_split(train_images,
train_labels, test_size=0.2, random_state=42)

2.4.3. U-Net 3+ Model Architecture

Full-scale skip connections: Integrates low-level and high-level features to improve


segmentation than U-net.

Enhances training by enforcing multi-scale feature learning.

def conv_block(x, filters, kernel_size=3):


x = layers.Conv2D(filters, kernel_size, padding='same', activation='relu')(x)
x = layers.Conv2D(filters, kernel_size, padding='same', activation='relu')(x)
return x

def build_unet_3plus():
inputs = layers.Input(shape=(256, 256, 3))

Vo Bao Long
Colorectal cancer prediction

# Encoder
c1 = conv_block(inputs, 64)
p1 = layers.MaxPooling2D((2, 2))(c1)

c2 = conv_block(p1, 128)
p2 = layers.MaxPooling2D((2, 2))(c2)

c3 = conv_block(p2, 256)
p3 = layers.MaxPooling2D((2, 2))(c3)

c4 = conv_block(p3, 512)
p4 = layers.MaxPooling2D((2, 2))(c4)

c5 = conv_block(p4, 1024)

# Decoder with Full-Scale Skip Connections


u4 = layers.UpSampling2D((2, 2))(c5)
merge4 = layers.Concatenate()([u4, c4, layers.UpSampling2D((2, 2))(c3),
layers.UpSampling2D((4, 4))(c2), layers.UpSampling2D((8, 8))(c1)])
d4 = conv_block(merge4, 512)

u3 = layers.UpSampling2D((2, 2))(d4)
merge3 = layers.Concatenate()([u3, c3, layers.UpSampling2D((2, 2))(c2),
layers.UpSampling2D((4, 4))(c1)])
d3 = conv_block(merge3, 256)

u2 = layers.UpSampling2D((2, 2))(d3)
merge2 = layers.Concatenate()([u2, c2, layers.UpSampling2D((2, 2))(c1)])
d2 = conv_block(merge2, 128)

u1 = layers.UpSampling2D((2, 2))(d2)
merge1 = layers.Concatenate()([u1, c1])
d1 = conv_block(merge1, 64)

outputs = layers.Conv2D(1, (1, 1), activation='sigmoid')(d1)

model = keras.Model(inputs, outputs)


return model

2.4.4. Model training


model = build_unet_3plus()
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])

model.fit(train_images, train_labels, validation_data=(val_images, val_labels), epochs=13,


batch_size=8)

Vo Bao Long
Colorectal cancer prediction

model.save("colorectal_segmentation_unet3plus.h5")
print("Model saved successfully!")
2.5. Another model and similar dataset.
https://www.kaggle.com/code/bolongv/another-model-for-kvarsir-seg

3.1. Evaluate model after training.


3.1.1. Model Unet

def load_images_and_labels(image_dir, mask_dir):


image_paths = sorted([os.path.join(image_dir, fname) for fname in os.listdir(image_dir)
if fname.endswith(".png")])
mask_paths = sorted([os.path.join(mask_dir, fname) for fname in os.listdir(mask_dir) if
fname.endswith(".png")])

images = []
labels = []

for img_path, mask_path in zip(image_paths, mask_paths):


image = cv2.imread(img_path, cv2.IMREAD_COLOR)
image = cv2.resize(image, (256, 256)) / 255.0 # Chuẩn hóa ảnh

label = cv2.imread(mask_path, cv2.IMREAD_GRAYSCALE)


label = cv2.resize(label, (256, 256))
label = (label > 0).astype(np.float32) # Chuyển thành nhãn nhị phân

images.append(image)
labels.append(label)

images = np.array(images)
labels = np.array(labels)
labels = np.expand_dims(labels, axis=-1)

return images, labels

def evaluate(model_path, image_dir, mask_dir):


model = keras.models.load_model(model_path)
test_images, test_labels = load_images_and_labels(image_dir, mask_dir)
loss, accuracy = model.evaluate(test_images, test_labels, batch_size=8, verbose=1)
print(f"Test Loss: {loss:.4f}")
print(f"Test Accuracy: {accuracy:.4f}")
return loss, accuracy

3.1.2. Model U-Net 3+

def load_images_and_labels(image_dir, mask_dir):


image_paths = sorted([os.path.join(image_dir, fname) for fname in os.listdir(image_dir)
if fname.endswith(".png")])

Vo Bao Long
Colorectal cancer prediction

mask_paths = sorted([os.path.join(mask_dir, fname) for fname in os.listdir(mask_dir) if


fname.endswith(".png")])

images = []
labels = []

for img_path, mask_path in zip(image_paths, mask_paths):


image = cv2.imread(img_path, cv2.IMREAD_COLOR)
image = cv2.resize(image, (256, 256)) / 255.0 # Chuẩn hóa ảnh

label = cv2.imread(mask_path, cv2.IMREAD_GRAYSCALE)


label = cv2.resize(label, (256, 256))
label = (label > 0).astype(np.float32) # Chuyển thành nhãn nhị phân

images.append(image)
labels.append(label)

images = np.array(images)
labels = np.array(labels)
labels = np.expand_dims(labels, axis=-1)

return images, labels

def evaluate(model_path, image_dir, mask_dir):


model = keras.models.load_model(model_path)
test_images, test_labels = load_images_and_labels(image_dir, mask_dir)
loss, accuracy = model.evaluate(test_images, test_labels, batch_size=8, verbose=1)
print(f"Test Loss: {loss:.4f}")
print(f"Test Accuracy: {accuracy:.4f}")
return loss, accuracy

3.2. Testing marked on a similar dataset.


3.2.1. Prepare dataset CRC_IMG
# Đường dẫn
excel_path =
"/Volumes/Home/Desktop/ML/env/Model_ML/CRC_ICM_v1_Clinical_Data.xlsx"
source_folder = "/Volumes/Home/Desktop/ML/env/Model_ML/CRC_ICM_v1_Images"
destination_folder = "/Volumes/Home/Desktop/ML/env/Model_ML/CRC_IMG"
df = pd.read_excel(excel_path)

# Lọc dữ liệu: cột thứ 2 (Pathology Code) và cột 12 (Tumor Type chứa 'Adenocarcinoma')
filtered_df = df[(df.iloc[:, 11].str.contains("Adenocarcinoma", na=False))]

# Danh sách các mã bệnh lý cần tìm


pathology_codes = filtered_df.iloc[:, 1].astype(str).tolist()

# Duyệt qua thư mục nguồn


if not os.path.exists(destination_folder):

Vo Bao Long
Colorectal cancer prediction

os.makedirs(destination_folder)

for subdir in os.listdir(source_folder):


subdir_path = os.path.join(source_folder, subdir)
if os.path.isdir(subdir_path) and subdir in pathology_codes:
# Lấy tất cả ảnh từ folder con đó
for file in os.listdir(subdir_path):
file_path = os.path.join(subdir_path, file)
if os.path.isfile(file_path):
shutil.move(file_path, os.path.join(destination_folder, file))
print(f"Moved: {file_path} -> {destination_folder}")

print("Hoàn thành di chuyển ảnh.")

3.2.2. U-net
# Định nghĩa lại kiến trúc Simple U-Net
class SimpleUNet(nn.Module):
def __init__(self):
super(SimpleUNet, self).__init__()
self.encoder = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=3, padding=1),
nn.ReLU(),
nn.Conv2d(64, 128, kernel_size=3, padding=1),
nn.ReLU()
)
self.decoder = nn.Sequential(
nn.Conv2d(128, 64, kernel_size=3, padding=1),
nn.ReLU(),
nn.Conv2d(64, 1, kernel_size=3, padding=1),
nn.Sigmoid()
)

def forward(self, x):


x = self.encoder(x)
x = self.decoder(x)
return x

# Load mô hình đã huấn luyện


model_path =
"/Volumes/Home/Desktop/ML/env/Model_ML/Model/Train_6/colorectal_segmentation_m
odel (6).pth"
model = SimpleUNet()
model.load_state_dict(torch.load(model_path, map_location=torch.device('cpu')))
model.eval()

# Định nghĩa dataset class để load ảnh test


class PolypDataset(Dataset):
def __init__(self, image_folder):

Vo Bao Long
Colorectal cancer prediction

self.image_folder = image_folder
self.image_paths = [os.path.join(image_folder, f) for f in os.listdir(image_folder) if
f.endswith(('.png', '.jpg', '.jpeg'))]
self.transform = transforms.Compose([
transforms.ToTensor()
])

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

def __getitem__(self, idx):


img_path = self.image_paths[idx]
image = cv2.imread(img_path, cv2.IMREAD_COLOR)
image = cv2.resize(image, (256, 256))
image = torch.tensor(image, dtype=torch.float32).permute(2, 0, 1) / 255.0
return image, img_path

# Load ảnh từ folder test


image_folder = "/Volumes/Home/Desktop/ML/env/Model_ML/Kvasir-SEG/images"
dataset = PolypDataset(image_folder)
data_loader = DataLoader(dataset, batch_size=1, shuffle=False)

# Thư mục lưu ảnh có Polyp


output_folder = "/Volumes/Home/Desktop/ML/env/Model_ML/Check_model"
os.makedirs(output_folder, exist_ok=True)

# Chạy dự đoán
for image, img_path in data_loader:
with torch.no_grad():
output = model(image.float())

mask = output.squeeze().numpy()
mask = (mask > 0.4).astype(np.uint8) * 255 # Ngưỡng xác định vùng có polyp

# Nếu có vùng Polyp thì lưu ảnh


if mask.sum() > 0:
img_name = os.path.basename(img_path[0])
save_path = os.path.join(output_folder, img_name)
cv2.imwrite(save_path, mask)
print(f"Saved: {save_path}")

# Đánh giá mô hình


json_path =
"/Volumes/Home/Desktop/ML/env/Model_ML/Kvasir-SEG/kavsir_bboxes.json"
with open(json_path, 'r') as f:
ground_truths = json.load(f)

def calculate_accuracy(output_folder, ground_truths):


total_images = 0
correct_predictions = 0

Vo Bao Long
Colorectal cancer prediction

for img_name in os.listdir(output_folder):


img_id = os.path.splitext(img_name)[0]
if img_id in ground_truths:
total_images += 1
mask_path = os.path.join(output_folder, img_name)
mask = cv2.imread(mask_path, cv2.IMREAD_GRAYSCALE)

bbox = ground_truths[img_id]['bbox']
height, width = ground_truths[img_id]['height'], ground_truths[img_id]['width']
mask = cv2.resize(mask, (width, height))

predicted_polyp = (mask > 0).astype(np.uint8)

print(f"Evaluating {img_id}: {len(bbox)} ground truth bboxes")

for box in bbox:


x_min, y_min, x_max, y_max = box['xmin'], box['ymin'], box['xmax'],
box['ymax']
gt_mask = np.zeros((height, width), dtype=np.uint8)
gt_mask[y_min:y_max, x_min:x_max] = 1

intersection = np.logical_and(predicted_polyp, gt_mask).sum()


union = np.logical_or(predicted_polyp, gt_mask).sum()
iou = intersection / union if union > 0 else 0

print(f"IoU for {img_id}: {iou:.4f}")

if iou > 0.5:


correct_predictions += 1
break

accuracy = correct_predictions / total_images if total_images > 0 else 0


print(f"Model Accuracy: {accuracy:.2%}")

calculate_accuracy(output_folder, ground_truths)

Vo Bao Long
Colorectal cancer prediction

plt.figure(figsize=(20,10))

plt.subplot(1, 3, 1) # (rows, columns, index)


plt.imshow(cv2.cvtColor(gray_img, cv2.COLOR_BGR2RGB))
plt.title('Ảnh xám')
plt.axis('off')

plt.subplot(1, 3, 2)
plt.imshow(cv2.cvtColor(spec_mask, cv2.COLOR_BGR2RGB))
plt.title('Trích xuất điểm chói')
plt.axis('off')

plt.subplot(1, 3, 3)
plt.imshow(cv2.cvtColor(enlarged_spec, cv2.COLOR_BGR2RGB))
plt.title('Mở rộng ảnh chói')
plt.axis('off')
plt.show()

Vo Bao Long
Colorectal cancer prediction

img_blur = cv2.GaussianBlur(img,(5,5), 0)
_, specular_mask_binary = cv2.threshold(enlarged_spec, 127, 255,
cv2.THRESH_BINARY)
specular_mask_binary = specular_mask_binary.astype(bool)

image_restore = img.copy()
image_restore[specular_mask_binary] = img_blur[specular_mask_binary]

plt.figure(figsize=(20,10))

plt.subplot(1, 3, 1) # (rows, columns, index)


plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
plt.title('Ảnh gốc')
plt.axis('off')

plt.subplot(1, 3, 2)
plt.imshow(cv2.cvtColor(img_blur, cv2.COLOR_BGR2RGB))
plt.title('Ảnh được làm mờ')
plt.axis('off')

plt.subplot(1, 3, 3)
plt.imshow(cv2.cvtColor(image_restore, cv2.COLOR_BGR2RGB))
plt.title('Khôi phục ảnh ban đầu')
plt.axis('off')
plt.show()

radius = 20
telea = cv2.inpaint(image_restore, enlarged_spec, radius,
cv2.INPAINT_TELEA)
# ns = cv2.inpaint(img, enlarged_spec, radius, cv2.INPAINT_NS)

plt.figure(figsize=(20,10))

plt.subplot(1, 3, 1) # (rows, columns, index)

Vo Bao Long
Colorectal cancer prediction

plt.imshow(cv2.cvtColor(image_restore, cv2.COLOR_BGR2RGB))
plt.title('Img_restore')

plt.subplot(1, 3, 2)
plt.imshow(cv2.cvtColor(enlarged_spec, cv2.COLOR_BGR2RGB))
plt.title('enlarged_spec')

plt.subplot(1, 3, 3)
plt.imshow(cv2.cvtColor(telea, cv2.COLOR_BGR2RGB))
plt.title('telea')

plt.show()

Discussion

The analysis of the results highlights the performance of the U-Net and U-Net+
models on the Kvasir dataset for colorectal polyp segmentation. While both models
demonstrated the ability to segment polyps, the overall accuracy was not optimal, indicating
the need for further refinement. The evaluation metrics, including IoU, Dice Similarity
Coefficient, Sensitivity, and F1-Score, showed that U-Net+ performed slightly better than the
standard U-Net due to its enhanced feature extraction capabilities. However, inconsistencies
in detection across varying polyp sizes and shapes suggest room for improvement in
generalization. These findings underscore the significance of architectural modifications and
dataset optimizations to achieve more reliable segmentation.

A key strength of this study was the implementation of both U-Net and its improved
variant, U-Net+, allowing a direct comparison of their effectiveness. The structural
enhancements in U-Net+ contributed to better feature learning, leading to improved
segmentation accuracy. Additionally, the use of the Kvasir dataset, which includes diverse
polyp images, provided a realistic evaluation of the models' clinical applicability.

However, limitations remain, particularly concerning the accuracy of both models,


which requires further optimization. The trained models did not achieve consistently high

Vo Bao Long
Colorectal cancer prediction

precision and recall, necessitating improvements through various strategies. Potential


solutions include modifying the dataset, experimenting with alternative deep learning
architectures, and incorporating semi-supervised learning techniques to evaluate the models'
ability to generalize to unseen, unlabeled data. Additionally, refining augmentation
techniques and integrating domain adaptation methods could enhance performance, making
these models more suitable for real-world medical applications.

Conclusion

In conclusion, the inherent complexities of colorectal conditions, the critical need for early
detection, and the demand for personalized, precision medicine make the integration of AI
into colorectal surgery not just beneficial, but urgently necessary. AI offers the potential to
revolutionize diagnosis, treatment planning, surgical execution, and postoperative care,
ultimately leading to improved patient outcomes and survival rates.

This study explores colorectal cancer segmentation using deep learning-based architectures,
with a focus on improving polyp detection accuracy. The models under consideration
(UNET, Unet +) will be evaluated on the Kvasir dataset, a benchmark for polyp
segmentation. By integrating pre-trained feature extractors like VGG16 and VGG19 with U-
Net, we aim to enhance feature representation and improve segmentation performance. Our
approach involves implementing multiple segmentation architectures, leveraging advanced
feature extraction techniques, and conducting a comprehensive evaluation using IoU, Dice
Similarity Coefficient, Sensitivity, Specificity, and F1-Score. This research contributes to the
development of optimized colorectal segmentation models by assessing their effectiveness in
different deep learning frameworks.

Future Work:

Analysis of the results highlights the performance of the trained models


UNET_EX_V3, DUCK-NET, VGG16 × U-Net, and VGG19 × U-Net—on the Kvasir
dataset. While the models demonstrated reasonable segmentation capability, their overall
accuracy was not optimal, indicating room for improvement. The evaluation metrics,
including IoU, Dice Similarity Coefficient, Sensitivity, and F1-Score, revealed
inconsistencies in performance across different models. The significance of these findings
lies in understanding the strengths and weaknesses of each approach, allowing for targeted
enhancements in colorectal polyp segmentation.

A key strength of this study was the implementation of multiple deep learning architectures,
enabling a comparative analysis of feature extraction and segmentation performance. The use
of pre-trained networks such as VGG16 and VGG19 enhanced feature representation, while
DUCK-NET and UNET_EX_V3 provided promising segmentation outcomes. Additionally,
leveraging the Kvasir dataset, which contains diverse polyp images, allowed for a robust
evaluation of model generalizability.

Future work will focus on refining these models through hyperparameter


optimization, data augmentation, and lightweight deployment strategies. The implementation
of AutoML-based tuning, GAN-generated synthetic data, and contrastive learning will
enhance model generalization. Additionally, integrating multi-modal data fusion techniques
with real-time colonoscopy tools can make these models more clinically relevant. Optimizing

Vo Bao Long
Colorectal cancer prediction

DUCK-NET for real-time applications and exploring semi-supervised learning techniques


will further improve segmentation accuracy with minimal labeled data. Finally, ensuring
model explainability through Grad-CAM and SHAP visualizations will increase trust in AI-
assisted diagnosis, paving the way for its integration into real-world clinical workflows.

References

Vo Bao Long
Colorectal cancer prediction

[*] Main code on github


https://github.com/Enzosama/colorectal_project

[*]Training Model Unet, Unet +


https://www.kaggle.com/code/bolongv/training-unet-model

[*]Training model UNET_EX_V3, DUCK-NET, VGG16 x UNET, VGG19 x UNET on Kvasir


SEG dataset.
https://www.kaggle.com/code/bolongv/another-model-for-kvarsir-seg

[1] EBHI-Seg dataset


https://paperswithcode.com/dataset/ebhi-seg

[2] EBHI-SEG
https://figshare.com/articles/dataset/EBHI-SEG/21540159?file=38179080

[3] Kvasir SEG (Segmented Polyp Dataset)


https://datasets.simula.no/kvasir-seg/

Vo Bao Long

You might also like