SCARED-C
收藏EndoscopyCorruptions 数据集概述
数据集简介
endoscopycorruptions 是一个 Python 包,用于模拟内窥镜手术中常见的图像损坏。该工具旨在通过向干净图像引入现实损坏来辅助开发和测试用于内窥镜图像处理的算法。通过评估算法对损坏图像的处理能力,开发者可以更好地理解其解决方案的鲁棒性和局限性。
主要功能
- Corrupt 函数:将指定的损坏应用于输入图像。
- Get Corruption Names 函数:列出所有可应用的损坏类型。
使用方法
导入函数
python from endoscopycorruptions import corrupt, get_corruption_names from PIL import Image import numpy as np import matplotlib.pyplot as plt import os
加载图像
使用 PIL 加载测试图像并将其转换为 numpy 数组: python image = np.asarray(Image.open(test_image.png)) plt.imshow(image)
预处理
如果图像包含 alpha 通道,可以移除以确保兼容性: python if len(image.shape) > 2 and image.shape[2] == 4: image = image[:, :, :3]
列出可用损坏类型
使用以下代码查看可应用的损坏类型: python get_corruption_names()
应用损坏
可以按以下方式将损坏应用于图像: python
示例:应用镜头畸变,严重程度为5
corrupted_image = corrupt(image, corruption_name=lens_distortion, severity=5) plt.imshow(corrupted_image) plt.show()
应用所有损坏并保存结果
python for corruption in get_corruption_names(): for severity in range(5): corrupted = corrupt(image, corruption_name=corruption, severity=severity+1) plt.imshow(corrupted) plt.axis(off)
folder_path = f"data/{corruption}/"
if not os.path.exists(folder_path):
os.makedirs(folder_path)
plt.savefig(f{folder_path}/c_{corruption}_sev{severity + 1}.png, bbox_inches=tight)
print(corruption)
依赖要求
该包需要以下依赖:
- Python 3.x
- PIL (Pillow)
- NumPy
- Matplotlib
- 如果希望使用提供的 Jupyter Notebook 进行演示,则需要能够运行 Jupyter Notebook 的环境。
引用
如果发现该工作有用,请考虑引用: bibtex @misc{Ivanrs297_endoscopycorruptions, author = {Ivan Reyes-Amezcua and Ricardo Espinosa and Andres Mendez-Vazquez and Gilberto Ochoa-Ruiz and Christian Daul}, title = {EndoscopyCorruptions: A Python package to simulate common image corruptions in endoscopic procedures}, year = {2024}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {url{https://github.com/Ivanrs297/endoscopycorruptions}}, }

- 1EndoDepth: A Benchmark for Assessing Robustness in Endoscopic Depth PredictionCINVESTAV Unidad Guadalajara, Mexico · 2024年



