An efficient pipeline for sorting clusters of touching corn kernels—potentially containing sound grains, defective grains, and foreign matter—is introduced. The method operates in two steps. First, a next-generation instance segmentation network, trained entirely on a corpus of synthetically generated images, separates the input scene into distinct individual objects. Second, a purpose-built, lightweight CNN architecture assigns each segmented object to one of three categories (sound, defective, or foreign matter). The segmentation model is learned using a strategy that eliminates the need for labor‑intensive, subjective manual annotation. For the classification step, the custom network is deliberately constructed with a minimal number of layer blocks, yielding a compact architecture suitable for on-device deployment. Experimental evaluations and comparative benchmarks confirm gains in both recognition accuracy and processing speed. The proposed segmentation and classification framework can be readily transferred to other cereal grains.