Current position:
Eggplant external defect detection based on hyperspectral

Eggplant external defect detection based on hyperspectral

2024-11-07 09:46


Eggplant, also known as Kunlun melon, dwarf melon, fallen su and yogurt, is a non-respiratory climacteric fruit. It originated in the tropical region of southeast Asia

and was introduced to my country during the Western Han Dynasty. Eggplant is rich in dietary fiber, vitamins, polyphenols, protein, minerals and other nutrients,

and has health benefits such as lowering blood lipids, preventing and treating hypertension and diabetes, protecting the liver and anti-oxidation. The production

and development and utilization of eggplant has broad market prospects. However, eggplant has defects such as cork and rotten fruit, which seriously affect the

yield and quality of eggplant, thereby reducing its commercial value. Cork may be caused by high temperature or abnormal climate change leading to calcium

and boron deficiency in eggplant; rotten fruit may be caused by insect pests, fungal pests, rain and light. In the actual production process, the removal of eggplant

cork and rotten fruit samples is still done manually, which is not only time-consuming and labor-intensive, inefficient, but also easy to cause missed selection.

Therefore, it is particularly important to realize a method that can quickly and accurately identify corky and rotten eggplant.


Hyperspectral imaging technology combines spectral analysis technology with digital imaging technology. It can simultaneously obtain spatial image information

of a large number of sample bands and spectral information of each pixel point. It has the advantages of high sensitivity, fast measurement speed and strong

anti-interference ability. It is widely used in non-destructive testing of agricultural products, disease detection and other fields.


In this study, hyperspectral technology was used to detect eggplant integrity, cork and rotten fruit. The original spectral data was preprocessed by various

preprocessing methods, and a PLS discriminant model was established for comparative analysis, and the best preprocessing method was selected for

subsequent research. SPA, RC and CARS were used to extract characteristic wavelengths from the preprocessed spectral data. Based on the characteristic

wavelengths, PLS and MLR discriminant models were established for comparative analysis to achieve qualitative discrimination of eggplant defects, which

provided a theoretical basis for the further development of eggplant online sorting equipment.


1 Materials and methods


1.1 Experimental materials


To ensure the reliability of the study, eggplants with uniform size (single fruit weight 450 g-680 g), nearly spherical shape and complete defect types (intact, corky

and rotten fruit) were selected as experimental samples. Figure 1 shows the three types of sample diagrams. The surface soil was cleaned and a total of 252 samples

were selected, including 170 intact samples, 60 corky samples and 22 rotten fruit samples. Hyperspectral images of each sample were collected, and then 252

spectral data were extracted from them. The three types of samples were randomly divided into 189 calibration set samples and 63 prediction set samples at a

ratio of approximately 3:1 using the Kennard-Stone algorithm.


2 Qualitative discriminant analysis of eggplant appearance quality based on hyperspectral data


2.1 Average spectral curves of intact, corky and rotten eggplant areas


Use the extract region of interest (ROI) function of ENVI4.7 software to extract the spectral data of the corky, rotten and intact areas of eggplant, and then calculate

and obtain the average spectrum of each type of sample, as shown in Figure 2. The "purple melon" eggplant is spherical and has a smooth and shiny skin, which

results in a high diffuse reflection intensity and high signal-to-noise ratio in the middle area of the collected hyperspectral image, affecting the modeling accuracy

and test reliability. Therefore, when using ENVI4.7 to extract the region of interest, the middle reflective area should be avoided.


As shown in Figure 2, the average spectral curves of intact eggplant, corky area and rotten fruit area are very different. In the range of 900~1300 nm, the reflectivity

of the intact area is the highest, which may be because the skin of the intact eggplant is smooth and the reflection of light is the strongest; the three curves near

1200 nm are all troughs, which is due to the secondary frequency absorption of the C-H group of chlorophyll in the eggplant epidermis12; in the band range greater

than 1350nm, the reflectivity of the intact area is lower than that of the corky and rotten fruit areas.


2.2 Feature band extraction


The feature band comes from the full spectrum band and carries its most important spectral discrimination information. Its main functions are: eliminating the linear

correlation, singularity and instability of the original data; reducing the data dimension, reducing the number of variables, and eliminating redundant interference

information. The extraction of feature bands directly affects the efficiency of model establishment and the reliability and accuracy of the prediction results after

modeling.


2.2.1 Continuous projection method (SPA)


The continuous projection algorithm is a forward variable selection algorithm that minimizes the collinearity of the vector space. As an emerging characteristic

wavelength screening method, it can effectively eliminate the influence of collinearity between wavelength variables, and then effectively extract characteristic

wavelength variables. SPA characteristic wavelength extraction is performed on the sample spectral data after normalization preprocessing, as shown in Figure

3. When the number of characteristic wavelengths is 14, the RMSE value is 0.3274, and the value reaches the minimum; the extracted characteristic wavelengths

are: 931.02, 924.64, 1399.29, 1093.68, 950.17, 902.3, 1380.21, 1147.86, 895.91, 1345.23, 1265.68, 1332.5, 1173.34, 982.08 nm, and their importance decreases in turn.


2.2.2 Regression coefficient method (RC)

Regression coefficient method [15 (RC): The PLS discriminant model is established for the preprocessed sample spectral data, and the regression coefficient is extracted from the model. This study selected 9 characteristic wavelength values, namely 924, 978, 1103, 1202, 1367, 1402, 1586, 1666, and 1681 nm. The principle is to take the local extreme value as the characteristic wavelength value, as shown in Figure 5。

3 Conclusions


3.1 Hyperspectral data of eggplant samples were collected based on hyperspectral technology. The original spectral data and the PLS model established after

preprocessing by various preprocessing methods were compared. The results showed that the PLS discrimination model after Normalize preprocessing had the

best effect, with a calibration set determination coefficient R² of 0.74 and a root mean square error RMSEC of 0.33; its prediction set determination coefficient

Rp² was 0.85 and the root mean square error RMSEP was 0.26.


3.2 SPA, RC and CARS were used to extract characteristic wavelengths from the spectral data after Normalize preprocessing, and PLS and MLR models were

established based on the characteristic wavelengths. Comparing various models, it can be seen that the CARS-MLR model has the best effect, with a calibration

set determination coefficient R² of 0.94, a prediction set determination coefficient Rp² of 0.90, RMSEC and RMSEP of 0.19 and 0.21 respectively, and a prediction

set discrimination accuracy of 96.82%, which has achieved good detection of eggplant external defects.