Applications of THz Spectral Imaging in the Detection of Agricultural Products

Agricultural products need to be inspected for quality and safety, and the issue of safety of agricultural products caused by quality is frequently investigated. Safety testing should be carried out before agricultural products are consumed. The existing technologies for inspecting agricultural products are time-consuming and require complex operation, and there is motivation to develop a rapid, safe, and non-destructive inspection technology. In recent years, with the continuous progress of THz technology, THz spectral imaging, with the advantages of its unique characteristics, such as low energies, superior spatial resolution, and high sensitivity to water, has been recognized as an efficient and feasible identification tool, which has been widely used for the qualitative and quantitative analyses of agricultural production. In this paper, the current main performance achievements of the use of THz images are presented. In addition, recent advances in the application of THz spectral imaging technology for inspection of agricultural products are reviewed, including internal component detection, seed classification, pesticide residues detection, and foreign body and packaging inspection. Furthermore, machine learning methods applied in THz spectral imaging are discussed. Finally, the existing problems of THz spectral imaging technology are analyzed, and future research directions for THz spectral imaging technology are proposed. Recent rapid development of THz spectral imaging has demonstrated the advantages of THz radiation and its potential application in agricultural products. The rapid development of THz spectroscopic imaging combined with deep learning can be expected to have great potential for widespread application in the fields of agriculture and food engineering.


Introduction
The food and agriculture industries need fast and effective methods to inspect the quality and safety of agricultural products [1]. The THz region of the electromagnetic spectrum lies between the microwave (MW) and infrared (IR) regions with frequency range from 0.1 to 10 THz. THz radiation is used in nondestructive testing due to its unique position in the electromagnetic spectrum [2][3][4][5]. For example, intermolecular and intramolecular rotation and vibrational transitions at THz frequencies provide unique fingerprints for many materials. These patterns are specific to the molecular structure and arrangement of compounds, so the chemical composition of a sample can be analyzed through its THz spectral fingerprint [6,7]. Dry media such as paper, cloth, and plastic

Principle
THz time-domain spectroscopy (TDS) is one of the most effective and widely used powerful detection techniques. In this method, a fs laser is employed to generate THz radiation pulses for pump-probe measurements. THz images are obtained by a per-pixel scan. Details of the system was described in previous works. The THz imaging system can be divided into transmission imaging and reflection imaging from the imaging method of the sample [34][35][36][37]. This type of time-domain system can be used to measure both the frequency and electric field simultaneously, thus providing the phase and amplitude. Therefore, dispersion, absorption coefficient, and other material properties can be measured at THz frequencies [38][39][40]. Figure 1 shows a THz spectroscopy imaging system and the applications of agricultural products.
With the rapid development of THz science and technology, spectral imaging can be divided into pulsed and continuous THz radiation. As early as 1984, Auston et al. discovered an electromagnetic pulse with a pulse width of ps, which marked the birth of THz optoelectronics [41]. Since then, great progress has been made in the generation and detection of pulsed THz signals. Pulse THz spectral imaging systems usually generate and detect transient electromagnetic pulses. THz time-domain imaging (THz-TDI) is a basic pulse imaging method. On this basis, THz real-time imaging [42][43][44] and THz near-field imaging [45] were developed to improve imaging performance. Among them, a real-time imaging system based on THz quantum cascade laser (QCL) has good performance. A THz QCL provides adjustable frequency and compact structure. THz QCLs have attracted extensive attention in the field of THz imaging. In recent years, THz QCL performance has been continuously improved, making it the first choice for use in real-time THz imaging systems [46][47][48]. Continuous THz imaging is another common THz spectral imaging technique that eliminates the need to use a pulsed fs laser for THz spectral imaging [49][50][51]. Since Kleine-Ostmann et al. first proposed continuous-wave THz spectral imaging in 2001, CW imaging has developed rapidly and is widely used as it provides high spectral resolution. In general, THz radiation can be detected using coherent and incoherent methods [52,53]. Some common THz spectral imaging techniques and their characteristics are shown in Table 1.

Optical Parameter Extraction
The samples were placed on the moving platform at the focus of the THz beam, and then THz spectral was translated by THz control system. The transmitted or reflected THz waveform for each position of the object was measured. Once the scanning procedure was finished, the THz images of samples with a form of 3D were built by adding signals collected pixel by pixel.
Therefore, data processing and feature parameter extraction for a single pixel are basic steps in reconstructing THz images. The method for extracting parameters for a single pixel is briefly described as follows: A time domain spectral signal is obtained by THz spectrum imaging system, and the amplitude and phase information of the sample is obtained with a Fourier transform [54]. THz pulses are absorbed and scattered by the sample, the sample's complex refractive index ( ) comprises its macroscopic optical properties, where dispersion is quantified with the real refractive index ( ) and absorption is quantified with the extinction coefficient ( ):

Optical Parameter Extraction
The samples were placed on the moving platform at the focus of the THz beam, and then THz spectral was translated by THz control system. The transmitted or reflected THz waveform for each position of the object was measured. Once the scanning procedure was finished, the THz images of samples with a form of 3D were built by adding signals collected pixel by pixel.
Therefore, data processing and feature parameter extraction for a single pixel are basic steps in reconstructing THz images. The method for extracting parameters for a single pixel is briefly described as follows: A time domain spectral signal is obtained by THz spectrum imaging system, and the amplitude and phase information of the sample is obtained with a Fourier transform [54]. THz pulses are absorbed and scattered by the sample, the sample's complex refractive index N(ω) comprises its macroscopic optical properties, where dispersion is quantified with the real refractive index n r (ω) and absorption is quantified with the extinction coefficient k(ω): The sample is scanned to obtain E s (ω) and a reference spectrum E re f (ω) [55,56]. Based on the Fresnel equation [57] and light propagation equation [58], the complex transmission function can be calculated as follows: Using the definition of transmittance, one can derive the following equation [59,60]: Ignoring the Fabry-Perot effect, the refractive index n(ω) and absorption coefficient α(ω) of the sample can be calculated as follows: ρ(ω) is the ratio of amplitudes for the sample and reference signals, ϕ(ω) is the phase difference between the sample and reference signals, ω is the angular frequency, c is the speed of light in vacuum, and d is the thickness of the sample. The time domain and frequency domain information for each pixel in the sample is obtained using the above calculation. Images can be formed using different potions parameters of data, which contain different information about the sample.

Internal Composition Detection
THz spectroscopic imaging can be used to detect the internal and intermolecular structure of samples. The spectral data contain information on the chemical, physical, and structural properties of the sample. Therefore, THz spectral imaging can be used to measure moisture content in crop leaves; maltose content, protein content, and fatty acid content in seeds; and from the state of seeds can be judged the seeds' morphology.
May and Taday [61] used THz pulse imaging to detect sugar crystallization in confectionery products. THz technology was used to track phase transition from the aqueous phase into a glassy state, and it can be used to monitor the formation of a sugar coatings. THz spectral imaging technology can be used to non-destructively identify the morphology and structure of wheat seeds. Data processing software was used to obtain a large amount of information from THz images. The internal structure of healthy seeds was evenly distributed except for the embryonic area. Gua et al. [62] measured three seeds by THz reflection imaging technology, and the results show that the first seed was ungerminated, while the second seed was still in the germination stage. The third seed could not find its embryonic area in the THz image, and there was a large area of strong reflection in the upper right corner, which means that the internal structure of the area was destroyed and the third seed was necrotic. It is impossible to distinguish the state of seeds with the naked eye; THz reflection imaging allows the state of seeds to be identified non-destructively. Penkov et al. [63] first used THz-TDS to study the late blight and fusariosis in potatoes and cereals of different varieties. It was found that THz-TDS can clearly determine the presence or absence of phytopathogens, which can be used to assess the degree and depth of damage to plant tissues. Wei et al. [64] used THz spectroscopy to quickly and accurately determine the protein content in soybeans, and the results show that dimensionality reduction algorithms combined with THz spectroscopy for the quantitative determination of protein in soybeans is feasible. Starch is converted into maltose during grain budding, and the degree of grain budding can be determined by measuring the content of maltose in grain. Jiang et al. [65] present PCA-SVM to detect maltose with different concentrations based on THz images. The results show that THz spectral imaging technology combined with chemometrics can be used to accurately measure the concentration of maltose, and the accuracy of their model exceeded 94%. Jiang et al. [66] proposed a method for quantitative analysis of wheat maltose using THz spectroscopy and THz spectroscopy imaging, which allows for the feature extraction on the THz image of the sample, and can be used to build information fusion models. In order to realize automatic optimization of LS-SVM, a Boosting enhanced iteration termination index was proposed to obtain the basic model parameters. Experimental results show that the prediction accuracy provided by the multivariate data fusion modeling algorithm is higher than that provided by LS-SVM modeling algorithm using THz spectrum and image feature data alone. Figures 2 and 3 show the THz absorption spectroscopy and THz images of the maltose and polyethylene mixtures and the maltose and wheat starch mixtures, respectively. The multivariate data fusion method was used to quantitatively analyze four unknown maltose concentration wheat samples. The results show that the fusion modeling algorithm can effectively determine the maltose content in food and agricultural products. and accurately determine the protein content in soybeans, and the results show that dimensionality reduction algorithms combined with THz spectroscopy for the quantitative determination of protein in soybeans is feasible. Starch is converted into maltose during grain budding, and the degree of grain budding can be determined by measuring the content of maltose in grain. Jiang et al. [65] present PCA-SVM to detect maltose with different concentrations based on THz images. The results show that THz spectral imaging technology combined with chemometrics can be used to accurately measure the concentration of maltose, and the accuracy of their model exceeded 94%. Jiang et al. [66] proposed a method for quantitative analysis of wheat maltose using THz spectroscopy and THz spectroscopy imaging, which allows for the feature extraction on the THz image of the sample, and can be used to build information fusion models. In order to realize automatic optimization of LS-SVM, a Boosting enhanced iteration termination index was proposed to obtain the basic model parameters. Experimental results show that the prediction accuracy provided by the multivariate data fusion modeling algorithm is higher than that provided by LS-SVM modeling algorithm using THz spectrum and image feature data alone. Figures 2 and 3 show the THz absorption spectroscopy and THz images of the maltose and polyethylene mixtures and the maltose and wheat starch mixtures, respectively. The multivariate data fusion method was used to quantitatively analyze four unknown maltose concentration wheat samples. The results show that the fusion modeling algorithm can effectively determine the maltose content in food and agricultural products. THz radiation is strongly absorbed by water [67]. Therefore, one of the most obvious applications of THz spectroscopy is its application in measuring moisture content [68,69]. The moisture content in food affects its texture, taste, microbial growth, shelf life, and overall quality. Ogawa et al. [70] established two experimental systems with THz electromagnetic wave to evaluate the quality of tomato. The experimental results show that the internal damage was able to be detected, which was difficult with NIR. Nie et al. [71] investigated the THz spectra of rapeseed leaves with different water content, and used the partial least squares, kernel PLS, and Boosting-PLS to establish models for predicting water content based on the processed transmission and absorption spectra. The results show that the proposed three methods could effectively predict water content in leaves. Yasui [72] added a micro-structured light guide antenna to the system to measure the moisture content in coffee powder stored in glass bottles. After 3.5 h of forced humidity absorption, the transmission spectrum of instant coffee was found to have changed significantly. Plant leaves have heterogeneous structures containing spatial variations in liquid, solid, and gaseous substances [73]. The content and distribution of these substances are related to leaf vigor and phylogenetic traits. Zang et al. [74] proposed PSO algorithm to conduct The analysis results were verified experimentally using the leaves of Bougainvillea spectabilis leaves, and showed good sensitivity to fine-grained differences of leaf growth and development stages, indicating that the THz imaging method has the potential for applications in agricultural product disease diagnosis and farmland cultivation management. Song et al. [75] proposed a new method involving THz-TDS to estimate the water content in plant leaves. THz-TDS was used to detect the spatial distribution of THz wave transmission in xylem and vein flesh of three plants. An image was reconstructed using the transmission amplitude. Water loss in the basal leaf area was found to be greater than that in the distal leaf area of three plants during the natural drying process. THz imaging method and direct water gravimetric method are consistent. Song et al. also studied temporal and spatial variations of water content in the leaves of damaged Ginkgo biloba plants with incisions. The experimental results illustrated the feasibility of using THz technology to monitor temporal and spatial variations of water content in plant leaves.

Seed Classification
THz spectroscopy combined with chemometric methods can be used for seed classification, such as the identification of transgenic seeds [76] and seed variety classification [77]. As early as 2005, Lu et al. [78] used THz-TDS and THz spectral imaging to identify corn seeds and processed THz images of samples with spatial pattern analysis. The results THz radiation is strongly absorbed by water [67]. Therefore, one of the most obvious applications of THz spectroscopy is its application in measuring moisture content [68,69]. The moisture content in food affects its texture, taste, microbial growth, shelf life, and overall quality. Ogawa et al. [70] established two experimental systems with THz electromagnetic wave to evaluate the quality of tomato. The experimental results show that the internal damage was able to be detected, which was difficult with NIR. Nie et al. [71] investigated the THz spectra of rapeseed leaves with different water content, and used the partial least squares, kernel PLS, and Boosting-PLS to establish models for predicting water content based on the processed transmission and absorption spectra. The results show that the proposed three methods could effectively predict water content in leaves. Yasui [72] added a micro-structured light guide antenna to the system to measure the moisture content in coffee powder stored in glass bottles. After 3.5 h of forced humidity absorption, the transmission spectrum of instant coffee was found to have changed significantly. Plant leaves have heterogeneous structures containing spatial variations in liquid, solid, and gaseous substances [73]. The content and distribution of these substances are related to leaf vigor and phylogenetic traits. Zang et al. [74] proposed PSO algorithm to conduct one-off quantitative analysis of the spatial variability in the distribution of leaf components based on the extended Landau-Lifshitz Looyenga model and THz spectral imaging. The analysis results were verified experimentally using the leaves of Bougainvillea spectabilis leaves, and showed good sensitivity to fine-grained differences of leaf growth and development stages, indicating that the THz imaging method has the potential for applications in agricultural product disease diagnosis and farmland cultivation management. Song et al. [75] proposed a new method involving THz-TDS to estimate the water content in plant leaves. THz-TDS was used to detect the spatial distribution of THz wave transmission in xylem and vein flesh of three plants. An image was reconstructed using the transmission amplitude. Water loss in the basal leaf area was found to be greater than that in the distal leaf area of three plants during the natural drying process. THz imaging method and direct water gravimetric method are consistent. Song et al. also studied temporal and spatial variations of water content in the leaves of damaged Ginkgo biloba plants with incisions. The experimental results illustrated the feasibility of using THz technology to monitor temporal and spatial variations of water content in plant leaves.

Seed Classification
THz spectroscopy combined with chemometric methods can be used for seed classification, such as the identification of transgenic seeds [76] and seed variety classification [77]. As early as 2005, Lu et al. [78] used THz-TDS and THz spectral imaging to identify corn seeds and processed THz images of samples with spatial pattern analysis. The results show that the proposed method can be used for corn seed identification. Qin et al. [79] proposed a method that combined SVM and MPGA for identifying GM crops with THz spectra. PCA was utilized to reduce the dimensionality. When the dimensionality of MPGA-SVM was 12, the accuracy was 99%. Liu et al. [80] used THz spectral imaging combined with chemometric methods to study the feasibility of non-destructive discrimination of genetically modified rice seeds and non-transgenic seeds. PCA, LS-SVM, PCA-BPNN, and RF models were used to classify rice seeds. The results show that there are indeed differences between non-transgenic rice seeds and genetically modified rice seeds. The RF model combined with the first-order derivative pretreatment can be used for classification with 96.67% accuracy. THz spectral imaging can also be used to identify seeds in different stages and moldy seeds. Jiang et al. [81] used THz imaging to identify wheat particles at different germination stages. The experimental results show that THz imaging combined with chemometrics is an effective method for identifying early germination (about 6 h) of wheat seeds to ensure quality and quantity of seeds. Jiang et al. [82] established a new method for identifying mildew on wheat using THz spectral imaging. Spectral data from 0.2 to 1.6 THz were extracted from the regions of interest (ROIs) in the THz image. The models developed with SVM, PLS, and BPNN were based on the full frequency and optimal frequency range, where the first three principal components were used as input variables. The prediction accuracy provided by this method exceeds 95% and can be used with all pixels in an image. The results show that THz imaging combined with chemometrics is an effective method for identifying mildew on wheat. The physiological functions of different parts of seeds are different, and their nutritional value is also different. Li et al. [83] proposed a pretreatment method based on THz TDS imaging system combined with optical information extraction, which can be used to effectively enhance the visual representation of different tissues of corn seed. This method provides a basis for using THz spectral imaging to analyze the chemical composition and content of seeds. Figure 4A shows the extraction process of embryo region localization. Figure 4B shows the extraction process of endosperm region localization. sification with 96.67% accuracy. THz spectral imaging can also be used to identify seeds in different stages and moldy seeds. Jiang et al. [81] used THz imaging to identify wheat particles at different germination stages. The experimental results show that THz imaging combined with chemometrics is an effective method for identifying early germination (about 6 h) of wheat seeds to ensure quality and quantity of seeds. Jiang et al. [82] established a new method for identifying mildew on wheat using THz spectral imaging. Spectral data from 0.2 to 1.6 THz were extracted from the regions of interest (ROIs) in the THz image. The models developed with SVM, PLS, and BPNN were based on the full frequency and optimal frequency range, where the first three principal components were used as input variables. The prediction accuracy provided by this method exceeds 95% and can be used with all pixels in an image. The results show that THz imaging combined with chemometrics is an effective method for identifying mildew on wheat. The physiological functions of different parts of seeds are different, and their nutritional value is also different. Li et al. [83] proposed a pretreatment method based on THz TDS imaging system combined with optical information extraction, which can be used to effectively enhance the visual representation of different tissues of corn seed. This method provides a basis for using THz spectral imaging to analyze the chemical composition and content of seeds. Figure 4a shows the extraction process of embryo region localization. Figure 4b shows the extraction process of endosperm region localization.

Pesticide Residues Detection
Pesticide residues are also a concern for consumers. Compared with conventional techniques used for pesticide detection, THz spectroscopy imaging enables qualitative, quantitative, and graphical analysis. In recent years, there has been a significant interest in employing THz imaging for detection of pesticides [1,84,85]. Lee et al. [86] proposed a novel high-sensitivity, selective method for detecting pesticide residues, where nano-scale metamaterials were used based on a THz-TDS system to detect methomyl. The enhanced THz near field strongly increases the absorption cross-section through the nanometer antenna material, and the detection sensitivity is still up to 1 ppb, even in the solution state of the pesticide sample. The THz signal reflected from the THz nano metamaterial can also be used to simply detect pesticide residues contained on the surface of an apple in a non-destructive manner without any treatment. The contaminated area with the residual methomyl (a green dashed circle) is located at a corner of the nano-slot-antenna array as

Pesticide Residues Detection
Pesticide residues are also a concern for consumers. Compared with conventional techniques used for pesticide detection, THz spectroscopy imaging enables qualitative, quantitative, and graphical analysis. In recent years, there has been a significant interest in employing THz imaging for detection of pesticides [1,84,85]. Lee et al. [86] proposed a novel high-sensitivity, selective method for detecting pesticide residues, where nano-scale metamaterials were used based on a THz-TDS system to detect methomyl. The enhanced THz near field strongly increases the absorption cross-section through the nanometer antenna material, and the detection sensitivity is still up to 1 ppb, even in the solution state of the pesticide sample. The THz signal reflected from the THz nano metamaterial can also be used to simply detect pesticide residues contained on the surface of an apple in a non-destructive manner without any treatment. The contaminated area with the residual methomyl (a green dashed circle) is located at a corner of the nano-slot-antenna array as marked in a white dashed square line (Figure 5a). The reflection image at 1.0 THz clearly shows different color distribution around the methomyl stain area (Figure 5b) [84].
Similar to other spectral imaging methods (such as hyperspectral imaging), THz spectral imaging has low sensitivity, and it is difficult to detect residues. However, metamaterials can be used to significantly increase sensitivity [87]. In addition, the size of metamaterials used in THz spectral imaging is larger than that of other metamaterials used in optical wavebands, so metamaterials used in THz spectral imaging are easier to manufacture.  Similar to other spectral imaging methods (such as hyperspectral imaging), THz spectral imaging has low sensitivity, and it is difficult to detect residues. However, metamaterials can be used to significantly increase sensitivity [87]. In addition, the size of metamaterials used in THz spectral imaging is larger than that of other metamaterials used in optical wavebands, so metamaterials used in THz spectral imaging are easier to manufacture.

Foreign Body Detection and Packaging Inspection
Detection of foreign bodies in food is a necessary means to ensure food safety and quality. Commercial X-ray imaging is widely used to monitor foreign objects that may be embedded in food. However, it is difficult for conventional detection methods to observe low-density foreign objects in optically opaque food substrates.
Jiang et al. [88] used THz reflection imaging to detect foreign bodies (FBs) in wheat grains and flour, and the results show that this method could successfully detect FBs like stones hidden in wheat particles. FBs at different depths hidden in flour could also be detected. Shen et al. [89] proposed a method for the detection of impurities in wheat, mainly including wheat husk, wheat straw, and weed. The method combined THz imaging technology with CNN. The wheat-V2 model can recognize the samples in wheats and the accuracy is 97.56%. Lee et al. [90] compared continuous wave THz spectroscopy imaging and X-ray imaging as techniques for detecting FBs in food. The maggots and crickets are used as a low-density FBs. Both THz and X-ray images can be used to detect aluminum and granite blocks in the sample, while maggots and crickets could only be detected by using THz imaging. The results show that continuous wave THz imaging has great potential for detecting high-density and low-density FBs embedded in food. Continuous sub-THz imaging can be used to identify low density foreign matter with non-ionizing radiation. Gyeongsik et al. [91] used a high-resolution raster scan imaging system to detect foreign matter hidden in dry food at 210 GHz. Test results show that the foreign material transmission image has higher contrast than the reflection mode image when continuous sub-THz imaging was used to detect insects in grain and dense materials like plastic. Gyeongsik [92] used 140 GHz radiation for transmission imaging of metal paper clips, insects, and other foreign bodies in chocolate. The results show that metal foreign objects in chocolate can be displayed, even without removing the wrapping paper. Therefore, the THz image technology can be used for non-destructive testing of food with high water content, and it is expected this technology will be used for non-destructive testing of agricultural products. Shin et al. [93] studied the feasibility of using complex refractive index mapping of food materials for qualitative analysis of food at THz frequencies. The THz reflection images of hidden defects in sugar and milk powder matrices were obtained, and

Foreign Body Detection and Packaging Inspection
Detection of foreign bodies in food is a necessary means to ensure food safety and quality. Commercial X-ray imaging is widely used to monitor foreign objects that may be embedded in food. However, it is difficult for conventional detection methods to observe low-density foreign objects in optically opaque food substrates.
Jiang et al. [88] used THz reflection imaging to detect foreign bodies (FBs) in wheat grains and flour, and the results show that this method could successfully detect FBs like stones hidden in wheat particles. FBs at different depths hidden in flour could also be detected. Shen et al. [89] proposed a method for the detection of impurities in wheat, mainly including wheat husk, wheat straw, and weed. The method combined THz imaging technology with CNN. The wheat-V2 model can recognize the samples in wheats and the accuracy is 97.56%. Lee et al. [90] compared continuous wave THz spectroscopy imaging and X-ray imaging as techniques for detecting FBs in food. The maggots and crickets are used as a low-density FBs. Both THz and X-ray images can be used to detect aluminum and granite blocks in the sample, while maggots and crickets could only be detected by using THz imaging. The results show that continuous wave THz imaging has great potential for detecting high-density and low-density FBs embedded in food. Continuous sub-THz imaging can be used to identify low density foreign matter with non-ionizing radiation. Gyeongsik et al. [91] used a high-resolution raster scan imaging system to detect foreign matter hidden in dry food at 210 GHz. Test results show that the foreign material transmission image has higher contrast than the reflection mode image when continuous sub-THz imaging was used to detect insects in grain and dense materials like plastic. Gyeongsik [92] used 140 GHz radiation for transmission imaging of metal paper clips, insects, and other foreign bodies in chocolate. The results show that metal foreign objects in chocolate can be displayed, even without removing the wrapping paper. Therefore, the THz image technology can be used for non-destructive testing of food with high water content, and it is expected this technology will be used for non-destructive testing of agricultural products. Shin et al. [93] studied the feasibility of using complex refractive index mapping of food materials for qualitative analysis of food at THz frequencies. The THz reflection images of hidden defects in sugar and milk powder matrices were obtained, and the results shown that THz pulse imaging can be used to classify and detect foreign bodies in terms of the optical parameters of food and insects. Figure 6 shows the optical and reflective THz images of the food samples. The mealworm pellet sample is the bright yellow and red area at 1 THz. Yoneda et al. [94] developed a high-power, high-sensitivity THz imaging system with 100 dB dynamic range, which uses seed-injected THz parameter generation and detection. By improving the analysis method, the reagent was successfully identified in a thicker and more complex box with attenuation of more than 50 dB at 1.3 THz. Chen et al. [95] used THz spectral imaging combined with principal component analysis, typical spectral comparison, and discriminant analysis to successfully detect metal pollutants in sausage and locate metal pollutants. The results show that THz spectral imaging could be used to locate foreign bodies with non-ionizing radiation. Hee et al. [96] used THz reflection imaging and time-of-flight imaging to gather images of rice, sugar, salt, and mealworm particles from 0.2 to 1.3 THz, and the complex refractive index of food and insects was measured. The results show that THz spectroscopy imaging technology can be used to easily distinguish food and insects.
in terms of the optical parameters of food and insects. Figure 6 shows the optical and reflective THz images of the food samples. The mealworm pellet sample is the bright yellow and red area at 1 THz. Yoneda et al. [94] developed a high-power, high-sensitivity THz imaging system with 100 dB dynamic range, which uses seed-injected THz parameter generation and detection. By improving the analysis method, the reagent was successfully identified in a thicker and more complex box with attenuation of more than 50 dB at 1.3 THz. Chen et al. [95] used THz spectral imaging combined with principal component analysis, typical spectral comparison, and discriminant analysis to successfully detect metal pollutants in sausage and locate metal pollutants. The results show that THz spectral imaging could be used to locate foreign bodies with non-ionizing radiation. Hee et al. [96] used THz reflection imaging and time-of-flight imaging to gather images of rice, sugar, salt, and mealworm particles from 0.2 to 1.3 THz, and the complex refractive index of food and insects was measured. The results show that THz spectroscopy imaging technology can be used to easily distinguish food and insects. For low-density foreign body detection, X-ray imaging makes the object invisible due to the excessive penetration strength. However, the sample dielectric contrast of THz frequencies is more pronounced because of the lower penetration strength, which can be seen clearly. THz penetrates through many packaging materials and its low radiation energy properties make it more suitable for nondestructive inspections on agricultural products. According to the different characteristics of THz spectral imaging, foreign bodies in agricultural products can be distinguished. For low-density foreign body detection, X-ray imaging makes the object invisible due to the excessive penetration strength. However, the sample dielectric contrast of THz frequencies is more pronounced because of the lower penetration strength, which can be seen clearly. THz penetrates through many packaging materials and its low radiation energy properties make it more suitable for nondestructive inspections on agricultural products. According to the different characteristics of THz spectral imaging, foreign bodies in agricultural products can be distinguished.

Water Absorption
THz radiation will be strongly absorbed by polar liquids (such as water, etc.), so the spectral signal will be attenuated to a certain extent when THz radiation is used to inspect agricultural products. The traditional method is to reduce water absorption by selecting a short optical path length [97] or to solve this problem by pre-processing the sample before inspection. Huang [98] proposed a THz-TDS method combined with multiple attenuated total reflection (MATR) to reduce the influence of water on the THz absorption. Guan et al. [99] designed and produced a 3D printed sample cell to solve the detection problem of high water-cut crude oil, and the results show that this can be used to determine water content in crude oil. The shape and thickness of the sample also affect the penetration of THz radiation. Cheon et al. [100] used freezing and penetration enhancers to increase the penetration depth of THz radiation into a sample. Water vapor in air will also absorb THz radiation. Mikhail et al. [101] used neural networks to remove data errors caused by water absorption. This method can be used to quickly remove water absorption lines from recorded data. There are four solutions to overcome water absorption and low penetration: (1) freezing or dehydrating the sample; (2) measuring at lower THz frequencies; (3) using THz technology combined with the attenuated total reflection method (ATR); (4) using deep learning or other methods to remove water vapor lines.

Scattering Effect
Scattering effects will occur when using THz radiation to inspect samples, especially when the samples are not uniform (e.g., with irregular shapes or varying particle sizes). Scattering will have a certain impact on measurements. To solve this problem, a sample can be finely ground before testing and pressed into a smooth, uniform sample, which can reduce scattering, and metamaterials can also be used. Ji et al. [102] used a doublenegative material sheet with a plasma coating to reduce scattering, and the results shown that scattering was reduced greatly when the coating was on the outer layer. Algorithms can also be used to solve this problem, such as a wavelet transform or Karhunen Loeve transform. Malevicha et al. [103] proposed a THz pulse spectroscopy method based on the improved Monte Carlo algorithm to reduce the influence of scattering on reconstructed spectral information.

High Hardware Equipment Cost
Compared with infrared and ultraviolet spectroscopy, the cost of THz equipment is higher, and the cost of the equipment has become one of the obstacles to commercialization of THz techniques. Commercialization requires that the performance of the instrument remains unchanged when equipment is integrated and miniaturized. Using the CMOS fabrication process to produce THz spectral imaging systems may have lower costs [104]. Yeo et al. [105] used a nano-distributed feedback laser as an emitter instead of a traditional GaAs emitter and detector. A THz continuous wave system may cost less while ensuring high availability. Shin et al. [106] used dodecanoic acid particles and polyethylene to prepare a THz filter with low production cost, and the research results show that the filter could be used to effectively control the THz spectrum. Won et al. [107] used graphene-based crack lithography to make nano-antenna structures. Experimental results show that the nano-antenna structure provides glucose molecule detection with high sensitivity, low cost, and high production efficiency. Combining a low-cost frequency modulation continuous wave imaging system with a THz time-domain spectral imaging system provides a system low-cost solution. The system has spectral recognition and penetration capabilities, so it is cost-effective [108]. Gyeongsik et al. [109] used a sub-THz imaging system to evaluate food quality. This method provides 800 × 400 mm 2 scanning area with low costs.

Low Detection Sensitivity
THz technology has developed into a non-destructive testing technique, but its sensitivity still needs to be increased compared with traditional techniques. Mou et al. [110] increased the sensitivity of THz technology to detect environmental pollutants by adjusting the geometric parameters of photonic crystal fibers. Suzuki et al. [111] proposed a THz spectral imaging system with single-walled carbon nanotubes and increased the sensitivity of the THz detector through optimization. The system can be used for drug quality detection, portable THz spectral imaging, and nondestructive testing of industrial products. Yan et al. [112] proposed a THz electromagnetically induced transparent metamaterial biosensor to study apoptosis of cancer cells. The experimental results show that the maximum experimental sensitivity of the sensor reached 900 kHz/cell mL 7 × 10 5 cells/mL −1 .

Outlook
In recent years, with the development of THz hardware technology, THz spectral imaging has made great progress so that THz spectral imaging can be applied in many fields. Many techniques and sample preparation methods have been employed with THz spectral imaging, making it a more powerful tool to identify materials. Applications of THz systems are beginning to shift from experimental studies to practical applications. The future research and development directions include:

THz Source and Detector Study
Because of the relatively high cost of THz technology, it has not been widely applied in actual production and real life. There are many types of continuous THz sources, such as optically pumped far-infrared gas lasers, THz vacuum electro devices, free electron lasers, THz quantum cascade laser, etc. Due to the limitation of current development, a THz source with large power, small size, room temperature operation, low cost, and continuous adjustability cannot be fully acquired. THz QCL is the most promising one, and it is likely to become the most ideal THz source in the future [113]. There are also some general problems with THz detectors. For example, room temperature THz detectors exhibited a large noise equivalent power and low sensitivity. This is in contrast to cooled THz detectors in the experiment setup. The study of low cost and high-efficiency THz source and detector can effectively reduce the cost of the THz system, which will make the THz technology more and more applied in various fields in the near future.

THz Technology Combined with Deep Learning Algorithm
At present, most of the agricultural products detected by THz wave have absorption peaks, which can be used to analyze the characteristics of agricultural products. However, some materials have no obvious absorption peaks in THz spectra, such as mixtures, which makes it impossible to intuitively analyze characteristics of the material. Deep learning algorithm was employed to analyze the spectral characteristics and the feature extraction and can obtain state-of-the-art performance on image classification and object detection. Deep learning algorithms can also be used to improve the resolution of THz images [114,115]. Therefore, deep learning and artificial intelligence can be considered to solve the problem of no absorption peak or no obvious absorption peak, and the hidden features of spectral data can be mined to achieve qualitative and quantitative analysis of samples. In the future, for the large amount of THz image data, we can consider introducing deep learning methods like convolutional neural networks (CNN) and deep belief networks (DBN) into the field of THz imaging process.

Establish THz Standard Database for Agricultural Products
Most applications of THz technology in agriculture involve qualitative and quantitative analysis of samples. The establishment of a THz agricultural product database can greatly simplify the analysis process. However, there are many types of agricultural products, and the workload involved in establishing a database for all agricultural products is very large. Therefore, a standard database containing the main components of agricultural products could be established, and different agricultural products could be identified based on the content of each component. The existence of differences in system errors and data processing methods leads to inconsistent THz spectral data. To establish THz standard database is the key point. At present, there have been studies on the standardization methods of THz spectral data [116]. It is necessary to further develop the standardization methods of THz image data to make the database more effective and reliable.

Application of Metamaterials to Increase Detection Sensitivity
When detecting harmful substances in agricultural products, the detection sensitivity and accuracy must be very high. Compared with traditional methods such as chemical detection, the sensitivity of THz technology still needs to be increased. The application of metamaterial sensors in the THz system will increase the detection sensitivity to a certain extent. Terahertz imaging technology with improved detection sensitivity is expected to become a supplementary verification method for industry detection standards in the future.

Optimization of the THz Software System
When analyzing and processing THz spectral imaging data, multiple processing methods are employed to find the best model. Therefore, several common modeling methods, such as PCA, SVM, PLS, BPNN, or RF, could be built into the software system, as could a built-in agricultural product standard database, design human-computer interaction and friendly visual interface, realize one-click processing, and analysis results of the measured spectral data. It can be developed into an independent analysis software system in the near future.

Conclusions
Recent rapid development of THz spectral imaging has demonstrated the advantages of THz radiation and its potential application in agricultural products, such as detecting ingredients, identifying seed varieties, measuring pesticide residues, and classifying detect foreign materials. However, it also has some drawbacks. The application of THz spectral imaging in agriculture and food engineering faces the main challenges of high water absorption, high cost, low source power, scattering effect, etc., which were also discussed. Methods for improving the performance of the THz technology are currently explored by many researchers.
Compared with THz spectral imaging applications in other industries, the targets detected in agriculture are generally uncontrollable and have diverse shape, size, structure, and composition. Therefore, higher requirements are put forward for the THz spectral imaging method and corresponding system. In recent years, some low-cost, high-efficiency THz systems have been developed, and some have incorporated metamaterial sensors to increase the sensitivity of the system. As well as the development of the fabrication technology and deep learning algorithms, THz spectroscopic imaging will become a potential efficient new tool for widespread application prospects in the fields of agriculture and food engineering.