An AFM DNA image-segmentation method based on random height mapping and a Sobel-guided attention module
Abstract
DNA conformational analysis requires accurate molecule-level delineation, meaning that segmentation is a prerequisite for quantitative analysis of atomic force microscopy (AFM) height maps. Although AFM provides direct height imaging, in grayscale renderings, DNA boundaries are often obscured by limited contrast. Salt deposits and scanning artifacts can produce fragmented traces and cause DNA to be merged spuriously with nearby salt deposits in the segmentation results. AFM images acquired under different scanning conditions often vary in contrast and sharpness, and the resulting degraded appearance challenges the robustness of segmentation. We propose a framework that integrates (i) quantile-bounded RGB mapping, (ii) Sobel-guided attention in UNet skip connections, and (iii) random-mapping training for robustness. With all components enabled (quantile-bounded RGB mapping, Sobel-guided attention at Skip1, and random-mapping training), the final model achieves an intersection over union (IoU) of 0.74 and a Dice score of 0.85 on the AFM test set. To assess robustness to boundary smoothing, we further applied post hoc Gaussian blur to the test inputs. At a Gaussian blur standard deviation of 3 pixels, the model trained with random mapping retains an IoU of 0.46, whereas the counterpart trained with fixed mapping drops to 0.26, an absolute gain of 0.20. Additional Gaussian-noise experiments on raw AFM height maps confirm that random-mapping training improves robustness to stochastic height-domain perturbations. Together, these results indicate that combining imaging-aware height-to-color encoding with training-time randomized mapping and lightweight, gradient-guided reweighting of skip features offers a practical route to robust and stable AFM–DNA segmentation, with potential transferability to other AFM image-analysis tasks.