*2.3. Performance Indicators*

We divided all samples in the classification model into positive and negative samples. In this paper, cracked eggs were labeled as positive samples, and intact eggs were marked as negative samples. The prediction category determined by the model was obtained by predicting the sample data output in the model. In order to better evaluate the classification performance of the proposed detection model, five evaluation indicators, accuracy (*ACC*), precision (*P*), recall (*R*), F1-score (*F*1), and Matthews correlation coefficient (*MCC*), were used to comprehensively evaluate the algorithm models regarding their classification ability.

We define the false-positive (*FP*) rate as the number of negative samples that the model incorrectly predicts as positive samples. We define the true-positive (*TP*) rate as the number of positive samples correctly predicted by the model as positive samples. We define the false-negative (*FN*) rate as the number of positive samples that the model incorrectly predicts as negative samples and the true-negative (*TN*) rate as the number of negative samples correctly predicted by the model as negative samples.

Accuracy (*ACC*), precision (*P*), recall (*R*), and F1-Score (*F*1) are common performance indicators used to evaluate the predictive ability of classification models, and their calculation formulas are as follows:

$$\text{ACC} = \frac{TP + TN}{TP + FP + TN + FN} \times 100\% \tag{12}$$

$$P = \frac{TP}{TP + FP} \tag{13}$$

$$R = \frac{TP}{TP + FN} \tag{14}$$

$$F1 = 2 \times \frac{P \times R}{P + R} \tag{15}$$

The Matthews correlation coefficient (*MCC*) [38] comprehensively considers *TP*, *TN*, *FP*, and *FN*. It is considered to be a better measure of the classifier's performance. The value range of the *MCC* is [−1, 1]. A value of 1 means that the prediction is entirely consistent with reality, a value of 0 means that the predicted result is not as good as the result of random prediction, and a value of −1 means that the predicted result is inconsistent with the actual result. *MCC* is defined as follows:

$$M\text{CC} = \frac{TP \times TN - FP \times FN}{\sqrt{(FP + TP)(TP + FN)(FN + TN)(TN + FP)}}\tag{16}$$

We used *ACC*, *P*, *R*, *F*1, and *MCC* as the evaluation indicators of the proposed method. In addition, the training time and preference time of the model were considered as a metric for performance evaluation, as they are of great significance to the real-time detection of cracked eggs.

#### *2.4. Experimental Environment*

All experimental calculations in this study were performed using MATLAB R2022a software, and the experimental computer processor was an 11th Gen Intel (R) Core (TM) i5-11400H @ 2.70GHz 2.69 GHz, Windows 10 (64-bit) Professional version.

#### **3. Results and Discussion**

### *3.1. Experimental Data*

The experimental data came from fresh eggs purchased at the farmers' market near the laboratory . The eggs were cleaned and transported to the laboratory. The mass of each egg was between 43.2 g∼62.3 g. The intact samples were observed under 10× magnification, and a total of 400 eggs were observed. To quickly obtain a sufficient number of egg microcrack samples, we selected 220 cracks of different types and positions by exerting external forces on different positions of eggs through the egg crack collision machine . The width of the artificial microcracks was generally less than 3 microns, which is usually not easy to observe with the human eye. The samples that could not be subjected to a discharge test due to excessive force or improper operation during the production process were rejected . Finally, a total of 356 egg samples that met the requirements were selected for experimentation, as shown in Table 1.

**Table 1.** The number of egg samples used by the electrical characteristic crack detection system to obtain a microcurrent signal.

