Fruit and vegetable freshness detection method and device, electronic equipment and storage medium

Through THz imaging technology and deep learning model, combined with the image and spectral information of fruits and vegetables, the problem that traditional detection methods cannot effectively judge the internal freshness of fruits and vegetables is solved, and efficient and accurate detection of fruits and vegetables is achieved.

CN120043989APending Publication Date: 2025-05-27GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411917793.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

Traditional fruit and vegetable freshness detection relies on artificial senses, is time-consuming and labor-intensive and easily affected by subjective factors, and cannot effectively judge the internal freshness of fruit and vegetable.

Method used

THz imaging technology is used to combine deep learning models, and the initial image information and initial spectral information of fruits and vegetables are obtained, and they are converted into target image information and target spectral information, the target model is determined, and the detection results of fruits and vegetables freshness are generated through the target model.

Benefits of technology

It realizes efficient and accurate detection of the internal freshness of fruits and vegetables, avoids the subjectivity and time-consuming problems of manual testing, and improves the detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120043989A_ABST
    Figure CN120043989A_ABST
Patent Text Reader

Abstract

Embodiments of the invention provide a fruit and vegetable freshness detection method and apparatus, an electronic device and a storage medium. The method comprises the steps of obtaining initial image information and initial spectral information of fruits and vegetables; converting the initial spectral information into target image information; converting the initial image information into target spectral information; determining a target model; the target image information and the target spectral information serve as input of the target model, the target model is controlled to generate the detection result for the freshness of the fruits and vegetables, the interior freshness of the fruits and vegetables is detected based on the THz imaging technology, the advantages of the THz imaging technology are fully utilized, and the detection accuracy of the freshness of the fruits and vegetables is improved. And an efficient and accurate solution is provided for fruit and vegetable quality detection by combining the powerful capability of the deep learning model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of fresh - degree detection of fruits and vegetables, and particularly to a method for detecting the fresh - degree of fruits and vegetables, a device for detecting the fresh - degree of fruits and vegetables, an electronic device, and a computer - readable storage medium. Background Art

[0002] Traditionally, the freshness of fruits and vegetables is mainly judged manually by characteristics such as color, shape, and smell of fruits and vegetables. However, this method requires a large amount of time and manpower, and is easily affected by various factors such as sensory sensitivity, detection environment, and detection experience. Therefore, fruits and vegetable products with substandard quality cannot be detected in time, which easily causes problems such as waste of resources and difficulty in agricultural product management. Although the fruit and vegetable detection method based on machine vision can deeply excavate the surface characteristics of fruits and vegetables, and its detection result accuracy is higher than that of manual detection, this method cannot observe the internal structure of fruits and vegetables and is difficult to judge whether the inside of fruits and vegetables is damaged. Summary of the Invention

[0003] Embodiments of the present invention provide a method, a device, an electronic device, and a computer - readable storage medium for detecting the fresh - degree of fruits and vegetables to overcome or at least partially solve the above problems.

[0004] Embodiments of the present invention disclose a method for detecting the fresh - degree of fruits and vegetables, including:

[0005] Obtaining initial image information and initial spectral information of fruits and vegetables;

[0006] Converting the initial spectral information into target image information;

[0007] Converting the initial image information into target spectral information;

[0008] Determining a target model;

[0009] By using the target image information and the target spectral information as inputs of the target model, controlling the target model to generate a detection result for the freshness of the fruits and vegetables.

[0010] Optionally, the initial spectral information includes the maximum value of spectral time - domain data and the minimum value of spectral time - domain data, and the step of converting the initial spectral information into target image information includes:

[0011] Generating target image information through the maximum value of spectral time - domain data and the minimum value of spectral time - domain data.

[0012] Optionally, the step of generating target image information through the maximum value of spectral time - domain data and the minimum value of spectral time - domain data includes:

[0013] Input the maximum value and the minimum value of the spectral time-domain data into Equation 1 to calculate the target image information;

[0014] Equation 1 is:

[0015] E pp =max(E P )-min(E p )

[0016] wherein, the maximum value of the spectral time-domain data is max(E P ), the minimum value of the spectral time-domain data is min(E p ), and the target image information is E pp .

[0017] Optionally, the step of converting the initial image information into target spectral information includes:

[0018] Convert the initial image information into a pseudo-color image;

[0019] Determine the region of interest on the pseudo-color image;

[0020] Extract the pixel coordinates of the region of interest;

[0021] Extract the corresponding spectral data from the original time-domain data according to the pixel coordinates;

[0022] Perform an averaging or weighted averaging process on the spectral data to generate target spectral information.

[0023] Optionally, it further includes:

[0024] Determine the absorption coefficient of the fruit and vegetable;

[0025] Determine the refractive index of the fruit and vegetable;

[0026] Perform a preprocessing operation on the target image information based on the refractive index and the absorption coefficient of the fruit and vegetable.

[0027] Optionally, the step of determining the absorption coefficient of the fruit and vegetable includes:

[0028] Determine the extinction coefficient for characterizing the light absorption and scattering ability of the fruit and vegetable;

[0029] Determine the amplitude for characterizing the amplitude of the transmitted light of the fruit and vegetable;

[0030] Calculate the absorption coefficient of the fruit and vegetable based on the extinction coefficient and the amplitude.

[0031] Optionally, the step of determining the refractive index of the fruit and vegetable includes:

[0032] Determine the sample thickness of the fruits and vegetables;

[0033] Determine the angular frequency of the terahertz wave;

[0034] Calculate the refractive index of the fruits and vegetables based on the sample thickness, the angular frequency, and the absorption coefficient.

[0035] Optionally, the step of performing a preprocessing operation on the target image information based on the refractive index and the absorption coefficient of the fruits and vegetables includes:

[0036] Determine the characteristic frequency band related to the freshness of the fruits and vegetables through the refractive index and the absorption coefficient of the fruits and vegetables;

[0037] Within the characteristic frequency band, perform a Fourier transform on the terahertz wave time-domain signal of the fruits and vegetables to obtain frequency-domain information;

[0038] Perform a preprocessing operation on the target image information according to the frequency-domain information.

[0039] Optionally, the step of performing a preprocessing operation on the target image information according to the frequency-domain information includes:

[0040] Reconstruct the target image information according to the frequency-domain information;

[0041] Perform enhancement processing on the reconstructed target image information.

[0042] An embodiment of the present invention also discloses a device for detecting the freshness of fruits and vegetables, including:

[0043] An initial image information and initial spectrum information acquisition module, configured to acquire the initial image information and the initial spectrum information of the fruits and vegetables;

[0044] A first conversion module, configured to convert the initial spectrum information into target image information;

[0045] A second conversion module, configured to convert the initial image information into target spectrum information;

[0046] A target model determination module, configured to determine a target model;

[0047] A detection result generation module, configured to control the target model to generate a detection result for the freshness of the fruits and vegetables by using the target image information and the target spectrum information as inputs of the target model.

[0048] An embodiment of the present invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0049] The memory is used to store a computer program;

[0050] The processor is configured to implement the method as described in the embodiments of the present invention when executing the program stored in the memory.

[0051] The embodiments of the present invention also disclose a computer-readable storage medium, on which instructions are stored. When executed by one or more processors, the instructions cause the processor to execute the method as described in the embodiments of the present invention.

[0052] The embodiments of the present invention include the following advantages:

[0053] In the embodiments of the present invention, by obtaining the initial image information and initial spectral information of fruits and vegetables; converting the initial spectral information into target image information; converting the initial image information into target spectral information; determining a target model; and using the target image information and the target spectral information as inputs to the target model to control the target model to generate a detection result for the freshness of the fruits and vegetables, the detection of the internal freshness of fruits and vegetables based on THz imaging technology is realized. The advantages of THz imaging technology are fully utilized, combined with the powerful capabilities of deep learning models, providing an efficient and accurate solution for the quality detection of fruits and vegetables. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 is a flowchart of the steps of a method for detecting the freshness of fruits and vegetables provided in the embodiments of the present invention;

[0055] Figure 2 is a schematic diagram of the process of a method for detecting the freshness of fruits and vegetables provided in the embodiments of the present invention;

[0056] Figure 3 is a block diagram of the structure of a device for detecting the freshness of fruits and vegetables provided in the embodiments of the present invention;

[0057] Figure 4 is a block diagram of the hardware structure of an electronic device provided in the embodiments of the present invention;

[0058] Figure 5 is a schematic diagram of a computer-readable medium provided in the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0059] To make the above objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0060] In practical applications, traditional detection of fruit and vegetable freshness mainly relies on manual senses. This method is not only time-consuming and laborious, but also greatly affected by subjective factors in the detection results, making it difficult to ensure the accuracy and consistency of detection. With the continuous development of technology, although the detection method based on machine vision has improved the detection efficiency to a certain extent, it can only detect the surface of fruits and vegetables and cannot deeply understand the internal quality status of fruits and vegetables.

[0061] The emergence of THz imaging technology provides a new solution for the detection of fruit and vegetable freshness. THz waves have extremely strong penetration ability, can penetrate most non-metallic materials without damage, and have unique "fingerprint" spectral characteristics for different substances. By analyzing the absorption and transmission characteristics of fruits and vegetables to THz waves, key information such as their internal moisture content, sugar content, and tissue structure can be obtained, so as to accurately evaluate the freshness of fruits and vegetables.

[0062] The advantages of combining THz imaging technology with deep learning are as follows:

[0063] Non-contact and non-destructive detection: THz waves will not cause any damage to fruits and vegetables, ensuring the safety of the detection process.

[0064] High-throughput detection: Through automated equipment, rapid detection of a large number of fruits and vegetables can be achieved, greatly improving the detection efficiency.

[0065] Multi-dimensional information acquisition: THz imaging technology can not only obtain external image information of fruits and vegetables, but also obtain internal chemical composition information, providing more comprehensive and accurate data for the evaluation of fruit and vegetable quality.

[0066] Intelligent analysis: The deep learning model can learn complex features from a large amount of THz image data to achieve automatic classification and prediction of fruit and vegetable freshness.

[0067] Specifically, the working process of this method is as follows:

[0068] Data acquisition: Use the THz imaging system to scan fruits and vegetables of different varieties, different maturities, and different disease degrees to obtain their THz images and spectral data.

[0069] Feature extraction: By analyzing the THz images and spectral data, extract features closely related to fruit and vegetable freshness, such as the position, intensity, and shape of absorption peaks.

[0070] Model training: Use the extracted features as input and train with deep learning models such as ResNet and VGGNet to establish a fruit and vegetable freshness prediction model.

[0071] Model evaluation: Use an independent test set to evaluate the model and verify the generalization ability of the model.

[0072] Deploy the application: Deploy the trained model to the actual application scenario to achieve real-time detection of the freshness of fruits and vegetables.

[0073] The application of THz imaging technology in the detection of fruit and vegetable freshness has broad application prospects:

[0074] Improve the quality of fruits and vegetables: Improve the quality of agricultural products and ensure the health of consumers by timely detecting and removing unqualified fruits and vegetables.

[0075] Reduce economic losses: Reduce economic losses caused by the decay and spoilage of fruits and vegetables and improve agricultural production efficiency.

[0076] Promote agricultural modernization: Provide intelligent and digital solutions for agricultural production and promote the transformation and upgrading of agriculture.

[0077] To better promote and apply this technology, the embodiment of the present invention also developed a fruit and vegetable freshness detection platform based on technologies such as Vue, Vant, Spring Boot, and MySQL. The platform has the following characteristics:

[0078] User-friendly interface: Provide a simple and intuitive interface for easy user operation.

[0079] Powerful functions: Support the detection of multiple fruit and vegetable varieties and provide detailed detection reports.

[0080] Data management: Realize the storage, management, and analysis of detection data to provide data support for subsequent research.

[0081] The method of combining THz imaging technology with deep learning provides a new and efficient solution for the detection of fruit and vegetable freshness. This method can not only improve the accuracy and efficiency of detection but also provide more scientific and intelligent decision-making support for agricultural production. With the continuous development of technology, THz imaging technology will play an increasingly important role in fields such as food safety and agricultural quality control.

[0082] Refer to Figure 1 , which shows the step flowchart of a fruit and vegetable freshness detection method provided in the embodiment of the present invention, specifically including the following steps:

[0083] Step 101, obtain the initial image information and initial spectral information of the fruits and vegetables;

[0084] Step 102, convert the initial spectral information into target image information;

[0085] Step 103, convert the initial image information into target spectral information;

[0086] Step 104, determine the target model;

[0087] Step 105: By using the target image information and the target spectral information as the input of the target model, control the target model to generate a detection result for the freshness of the fruits and vegetables.

[0088] In the embodiment of the present invention, the initial image information and the initial spectral information of fruits and vegetables can be obtained;

[0089] Purpose: To collect the original data of fruits and vegetables and provide a basis for subsequent analysis and modeling.

[0090] Method: Use a THz transmission imaging system to scan fruits and vegetables, and simultaneously obtain the image and spectral information of the fruits and vegetables.

[0091] Beneficial effects: The visual and spectral characteristics of fruits and vegetables are obtained, providing rich input data for subsequent deep learning models.

[0092] In a specific implementation, in order to analyze the characteristics of fruits and vegetables more comprehensively and deeply and extract valuable information from different perspectives, the THz images and spectra can be converted into each other.

[0093] The purposes of reconstructing the peak image from the THz spectrum include:

[0094] Intuitive display of differences: By converting spectral data into images, the absorption differences of different fruits and vegetables or different parts of the same fruit and vegetable in the THz band can be more intuitively displayed, so as to quickly locate the regions of interest.

[0095] Comparative analysis: By comparing the reconstructed peak image with the original THz image, the accuracy of the spectral analysis results can be verified, and the information that may be hidden in the image can be further explored.

[0096] Feature extraction: Based on the reconstructed peak image, image processing and feature extraction can be performed, such as edge detection, texture analysis, etc., to provide more features for subsequent classification and recognition.

[0097] The purposes of extracting the time-domain spectrum from the THz image include:

[0098] Quantitative analysis: The time-domain spectrum contains the absorption and dispersion information of the sample to the THz wave, and quantitative analysis can be performed, such as calculating the absorption coefficient, refractive index, etc., so as to deeply understand the material composition and structure of fruits and vegetables.

[0099] Spectral feature extraction: By analyzing the time-domain spectrum, the characteristic spectrum of fruits and vegetables can be extracted for establishing a spectral library to realize the rapid identification and classification of fruits and vegetables of different varieties and different qualities.

[0100] Combined with image information: Combining time-domain spectroscopy with image information enables non-destructive detection and quality evaluation of fruits and vegetables, such as detecting internal defects and measuring moisture content, etc.

[0101] The purpose of the mutual conversion between THz images and spectra is as follows:

[0102] Complementary information: THz images and spectra contain complementary information. The image provides the spatial distribution information of the sample, while the spectrum provides the material composition information of the sample. By mutual conversion, the two types of information can be combined to obtain more comprehensive information.

[0103] Multi-angle analysis: Analyzing data from different angles can discover more hidden rules and features, improving the reliability of the analysis results.

[0104] Model construction: Combining image and spectral data can construct more complex models, improving the prediction accuracy of the models.

[0105] The mutual conversion between THz images and spectra is an important data processing method in THz imaging technology. Through this method, the information contained in THz data can be more deeply explored, providing a reliable basis for fruit and vegetable quality evaluation, classification and recognition, etc.

[0106] In the embodiment of the present invention, the initial spectral information can be converted into target image information;

[0107] Purpose: To convert spectral data into an image form for facilitating the processing by a deep learning model.

[0108] Method: Utilize the features in the spectral data and map them into a two-dimensional image space.

[0109] Beneficial effect: Combining spectral information with image information can better capture the internal structure and composition information of fruits and vegetables, improving the prediction accuracy of the model.

[0110] In the embodiment of the present invention, the initial image information can be converted into target spectral information;

[0111] Purpose: To convert image data into spectral data to supplement spectral information and enrich features.

[0112] Method: Utilize image processing technology to extract features such as texture and color in the image and map them into the spectral space.

[0113] Beneficial effect: Increasing the sensitivity of the model to the surface features of fruits and vegetables and improving the adaptability of the model to fruits and vegetables of different varieties and different growth stages.

[0114] In the embodiment of the present invention, the target model can be determined

[0115] Objective: Select a suitable deep learning model to train the fruit and vegetable dataset and establish a prediction model for the freshness of fruits and vegetables.

[0116] Exemplarily, a suitable model can be selected from classic models such as ResNet, VGGNet, GoogleNet, etc., and fine-tuned according to the characteristics of the dataset.

[0117] Beneficial effects: Different models have different characteristics. Selecting a suitable model can improve the performance and efficiency of the model.

[0118] Basis for model selection:

[0119] ResNet: Suitable for processing deep networks and has good fitting ability for complex data.

[0120] VGGNet: The network structure is simple and easy to train, suitable for processing small datasets.

[0121] GoogleNet: Has strong feature extraction ability and is suitable for processing multi-scale features.

[0122] In the embodiment of the present invention, by using the target image information and the target spectral information as the input of the target model, the target model can be controlled to generate a detection result for the freshness of the fruits and vegetables:

[0123] Objective: Use the trained model to predict new fruit and vegetable samples to obtain the freshness of fruits and vegetables.

[0124] Method: Input the processed image and spectral data into the trained model, and the model outputs a probability value indicating the probability that the fruit and vegetable is fresh.

[0125] Beneficial effects: Realize fast, accurate, and non-destructive detection of the freshness of fruits and vegetables.

[0126] In the embodiment of the present invention, by obtaining the initial image information and initial spectral information of the fruits and vegetables; converting the initial spectral information into target image information; converting the initial image information into target spectral information; determining the target model; and using the target image information and the target spectral information as the input of the target model to control the target model to generate a detection result for the freshness of the fruits and vegetables, the detection of the internal freshness of fruits and vegetables based on THz imaging technology is realized, making full use of the advantages of THz imaging technology and combining the powerful capabilities of deep learning models, providing an efficient and accurate solution for the quality detection of fruits and vegetables.

[0127] On the basis of the above embodiments, variant embodiments of the above embodiments are proposed. It should be noted here that for the sake of brevity in description, only the differences from the above embodiments are described in the variant embodiments.

[0128] In an optional embodiment of the present invention, the initial spectral information includes the maximum value of spectral time-domain data and the minimum value of spectral time-domain data. The step of converting the initial spectral information into target image information includes:

[0129] Generating target image information through the maximum value of the spectral time-domain data and the minimum value of the spectral time-domain data.

[0130] In practical applications, the maximum value and the minimum value are two of the most representative features in spectral data, and they can reflect the intensity change range of the spectral signal.

[0131] The new value calculated through these two values can simplify the spectral data while retaining some spectral information.

[0132] Optionally, the step of generating target image information through the maximum value of the spectral time-domain data and the minimum value of the spectral time-domain data includes:

[0133] Inputting the maximum value of the spectral time-domain data and the minimum value of the spectral time-domain data into Formula 1 to calculate the target image information;

[0134] Formula 1 is:

[0135] E pp =max(E P )-min(E p )

[0136] Wherein, the maximum value of the spectral time-domain data is max(E P ), the minimum value of the spectral time-domain data is min(E p ), and the target image information is E pp .

[0137] The meaning of Formula 1: Subtracting the minimum value from the maximum value of the spectral data to obtain a new value E pp . This value reflects the intensity change range of the spectral signal.

[0138] Assume: This new value E pp has a certain correspondence with the pixel value of the image. For example, the larger the value of E pp , the brighter the corresponding pixel point may be, indicating that the intensity change of the spectral signal in this area is relatively large.

[0139] Generating the target image:

[0140] The calculated Epp Use the value as the pixel value of the image to generate a new image;

[0141] The size and resolution of the image depend on the dimension and sampling frequency of the original spectral data.

[0142] Why use the maximum and minimum values:

[0143] The maximum and minimum values are two of the most representative features in the spectral data, and they can reflect the intensity change range of the spectral signal.

[0144] The new value E calculated through these two values pp can simplify the spectral data while retaining some spectral information.

[0145] The subtraction operation can highlight the difference of the spectral signal. If the spectral intensities of two bands differ greatly, then the calculated E pp value will be large, and the corresponding pixel points will be very bright.

[0146] Rationality of the assumption:

[0147] The assumption of the method in Formula 1 is that there is a certain corresponding relationship between the intensity change of the spectral data and the brightness of the image. This assumption is reasonable to a certain extent because the spectral data reflects the absorption and reflection characteristics of substances to light, and the brightness of the image also reflects the strength of light.

[0148] However, this corresponding relationship is not completely linear and is affected by various factors, such as the type of light source, the characteristics of the detector, etc.

[0149] The method of converting spectral data into image data through Formula 1 is a simple and effective method, but there are certain limitations. In practical applications, it is necessary to select a suitable method for processing according to specific data and tasks.

[0150] In an optional embodiment of the present invention, the step of converting the initial image information into target spectral information includes:

[0151] Convert the initial image information into a pseudo-color image;

[0152] Determine the region of interest on the pseudo-color image;

[0153] Extract the pixel coordinates of the region of interest;

[0154] Extract the corresponding spectral data from the original time-domain data according to the pixel coordinates;

[0155] Perform averaging or weighted averaging on the spectral data to generate target spectral information.

[0156] In a specific implementation, by performing color space conversion on the THz image (such as HSV, HOT), the originally single-channel grayscale image can be converted into a multi-channel color image, so as to more intuitively present the internal structure and composition information of fruits and vegetables. Then, the embodiments of the present invention can determine the region of interest according to the distribution of specific colors in these color images, and extract the THz time-domain spectral data corresponding to this region.

[0157] Specific explanation:

[0158] THz image: This is the image data of fruits and vegetables obtained by the THz imaging system. Since the THz wave has different penetration abilities and absorption characteristics for different substances, the THz image can reflect the internal structure and composition information of fruits and vegetables.

[0159] Pseudo-color maps such as HSV, HOT:

[0160] HSV: An abbreviation for Hue, Saturation, Value, which is a commonly used color space. Converting the grayscale image to the HSV space can better represent the color information of the image.

[0161] HOT: An abbreviation for Hue, Saturation, Value and Temperature, which is an improved HSV color space with an added temperature dimension and can represent colors more precisely.

[0162] Pseudo-color map: Mapping the grayscale image to a specific color space, thereby converting the gray levels in the image into different colors to enhance the visual effect and contrast of the image.

[0163] Region of interest: In the pseudo-color image, the embodiments of the present invention can determine the region of interest according to features such as color and texture, such as disease spots, wormholes, internal cavities, etc. of fruits and vegetables.

[0164] THz time-domain spectrum: Each pixel point corresponds to a THz time-domain signal. By averaging or other processing of the pixel points in the region of interest, the average THz time-domain spectrum of this region can be obtained.

[0165] The purpose of converting the said initial image information into target spectral information is:

[0166] Improve visibility: The pseudo-color map can more intuitively display the detailed information in the THz image, which is convenient for observation and analysis.

[0167] Enhance contrast: Through color mapping, the contrast between different tissues or components can be enhanced, making it easier to distinguish different features.

[0168] Feature extraction: By analyzing the THz time-domain spectrum of the region of interest, characteristic information of this region such as moisture content, density, etc. can be extracted, thereby evaluating the quality of fruits and vegetables.

[0169] The application scenarios can include:

[0170] Detection of fruit and vegetable diseases: By analyzing the THz time-domain spectrum of the diseased area, the disease types of fruits and vegetables can be diagnosed.

[0171] Evaluation of fruit and vegetable maturity: By analyzing the THz time-domain spectrum of the pulp area, the maturity of fruits and vegetables can be evaluated.

[0172] Detection of internal defects in fruits and vegetables: By analyzing the THz time-domain spectrum of areas such as cavities and wormholes, the internal defects of fruits and vegetables can be detected.

[0173] Optionally, the implementation of the present invention can also be carried out in the following ways:

[0174] Selection of color space: Explore other color spaces such as CIELAB, etc. to find a representation method more suitable for THz images.

[0175] Feature extraction algorithm: Develop a more effective feature extraction algorithm to extract more discriminative features from the THz time-domain spectrum.

[0176] Machine learning: Use machine learning algorithms to establish a mapping relationship between THz images and the quality of fruits and vegetables to achieve automated detection.

[0177] Exemplarily:

[0178] 1. Preprocess the collected THz images of fruits and vegetables: including operations such as denoising, enhancing contrast, edge detection, etc. to improve the image quality and facilitate subsequent feature extraction.

[0179] 2. Convert the preprocessed THz images into pseudo-color images such as HSV or HOT: Through color space conversion, convert the grayscale image into a color image to enhance the visualization effect of the image and facilitate the identification of the characteristics of different tissues.

[0180] 3. Determine the region of interest on the pseudo-color image: According to the specific characteristics of fruits and vegetables (such as diseased spots, wormholes, maturity, etc.), use methods such as image segmentation and threshold segmentation to separate the region of interest from the background.

[0181] 4. Extract the pixel coordinates of the region of interest: Record the coordinates of all pixel points within the region of interest to provide a basis for subsequent extraction of spectral information.

[0182] 5. Extract the corresponding spectral data from the original THz time-domain data according to the pixel coordinates: The original THz data is usually stored in matrix form, where each column represents the time-domain signal of a pixel point. According to the pixel coordinates, the time-domain signal corresponding to the region of interest is extracted from the matrix.

[0183] 6. Perform average or weighted average processing on the extracted spectral data: If the region of interest contains multiple pixel points, in order to obtain the representative spectrum of this region, the time-domain signals corresponding to these pixel points can be averaged or weighted averaged.

[0184] 7. Use the averaged time-domain signal as the target spectral information: Use the processed time-domain signal as the characteristic spectrum of this region of interest for subsequent analysis and modeling.

[0185] By converting the THz image into a pseudo-color map and combining the analysis of the region of interest, the embodiments of the present invention can more deeply explore the information in the THz image, providing a new method for fruit and vegetable quality detection. This method has the advantages of non-destructiveness, rapidity, accuracy, etc., and has broad application prospects in the fields of agricultural production and food safety.

[0186] In an alternative embodiment of the present invention, it further includes:

[0187] Determine the absorption coefficient of the fruit and vegetable;

[0188] Determine the refractive index of the fruit and vegetable;

[0189] Perform a preprocessing operation on the target image information based on the refractive index and the absorption coefficient of the fruit and vegetable.

[0190] 1. Determine the absorption coefficient of the fruit and vegetable;

[0191] Purpose: Quantify the absorption ability of fruits and vegetables to electromagnetic waves at specific frequencies.

[0192] Beneficial effects:

[0193] Reflect internal components: The absorption coefficient is closely related to the water content, sugar content, tissue structure, etc. of fruits and vegetables. By measuring the absorption coefficient, the internal components of fruits and vegetables can be indirectly reflected.

[0194] Distinguish different varieties or growth stages: Fruits and vegetables of different varieties or growth stages have differences in internal components and structures, resulting in different absorption characteristics of electromagnetic waves.

[0195] Detect diseases: The components and structures of diseased tissues are different from those of healthy tissues, resulting in changes in their absorption characteristics of electromagnetic waves.

[0196] 2. Determine the refractive index of the fruit and vegetable;

[0197] Objective: To quantify the propagation speed of light in fruits and vegetables.

[0198] Beneficial effects:

[0199] Reflecting density and composition: The refractive index is closely related to the density and composition of fruits and vegetables. By measuring the refractive index, the density and composition of fruits and vegetables can be indirectly reflected.

[0200] Distinguishing different varieties or growth stages: Fruits and vegetables of different varieties or growth stages have different densities and compositions, resulting in different refractive indices.

[0201] Detecting diseases: The density and composition of diseased tissues are different from those of healthy tissues, resulting in changes in their refractive indices.

[0202] 3. Perform a preprocessing operation on the target image information based on the refractive index and the absorption coefficient of the fruits and vegetables;

[0203] Objective: Using the obtained absorption coefficient and refractive index information to process the original image, enhance the target features, remove interference information, and provide a better data basis for subsequent image analysis and classification.

[0204] Beneficial effects:

[0205] Enhancing target features: By enhancing the characteristic frequencies related to the freshness of fruits and vegetables, the contrast of the target features can be improved, facilitating subsequent identification and classification.

[0206] Removing noise: Remove the noise in the image by methods such as filtering to improve the image quality.

[0207] Correcting uneven illumination: By correcting uneven illumination, the uniformity of the image can be improved, and the influence of illumination on the detection results can be reduced.

[0208] Improving the classification accuracy: The features of the preprocessed image are more representative, which is conducive to improving the accuracy of the subsequent classification model.

[0209] By determining the absorption coefficient and refractive index of fruits and vegetables, the internal structure and composition information of fruits and vegetables can be obtained. Based on this information for image preprocessing, the target features can be effectively enhanced, interference information can be removed, and a reliable data basis for subsequent fruit and vegetable quality detection can be provided.

[0210] In an alternative embodiment of the present invention, the step of determining the absorption coefficient of the fruits and vegetables includes:

[0211] Determining the extinction coefficient for characterizing the absorption and scattering ability of the fruits and vegetables to light;

[0212] Determining the amplitude value for characterizing the amplitude of the transmitted light of the fruits and vegetables;

[0213] Calculate the absorption coefficient of the fruits and vegetables based on the extinction coefficient and the amplitude.

[0214] Exemplarily, the calculation of the absorption coefficient can be achieved through Formula 2.

[0215] Formula 2:

[0216]

[0217] Through Formula 2, by measuring the amplitude of the transmitted light and the calculated refractive index, the absorption coefficient of the material can be calculated. The absorption coefficient reflects the absorption ability of the material to THz waves and is closely related to the composition, moisture content, etc. of the material.

[0218] Where:

[0219] α(ω): Absorption coefficient, representing the absorption ability of the material to light waves of a specific frequency. The larger the absorption coefficient, the stronger the absorption of light by the material.

[0220] k(ω): Extinction coefficient, closely related to the absorption coefficient, characterizing the absorption and scattering abilities of the material to light.

[0221] ω: Angular frequency, representing the frequency of the light wave.

[0222] c: Speed of light, a constant.

[0223] d: Thickness of the sample.

[0224] A(ω): Amplitude, representing the amplitude of the transmitted light.

[0225] n(ω): Refractive index, representing the change in the propagation speed of light in different media.

[0226] The physical meaning of Formula 2 lies in:

[0227] Essentially, Formula 2 describes the absorption characteristics of the material to electromagnetic waves. By measuring the amplitude of the transmitted light and the calculated refractive index, the absorption coefficient of the material can be calculated. The magnitude of the absorption coefficient reflects the absorption ability of the material to electromagnetic waves of a specific frequency.

[0228] The physical meaning of the absorption coefficient: The larger the absorption coefficient, the stronger the absorption of the incident light by the material and the weaker the transmitted light. This is closely related to factors such as the composition, structure, and environment of the material.

[0229] The beneficial effects of Formula 2 in THz image processing of fruits and vegetables:

[0230] Quantitatively characterize the characteristics of fruits and vegetables:

[0231] Water content: Water molecules have a strong absorption effect on THz waves. By measuring the absorption coefficient, the water content of fruits and vegetables can be quantitatively evaluated, and thus the freshness of fruits and vegetables can be reflected.

[0232] Sugar content: Different sugars have different absorption characteristics for THz waves. By analyzing the absorption spectrum, the sugar content of fruits and vegetables can be inferred, and thus their sweetness and maturity can be evaluated.

[0233] Tissue structure: Different tissue structures have different absorption and scattering characteristics for THz waves. By the change of the absorption coefficient, the degree of damage or pathological changes of fruit and vegetable tissues can be reflected.

[0234] Distinguishing fruits and vegetables of different varieties or growth stages:

[0235] For fruits and vegetables of different varieties or growth stages, there are differences in their internal components and structures, resulting in different absorption characteristics for THz waves. By comparing the absorption coefficient spectra of different samples, variety identification or growth stage judgment can be achieved.

[0236] Monitoring the maturity and quality of fruits and vegetables:

[0237] During the ripening process of fruits and vegetables, their internal components and structures will change, resulting in changes in the absorption coefficient spectrum. By tracking the change of the absorption coefficient, the maturity of fruits and vegetables can be monitored to determine whether they reach the best edible state.

[0238] Detecting diseases of fruits and vegetables:

[0239] The components and structures of diseased tissues are different from those of healthy tissues, resulting in changes in their absorption characteristics for THz waves. By analyzing the absorption coefficient spectrum, diseases of fruits and vegetables can be detected early, thus reducing losses.

[0240] Providing a data basis for establishing a fruit and vegetable quality evaluation model:

[0241] The absorption coefficient spectrum is an important input variable for the fruit and vegetable quality evaluation model. By establishing a quantitative relationship between the absorption coefficient and the fruit and vegetable quality, an efficient and accurate fruit and vegetable quality evaluation model can be established.

[0242] Formula two converts the THz time-domain signal into spectral information with rich physical meanings by calculating the absorption coefficient. These information can reflect the internal structure, components and quality of fruits and vegetables, providing a scientific basis for the non-destructive testing and quality evaluation of fruits and vegetables.

[0243] In an optional embodiment of the present invention, the step of determining the refractive index of the fruits and vegetables includes:

[0244] Determining the sample thickness of the fruits and vegetables;

[0245] Determining the angular frequency of the terahertz wave;

[0246] Calculate the refractive index of the fruits and vegetables based on the sample thickness, the angular frequency, and the absorption coefficient.

[0247] Exemplarily, the refractive index of the fruits and vegetables can be calculated by Equation 3.

[0248] Equation 3:

[0249]

[0250] Where:

[0251] n(ω): The refractive index, which represents the change in the propagation speed of light in different media. In the THz band, the refractive index is closely related to the dielectric constant of the material and reflects the polarization characteristics of the material.

[0252] c: The speed of light, a constant.

[0253] φ(ω): The absorption coefficient, which characterizes the absorption ability of the material to THz waves. The larger the absorption coefficient, the stronger the absorption of the material to THz waves.

[0254] ω: The angular frequency, which represents the frequency of the THz wave.

[0255] d: The sample thickness.

[0256] The physical meaning of Equation 3:

[0257] Equation 3 is mainly used to calculate the refractive index of the material. The refractive index is an important physical quantity that describes the change in the propagation speed of light in different media. When light enters from one medium into another medium, its propagation direction will change, and this phenomenon is called refraction. The magnitude of the refractive index directly affects the refraction angle.

[0258] The physical meaning of the refractive index: The larger the refractive index, the slower the propagation speed of light in the medium. The change in the refractive index reflects the changes in physical properties such as the density and composition of the material.

[0259] The beneficial effects of Equation 3 in the THz image processing of fruits and vegetables

[0260] Quantitatively characterize the characteristics of fruits and vegetables:

[0261] Density: The refractive index is closely related to the density of the material. By measuring the refractive index, the density of the fruits and vegetables can be indirectly reflected, thereby evaluating the maturity and moisture content of the fruits and vegetables.

[0262] Composition: The refractive indices of different substances are different. By analyzing the refractive index spectrum, the composition of the fruits and vegetables can be inferred, such as the sugar content, protein content, etc.

[0263] Organizational structure: Different organizational structures have different effects on the light propagation speed. Through the change of refractive index, the degree of damage or pathological conditions of fruit and vegetable tissues can be reflected.

[0264] Differentiating fruits and vegetables of different varieties or growth stages:

[0265] Fruits and vegetables of different varieties or growth stages have differences in their internal components and structures, resulting in different refractive indices. By comparing the refractive index spectra of different samples, variety identification or growth stage judgment can be achieved.

[0266] Monitoring the maturity and quality of fruits and vegetables:

[0267] During the ripening process of fruits and vegetables, their internal components and structures change, resulting in changes in refractive index. By tracking the change of refractive index, the maturity of fruits and vegetables can be monitored to determine whether they reach the best edible state.

[0268] Detecting diseases of fruits and vegetables:

[0269] The components and structures of diseased tissues are different from those of healthy tissues, resulting in changes in their refractive indices. By analyzing the refractive index spectrum, diseases of fruits and vegetables can be detected early, thus reducing losses.

[0270] Providing a data basis for establishing a fruit and vegetable quality evaluation model:

[0271] The refractive index spectrum is an important input variable for the fruit and vegetable quality evaluation model. By establishing a quantitative relationship between the refractive index and the fruit and vegetable quality, an efficient and accurate fruit and vegetable quality evaluation model can be established.

[0272] Formula three provides a method for quantitatively characterizing the internal structure and components of fruits and vegetables by calculating the refractive index. The change of refractive index reflects the changes in the physical and chemical properties of fruits and vegetables, providing important information for the quality evaluation of fruits and vegetables.

[0273] In an alternative embodiment of the present invention, the step of performing preprocessing operations on the target image information based on the refractive index and absorption coefficient of the fruit and vegetable includes:

[0274] Determining a characteristic frequency band related to the freshness of the fruit and vegetable through the refractive index and absorption coefficient of the fruit and vegetable;

[0275] Performing Fourier transform on the terahertz wave time-domain signal of the fruit and vegetable within the characteristic frequency band to obtain frequency-domain information;

[0276] Reconstructing the target image information according to the frequency-domain information;

[0277] Performing enhancement processing on the reconstructed target image information.

[0278] In specific implementations, embodiments of the present invention can utilize Formula 2 and Formula 3 to calculate the refractive index and absorption coefficient spectra of different parts of fruits and vegetables.

[0279] Analyze the calculated refractive index and absorption coefficient spectra to determine the characteristic frequency bands related to the freshness of fruits and vegetables.

[0280] Adopt algorithms such as iPLS, siPLS, biPLS, etc., or use the peak observation method to accurately extract the above-mentioned characteristic frequency bands.

[0281] Within the extracted characteristic frequency bands, perform Fourier transform on the THz time-domain signals of fruits and vegetables to obtain frequency-domain information.

[0282] According to the frequency-domain information, reconstruct the THz image of fruits and vegetables so that the image mainly reflects the information within the characteristic frequency bands.

[0283] Perform enhancement processing on the reconstructed THz image, such as contrast enhancement, edge detection, etc., to highlight the features of interest.

[0284] The purposes and beneficial effects of each sub-step include:

[0285] 1. Utilize Formula 2 and Formula 3 to calculate the refractive index and absorption coefficient spectra of different parts of fruits and vegetables.

[0286] Purpose: Extract quantitative information reflecting the internal structure and composition of fruits and vegetables from the THz time-domain signals.

[0287] Effect:

[0288] Quantify fruit and vegetable characteristics: Convert the qualitative THz image into quantitative spectral data, providing a more accurate basis for subsequent analysis.

[0289] Reveal the internal structure: The refractive index and absorption coefficient are closely related to the water content, sugar content, tissue structure, etc. of fruits and vegetables. By analyzing these parameters, the internal structure of fruits and vegetables can be understood more deeply.

[0290] 2. Analyze the calculated refractive index and absorption coefficient spectra to determine the characteristic frequency bands related to the freshness of fruits and vegetables.

[0291] Purpose: Find the specific frequency ranges that can distinguish fruits and vegetables with different freshness levels.

[0292] Effect:

[0293] Lock key information: By analyzing the spectra, it is possible to find which frequencies of THz waves are most sensitive to changes in the freshness of fruits and vegetables, thereby extracting features targeted.

[0294] Improve detection efficiency: Narrow the analysis range and improve the detection speed and accuracy.

[0295] 3. Use algorithms such as iPLS, siPLS, biPLS, or extract the above characteristic frequency bands accurately through the peak observation method.

[0296] Purpose: Accurately extract the characteristic frequencies related to the freshness of fruits and vegetables from a large amount of spectral data.

[0297] Effect:

[0298] Improve the accuracy of feature extraction: These algorithms can effectively extract useful features from noise and redundant information.

[0299] Enhance the robustness of the model: The extracted features are more representative, which helps to improve the generalization ability of the subsequent model.

[0300] 4. Within the extracted characteristic frequency bands, perform Fourier transform on the THz time-domain signal of fruits and vegetables to obtain frequency-domain information.

[0301] Purpose: Convert the time-domain signal into a frequency-domain signal to more intuitively observe the frequency components of the signal.

[0302] Effect:

[0303] Focus on characteristic frequencies: Through Fourier transform, the attention can be concentrated on the characteristic frequencies related to freshness, and other irrelevant information can be ignored.

[0304] Facilitate image reconstruction: The frequency-domain information can be directly used for image reconstruction, making the reconstructed image better reflect the freshness state of fruits and vegetables.

[0305] 5. According to the frequency-domain information, reconstruct the THz image of fruits and vegetables so that the image mainly reflects the information within the characteristic frequency bands.

[0306] Purpose: Generate an image that can highlight the freshness characteristics of fruits and vegetables.

[0307] Effect:

[0308] Enhance the feature contrast: Through reconstruction, the signals corresponding to the characteristic frequencies can be enhanced, making the features related to freshness in the image more obvious.

[0309] Simplify subsequent analysis: The reconstructed image is easier for image processing and feature extraction.

[0310] 6. Perform enhancement processing on the reconstructed THz image, such as contrast enhancement, edge detection, etc., to highlight the features of interest.

[0311] Purpose: Further improve the image quality for subsequent image analysis and feature extraction.

[0312] Effect:

[0313] Improve visual effect: Enhancement processing can improve the clarity and contrast of images, making it easier for the human eye to observe.

[0314] Facilitate computer recognition: The features of the enhanced image are more obvious, which is beneficial for computer algorithms to perform feature extraction and classification.

[0315] Through the above steps, complex THz time-domain signals can be converted into images that contain rich information and are easy to understand. This method can effectively extract the freshness features of fruits and vegetables, providing a new technical means for non-destructive detection of fruit and vegetable quality.

[0316] From time domain to frequency domain: Convert the time-domain signal into a frequency-domain signal for better analysis of frequency components.

[0317] Feature extraction: Determine the characteristic frequencies related to freshness and enhance the signals of these frequencies.

[0318] Image reconstruction: Reconstruct the image based on the extracted characteristic frequencies to highlight the features of interest.

[0319] Image enhancement: Further improve the image quality for subsequent analysis.

[0320] The combination of these steps enables the embodiments of the present invention to extract useful information from a large amount of THz data, providing a solid foundation for the intelligent detection of fruit and vegetable quality.

[0321] To enable those skilled in the art to better understand the embodiments of the present invention, the following uses an example to illustrate the embodiments of the present invention.

[0322] Refer to Figure 2 , Figure 2 which is a schematic flow diagram of a method for detecting the freshness of fruits and vegetables provided in the embodiments of the present invention;

[0323] THz imaging technology is a novel non-destructive three-dimensional detection technology. The combination of THz imaging technology and deep learning can effectively evaluate the freshness of fruits and vegetables. The functions of this detection method are mainly reflected in the following aspects:

[0324] (1) Acquisition of THz spectral data of fruits and vegetables:

[0325] The THz transmission imaging system can simultaneously obtain the image and spectral information of fruits and vegetables, and the two sets of information can be converted with each other.

[0326] For the THz spectrum, the peak image of fruits and vegetables can be reconstructed according to Formula 1;

[0327] For the THz image, the THz time-domain spectrum of the fruits and vegetables in the region of interest can be obtained according to pseudo-color maps such as HSV and HOT.

[0328] The biggest advantage of THz imaging technology compared with intelligent cameras and video cameras is that the images obtained by this technology contain rich chemical information, while intelligent cameras and video cameras can only obtain the surface features of fruits and vegetables.

[0329] The first formula is as follows:

[0330] E pp = max(E P ) - min(E p )

[0331] Among them, the maximum value of the spectral time-domain data is max(E P ), the minimum value of the spectral time-domain data is min(E p ), and the target image information is E pp .

[0332] (2) Preprocessing of THz spectral data of fruits and vegetables:

[0333] First, according to the second formula and the third formula, the THz frequency domain, refractive index, and absorption coefficient spectra are respectively extracted from the THz time-domain spectra of fruits and vegetables.

[0334] Among them, represents the refractive index, and is the absorption coefficient.

[0335] Secondly, the THz characteristic frequency bands that can characterize the freshness of fruits and vegetables are respectively extracted from the refractive index and absorption coefficient spectra of fruits and vegetables, and the THz images of fruits and vegetables are reconstructed under this frequency band. Finally, the THz images of fruits and vegetables are enhanced to increase the data set of fruits and vegetables and prevent overfitting of the model used for training.

[0336] The second formula:

[0337]

[0338] The third formula:

[0339]

[0340] Among them:

[0341] α(ω): Absorption coefficient, indicating the absorption ability of the material to light waves of a specific frequency. The larger the absorption coefficient, the stronger the absorption of light by the material.

[0342] k(ω): Extinction coefficient, closely related to the absorption coefficient, characterizing the absorption and scattering ability of the material to light.

[0343] ω: Angular frequency, indicating the frequency of light waves.

[0344] c: Speed of light, a constant.

[0345] d: Thickness of the sample.

[0346] A(ω): Amplitude, representing the amplitude of the transmitted light.

[0347] n(ω): Refractive index, representing the change in the propagation speed of light in different media.

[0348] n(ω): Refractive index, representing the change in the propagation speed of light in different media. In the THz band, the refractive index is closely related to the dielectric constant of the material, reflecting the polarization characteristics of the material.

[0349] c: Speed of light, a constant.

[0350] φ(ω): Absorption coefficient, characterizing the absorption ability of the material for THz waves. The larger the absorption coefficient, the stronger the absorption of the material for THz waves.

[0351] ω: Angular frequency, representing the frequency of the THz wave.

[0352] d: Thickness of the sample.

[0353] (3) Establishment of the fruit and vegetable freshness detection model:

[0354] For the fruit and vegetable freshness detection model, deep learning models such as ResNet, VGGNet, and GoogleNet can be selected to perform in-depth training on the fruit and vegetable dataset.

[0355] Among them,

[0356] The advantage of ResNet is that the number of network construction layers is deep, but the performance will not decline;

[0357] The advantage of VGGNet is that the network structure is simple and deep, so it can capture more detailed information;

[0358] The advantage of GoogleNet is that it has strong feature extraction ability and parameter optimization efficiency.

[0359] Taking the THz spectra and THz images of fruits and vegetables as the input data of the model respectively, by comparing evaluation indicators such as accuracy and recall rate, the most suitable deep learning model for fruit and vegetable freshness detection is selected.

[0360] (4) Construction of the fruit and vegetable freshness detection platform:

[0361] The construction of the fresh - degree detection platform for fruits and vegetables mainly consists of six parts: front - end development, back - end development, database design, API integration, platform testing, and platform deployment and maintenance. First, the front - end development tools select Vue and Vant frameworks, which are mainly used to complete the design of the user - interaction module and receive input data. Second, the back - end selects the Spring Boot framework for development, and its main function is to implement the specific functions of the detection platform, such as registration, query, etc. Third, this article uses the MySQL database to realize functions such as data storage, management, and retrieval. Then, to enhance the functionality of the detection platform, this article conducts API integration on the detection platform to meet its needs for accessing external data and services. Finally, this article conducts a large number of tests on the platform and deploys the platform to ensure that users can use the detection platform safely and conveniently.

[0362] In summary, the fresh - degree detection system for fruits and vegetables based on THz imaging mainly consists of four parts: acquisition of THz spectral data of fruits and vegetables, pre - processing of THz spectral data of fruits and vegetables, establishment of a fresh - degree detection model for fruits and vegetables, and construction of a fresh - degree detection platform for fruits and vegetables. The main functions of these four modules are to obtain the THz spectra of fruits and vegetables, extract the THz spectra of fruits and vegetables in the characteristic frequency band, detect the fresh - degree of fruits and vegetables, and visualize the detection results. Combining THz imaging technology with deep - learning technology can efficiently and quickly realize the fresh - degree detection of fruits and vegetables and discover potential spoilage problems of fruits and vegetables. At the same time, the construction of the fresh - degree detection platform for fruits and vegetables can expand the application scope of artificial intelligence such as the Internet of Things and smart homes, assist users in effectively identifying and managing food ingredients, and improve the quality of users' lives.

[0363] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequences, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present invention.

[0364] Referring to Figure 3 , a structural block diagram of a fresh - degree detection device for fruits and vegetables provided in an embodiment of the present invention is shown, which may specifically include the following modules:

[0365] An initial image information and initial spectral information acquisition module 301, configured to acquire the initial image information and initial spectral information of fruits and vegetables;

[0366] A first conversion module 302, configured to convert the initial spectral information into target image information;

[0367] A second conversion module 303, configured to convert the initial image information into target spectral information;

[0368] A target model determination module 304, configured to determine a target model;

[0369] A detection result generation module 305, configured to control the target model to generate a detection result for the freshness of the fruits and vegetables by using the target image information and the target spectral information as inputs of the target model.

[0370] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For related parts, please refer to the partial description of the method embodiment.

[0371] In addition, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements each process of the above-mentioned embodiment of the fruit and vegetable freshness detection method, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0372] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements each process of the above-mentioned embodiment of the fruit and vegetable freshness detection method, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here. Among them, the computer-readable storage medium is, for example, a read-only memory (ROM for short), a random access memory (RAM for short), a magnetic disk, or an optical disc, etc.

[0373] Figure 4 A schematic diagram of the hardware structure of an electronic device for implementing each embodiment of the present invention.

[0374] The electronic device 400 includes, but is not limited to: a radio frequency unit 401, a network module 402, an audio output unit 403, an input unit 404, a sensor 405, a display unit 406, a user input unit 407, an interface unit 408, a memory 409, a processor 410, and a power supply 411, etc. Those skilled in the art can understand that Figure 4 the structure of the electronic device shown in does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than those shown, or combine some components, or have different component arrangements. In the embodiment of the present invention, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle-mounted terminal, a wearable device, and a pedometer, etc.

[0375] It should be understood that in the embodiments of the present invention, the radio frequency unit 401 can be used for receiving and transmitting information or signals during a call. Specifically, after receiving the downlink data from the base station, it is given to the processor 410 for processing; in addition, the uplink data is sent to the base station. Generally, the radio frequency unit 401 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, etc. In addition, the radio frequency unit 401 can also communicate with the network and other devices through a wireless communication system.

[0376] The network module 402 provides the user with wireless broadband Internet access, such as helping the user to send and receive e-mails, browse web pages, and access streaming media, etc.

[0377] The audio output unit 403 can convert the audio data received by the radio frequency unit 401 or the network module 402 or stored in the memory 409 into an audio signal and output it as sound. Moreover, the audio output unit 403 can also provide an audio output related to the specific functions executed by the electronic device 400 (for example, call signal receiving sound, message receiving sound, etc.). The audio output unit 403 includes a speaker, a buzzer, a receiver, etc.

[0378] The input unit 404 is used for receiving audio or video signals. The input unit 404 may include a graphics processing unit (GPU) 4041 and a microphone 4042. The graphics processing unit 4041 processes the image data of a static picture or video obtained by an image capturing device (such as a camera) in a video capture mode or an image capture mode. The processed image frames can be displayed on the display unit 406. The processed image frames can be stored in the memory 409 (or other storage media) or sent via the radio frequency unit 401 or the network module 402. The microphone 4042 can receive sounds and can process such sounds into audio data. The processed audio data can be converted into a format that can be output via the radio frequency unit 401 to a mobile communication base station in the case of a telephone call mode.

[0379] The electronic device 400 further includes at least one sensor 405, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor. Among them, the ambient light sensor can adjust the brightness of the display panel 4061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 4061 and / or the backlight when the electronic device 400 is moved to the ear. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 405 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be elaborated here.

[0380] The display unit 406 is used to display information input by the user or information provided to the user. The display unit 406 may include a display panel 4061, and the display panel 4061 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.

[0381] The user input unit 407 can be used to receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the electronic device. Specifically, the user input unit 407 includes a touch panel 4071 and other input devices 4072. The touch panel 4071, also known as a touch screen, can collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 4071). The touch panel 4071 can include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 410, and receives and executes the commands sent by the processor 410. In addition, the touch panel 4071 can be implemented in multiple types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 4071, the user input unit 407 may further include other input devices 4072. Specifically, the other input devices 4072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, which will not be elaborated here.

[0382] Further, the touch panel 4071 can cover the display panel 4061. After the touch panel 4071 detects a touch operation on or near it, it is transmitted to the processor 410 to determine the type of touch event. Subsequently, the processor 410 provides a corresponding visual output on the display panel 4061 according to the type of touch event. Although in Figure 4 the touch panel 4071 and the display panel 4061 are implemented as two independent components to realize the input and output functions of the electronic device, in some embodiments, the touch panel 4071 and the display panel 4061 can be integrated to realize the input and output functions of the electronic device, and the specific implementation here is not limited.

[0383] The interface unit 408 is an interface for connecting an external device to the electronic device 400. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headset port, and so on. The interface unit 408 can be used to receive inputs from external devices (such as data information, power, etc.) and transmit the received inputs to one or more components within the electronic device 400 or can be used to transfer data between the electronic device 400 and external devices.

[0384] The memory 409 can be used to store software programs and various data. The memory 409 mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory 409 can include a high-speed random access memory and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.

[0385] The processor 410 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 409, and calling data stored in the memory 409, it executes various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 410 can include one or more processing units; preferably, the processor 410 can integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 410.

[0386] The electronic device 400 may further include a power source 411 (such as a battery) for powering each component. Preferably, the power source 411 can be logically connected to the processor 410 through a power management system, so as to manage functions such as charging, discharging, and power consumption management through the power management system.

[0387] In addition, the electronic device 400 includes some functional modules not shown here and will not be elaborated further.

[0388] It should be noted that in this article, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article or device comprising such element.

[0389] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present invention.

[0390] As Figure 5 shown, in another embodiment provided by the present invention, a computer-readable storage medium 501 is further provided. Instructions are stored in the computer-readable storage medium, and when it runs on a computer, it causes the computer to execute the fruit and vegetable freshness detection method described in the above embodiments.

[0391] The embodiments of the present invention have been described above in conjunction with the accompanying drawings. However, the present invention is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present invention, those of ordinary skill in the art can also make many forms without departing from the spirit and scope protected by the claims of the present invention, and all of them fall within the protection scope of the present invention.

[0392] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present invention can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0393] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0394] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be electrical, mechanical, or other forms.

[0395] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0396] In addition, the functional units in the various embodiments of the present invention can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0397] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0398] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for detecting the freshness of fruits and vegetables, characterized in that: include: Obtaining initial image information and initial spectrum information of fruits and vegetables; converting the initial spectrum information into target image information; Converting the initial image information into target spectrum information; Determine the target model; By taking the target image information and the target spectrum information as inputs of the target model, the target model is controlled to generate detection results for the freshness of the fruits and vegetables.

2. The method according to claim 1, characterized in that The initial spectrum information includes a maximum value of spectrum time domain data and a minimum value of spectrum time domain data. The step of converting the initial spectrum information into target image information includes: The target image information is generated by the maximum value of the spectral time domain data and the minimum value of the spectral time domain data.

3. The method according to claim 2, characterized in that The step of generating target image information by using the maximum value of the spectral time domain data and the minimum value of the spectral time domain data comprises: Inputting the maximum value of the spectral time domain data and the minimum value of the spectral time domain data into Formula 1 to calculate target image information; The formula 1 is: AND pp =max(E P )-min(E p ) Among them, the maximum value of the spectral time domain data is max(E P ), the minimum value of the spectral time domain data is min(E p ), the target image information is E pp .

4. The method according to claim 3, characterized in that The step of converting the initial image information into target spectrum information comprises: Converting the initial image information into a pseudo-color image; determining a region of interest on the pseudo-color image; Extracting pixel coordinates of the region of interest; Extracting corresponding spectral data from the original time domain data according to the pixel coordinates; The spectral data are averaged or weighted averaged to generate target spectral information.

5. The method according to claim 1, characterized in that Also includes: determining the absorption coefficient of the fruit and vegetable; Determining the fruit and vegetable refractive index of the fruit and vegetable; A preprocessing operation is performed on the target image information based on the refractive index of the fruit and vegetable and the absorption coefficient.

6. The method according to claim 5, characterized in that The step of determining the absorption coefficient of the fruits and vegetables comprises: Determining an extinction coefficient for characterizing the light absorption and scattering ability of the fruit and vegetable; Determining an amplitude value used to characterize the amplitude of the light transmitted through the fruit and vegetable; The absorption coefficient of the fruit and vegetable is calculated based on the extinction coefficient and the amplitude.

7. The method according to claim 6, characterized in that The step of determining the refractive index of the fruits and vegetables comprises: Determining the sample thickness of the fruit and vegetable; Determine the angular frequency of the terahertz wave; The refractive index of the fruit and vegetable is calculated based on the sample thickness, the angular frequency and the absorption coefficient.

8. The method according to claim 5, characterized in that The step of performing a preprocessing operation on the target image information based on the refractive index of the fruit and vegetable and the absorption coefficient comprises: Determine a characteristic frequency band related to the freshness of the fruits and vegetables by using the refractive index of the fruits and vegetables and the absorption coefficient; In the characteristic frequency band, Fourier transform is performed on the terahertz wave time domain signal of fruits and vegetables to obtain frequency domain information; A preprocessing operation is performed on the target image information according to the frequency domain information.

9. The method according to claim 8, characterized in that The step of performing a preprocessing operation on the target image information according to the frequency domain information comprises: reconstructing the target image information according to the frequency domain information; The reconstructed target image information is enhanced.

10. A device for detecting the freshness of fruits and vegetables, characterized in that: include: An initial image information and initial spectrum information acquisition module, used to acquire initial image information and initial spectrum information of fruits and vegetables; A first conversion module, used for converting the initial spectrum information into target image information; A second conversion module, used for converting the initial image information into target spectrum information; A target model determination module, used for determining a target model; The detection result generating module is used to control the target model to generate the detection result of the freshness of the fruits and vegetables by taking the target image information and the target spectrum information as the input of the target model.

11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 9 when executing the program stored in the memory.

12. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Food material freshness monitoring method and system and computer program product

    CN121113898A