2.2.2. Apple Grading Criteria

In this paper, based on the Red Fuji GB/T 10651-2008 national standard [14], as shown in Table 1, ripeness, fruit shape, defects, and fruit diameter were selected as grading features to classify Red Fuji apples into 3 grades for this dataset.


**Table 1.** Red Fuji GB/T 10651-2008 national standard.

#### 2.2.3. Dataset Annotation and Expansion

LabelImg was used to annotate the apple images, saving the image categories and target rectangle boxes according to the PASCAL VOC dataset format, generating an annotation file in XML format. As the height of the industrial camera is a fixed value, the longest side of the rectangular box calibrated in the dataset is used as the criterion for fruit diameter; the ratio of the long side to the short side of the rectangular box is used as the criterion for fruit shape; apples with poor ripeness and defects are not carefully classified and are judged to be grade-3 apples. The collected apple images were expanded using MATLAB (2019) to make the training model more robust. The expansion methods included horizontal mirroring, vertical mirroring, multi-angle rotation (90.180.270), and image tiling. The expanded dataset is shown in Figure 7. The extended dataset has 6000 images with a uniform image size of 1280 × 1024, with a high number of grade-1 and grade-2 apples, each accounting for 40%, and a low number of grade-3 apples, accounting for 20%. The extended dataset was allocated to the training, test, and validation sets in a ratio of 7:2:1.

**Figure 7.** The expanded dataset.
