Evaluating and Enhancing Segmentation Model Robustness with Metamorphic Testing
Seif Mzoughi, Mohamed Elshafeia, Foutse Khomh
TL;DR
This work introduces SegRMT, a metamorphic testing framework that uses a genetic algorithm to discover sequences of spatial and spectral perturbations under a PSNR constraint to stress test image segmentation models. Evaluated on Cityscapes with DeepLabV3, SegRMT delivers stronger adversaries (mIoU as low as $6.4\%$ at $24$ dB PSNR) than traditional gradient-based attacks and enables adversarial training that improves robustness and cross-adversarial generalization. The study provides a rigorous comparison against FGSM, PGD, and C&W, demonstrates robust gains through metamorphic testing, and highlights the importance of diverse adversarial exposure for reliable segmentation in safety-critical domains. The findings suggest SegRMT as both an effective robustness evaluator and a practical tool for improving generalization against a broad spectrum of perturbations in real-world vision systems.
Abstract
Image segmentation is critical for applications such as medical imaging, augmented reality, and video surveillance. However, segmentation models often lack robustness, making them vulnerable to adversarial perturbations from subtle image distortions. In this work, we propose SegRMT, a metamorphic testing approach that leverages genetic algorithms (GA) to optimize sequences of spatial and spectral transformations while preserving image fidelity via a predefined PSNR threshold. Using the Cityscapes dataset, our method generates adversarial examples that effectively challenge the DeepLabV3 segmentation model. Our experiments show that SegRMT reduces DeepLabV3's mean Intersection over Union (mIoU) to 6.4%, outperforming other adversarial baselines that decrease mIoU to between 8.5% and 21.7%. Furthermore, when used for adversarial training, SegRMT boosts model performance, achieving mIoU improvements up to 73% on dedicated adversarial datasets and increasing cross-adversarial mIoU to 53.8%, compared to only 2%-10% for other methods. These findings demonstrate that SegRMT not only simulates realistic image distortions but also enhances the robustness of segmentation models, making it a valuable tool for ensuring reliable performance in safety-critical applications.
