Fried bean curd texture detection method based on ultrasonic technology

Through the combination of ultrasonic technology and machine learning models, non-destructive real-time detection of the texture of fried tofu is achieved, solving the limitations of traditional detection methods, and improving the quality control and process optimization capabilities of the production process.

CN120294149APending Publication Date: 2025-07-11JIANGSU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510452052.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-11
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The prior art is difficult to achieve real-time and non-destructive testing of the quality and structural characteristics of soybean products, resulting in difficult to ensure process regulation lag and product homogeneity during the production process.

Method used

The texture detection method based on ultrasonic technology is adopted, combined with ultrasonic scanning system and machine learning model, non-destructive real-time prediction and visualization of the cohesion and recovery force of fried tofu.

Benefits of technology

It improves detection accuracy and efficiency, realizes quality control and process optimization in the production process of fried tofu, and provides intuitive and fast technical support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120294149A_ABST
    Figure CN120294149A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of food detection, in particular to a fried bean curd texture detection method based on an ultrasonic technology. According to the method, an ultrasonic scanning system is built, real-time collection of bean curd ultrasonic signals in the frying process is achieved, and discrete wavelet transform, principal component analysis dimensionality reduction and Monte Carlo cross validation processing are conducted on collected data so as to remove abnormal values. Then, data points are converted to realize visualization of cracks, bubbles, foreign matters and other defects of the sample, meanwhile, a prediction model is constructed by utilizing a learning algorithm, the prediction performance of the prediction model is compared and analyzed, and the method can accurately reflect texture changes in the bean curd frying process through training prediction. The invention provides a novel, rapid and efficient non-invasive detection means for detecting the texture characteristics of the fried bean curd, improves the detection precision and efficiency, overcomes the limitation of the traditional TPA method, can be widely applied to monitoring in a food processing dynamic process, and has a good application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of food detection, and particularly relates to a method for detecting the texture of fried tofu based on ultrasonic technology. Background Art

[0002] As an important source of plant protein, the texture characteristics of soy products directly affect consumer acceptance. At present, the detection of key indicators such as the coagulation degree of soymilk and the texture characteristics of tofu mainly relies on sensory evaluation and food texture analyzers. The former has problems such as strong subjectivity, poor data repeatability, and inconsistent quantification standards. Although the latter can accurately quantify the measurement, it causes irreversible damage to the sample structure integrity and cannot achieve real-time monitoring and dynamic regulation during the production process. In recent years, with the advancement of the industrialized production of soy products, their quality texture characteristics have shown complex non-linear time-varying characteristics, posing dual requirements of real-time and high spatial resolution for detection technology. However, the traditional "offline sampling + physical and chemical analysis" mode is difficult to synchronously obtain multi-parameter continuous data, resulting in lag in process control and difficulty in ensuring product homogeneity.

[0003] Therefore, there is an urgent need to introduce an online non-destructive detection method to real-time analyze the microscopic dynamic changes of texture through non-invasive means, realize the accurate monitoring of the whole process quality from raw materials to finished products, and provide technical support for the quality improvement and standardized production of the soy product industry. Summary of the Invention

[0004] Aiming at the deficiencies of the prior art, the present invention proposes a method for detecting the texture of fried tofu based on ultrasonic technology, which realizes non-destructive real-time prediction and visualization of the resilience and cohesiveness of fried tofu, improves the detection accuracy and efficiency, overcomes the limitations of the traditional TPA method, and provides intuitive and rapid technical support for quality control and process optimization during the production process of fried tofu.

[0005] To achieve the above purposes, the present invention provides the following technical solutions;

[0006] A method for detecting the texture of fried tofu based on ultrasonic technology, the steps are as follows:

[0007] (1) Sample preparation

[0008] S1: Soak soybeans in water, after soaking, rinse with clean water, then add the rinsed soybeans into water again for stirring and grinding, filter after grinding to obtain raw soymilk; boil the raw soymilk, then add a coagulant, let it stand at room temperature for a period of time to form tofu curd; then stir and add it into a mold, press and squeeze out the water, after pressing, obtain tofu, and cut the tofu into cubes, divided into test sample 1 and sample 2;

[0009] Preferably, the soybeans used in step S1 are Northeast soybeans. The ratio of soybeans to water is 1 g: 3-4 mL, the temperature of the water is 22-28 °C, and the soaking time is 10-12 h; the dosage relationship of the washed soybeans added to water again is 1 g: 6-8 mL; the stirring and grinding is carried out using a wall breaker at a speed of 10000-12000 r / min for 1-5 minutes;

[0010] The boiling time is 5-8 min, the coagulant is magnesium sulfate coagulant, and its dosage is 0.5%-1.5% of the mass of the raw soy milk; the pressing pressure is 2 kg / cm 2 , and the pressing time is 40-50 minutes; the size of the cube is 30 mm × 30 mm × 30 mm.

[0011] S2: Put the sample 2 in step S1 into an oil pan for frying to obtain a fried sample, which is divided into test sample 3 and test sample 4.

[0012] Preferably, the frying temperature in step S2 is 180 °C, and the frying time is 5-10 min.

[0013] (2) Data acquisition based on an ultrasonic scanning system

[0014] S1: The ultrasonic scanning system includes a three-axis moving platform, an ultrasonic transducer, an ultrasonic detector, and a sample area to be measured; among them, the ultrasonic transducer, the ultrasonic detector, and the sample area to be measured are all arranged on the three-axis moving platform;

[0015] Preferably, in S1 of step (2), the X and Y axis strokes of the three-axis moving platform are 300 mm, and the Z axis stroke is 50 mm; the ultrasonic transducer is an Olympus 10 MHz immersion focusing transducer, and the ultrasonic detector is a CTS-02UT ultrasonic detector.

[0016] S2: The ultrasonic scanning system further includes a host computer and a control module. The control module is built into the host computer and is developed based on Qt and C++. It includes a motion control module and a vision positioning module, integrating the motion control of the three-axis moving platform and the vision positioning function of the sample; at the same time, the control module is electrically connected to the ultrasonic transducer and the ultrasonic detector to realize signal transmission and control, and provides two working modes: A-scan and C-scan;

[0017] The A-scan mode is to collect in a single-point manner, control the ultrasonic detector and the ultrasonic transducer, and scan the sample at a set sampling frequency to obtain the one-dimensional depth information of the sample;

[0018] The C-scan mode is based on the A-scan. It will perform point-by-point continuous sampling on the sample at a set step distance according to the pre-set path planning, and finally obtain the three-dimensional information of the sample. The path planning includes, for example, bow-shaped scanning and circular scanning.

[0019] The motion control module adopts an embedded real-time control architecture, and the core algorithm is an adaptive PID controller based on a BP neural network. The controller adopts a dual-loop control strategy (current loop + speed loop) to achieve high-precision motion control of the three-axis moving platform. The motion control module can convert the target position set on the interface into a motor pulse command through the hand-eye calibration coordinate transformation algorithm to ensure that the ultrasonic transducer accurately reaches the position of each sampling point.

[0020] Preferably, in S2 of step (2), the visual positioning module is constructed based on the YOLOv5 algorithm, which can predict the bounding box and probability distribution through the grid image to achieve rapid positioning of the sample center point. The set sampling frequency is 100 MHz, and the set step distance is 1 mm.

[0021] The A-scan interface supports real-time adjustment of acquisition parameters such as gain, sound speed, and pulse width. The C-scan interface provides functions such as power-on reset, trajectory planning, and scanning range setting to improve the operation convenience in different scanning modes.

[0022] S3: The acquisition steps are as follows: Place the test sample 3 obtained in step (1) in the sample area to be measured, and preliminarily locate the sample center point through the control module in combination with the ultrasonic transducer and the ultrasonic detector. Subsequently, collect N pictures of the sample to construct a training data set. Divide 80%-90% of the data set into a training set, and the remaining part as a test set. Then use the Epochs model to train and test-verify the N pictures Q times to obtain a trained visual model. Finally, integrate the trained visual model into the control module, and convert the image coordinate system into mechanical coordinate system data through the coordinate system calibration algorithm to finally achieve positioning.

[0023] Preferably, in S3 of step (2), N takes a value of 1300-1600, and Q takes a value of 150-300.

[0024] S4: Based on the test sample 1 prepared in step (1), perform frying treatment using the gradient frying method: Place the test sample 1 in an oil pan for frying, fry continuously for K minutes, and take out C fried samples every 1 minute. Finally, obtain K batches of fried samples, number the K batches of fried samples in the order of frying time, and record them as T1, T2,..., TK in sequence, and transfer these fried samples to the sample area to be measured in sequence for ultrasonic data acquisition and texture data acquisition.

[0025] Preferably, in S4 of step (2), the frying temperature is 180 °C, the value of K is 7 - 10 minutes, and the value of C is 100 - 200.

[0026] S4-1: Ultrasonic data acquisition: The steps adopted are as follows: First, the control module combines the ultrasonic transducer and the ultrasonic detector to locate the center point of the fried sample; subsequently, the ultrasonic detector emits an electrical signal, which is transmitted to the ultrasonic transducer. After that, the transducer converts it into ultrasonic waves through the piezoelectric effect and emits them to the fried sample in the sample area to be measured. When the ultrasonic waves encounter the interfaces of different media inside the fried sample, reflections occur. The transducer receives the reflected waves and converts them back into electrical signals through the piezoelectric effect again and transmits them back to the ultrasonic detector. After being processed by the ultrasonic detector, they are transmitted to the control module to obtain ultrasonic sample data and the corresponding frying time, which are used as input data and denoted as X.

[0027] S4-2: Texture data acquisition: The fried samples for which data acquisition is completed in S4-1 are subjected to texture analysis. Batch texture tests are carried out on the fried samples of T1, T2,..., TK to obtain the cohesion data (denoted as Y1) and resilience data (denoted as Y2) of the samples.

[0028] Preferably, in S4-2 of step (2), the texture test is carried out using a TA-XT2i texture analyzer, equipped with a P / 50 aluminum cylindrical probe. In the TPA2 mode, the compression ratio is set to 30%, and the pre-test speed and test speed are set to 1 mm / s and 0.5 mm / s respectively to collect the texture information of the samples.

[0029] Finally, the cohesion data (label Y1) and resilience data (label Y2) of the samples are obtained through the test, and at the same time, the ultrasonic data of each fried tofu sample correspond to the corresponding cohesion and resilience data (K × C each for Y1 and Y2, and C samples for each gradient).

[0030] S4-3: Place the test sample 4 obtained in step (1) in the sample area to be measured, and switch to the C-scan interface through the control module; First, the control module combines the ultrasonic transducer and the ultrasonic detector to locate the center point of the test sample. After completing the positioning of the sample, control the ultrasonic transducer to perform point-by-point A-scan along the preset trajectory. The ultrasonic transducer performs continuous sampling with a preset step size, and finally obtains the three-dimensional data of sample 4 and records it as imaging data 1.

[0031] Preferably, the step size in S4-3 of step (2) is 1 mm.

[0032] (3) Preprocessing of the acquired data;

[0033] Based on the input data X and imaging data 1 acquired in step (2), a three-level preprocessing process is adopted for feature optimization:

[0034] First, perform a discrete wavelet transform (DWT) on the input data X and the imaging data 1 to achieve multi-scale decomposition; then use the db4 wavelet basis function to extract 5 layers of detail coefficients, filter out high-frequency noise, and retain the time-frequency domain characteristics of the ultrasonic signal; subsequently, apply the principal component analysis (PCA) algorithm to project the multi-dimensional original features into the principal component space with the maximum variance, and determine the optimal dimensionality reduction dimension through the cumulative variance contribution rate; finally, adopt Monte Carlo cross-validation (MCCV), set a predetermined period, and divide the sample set into a training set and a validation set according to a certain ratio for outlier detection, eliminate data redundancy, and obtain the preprocessed input data X and the preprocessed ultrasonic imaging data 1, which are correspondingly denoted as input data X1 and ultrasonic imaging data 2;

[0035] Preferably, the predetermined number of periods in step (3) is 2000, and the certain ratio is 7:3.

[0036] (4) Visual analysis of texture characteristics:

[0037] Based on the data preprocessed in step (3), convert the ultrasonic imaging data 2 into three-dimensional point data through a spatial coordinate mapping algorithm. Each data point contains x-y plane coordinates (lateral accuracy 0.1 mm / pixel), z-axis depth (longitudinal resolution 0.1 mm), and an equivalent area parameter; all data points are constructed into a three-dimensional ultrasonic image through a spatial interpolation algorithm, which can clearly display the internal texture characteristics of the sample. Specifically, cracks are manifested as low-amplitude signal bands, bubbles appear as circular hypoechoic areas, and foreign objects are shown as high-contrast boundaries;

[0038] At the same time, the three-dimensional ultrasonic image uses pseudo-color coding (green represents normal tissue, and purple marks defects), and is displayed in real time on the left side of the C-scan interface, and also supports local magnification (up to 10 times) and three-dimensional rotation functions to observe the spatial distribution form and size of the defects (the minimum recognizable foreign object is 0.5 mm).

[0039] (5) Prediction model establishment

[0040] S1: Based on the input data X1 obtained in step (3), integrate it with the cohesion Y1 and the resilience Y2 obtained from the texture analysis in step (2) to construct a structured data set suitable for machine learning; that is, establish the mapping relationships between the input data X1 and the cohesion Y1, and the resilience Y2 respectively, and create two independent data sets, denoted as data set 1 and data set 2; data set 1 contains the input data X1 and the corresponding cohesion Y1, and data set 2 contains the input data X1 and the corresponding resilience Y2; the two data sets will be used to train machine learning models for predicting cohesion and resilience respectively;

[0041] Specifically, a dataset contains input feature X1 and target variable Y1 for training the cohesion prediction model; another dataset contains the same input feature X1 and target variable Y2 for training the resilience prediction model; each dataset is divided into a training set and a test set in proportion, where the training set is used for model learning and parameter optimization, and the test set is used to evaluate the generalization ability of the model;

[0042] S2: Use Python combined with learning algorithms to build a learning model; and train the learning model with the training set data to learn the mapping relationship between the input data X1, cohesion Y1, and resilience Y2; the evaluation of the learning model performance is judged by the coefficient of determination R 2 and root mean square error (RMSE), and finally select the learning model with the best performance as the final model; and save it to a file in the.pkl format; in the Python environment, the pickle library can be used to load the model and make predictions;

[0043] Preferably, in S1 of step (5), each dataset is divided into a training set and a test set in proportion, where the proportion of the training set is 70-80%; the learning algorithms described in S2 include XGBoost, Random Forest (RF), LightGBM, and Artificial Neural Network (ANN).

[0044] The basis for judgment is: the coefficient of determination (R 2 ) is used to measure the ability of the model to explain the data, and the closer its value is to 1, the higher the fitting degree of the model to the data; the root mean square error (RMSE) is used to measure the deviation between the predicted value and the true value of the model, and the smaller its value, the higher the prediction accuracy of the model.

[0045] (6) Practical model application

[0046] Select a sample to be tested, obtain the input data X1 of the sample according to the acquisition steps in step S4, and then substitute it into the final model constructed in step (5), and the corresponding cohesion Y1 and resilience Y2 can be quickly predicted through the loaded model, realizing the texture detection of the sample.

[0047] Advantages of the present invention:

[0048] Based on ultrasonic detection technology, the present invention builds a signal acquisition platform, and through discrete wavelet transform filtering, principal component analysis for dimensionality reduction, Monte Carlo cross-validation, and regression models such as LightGBM on the collected ultrasonic signals, realizes non-destructive real-time prediction and visualization of the resilience and cohesion of fried tofu. By optimizing the signal preprocessing process and model parameters, the constructed prediction model has Rp in the detection of toughness and cohesion 2The values reached 0.969 and 0.956 respectively, significantly improving the detection accuracy and efficiency, overcoming the limitations of the traditional TPA method, realizing non-destructive real-time prediction and visualization of the resilience and cohesiveness of fried tofu, and providing intuitive and rapid technical support for quality control and process optimization in the production process of fried tofu.

[0049] The specific advantages are as follows:

[0050] High detection accuracy: The present invention uses ultrasonic sensors and image reconstruction algorithms to finely detect the internal microstructure and defect distribution of fried tofu, ensuring high accuracy in quality monitoring.

[0051] Good prediction model effect: A prediction model for resilience and cohesiveness based on LightGBM was successfully constructed. The model achieved excellent performances of Rp 2 of 0.969 and 0.956 respectively in the prediction of resilience and cohesiveness.

[0052] Non-destructive real-time monitoring: Using ultrasonic scanning imaging technology, the system realizes real-time on-line detection during the processing of fried tofu, without damaging the samples, thus maintaining the integrity of the products.

[0053] Strong adaptability: By optimizing the signal preprocessing, prediction model, and image reconstruction processes, the equipment can effectively reduce noise interference and maintain stable operation in complex production environments.

[0054] Automatic calibration and dynamic update: The system has an automatic calibration function and can continuously adjust the detection model according to the real-time collected data to ensure continuous improvement of the detection accuracy.

[0055] High-speed response and real-time visualization: By integrating a high-speed data acquisition and processing module, instant feedback and intuitive visualization of the detection results are achieved, providing timely basis for production regulation.

[0056] Modular integrated design: The equipment adopts a modular software and hardware architecture, which is convenient for integration with existing processing lines and supports subsequent function expansion and system upgrade.

[0057] Improve the quality control level: The system intuitively displays the detection data and quality analysis results, providing scientific and reliable technical support for quality control and process optimization in the soybean processing process. Description of the Drawings

[0058] Figure 1 It is a schematic flow chart of an embodiment of the present invention.

[0059] Figure 2 It is a schematic structural diagram of an ultrasonic scanning system.

[0060] Figure 3(a) Host computer login interface; (b) Ultrasonic C-scan interface; (c) Ultrasonic A-scan interface.

[0061] Figure 4 It is the wavelet decomposition filter.

[0062] Figure 5 Removing outliers for Monte Carlo cross validation

[0063] Figure 6 (a) is the visualization of the restoring force data; (b) is the visualization of the cohesive force data.

[0064] Figure 7 (a) is the result of restoring force prediction; (b) is the result of cohesive force prediction. DETAILED DESCRIPTION

[0065] The present invention is explained and interpreted in more detail by the following embodiments. It should be clear that the embodiments are only for illustrative purposes, and the protection scope of the present invention should not be limited or constrained by these embodiments.

[0066] It should be understood that the terms described in the present invention are only used to describe specific embodiments and are not intended to limit the scope of protection of the present invention. Unless otherwise expressly stated, all technical and scientific terms used herein have the same meanings and connotations as commonly understood by technicians with ordinary skills in the field of the present invention.

[0067] Although the present invention only describes the preferred methodology and materials in detail, any method and material similar or equivalent to that described herein may also be used in the implementation or experimental verification process of the present invention. All documents mentioned in this specification are incorporated herein by reference to disclose and describe in detail the methodology and / or materials related to the documents. The raw materials and reagents used in the present invention can be obtained through commercial channels or conventional means. If there is any conflict or inconsistency between the cited documents and this specification, the content of this specification shall prevail.

[0068] Embodiment 1:

[0069] (1) Sample preparation

[0070] S1: Tofu sample: Soybeans from Northeast China were selected and soaked in 25±1℃ tap water at a ratio of 1g:4mL (soybeans: water) for 10 hours. After soaking, they were rinsed with deionized water twice to remove surface impurities; then deionized water was added at a ratio of 1g:8mL (soybeans: water), and the mixture was ground with a wall-breaking machine at 12000r / min for 1 minute, and raw soy milk was obtained by filtering;

[0071] After boiling fresh soybean milk for 5 minutes, add magnesium sulfate coagulant according to a mass ratio of 1%, and keep it warm at 25±1°C for 20 minutes to form bean curd. Put the bean curd into a mold and apply a pressure of 2 kg / cm 2 to press for 45 minutes to make a cube sample of 30mm×30mm×30mm, which is divided into model test sample 1 and sample 2.

[0072] S2: Fried sample: Heat it to 180°C in soybean oil. Put sample 2 into a frying wire mesh bag according to a mass ratio of 1:10 with soybean oil and fry for 5 minutes to obtain fried tofu, which is divided into test sample 3 and test sample 4.

[0073] (2) Ultrasonic data acquisition

[0074] S1: The ultrasonic scanning system includes a three-axis moving platform, an ultrasonic transducer, an ultrasonic detector and a sample area to be measured; among them, the ultrasonic transducer, the ultrasonic detector and the sample area to be measured are all set on the three-axis moving platform;

[0075] The X and Y axis strokes of the three-axis moving platform are 300mm, and the Z axis stroke is 50mm; the ultrasonic transducer is an Olympus 10MHz immersion focused transducer, and the ultrasonic detector is a CTS-02UT ultrasonic detector.

[0076] S2: The ultrasonic scanning system also includes a host computer and a control module. The control module is installed in the host computer. The control module is developed using Qt / C++. Specifically, it includes a motion control module and a visual positioning module, integrating platform motion control and visual positioning functions. The visual positioning module is built based on the YOLOv5 algorithm, which can predict the bounding box and probability distribution through grid images, and realize the rapid positioning of the sample center point.

[0077] The control module is electrically connected to the ultrasonic transducer and the ultrasonic detector, providing two modes: A-scan and C-scan. A-scan obtains single-point one-dimensional depth information row by row at a sampling rate of 100MHz; C-scan is based on A-scan and generates three-dimensional imaging data through continuous sampling with a step size of 1mm. Among them, the A-scan interface supports real-time adjustment of acquisition parameters such as gain, sound speed, and pulse width; the C-scan interface provides functions such as power-on reset, trajectory planning, and scan range setting to improve the operation convenience under different scan modes.

[0078] The motion control module adopts an embedded real-time control architecture, and the core algorithm is an adaptive PID controller based on the BP neural network; this controller adopts a dual-loop control strategy (current loop + speed loop) to achieve high-precision motion control of the three-axis moving platform. The motion control module can convert the target position set on the interface into motor pulse commands through coordinate transformation algorithms to ensure that the ultrasonic transducer accurately reaches the position of each sampling point.

[0079] S2-1: The control module provides A-scan and C-scan dual-interface interactive design: the A-scan interface supports real-time adjustment of gain, sound velocity, and pulse width acquisition parameters; the C-scan interface provides power-on reset, trajectory planning, and scan range setting functions to improve the convenience of operation under different scan modes.

[0080] S2-2: The visual positioning module is built based on the YOLOv5 algorithm, which can predict bounding boxes and probability distributions through gridded images to quickly locate the center point of samples.

[0081] S3: Place the test sample 3 obtained in step (1) in the sample test area, and use the control module in combination with the ultrasonic transducer and the ultrasonic detector to preliminarily locate the center point of the sample; then, use an industrial camera to collect 1500 sample images to form a training data set, where the training set contains 1300 images and the test set has 200 images. After 200 training and testing verifications of the Epochs model on the 1300 images, a trained visual model is obtained; finally, the trained visual model is integrated into the control module, and the image coordinate system is converted into mechanical coordinate system data through the coordinate system calibration algorithm to finally achieve positioning.

[0082] S4: Based on the model test sample 1 obtained in step (1), a gradient frying method is used to process it. The sample is placed in a fryer set at a temperature of 180°C and fried for 7 minutes. During this period, 100 samples are taken out every 1 minute. After being taken out, all 700 samples are numbered according to the frying time sequence. The batch sample of the first minute is recorded as T1, and the 100 samples are recorded as T1-1, T1-2..., T1-100 in sequence; similarly, the other batch numbers are numbered in the same way. These fried samples are transferred to the sample test area in sequence for ultrasonic data acquisition and texture data acquisition.

[0083] S4-1: Ultrasonic data acquisition: First, 100 samples labeled T1 are placed in the sample test area in sequence;

[0084] The control module is installed in the host computer. Log in to the host computer to start the control module and enter the operation interface (such as Figure 3) Then click the power-on button. First, the control module is used to reset the three-axis moving platform. Then switch to the A-scan interface. The control module combines with the ultrasonic transducer and the ultrasonic detector to preliminarily locate the center point of the sample. Subsequently, set the ultrasonic parameters: gain 32 dB, emission voltage -250 V, pulse width 125 ns, range 200 mm, sound speed 5900 m / s, gate position 20 mm, gate width 35 mm, gate height 20 mm, and keep the rest of the parameters default. The ultrasonic detector emits an electrical signal. After this signal is transmitted to the ultrasonic transducer, the transducer converts it into ultrasonic waves through the piezoelectric effect and emits them to the deep-fried tofu sample in the area to be measured of the sample. When the ultrasonic waves encounter the interfaces of different media inside the sample, reflections occur. The transducer receives the reflected waves and converts them back into electrical signals through the piezoelectric effect again and transmits them back to the ultrasonic detector. After being processed by the ultrasonic detector, they are processed into digital signals, transmitted back to the control module, and displayed through the upper computer interface to obtain the ultrasonic sample data T1 (denoted as T1-1, T1-2,..., T1-100 respectively).

[0085] Similar to T1, sequentially collect the ultrasonic echo data of samples T2 to T7, and integrate all the collected data into the input data X (including 700 sample data, 100 for each time gradient).

[0086] S4-2: Texture data acquisition: Use the TA-XT2i texture analyzer equipped with a P / 50 aluminum cylindrical probe for the deep-fried samples that have completed data acquisition in S4-1 to conduct batch texture tests on the deep-fried tofu samples of T1 to T7. The TPA2 mode is adopted for the test, and the compression ratio is set to 30%. The pre-test speed and the test speed are set to 1 mm / s and 0.5 mm / s respectively. The cohesion Y1 and the resilience Y2 data are obtained, where both Y1 and Y2 contain 700 sample data, 100 for each time gradient.

[0087] S4-3: Place the test sample 4 obtained in step (1) in the area to be measured of the sample. Similarly, start the control module through the upper computer interface. The difference is to switch to the C-scan interface and set the scanning parameters: speed 20%, movement trajectory is bow-shaped, jogging distance 10 mm, sampling interval in both the x / y directions is 1 mm, and keep the rest of the parameters default. Then start the scan. The three-axis moving platform is positioned and moved through the vision control module. After the positioning is completed, the ultrasonic transducer is controlled by the control module to perform point-by-point A-scan along the preset trajectory. The ultrasonic transducer continuously samples with a 1-mm step distance to obtain the three-dimensional data of the sample and records it as the imaging data 1.

[0088] (3) Data preprocessing

[0089] Based on the input data X and the imaging data 1 collected in step (2), a three-level preprocessing process is adopted for feature optimization:

[0090] The collected input data X and imaging data 1 are filtered by means of discrete wavelet transform (DWT) to extract the key feature information of the data at different frequencies and time scales. After the feature extraction is completed, the principal component analysis (PCA) is used to reduce the dimension of the data, reduce data redundancy, and improve the data processing efficiency. Using Monte Carlo cross-validation (MCCV), according to the predetermined number of cycles 2000, the sample set is divided into a training set and a validation set in a ratio of 7:3, so as to eliminate outliers and ensure the reliability of the data.

[0091] After the above steps, the preprocessing of the input data X and the imaging data 1 is completed, and the preprocessed input data X and the preprocessed ultrasonic imaging data 1 are obtained, which are correspondingly recorded as the input data X1 and the ultrasonic imaging data 2.

[0092] (4) Texture visualization analysis

[0093] Based on the data preprocessed in step (3), the ultrasonic imaging data 2 is converted into three-dimensional point data through a spatial coordinate mapping algorithm. Each data point contains the x-y plane coordinates (transverse accuracy 0.1 mm / pixel), the z-axis depth (longitudinal resolution 0.1 mm), and the equivalent area parameter; all data points are constructed into a three-dimensional ultrasonic image through a spatial interpolation algorithm, which can clearly display the internal texture characteristics of the sample. Specifically, cracks are shown as low-amplitude signal bands, bubbles present circular hypoechoic regions, and foreign objects are displayed as high-contrast boundaries;

[0094] At the same time, the three-dimensional ultrasonic image adopts pseudo-color coding (green represents normal tissue, and purple marks defects), and is displayed on the left side of the C-scan interface of the host computer in pseudo-color coding (as Figure 6 shown), where green represents normal tissue and purple represents defects. It supports local magnification (up to 10 times) and three-dimensional rotation functions to observe the spatial distribution form and size of defects (the minimum recognizable foreign object is 0.5 mm).

[0095] (5) Prediction model establishment

[0096] Based on the input data X1 obtained in step (3), it is integrated with the cohesion Y1 and the resilience Y2 obtained from the texture analysis in step (2) to construct a structured data set suitable for machine learning;

[0097] To establish the mapping relationship between the input data and the cohesion and resilience, two independent data sets are created, denoted as data set 1 and data set 2; data set 1 contains the input data X1 and the corresponding cohesion Y1, and data set 2 contains the input data X1 and the corresponding resilience Y2. These two data sets are respectively stored in Excel tables for subsequent training of machine learning models for predicting cohesion and resilience.

[0098] Both Dataset 1 and Dataset 2 are divided into a training set and a validation set in a ratio of 7:3. For each dataset, four machine learning algorithms, namely XGBoost, Random Forest (RF), LightGBM, and Artificial Neural Network (ANN), are used to build models. All models are cross-validated and hyperparameter-tuned to optimize the prediction performance. The Root Mean Square Error (RMSE) and the coefficient of determination (R 2 ) are used as evaluation metrics to compare the prediction effects of each model on the validation set.

[0099] Finally, the models with the best performance are selected to predict the cohesiveness and resilience of fried tofu respectively. The performance comparison of each model is shown in Table 1 in detail.

[0100] Table 1: Results of resilience and cohesiveness based on different models

[0101]

[0102]

[0103] (6) Model application:

[0104] Based on the results of step (5) and Table 1, after DWT transformation, the LightGBM model performs best in predicting resilience and cohesiveness (as Figure 7 shown). Therefore, the trained LightGBM model is saved as a.pkl file. In Python, the pickle library can be used to load this model file.

[0105] Therefore, this study combines ultrasonic detection technology with a machine learning regression model. By preprocessing, wavelet decomposition and reconstruction, and dimensionality reduction of the ultrasonic signals of tofu at different frying times, a prediction model of resilience and cohesiveness based on LightGBM is successfully constructed. The model achieved excellent performances of Rp 2 of 0.969 and 0.956 respectively in predicting resilience and cohesiveness, effectively solving the problems of sample destruction and low efficiency in traditional TPA detection. At the same time, the visualization technology based on ultrasonic signal data intuitively reflects the inhomogeneity of the texture inside fried tofu, providing a fast, non-destructive, and efficient detection scheme for food processing and quality control.

[0106] Note: The above embodiments are only used to illustrate the present invention and do not limit the technical solutions described in the present invention; therefore, although this specification has described the present invention in detail with reference to the above respective embodiments, those of ordinary skill in the art should understand that the present invention can still be modified or equivalently replaced; and all technical solutions and their improvements that do not depart from the spirit and scope of the present invention shall be covered within the scope of the claims of the present invention.

Claims

1. A method for detecting the texture of fried tofu based on ultrasonic technology, characterized in that, The steps are as follows: (1) Sample preparation S1: Add soybeans into water for soaking. After soaking, rinse them with clean water. Then add the rinsed soybeans back into water for stirring and grinding. After grinding, filter to obtain raw soy milk. Boil the raw soy milk, then add a coagulant and let it stand at room temperature for a period of time to form bean curd. Then stir and add it into a mold. After pressing and squeezing out the water, tofu is obtained after pressing is completed. Cut the tofu into cubes and divide them into test sample 1 and sample 2; S2: Put sample 2 in step S1 into an oil pan for frying. After frying, a fried sample is obtained and divided into test sample 3 and test sample 4; (2) Data acquisition based on an ultrasonic scanning system S1: The ultrasonic scanning system includes a three-axis moving platform, an ultrasonic transducer, an ultrasonic detector, and a sample area to be measured; among them, the ultrasonic transducer, the ultrasonic detector, and the sample area to be measured are all arranged on the three-axis moving platform; S2: The ultrasonic scanning system further includes a host computer and a control module. The control module is built into the host computer and is developed based on Qt and C++. It includes a motion control module and a vision positioning module, integrating the motion control of the three-axis moving platform and the vision positioning function of the sample. At the same time, the control module is electrically connected to the ultrasonic transducer and the ultrasonic detector to achieve signal transmission and control, providing two working modes: A-scan and C-scan; The A-scan mode is to collect in a single-point manner. Control the ultrasonic detector and the ultrasonic transducer to scan the sample at a set sampling frequency, so as to obtain the one-dimensional depth information of the sample; The C-scan mode is based on the A-scan. It will perform point-by-point continuous sampling of the sample at a set step distance according to the pre-set path planning, and finally the three-dimensional information of the sample can be obtained; Among them, the path planning includes, for example, arc scanning and circular scanning. The motion control module adopts an embedded real-time control architecture, and the core algorithm is an adaptive PID controller based on a BP neural network; this controller adopts a dual-loop control strategy to achieve high-precision motion control of the three-axis moving platform. The motion control module can convert the target position set on the interface into a motor pulse command through the hand-eye calibration coordinate transformation algorithm to ensure that the ultrasonic transducer accurately reaches the position of each sampling point; The A-scan interface supports real-time adjustment of acquisition parameters such as gain, sound speed, and pulse width; the C-scan interface provides functions such as power-on reset, trajectory planning, and scan range setting, improving the operation convenience in different scan modes. S3: The acquisition steps are as follows: Place the test sample 3 obtained in step (1) in the area to be tested. The control module, in combination with the ultrasonic transducer and the ultrasonic detector, is used to preliminarily locate the center point of the sample. Subsequently, N pictures of the sample are collected to construct a training data set. And 80%-90% of the data set is divided into a training set, and the remaining part is used as a test set. Then, the Epochs model is used to train and test N pictures Q times to obtain a trained visual model. Finally, the trained visual model is integrated into the control module, and the image coordinate system is converted into mechanical coordinate system data through a coordinate system calibration algorithm to finally achieve positioning. S4: Based on the test sample 1 prepared in step (1), frying treatment is carried out by the gradient frying method: that is, the test sample 1 is placed in an oil pan for frying, continuously fried for K minutes, and C fried samples are taken out every 1 minute. Finally, K batches of fried samples are obtained. The K batches of fried samples are numbered in the order of frying time, denoted as T1, T2,..., TK in sequence, and these fried samples are transferred to the area to be tested in sequence for ultrasonic data acquisition and texture data acquisition. S4-1: Ultrasonic data acquisition: The steps adopted are as follows: First, the control module, in combination with the ultrasonic transducer and the ultrasonic detector, locates the center point of the fried sample. Subsequently, the ultrasonic detector emits an electrical signal. After the signal is transmitted to the ultrasonic transducer, the transducer converts it into ultrasonic waves through the piezoelectric effect and emits them to the fried sample in the area to be tested. When the ultrasonic waves encounter the interfaces of different media inside the fried sample, reflections occur. The transducer receives the reflected waves and uses the piezoelectric effect again to convert them into electrical signals and send them back to the ultrasonic detector. After being processed by the ultrasonic detector, they are sent back to the control module to obtain ultrasonic sample data and the corresponding frying time, which are used as input data and denoted as X. S4-2: Texture data acquisition: The fried samples for which data acquisition is completed in S4-1 are subjected to texture analysis. The fried samples of T1, T2,..., TK are subjected to batch texture tests to obtain the cohesion data and resilience data of the samples, where the cohesion data is denoted as Y1 and the resilience data is denoted as Y2. S4-3: Place the test sample 4 obtained in step (1) in the area to be tested, and switch to the C-scan interface through the control module. First, the control module, in combination with the ultrasonic transducer and the ultrasonic detector, locates the center point of the test sample. After the positioning of the sample is completed, the ultrasonic transducer is controlled to perform point-by-point A-scanning along a preset trajectory. The ultrasonic transducer performs continuous sampling with a preset step size, and finally the three-dimensional data of sample 4 is obtained and recorded as imaging data 1. (3) Preprocessing of the collected data; Based on the input data X collected in step (2) and the imaging data 1, a three-level preprocessing process is adopted for feature optimization: First, perform discrete wavelet transform on the input data X and the imaging data 1 to achieve multi-scale decomposition; then use the db4 wavelet basis function to extract 5 layers of detail coefficients, filter out high-frequency noise, and retain the time-frequency domain characteristics of the ultrasonic signal; subsequently, apply the principal component analysis algorithm to project the multi-dimensional original features into the principal component space with the maximum variance, and determine the optimal dimensionality reduction dimension through the cumulative variance contribution rate; finally, adopt Monte Carlo cross-validation, set a predetermined number of cycles, and divide the sample set into a training set and a validation set according to a certain ratio for outlier detection, eliminate data redundancy, and obtain the preprocessed input data X and the preprocessed ultrasonic imaging data 1, which are correspondingly denoted as input data X1 and ultrasonic imaging data 2; (4) Visual analysis of texture characteristics: Based on the data preprocessed in step (3), convert the ultrasonic imaging data 2 into three-dimensional point data through the spatial coordinate mapping algorithm. Each data point contains the x-y plane coordinates, the z-axis depth, and the equivalent area parameter; all data points are constructed into a three-dimensional ultrasonic image through the spatial interpolation algorithm, which can clearly display the internal texture characteristics of the sample. Specifically: cracks are manifested as low-amplitude signal bands, bubbles present circular hypoechoic areas, and foreign objects are shown as high-contrast boundaries; (5) Establishment of prediction model S1. Integrate the input data X1 obtained in step (3) with the cohesion Y1 and the resilience Y2 obtained from the texture analysis in step (2) to construct a structured data set suitable for machine learning; that is, establish the mapping relationships between the input data X1 and the cohesion Y1, and the resilience Y2 respectively, and create two independent data sets, denoted as data set 1 and data set 2; data set 1 contains the input data X1 and the corresponding cohesion Y1, and data set 2 contains the input data X1 and the corresponding resilience Y2; the two data sets will be used to train machine learning models for predicting cohesion and resilience respectively; One data set contains the input feature X1 and the target variable Y1, which is used to train the cohesion prediction model; the other data set contains the same input feature X1 and the target variable Y2, which is used to train the resilience prediction model; each data set is divided into a training set and a test set according to a certain ratio. The training set is used for model learning and parameter optimization, and the test set is used to evaluate the generalization ability of the model; S2. Use Python combined with a learning algorithm to construct a learning model; And the learning model is trained with the training set data to learn the mapping relationship between the input data X1 and the cohesive force Y1 and the restoring force Y2; the evaluation of the learning model performance is judged by the coefficient of determination R 2 and the root mean square error. Finally, the learning model with the best performance is selected as the final model; and it is saved to a file in the.pkl format; in the Python environment, the pickle library can be used to load the model and make predictions; (6) Application of the actual model Select the sample to be measured, obtain the sample input data X1 according to the acquisition steps in step S4, and then substitute it into the final model constructed in step (5), and the corresponding cohesion Y1 and resilience Y2 can be quickly predicted through the loaded model, realizing the texture detection of the sample.

2. The texture detection method of fried tofu based on ultrasonic technology according to claim 1, characterized in that, In step S1, the soybeans used are Northeast soybeans. The ratio of soybeans to water is 1g: 3 - 4mL, the temperature of the water is 22 - 28°C, and the soaking time is 10 - 12h; the dosage relationship of the washed soybeans added to water again is 1g: 6 - 8mL; the stirring and grinding is carried out using a wall breaker at a speed of 10000 - 12000r / min for 1 - 5 minutes; The boiling time is 5 - 8 min, the coagulant is magnesium sulfate coagulant, and its dosage is 0.5% - 1.5% of the mass of raw soy milk; the pressing pressure is 2 kg / cm 2 , and the pressing time is 40 - 50 minutes; the size of the cube is 30 mm × 30 mm × 30 mm; In step S2, the frying temperature is 180°C and the frying time is 5 - 10min.

3. The texture detection method of fried tofu based on ultrasonic technology according to claim 1, characterized in that In S1 of step (2), the X and Y axis travel of the three-axis moving platform is 300 mm, and the Z axis travel is 50 mm; the ultrasonic transducer is an Olympus 10 MHz immersion focused transducer, and the ultrasonic detector is a CTS-02UT ultrasonic detector.

4. A texture detection method for deep-fried tofu based on ultrasonic technology according to claim 1, characterized in that In S2 of step (2), the visual positioning module is constructed based on the YOLOv5 algorithm, which can predict the bounding box and probability distribution through the grid image to achieve rapid positioning of the sample center point; the set sampling frequency is 100 MHz, and the set step size is 1 mm.

5. A texture detection method for fried tofu based on ultrasonic technology according to claim 1, characterized in that In S3 of step (2), the value of N is 1300 - 1600; the value of Q is 150 - 300.

6. The texture detection method of fried tofu based on ultrasonic technology according to claim 1, wherein In S4 of step (2), the frying temperature is 180 °C, the value of K is 7 - 10 minutes, and the value of C is 100 - 200.

7. A texture detection method for deep-fried tofu based on ultrasonic technology according to claim 1, characterized in that In S4-2 of step (2), the texture test is carried out using a TA-XT2i texture analyzer, equipped with a P / 50 aluminum cylindrical probe. In the TPA2 mode, the compression ratio is set to 30%, and the pre-test speed and test speed are set to 1 mm / s and 0.5 mm / s respectively to collect the texture information of the sample.

8. A texture detection method for deep-fried tofu based on ultrasonic technology according to claim 1, characterized in that In S4-2 of step (2), the step size is 1 mm.

9. A texture detection method for fried tofu based on ultrasonic technology according to claim 1, characterized in that, In step (3), the number of predetermined cycles is 2000, and the certain ratio is 7:

3.

10. A texture detection method for fried tofu based on ultrasonic technology according to claim 1, characterized in that, In S1 of step (5), each data set is divided into a training set and a test set according to a ratio, where the proportion of the training set is 70 - 80%; in S2, the learning algorithms include XGBoost, random forest, LightGBM, and artificial neural network.