Integration of U-Net and FastSAM for Accurate Leaf Image Segmentation in Complex Backgrounds
Received: 1 September 2025 | Revised: 6 October 2025 | Accepted: 22 October 2025 | Online: 3 November 2025
Corresponding author: Sopon Phumeechanya
Abstract
Leaf segmentation plays a crucial role in plant phenotyping and precision agriculture, enabling the monitoring of growth, disease detection, and informed crop management. However, accurate segmentation in natural environments is challenging due to complex backgrounds, overlapping structures, irregular boundaries, and varying illumination. This paper proposes a hybrid six-stage framework that integrates U-Net with the Fast Segment Anything Model (FastSAM) to achieve accurate and efficient leaf segmentation. The pipeline consists of initial U-Net segmentation, largest component filtering, contour extraction with convex hull transformation, bounding box derivation via distance transform, promptable refinement with FastSAM, and final contour selection. The experiments conducted used 633 images from the Pl@ntLeaves database: 333 images for model development with a train/validation split of 266/67 (20% validation), and a held-out test set of 300 images. On the 300-image test set, the proposed framework achieved superior results (Precision = 0.966, Recall = 0.945, Intersection over Union (IoU) = 0.917, Dice = 0.953, HD95 = 27.859), outperforming DeepLabV3 and CLIPSeg. These findings confirm that combining U-Net's fine-grained feature extraction with FastSAM's efficient prompt-based refinement provides a robust and scalable solution for plant phenotyping and precision agriculture, particularly by enhancing boundary accuracy in complex natural scenes.
Keywords:
leaf segmentation, U-Net, FastSAM, precision agriculture, plant phenotypingDownloads
References
J. W. Abe, J. Ilao, and G. Foliente, “Promptable Leaf Segmentation in Plant Phenotyping: Research Perspectives and Challenges,” in 2024 30th International Conference on Mechatronics and Machine Vision in Practice, Leeds, UK, Oct. 2024, pp. 1–6. DOI: https://doi.org/10.1109/M2VIP62491.2024.10745998
A. Lyasmine, F. Idir, and B. Samia, “Plant Leaf Image Segmentation in Natural Scenes: A Multi-layer Graph Queries Propagation Approach,” Pattern Analysis and Applications, vol. 28, no. 1, Mar. 2025, Art. no. 1. DOI: https://doi.org/10.1007/s10044-024-01380-y
L. Gao and X. Lin, “Fully Automatic Segmentation Method for Medicinal Plant Leaf Images in Complex Background,” Computers and Electronics in Agriculture, vol. 164, Sep. 2019, Art. no. 104924. DOI: https://doi.org/10.1016/j.compag.2019.104924
E. Iren, “Comparison of YOLOv5 and YOLOv6 Models for Plant Leaf Disease Detection,” Engineering, Technology & Applied Science Research, vol. 14, no. 2, pp. 13714–13719, Apr. 2024. DOI: https://doi.org/10.48084/etasr.7033
Z. Wang, K. Wang, F. Yang, S. Pan, and Y. Han, “Image Segmentation of Overlapping Leaves Based on Chan–Vese Model and Sobel Operator,” Information Processing in Agriculture, vol. 5, no. 1, pp. 1–10, Mar. 2018. DOI: https://doi.org/10.1016/j.inpa.2017.09.005
R. Khan and R. Debnath, “Segmentation of Single and Overlapping Leaves by Extracting Appropriate Contours,” in 6th International Conference on Computer Science, Engineering and Information Technology, Chennai, India, Nov. 2019, pp. 287–300. DOI: https://doi.org/10.5121/csit.2019.91323
B. M. Patil and B. Amarapur, “Cotton Leaf Image Segmentation using Modified Factorization-Based Active Contour Method,” International Journal of Advanced Computer Science and Applications, vol. 11, no. 9, pp. 516–521, 2020. DOI: https://doi.org/10.14569/IJACSA.2020.0110962
C. Yang, L. Fang, Q. Yu, and H. Wei, “A Learning Robust and Discriminative Shape Descriptor for Plant Species Identification,” IEEE/ACM Transactions on Computational Biology and Bioinformatics, vol. 20, no. 1, pp. 39–51, Jan. 2023. DOI: https://doi.org/10.1109/TCBB.2022.3148463
L. Gao and X. Lin, “A Method for Accurately Segmenting Images of Medicinal Plant Leaves With Complex Backgrounds,” Computers and Electronics in Agriculture, vol. 155, pp. 426–445, Dec. 2018. DOI: https://doi.org/10.1016/j.compag.2018.10.020
J. Long, E. Shelhamer, and T. Darrell, “Fully Convolutional Networks for Semantic Segmentation,” in 2015 IEEE Conference on Computer Vision and Pattern Recognition, Boston, MA, USA, Jun. 2015, pp. 3431–3440. DOI: https://doi.org/10.1109/CVPR.2015.7298965
O. Ronneberger, P. Fischer, and T. Brox, “U-Net: Convolutional Networks for Biomedical Image Segmentation,” in Medical Image Computing and Computer-Assisted Intervention – MICCAI 2015, vol. 9351, N. Navab, J. Hornegger, W. M. Wells, and A. F. Frangi, Eds. Cham, Switzekland: Springer International Publishing, 2015, pp. 234–241. DOI: https://doi.org/10.1007/978-3-319-24574-4_28
Z. Jia, A. Shi, G. Xie, and S. Mu, “Image segmentation of persimmon leaf diseases based on UNet,” in 2022 7th International Conference on Intelligent Computing and Signal Processing, Xi’an, China, Apr. 2022, pp. 2036–2039. DOI: https://doi.org/10.1109/ICSP54964.2022.9778390
T. Qian et al., “Cucumber Leaf Segmentation Based on Bilayer Convolutional Network,” Agronomy, vol. 14, no. 11, Nov. 2024, Art. no. 2664. DOI: https://doi.org/10.3390/agronomy14112664
W. Mu, Z. Jia, Y. Liu, W. Xu, and Y. Liu, “Image Segmentation Model of Pear Leaf Diseases Based on Mask R-CNN,” in 2022 International Conference on Image Processing and Media Computing, Xi’an, China, May 2022, pp. 41–45. DOI: https://doi.org/10.1109/ICIPMC55686.2022.00016
J. Kan, Z. Gu, C. Ma, and Q. Wang, “Leaf Segmentation Algorithm Based on Improved U-shaped Network under Complex Background,” in 2021 IEEE 4th Advanced Information Management, Communicates, Electronic and Automation Control Conference, Chongqing, China, Jun. 2021, pp. 87–92. DOI: https://doi.org/10.1109/IMCEC51613.2021.9482382
Q. Wang, W. Du, C. Ma, and Z. Gu, “Leaf Image Semantic Segmentation Based on Deep Learning,” in 2021 IEEE 2nd International Conference on Information Technology, Big Data and Artificial Intelligence, Chongqing, China, Dec. 2021, pp. 1147–1151. DOI: https://doi.org/10.1109/ICIBA52610.2021.9688307
L. Zhang and X. Liang, “Image Segmentation of Plant Leaves in Natural Environments Based on LinkNet,” Journal of Computing and Electronic Information Management, vol. 11, no. 3, pp. 67–72, Dec. 2023. DOI: https://doi.org/10.54097/jceim.v11i3.15
P. Dinesh and R. Lakshmanan, “FB-PNet: A Semantic Segmentation Model for Automated Plant Leaf and Disease Annotation,” International Journal of Advanced Computer Science and Applications, vol. 16, no. 5, 2025. DOI: https://doi.org/10.14569/IJACSA.2025.0160549
D. Morris, “A Pyramid CNN for Dense-Leaves Segmentation,” in 2018 15th Conference on Computer and Robot Vision, Toronto, ON, Canada, May 2018, pp. 238–245. DOI: https://doi.org/10.1109/CRV.2018.00041
K. Yang, W. Zhong, and F. Li, “Leaf Segmentation and Classification with a Complicated Background Using Deep Learning,” Agronomy, vol. 10, no. 11, Nov. 2020, Art. no. 1721. DOI: https://doi.org/10.3390/agronomy10111721
R. Ma et al., “Local Refinement Mechanism for Improved Plant Leaf Segmentation in Cluttered Backgrounds,” Frontiers in Plant Science, vol. 14, Aug. 2023, Art. no. 1211075. DOI: https://doi.org/10.3389/fpls.2023.1211075
J. Bala, H. B. Salau, I. J. Umoh, A. J. Onumanyi, S. A. Tijani, and B. Yahaya, “Development of Hybrid Automatic Segmentation Technique of a Single Leaf from Overlapping Leaves Image,” Journal of ICT Research and Applications, vol. 14, no. 3, Mar. 2021. DOI: https://doi.org/10.5614/itbj.ict.res.appl.2021.14.3.4
L. Loyani and D. Machuve, “A Deep Learning-based Mobile Application for Segmenting Tuta Absoluta’s Damage on Tomato Plants,” Engineering, Technology & Applied Science Research, vol. 11, no. 5, pp. 7730–7737, Oct. 2021. DOI: https://doi.org/10.48084/etasr.4355
N. Nikbakhsh, Y. Baleghi, and H. Agahi, “Maximum Mutual Information and Tsallis Entropy for Unsupervised Segmentation of Tree Leaves in Natural Scenes,” Computers and Electronics in Agriculture, vol. 162, pp. 440–449, Jul. 2019. DOI: https://doi.org/10.1016/j.compag.2019.04.038
N. Nikbakhsh, Y. Baleghi, and H. Agahi, “A Novel Approach for Unsupervised Image Segmentation Fusion of Plant Leaves Based on G-mutual Information,” Machine Vision and Applications, vol. 32, no. 1, Jan. 2021, Art. no. 5. DOI: https://doi.org/10.1007/s00138-020-01130-0
R. Alanazi, “A YOLOv10-based Approach for Banana Leaf Disease Detection,” Engineering, Technology & Applied Science Research, vol. 15, no. 3, pp. 23522–23526, Jun. 2025. DOI: https://doi.org/10.48084/etasr.11138
L.-C. Chen, G. Papandreou, F. Schroff, and H. Adam, “Rethinking Atrous Convolution for Semantic Image Segmentation.” arXiv, 2017.
A. Kirillov et al., “Segment Anything,” in 2023 IEEE/CVF International Conference on Computer Vision, Paris, France, Oct. 2023, pp. 3992–4003. DOI: https://doi.org/10.1109/ICCV51070.2023.00371
T. Luddecke and A. Ecker, “Image Segmentation Using Text and Image Prompts,” in 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, Jun. 2022, pp. 7076–7086. DOI: https://doi.org/10.1109/CVPR52688.2022.00695
X. Zhao et al., “Fast Segment Anything.” arXiv, 2023.
H. Goeau et al., “The ImageCLEF 2011 plant images classification task.” 2012, [Online]. Available: https://liris.univ-lyon2.fr/reves/content/en/databases.php.
H. Goeau et al., “The ImageCLEF 2012 Plant Identication Task.” 2012, [Online]. Available: https://liris.univ-lyon2.fr/reves/content/en/databases.php.
D. Bolya, C. Zhou, F. Xiao, and Y. J. Lee, “YOLACT: Real-Time Instance Segmentation,” in 2019 IEEE/CVF International Conference on Computer Vision, Seoul, South Korea, Oct. 2019, pp. 9156–9165. DOI: https://doi.org/10.1109/ICCV.2019.00925
A. A. Taha and A. Hanbury, “Metrics for Evaluating 3D Medical Image Segmentation: Analysis, Selection, and Tool,” BMC Medical Imaging, vol. 15, no. 1, Dec. 2015, Art. no. 29. DOI: https://doi.org/10.1186/s12880-015-0068-x
Downloads
How to Cite
License
Copyright (c) 2025 Parichat Sermwuthisarn, Sopon Phumeechanya

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain the copyright and grant the journal the right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) after its publication in ETASR with an acknowledgement of its initial publication in this journal.
