Traditional apple sorting primarily relies on manual visual inspection, which is inefficient and prone to errors. Sorting machines based on traditional algorithms perform poorly under different lighting conditions and with different apple varieties, resulting in low detection accuracy, long development and adjustment cycles, and high costs. There is an urgent need for an automated inspection and grading solution that can adapt to various varieties and lighting conditions while accurately detecting low-contrast defects (e.g., spots, dents, cracks) to replace manual labor and improve grading accuracy.