The length of the main stem of sweet potato seedlings is a crucial criterion for determining whether to harvest it. However, accurately estimating the main stem length is challenging due to two growth forms: leaf occlusion and self-curvature, which complicate automated harvesting and grading. This paper considers the morphological characteristics of sweet potato seedlings and proposes a main stem reconstruction and length estimation algorithm based on a two-stage classifier and feature extraction and search. Semantic segmentation is used to obtain masks of the stems. This is followed by image processing to segment clustered skeletons into singular lines, facilitating feature analysis of the main stem. Object detection is employed to identify regions of interest such as roots, growth joints, and stem-leaf intersections. Using the category and centroid information obtained from object detection, a prioritized search relationship is established among the line segments extracted through image processing. Subsequently, the main stems are classified and reconstructed based on constraints including direction, distance, and curvature. Finally, utilizing stereo depth information, the main stem is divided into four parts to estimate its length. Experimental results demonstrate that the algorithm achieves effective main stem reconstruction under four conditions: un-occluded, partially occluded, curved main stem, and low-density clustered multi-seedling states. The algorithm achieves a median length estimation error of 1.7 cm, with maximum errors of 3.2 cm and minimum errors of 0.3 cm. It provides an automated solution for length estimation during sweet potato seedling harvesting and grading.The length of sweet potato seedling main stems is critical for harvest decisions, but accurately measuring it is challenging due to leaf occlusion and self-curvature. This study proposes a method for stem reconstruction and length estimation using a two-stage classifier, feature extraction, and semantic segmentation to obtain stem masks. Image processing separates clustered skeletons into singular lines for detailed analysis. Object detection identifies roots, stem-leaf intersections, and establishes a search relationship among segments. Stems are reconstructed based on directional, distance, and curvature constraints, then divided into four parts for length estimation using stereo depth information. Experimental results demonstrate effectiveness under various conditions: un-occluded, partially occluded, curved stems, and low-density clusters. Median length estimation error is 1.7 cm, with maximum and minimum errors of 3.2 cm and 0.3 cm respectively. This automated method provides a reliable solution for sweet potato seedling harvest and grading.