**2. Materials and Methods**

#### *2.1. Experimental Materials and Image Acquisition*

Standard samples of early indica rice DOM (SAC LS/T 15121-2020), including wellmilled, reasonably well-milled and substandard, were selected from the Anhui grain and oil products quality supervision and testing station in Hefei, Anhui Province, China. A total of 50 g of each class of rice was used for sample preparation. Each five grams of rice was packed in a sealed bag as a group, and each type of rice was packed in 10 groups. Finally, there were 30 groups of three types of rice, marked with the corresponding serial numbers, and stored in a refrigerator at 0–5 ◦C to prevent the influence of sample deterioration on the inspection results.

According to the requirements of rice image acquisition, a Phantom h9 flatbed scanner was used to acquire RGB images of rice in multiple mixed poses with the background of a black frosted Acrylic plate. The contrast ratio, brightness, resolution, and image size of the flatbed scanner were set to 65, 30, 600 dpi, and 5000 pixels × 7000 pixels, respectively. Image acquisition was carried out in units of five grams, and each group of rice was placed on the draft table of the scanner with the help of a separating sieve to avoid the adhesion of rice grains. Then, image scanning was performed. Next, the operation of random placement and scanning was executed again to fully utilize the sample and obtain two different images. Finally, the scanned rice was put into the corresponding sealed bag, and the other group of rice was repositioned on the scanner. The above steps were performed on 30 groups of samples of well-milled, reasonably well-milled, and substandard in turn. Finally, a total of 60 valid images were obtained, some of which are shown in Figure 1.

**Figure 1.** Images of the original multi-grain rice. (**a**) Well-milled. (**b**) Reasonably well-milled. (**c**) Substandard.

#### *2.2. Image Preprocessing*

The image quality of the original images of multi-grain rice is affected by noise due to the limitation of the shooting conditions. So, a series of preprocessing operations were taken for the images to selectively highlight effective features and eliminate irrelevant information in order to improve the image quality and increase the classification and recognition accuracy. Meanwhile, in this research, we performed image smoothing, binarization, and segmentation of single-grain rice on the original rice images before inputting the singlegrain rice images into the CNN model.
