Abstract:
Accurate segmentation and projection area estimation of hanging watermelon fruits under occlusion conditions in greenhouse cultivation are critical for achieving precise phenotypic analysis and intelligent yield prediction, forming the technical foundation for automated water and fertilizer management. This study developed and validated a novel hybrid computational framework that integrates deep learning-based semantic segmentation with robust geometrical model fitting to specifically address the significant challenge of reconstructing complete fruit contours from heavily occluded images, where fruits are often partially obscured by leaves, vines, and support nets. The methodology comprised three stages. First, a comparative evaluation was conducted among five representative semantic segmentation models: U-Net with VGG backbone, U-Net with ResNet50 backbone, DeepLabv3 with MobileNet backbone, DeepLabv3 with Xception backbone, and the Pyramid Scene Parsing Network. The best-performing model was selected for generating the initial fruit region masks. Next, a border following algorithm extracted ordered contour coordinates from the binary mask. Finally, a two-stage ellipse fitting process was applied: an adaptive RANSAC algorithm identified true boundary inliers, with automated parameter tuning, followed by least squares optimization on these inliers to determine ellipse parameters. Projected area was calculated from the fitted ellipse. A dedicated, high-quality image dataset was constructed for this study, containing 2,000 images of two prominent hanging watermelon cultivars. The dataset was meticulously designed to include a balanced distribution of various occlusion types (leaf, vine, net bag, identification tag) and severity levels, as well as non-occluded reference samples. Experimental results demonstrated that the U-Net model with a VGG16 backbone achieved superior segmentation performance, with a precision of 99.41%, a recall of 99.36%, and an Intersection over Union (IoU) score of 98.78%, outperforming the other four candidate models and providing an exceptionally reliable foundation for subsequent geometrical processing. The proposed adaptive RANSAC combined with least squares fitting method proved dramatically more robust than conventional least squares fitting applied directly to all contour points. Quantitative evaluation based on the calculated projection area showed that the proposed hybrid method achieved an outstanding coefficient of determination (
R2) of 0.99 when compared to meticulously obtained manual ground-truth measurements. The root mean square error (RMSE) was 6.35 cm
2, and the mean absolute percentage error (MAPE) was 3.07%. This performance signifies a substantial improvement, with a 64% reduction in RMSE and a 62% reduction in MAPE compared to the traditional least squares fitting baseline. The method's robustness was further confirmed under varying occlusion intensities; when test samples were categorized into mild, moderate, and severe occlusion levels based on the fitted inlier ratio, the MAPE remained consistently low at 2.41%, 3.01%, and 3.97%, respectively. In a comprehensive benchmark against the prominent Segment Anything Model (SAM) operating in both interactive and automatic modes, the proposed method demonstrated decisive advantages for this specific agricultural occlusion problem. It yielded significantly lower estimation errors, with an RMSE of 6.35 cm
2, which starkly contrasts with the 21.45 cm
2 obtained by interactive SAM and the 25.63 cm
2 from auto-prompting SAM. The study presents a practical method for high-precision segmentation of occluded watermelon fruits in greenhouses. By combining U-Net segmentation with adaptive RANSAC-based ellipse fitting, the framework reliably reconstructs complete fruit contours, enabling accurate, automated estimation of phenotypic traits such as projected area. This supports growth monitoring, yield prediction, and cultivation optimization. The approach demonstrates robustness and efficiency, advancing vision-based automation in protected horticulture.