1. Introduction
Walnuts, along with almonds, cashews, and hazelnuts, are the world-renowned “four dried nuts” with rich nutritional value. The plumpness of the walnut is a key factor; if the walnut kernel is not full, it is possible it lacked nutrition during the growth process, which seriously affects the quality of the walnut. Walnut kernels are mainly processed in China, and the main products are walnut food, walnut oil, and walnut health products, which are favored by more and more consumers and have great edible and commercial value [
1]. During storage, walnuts are prone to oil oxidation, protein denaturation, texture drying, color browning, flavor loss, internal insect damage, and kernel mildew [
2]. Inadvertent consumption of deteriorated walnuts can cause diarrhea, vomiting, and even cancer; thus, there is an urgent need for effective, non-destructive detection technology to monitor their quality in real time. Fruit fullness and mildew will affect the quality of walnuts, but walnuts have hard shells, which greatly hinders the effective extraction of its internal information, which discourages previous non-destructive quality detection methods. Therefore, it is of great significance to carry out a study on rapid, non-destructive detection of walnut internal quality for the realization of the walnut quality, safety monitoring, and the healthy development of the walnut industry.
In recent years, various imaging technologies such as X-ray imaging, infrared imaging, and hyper-spectral imaging have been used for the detection of the internal quality of food. Chuang C L et al. [
3] developed an automatic detection device for internal pests of agricultural products based on an x-ray with the main detection targets being fruits, such as peaches and guavas. The results showed that the device can accurately locate internal pests in the fruits with a localization accuracy of 94%. Long Y et al. [
4] applied a line scanning Raman hyper-spectral imaging system to extract corn mildew texture features and established an optimal detection model. The results showed that the mildew of maize kernels can be effectively detected with Raman hyper-spectral technology. Jiang H Z et al. [
5] applied the hyper-spectral imaging system to identify Camellia oil tea fruits with different degrees of mildew, and the CARS-PLS-DA model showed the best performance. The overall results showed that the hyper-spectral imaging technology provides a solution for detecting the degree of natural mildew of Camellia oil tea fruits. Each detection technology has its own advantages and disadvantages, and a single technology cannot meet all the requirements of the food industry for the analysis of complex foreign bodies and food substances. For instance, X-ray imaging is difficult to detect foreign bodies with a density lower than that of the food matrix, and its ionizing radiation is harmful to both the experimenter and the sample [
6]. Although the information obtained with hyper-spectral imaging is relatively more comprehensive, it is difficult to penetrate the samples with hard shells. Due to the thick shell of walnuts, it is difficult to carry out the detection of the actual walnut. In order to meet the urgent demand for safe and high-quality food, more effective technologies are needed to achieve the internal quality detection of food.
As an emerging non-destructive detection method, terahertz spectroscopy imaging technology has dual characteristics of microwave and infrared technologies, which can penetrate and interact with many commonly used materials. Terahertz spectroscopy and imaging technology has great application potential in the field of food quality detection due to its penetrability, fingerprint identification, and safety. Jiang Y et al. [
7] used terahertz time domain spectral reflectance imaging technology to detect foreign bodies in wheat grains at different depths, and terahertz images were processed using image preprocessing and threshold segmentation algorithms to achieve the detection of foreign bodies in flour. Wang C et al. [
8] realized the detection of metal foreign bodies in sausages by terahertz imaging technology. Jun Hu et al. [
9] used terahertz imaging technology to detect common foreign bodies in milk powder, such as polymer materials (PP, PVC, PE) and metal gaskets. Sun X D et al. [
10] used terahertz time-domain transmission imaging system to scan the terahertz data of sunflower seeds and segmented the image with binary value. The results showed that terahertz technology is able to detect the fullness of sunflower seeds. Qi S Y et al. [
11] realized the identification of normal walnuts, insect-infested walnuts, and mildew walnuts using a powder compression method. Xie L et al. [
12] detected endogenous foreign bodies in walnut kernels by comparing the typical absorption spectra of walnut kernels and walnut shells at different concentrations, and they identified shell contamination in walnut kernels effectively using terahertz imaging technology.
The detection of actual walnuts is difficult due to their thick shells. Therefore, there are few studies that have been carried out on the detection of the fullness of the walnuts. In this paper, terahertz time-domain spectroscopy transmission imaging technology is used to study the mildew and fullness of walnuts. First, the image information of different types of walnuts is collected, and the spectral data of the walnut shell, walnut kernel, mildew sample, and reference group in four different regions of interest are extracted. Three qualitative detection models of SVM, RF, and KNN are established to explore the optimal model through the accuracy rate and identify the normal walnuts and mildew walnut. Second, the visualization of walnut fullness is studied. The transmission imaging of walnut samples with different fullness is carried out, and the image is segmented using a binarization threshold. The proportion of the walnut kernel and walnut shell is calculated with pixels to realize the detection and calculation of walnut fullness.
4. Conclusions
In this paper, terahertz transmission imaging technology is used to identify and analyze normal walnuts and mildewed walnuts while image processing is performed on physical samples with different kernel sizes to calculate the fullness of the walnuts. First, the image information of the walnuts is collected, and the terahertz spectral information for different regions of interest is extracted. Three qualitative discrimination models of SVM, RF, and KNN are established, and the overall identification accuracy of the three models reaches 90.83%, 97.38%, and 97.87%, respectively. The KNN has the optimal qualitative discrimination effect. Among them, in a single category, the recognition accuracy of the model for the walnut kernel, walnut shell, mildewed samples, and reference group reaches 94%, 100%, 97.43%, and 100%, respectively. The terahertz transmission images of five kinds of physical samples with different kernel sizes are processed, and the fullness of the walnuts is characterized by calculating the ratio of the number of pixels of the walnut kernels to walnut shells in the binary images. Meanwhile, the original images of the samples are also processed, and their fullness is calculated. It is found that both errors are less than 5%, indicating that terahertz imaging technology combined with image processing can effectively evaluate the fullness of the walnut. In this case, this study provides a non-destructive method for walnut mildew detection, and it also provides a new method to analyze the fullness of walnut kernels, which has important value in practical application. Terahertz spectroscopy and imaging provides a non-destructive detection method for walnut quality, which can provide a reference for the quality detection of other dried nuts with shells, thus having significant practical value.