Baijiu quality detection method based on image recognition

CN122961933APending Publication Date: 2026-10-23HUAYIN HUASHANCHUN WINERY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611077268.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-20
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0003]可见光成像受限于物理波段的穿透与吸收特性,无法获取透明酒体内部风味物质的光学响应特征,导致基于可见光的常规图像检测技术无法对白酒风味物质含量进行无损检测,存在可见光图像无法穿透透明酒体以检测风味物质含量的技术问题

Benefits of technology

1.通过采集白酒样本在紫外至近红外波段的透射多光谱图像,提取反映化学键吸收的光密度特征向量,并对酒体施加标准超声脉冲激励产生微观气泡群,提取反映由风味物质浓度决定的表面张力与粘度的上浮速度梯度和形态畸变率,将光密度特征向量与上浮速度梯度和形态畸变率在隐空间进行注意力权重融合,得到跨模态融合特征输入映射模型,利用光学吸收特征与流体力学特征在物理机制上的耦合,消除了可见光图像对透明酒体内部成分无法成像的物理限制,实现了对白酒风味物质含量的无损图像检测。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122961933A_ABST
    Figure CN122961933A_ABST
Patent Text Reader

Abstract

The present application belongs to the field of image analysis, and specifically relates to a liquor quality detection method based on image recognition. A transmission multispectral image of a liquor sample in the ultraviolet to near-infrared band is collected, and an optical density feature vector is extracted; a standard ultrasonic pulse excitation is applied to the liquor sample to generate micro-bubble groups, a high-speed time sequence image sequence is captured, and a micro-bubble group's upward velocity gradient and morphological distortion rate are extracted; the optical density feature vector and the upward velocity gradient and the morphological distortion rate are fused in an attention weight in a hidden space to obtain a cross-modal fusion feature; and the cross-modal fusion feature is input into a flavoring substance concentration mapping model to output a flavoring substance concentration detection result. The present application overcomes the physical limitation that visible light images cannot image the internal components of transparent liquor bodies, eliminates the defects that single spectral images are interfered by environmental light and container wall refraction, realizes nondestructive detection of liquor flavoring substances, and improves detection reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image analysis, specifically a method for detecting the quality of baijiu (Chinese liquor) based on image recognition. Background Technology

[0002] Current image-based quality inspection methods for baijiu (Chinese liquor) are mostly based on visible light imaging. By capturing visible light images of baijiu samples, image processing techniques are used to extract macroscopic visual features of the liquor, such as color, transparency, or suspended matter, to determine if there are any appearance defects. However, for detecting the content of flavor compounds within baijiu, because the liquor is transparent to visible light, visible light cannot interact with the flavor compounds inside. Conventional image inspection methods cannot obtain information about the flavor compounds within the transparent liquor. To obtain information about the internal components, offline physicochemical analysis methods are usually required, using specialized instruments to perform chemical reagent reactions or spectral scanning analysis on the liquor.

[0003] Visible light imaging is limited by the penetration and absorption characteristics of physical wavebands, making it impossible to obtain the optical response characteristics of flavor substances inside transparent liquor. This results in conventional visible light-based image detection techniques being unable to perform non-destructive detection of the flavor substance content in baijiu, presenting a technical problem that visible light images cannot penetrate transparent liquor to detect the flavor substance content. Summary of the Invention

[0004] The purpose of this invention is to provide a method for detecting the quality of liquor based on image recognition, which can effectively solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows: Image recognition-based methods for detecting the quality of baijiu (Chinese liquor) include: A transmission multispectral image of a liquor sample in the ultraviolet to near-infrared band is acquired, and the optical density feature vector of each band is extracted from the transmission multispectral image. A standard ultrasonic pulse was applied to the liquor sample to generate a microbubble cluster, and a high-speed time-series image sequence of the microbubble cluster was captured. The rising velocity gradient and morphological distortion rate of the microbubble cluster were extracted from the high-speed time-series image sequence. The optical density feature vector is fused with the buoyancy gradient and the morphological distortion rate in the latent space using attention weights to obtain cross-modal fusion features. A flavor compound concentration mapping model is constructed based on the cross-modal fusion features. The cross-modal fusion features are input into the flavor compound concentration mapping model, and the flavor compound concentration detection results of the liquor sample are output.

[0006] Preferably, extracting the optical density feature vectors of each band from the transmission multispectral image includes: A background multispectral image of a blank container without a liquor sample is obtained. The transmission multispectral image and the background multispectral image are then subjected to pixel-by-pixel difference operation in the spatial dimension to eliminate optical offset interference caused by container wall refraction, thereby obtaining a differential multispectral image. A two-dimensional Fourier frequency domain transform is performed on the differential multispectral image to locate a specific frequency band region in the frequency domain corresponding to the absorption peak of the chemical bond of flavor substances. The frequency domain amplitude distribution of the specific frequency band region is extracted, and the frequency domain amplitude distribution is subjected to global mean pooling along the spatial channel dimension. The pooled frequency domain amplitudes are arranged in band order to form the optical density feature vector.

[0007] Preferably, extracting the rising velocity gradient and morphological distortion rate of the microbubble swarm from the high-speed time-series image sequence includes: Perform adjacent frame difference operation on the high-speed temporal image sequence, and combine edge detection operator to extract the motion contour edge of micro bubbles; Based on the centroid coordinate displacement of the motion contour edge in a continuous time sequence, the instantaneous buoyancy velocity within adjacent time intervals is calculated, and the buoyancy velocity gradient is obtained by differentiating the instantaneous buoyancy velocity along the time axis. Perform minimum bounding ellipse fitting on the edge of the motion contour, calculate the weighted sum of the change in the ratio of the major and minor axes of the ellipse of the same microbubble in adjacent frames and the change in the ellipse deflection angle, and determine the weighted sum as the morphological distortion rate.

[0008] Preferably, the optical density feature vector is fused with the buoyancy gradient and the morphological distortion rate in the latent space using attention weights to obtain cross-modal fused features, including: The optical density feature vector is mapped to optical latent space features, and the buoyancy velocity gradient and the morphological distortion rate are concatenated and mapped to fluid latent space features. Using the optical latent space features as the query matrix and the fluid latent space features as the key matrix and value matrix, the cross-attention coefficient matrix is ​​calculated, and the cross-attention coefficient matrix is ​​multiplied by the fluid latent space features to obtain the weighted fluid features. The weighted fluid features and the optical latent space features are added element-wise to form the cross-modal fusion features.

[0009] Preferably, a flavor compound concentration mapping model is constructed based on the cross-modal fusion features. The cross-modal fusion features are input into the flavor compound concentration mapping model, and the output of the flavor compound concentration detection results of the liquor sample includes: The cross-modal fusion feature is input into a regression network comprising a multilayer perceptron, wherein the multilayer perceptron comprises an input layer, at least two hidden layers and an output layer connected in sequence, and residual connections are introduced between the hidden layers; The output layer outputs predicted concentration values ​​of various flavor substances; The mean square error between the predicted concentration value and the actual physicochemical analysis value is used as the target loss function to update the parameters of the flavor substance concentration mapping model until the target loss function converges, and the final flavor substance concentration detection result of the liquor sample is output.

[0010] Preferably, before collecting the transmission multispectral image of the liquor sample in the ultraviolet to near-infrared band, the method further includes: Based on the known basic aroma categories of the liquor samples, target feature band combinations sensitive to the basic aroma categories are matched from a preset band combination database; According to the wavelength interval of each band in the target characteristic band combination, a timing exposure control signal is generated and sent to the corresponding multispectral light source and image sensor, so that the multispectral light source switches to emit light sequentially and the image sensor performs exposure synchronously, thereby acquiring the transmission multispectral image without spectral crosstalk.

[0011] Preferably, before performing pixel-by-pixel difference operations between the transmission multispectral image and the background multispectral image in the spatial dimension, the method further includes: The background multispectral image is segmented by brightness threshold, and pixel regions with brightness values ​​exceeding a preset highlight threshold are extracted as the container wall reflective highlight areas; A morphological dilation operation is performed on the reflective specular area of ​​the container wall to generate a specular mask area; When performing the pixel-by-pixel difference operation, the pixel values ​​of the pixels in the transmission multispectral image and the background multispectral image that fall into the specular mask region are set to zero, and the difference calculation is only performed on pixels in the non-spectral mask region to eliminate local saturation interference caused by specular reflection.

[0012] Preferably, before performing minimum bounding ellipse fitting on the motion contour edge, the method further includes: Concave point detection is performed on the edge of the motion contour to identify concave contour segments where adjacent microbubbles adhere together. A normal direction is constructed at the concave contour segment, and the adjacent adhered microbubbles are contoured and separated along the normal direction to obtain independent bubble contours. Calculate the convex hull of the independent bubble profile, remove edge burrs with a convex hull defect area smaller than a preset defect threshold, and perform the minimum circumscribed ellipse fitting on the independent bubble profile after removal to avoid distortion in the calculation of morphological distortion rate caused by bubble adhesion.

[0013] Preferably, after calculating the cross-attention coefficient matrix, the method further includes: Apply sparsity regularization constraints based on information entropy to the cross-attention coefficient matrix, calculate the information entropy of the cross-attention coefficient matrix, and when the information entropy exceeds a preset information entropy threshold, set the elements at the end of the cross-attention coefficient matrix to zero according to a preset proportion, while retaining the non-zero weight elements that represent strong physical coupling relationships. The sparsed cross-attention coefficient matrix is ​​multiplied with the fluid latent space features to obtain the weighted fluid features, thus suppressing interference from spurious correlations between optical features and fluid features.

[0014] Preferably, after sending the timing exposure control signal to the corresponding multispectral light source and image sensor, the method further includes: Obtain the dynamic average brightness value of the current frame image acquired by the image sensor in the current band; Determine whether the dynamic average brightness value is within a preset standard brightness range. If the dynamic average brightness value is lower than the lower limit of the preset standard brightness range, generate an exposure extension command and increase the exposure time of the next adjacent band by a fixed step size. If the dynamic average brightness value is higher than the upper limit of the preset standard brightness range, an exposure shortening command is generated to reduce the exposure time of the next adjacent band by a fixed step size until the brightness of the images acquired in all bands falls within the preset standard brightness range.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. By acquiring transmission multispectral images of baijiu samples in the ultraviolet to near-infrared bands, optical density feature vectors reflecting chemical bond absorption are extracted. Standard ultrasonic pulse excitation is applied to the baijiu to generate micro-bubble clusters, and the rising velocity gradient and morphological distortion rate reflecting the surface tension and viscosity determined by the concentration of flavor substances are extracted. The optical density feature vector, rising velocity gradient, and morphological distortion rate are fused with attention weights in the latent space to obtain a cross-modal fusion feature input mapping model. By utilizing the coupling of optical absorption features and hydrodynamic features in the physical mechanism, the physical limitation that visible light images cannot image the internal components of transparent baijiu is eliminated, realizing non-destructive image detection of the flavor substance content of baijiu.

[0016] 2. By performing pixel-by-pixel difference operations on the transmission multispectral image and the background multispectral image to eliminate container wall refraction interference, and locating specific frequency band regions corresponding to the absorption peaks of chemical bonds of flavor substances in the frequency domain to extract the frequency domain amplitude distribution, and by cutting and separating the microscopic bubble adhesion contours and removing burrs, ellipse fitting is performed to calculate the morphological distortion rate, thus eliminating the interference of container wall refraction, local saturation interference, and bubble adhesion on feature extraction; applying sparsity regularization constraints based on information entropy to the cross-attention coefficient matrix suppresses the interference of spurious correlations between optical features and fluid features; and improving the stability of image data acquisition for different types of baijiu in different bands by matching target feature bands according to the baijiu aroma type and adjusting the exposure time based on the dynamic average brightness value. Attached Figure Description

[0017] Figure 1 This is a flowchart of the overall method for quality detection of baijiu based on image recognition according to the present invention; Figure 2 This is a flowchart of the transmission multispectral image acquisition and optical density feature vector extraction process of the present invention; Figure 3 This is a flowchart of the high-speed time-series image feature extraction process for microscopic bubble swarms according to the present invention; Figure 4 This is a flowchart of the cross-modal latent space attention weight fusion process of the present invention; Figure 5 This is a flowchart illustrating the construction and detection process of the flavor substance concentration mapping model of the present invention. Figure 6 This is a flowchart of the fragrance matching band selection and dynamic exposure adjustment process of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Please refer to Figure 1This embodiment provides a method for detecting the quality of baijiu (Chinese liquor) based on image recognition. First, a multispectral transmission image of the baijiu sample in the ultraviolet to near-infrared band is acquired. The wavelength range of the ultraviolet to near-infrared band is 200nm to 2500nm. Electromagnetic waves in this band can produce specific vibrational and rotational absorption effects with the chemical bonds of various flavor substances in baijiu, thus reflecting the concentration information of flavor substances in the transmitted light intensity. During the acquisition process, the baijiu sample is placed in a transparent quartz cuvette with an optical path length of 10mm. The multispectral light source is incident perpendicularly from one side of the cuvette, and the image sensor receives the transmitted light signal from the other side of the cuvette. The multispectral light source uses a narrowband filter array to achieve band selection. The full width at half maximum (FWHM) of each narrowband filter is 10nm, ensuring the spectral purity of each band. The image sensor uses a CMOS area array sensor with a pixel resolution of 1920×1080 and a grayscale quantization accuracy of 16 bits for each pixel.

[0020] Optical density feature vectors for each band are extracted from the transmission multispectral image. Optical density is a physical quantity characterizing a substance's ability to absorb light, defined as the logarithm of the ratio of incident light intensity to transmitted light intensity. For each band of the transmission image, the optical density value at each pixel location is calculated, forming an optical density distribution map for that band. The optical density distribution maps of all bands are arranged in wavelength order to form a three-dimensional optical density tensor, with dimensions of [number of bands, image height, image width]. Global mean pooling is performed on the three-dimensional optical density tensor along the spatial dimension to obtain the average optical density value for each band. These average optical density values ​​are then arranged in band order to form an optical density feature vector. The dimension of the optical density feature vector is equal to the number of bands collected, and each element corresponds to the average optical density value of a specific band, reflecting the overall light absorption capacity of the liquor sample in that band.

[0021] Standard ultrasonic pulses were applied to the baijiu sample to generate microbubble clusters. The ultrasonic pulse excitation was generated by an ultrasonic transducer with an operating frequency of 20 kHz, a pulse width of 100 μs, a pulse repetition frequency of 1 Hz, and a sound intensity of 1 W / cm². The ultrasonic transducer was placed at the bottom of the cuvette, ensuring close contact with the bottom to guarantee effective transfer of ultrasonic energy to the baijiu sample. When the ultrasonic pulses acted on the baijiu sample, cavitation was generated within the liquor, forming numerous microbubbles with diameters between 10 μm and 100 μm. These microbubbles moved upwards under buoyancy, and their motion characteristics were influenced by hydrodynamic parameters such as surface tension, viscosity, and density of the liquor, which are closely related to the concentration of flavor compounds in the baijiu.

[0022] A high-speed time-series image sequence of microbubble swarms was captured. The high-speed camera operated at a frame rate of 1000 fps, an exposure time of 100 μs, and a resolution of 1280 × 720. The camera was positioned on the side of the cuvette, perpendicular to the direction of ultrasonic propagation, to ensure clear capture of the upward movement of the microbubbles. The high-speed time-series image sequence was acquired over 1 second, containing 1000 frames, covering the entire process from bubble formation to their rise to the liquid surface. A uniform surface light source was used concurrently with the acquisition of the high-speed time-series image sequence to ensure sufficient contrast between the bubbles and the background in the images.

[0023] The rising velocity gradient and morphological distortion rate of microbubble clusters were extracted from a high-speed temporal image sequence. First, the high-speed temporal image sequence was preprocessed, including background subtraction, grayscale normalization, and median filtering to eliminate the effects of background noise and uneven illumination. Then, the motion contour edges of the microbubbles were extracted using an inter-frame difference method combined with an edge detection operator. For consecutive temporal images, the difference image between two adjacent frames was calculated; the regions with non-zero pixel values ​​in the difference image were identified as the bubble motion regions. Within these motion regions, the Canny edge detection operator was used to extract the bubble contour edges. The Canny edge detection operator had a low threshold of 50, a high threshold of 150, and a Gaussian filter kernel size of 3×3.

[0024] Based on the centroid coordinate displacement of the moving contour edge over continuous time, the instantaneous upward velocity within adjacent time intervals is calculated. For each bubble's contour edge, its centroid coordinates are calculated using the following formula:

[0025] in, Let these be the centroid coordinates of the bubble profile. For the bubble outline The coordinates of each pixel This represents the total number of pixels on the bubble outline.

[0026] For the centroid coordinates of the same bubble in two adjacent frames and Calculate its time interval The displacement vector within the bubble, the vertical component of which is the bubble's upward displacement. The formula for calculating the instantaneous upward velocity is:

[0027] in, For the bubble at time The instantaneous upward speed, The time interval between two adjacent frames is the reciprocal of the high-speed camera's frame rate.

[0028] The ascent velocity gradient is obtained by differentiating the instantaneous ascent velocity along the time axis. The ascent velocity gradient reflects the rate of change of the bubble's ascent velocity with time, and its calculation formula is:

[0029] in, For the bubble at time The upward velocity gradient.

[0030] A minimum bounding ellipse fitting is performed on the edges of the moving contour. The weighted sum of the changes in the ratio of the major and minor axes of the ellipse to the changes in the ellipse deflection angle for the same microbubble in adjacent frames is calculated, and this weighted sum is determined as the morphological distortion rate. The minimum bounding ellipse fitting uses the least squares method. For a given set of bubble contour points, an ellipse is fitted such that the sum of the squared distances from all contour points to the ellipse is minimized. The general equation of the ellipse is:

[0031] in, Let be the coefficients of the equation of the ellipse, and satisfy . .

[0032] By solving the coefficients of the above equation, the coordinates of the center of the ellipse can be obtained. Long half shaft short half shaft and deflection angle The ratio of the major axis to the minor axis of the ellipse is... Deflection angle It is the angle between the major axis of the ellipse and the horizontal direction.

[0033] For the same bubble in two adjacent frames, the ellipse parameters and Calculate the change in the ratio of major to minor axis. and the change in deflection angle The formula for calculating the morphological distortion rate is:

[0034] in, For the bubble at time Morphological distortion rate, and These are weighting coefficients, and they satisfy... In this embodiment, Take 0.7, Take 0.3.

[0035] By fusing the optical density feature vector with the buoyancy gradient and morphological distortion rate in the latent space using attention weights, a cross-modal fused feature is obtained. The optical density feature vector reflects the optical absorption characteristics of the baijiu sample, while the buoyancy gradient and morphological distortion rate reflect the hydrodynamic characteristics of the baijiu sample. These two modal features reflect the concentration information of flavor substances in baijiu from different physical mechanisms. By fusing the features with attention weights in the latent space, the complementarity between the two modal features can be fully utilized to improve the accuracy of flavor substance concentration detection.

[0036] First, the optical density feature vector is mapped to optical latent space features, and the buoyancy gradient and morphological distortion rate are concatenated and mapped to fluid latent space features. The mapping process employs a linear transformation combined with a nonlinear activation function. The weight matrix for the linear transformation is obtained through training, and the ReLU function is used for the nonlinear activation function. Both the optical and fluid latent space features have the same dimensionality of 256.

[0037] Using optical latent space features as the query matrix and fluid latent space features as the key and value matrices, the cross-attention coefficient matrix is ​​calculated. The formula for calculating the cross-attention coefficient matrix is:

[0038] in, The query matrix corresponds to the optical latent space features; The key matrix corresponds to the fluid latent space features; The value matrix corresponds to the fluid latent space features; is the dimension of the key matrix, i.e., the dimension of the latent space features.

[0039] Multiplying the cross-attention coefficient matrix by the fluid latent space features yields weighted fluid features, where each element reflects the importance of the corresponding element in the fluid latent space features to the optical latent space features. Adding the weighted fluid features element-wise to the optical latent space features creates the cross-modal fusion feature. The cross-modal fusion feature has the same dimensionality as both the optical and fluid latent space features, at 256 dimensions.

[0040] A flavor compound concentration mapping model is constructed based on cross-modal fusion features. The cross-modal fusion features are input into the flavor compound concentration mapping model, which outputs the detection results of flavor compound concentrations in the baijiu sample. The flavor compound concentration mapping model adopts a multilayer perceptron structure, which includes an input layer, two hidden layers, and an output layer connected sequentially. The number of neurons in the input layer is equal to the dimension of the cross-modal fusion features, i.e., 256; the number of neurons in the two hidden layers are 128 and 64, respectively; the number of neurons in the output layer is equal to the number of flavor compounds to be detected. In this embodiment, the flavor compounds to be detected include ethyl acetate, ethyl lactate, ethyl hexanoate, ethyl butyrate, isoamyl alcohol, isobutanol, n-propanol, and acetaldehyde, a total of 8 compounds; therefore, the number of neurons in the output layer is 8.

[0041] Residual connections are introduced between hidden layers. The formula for calculating residual connections is as follows:

[0042] in, For the first The output of the layer, For the first Nonlinear transformation of the layer, For the first Layer weight matrix. Residual connections can alleviate the vanishing gradient problem during the training of deep neural networks, improving the training efficiency and generalization ability of the model.

[0043] The output layer employs a linear activation function to output predicted concentrations of various flavor compounds. The mean squared error between the predicted concentrations and the actual physicochemical analysis values ​​is used as the target loss function to update the parameters of the flavor compound concentration mapping model. The formula for calculating the mean squared error loss function is as follows:

[0044] in, For mean square error loss, The number of training samples, This represents the number of flavor compounds. For the first In the nth sample The true concentration values ​​of the flavor compounds For the first In the nth sample Predicted concentration values ​​of flavor compounds.

[0045] The stochastic gradient descent algorithm was used to update the model parameters, with a learning rate of 0.001, a batch size of 32, and 100 training epochs. Training was stopped when the objective loss function converged, and the final detection results of flavor compound concentrations in the baijiu samples were output. The correlation between the chemical bond absorption bands corresponding to different flavor compounds and the hydrodynamic parameters is shown in Table 1.

[0046] Table 1. Correlation between chemical bond absorption bands and hydrodynamic parameters for different flavor substances.

[0047] Table 1 shows the chemical bond types, characteristic absorption bands, and influence coefficients on the surface tension and viscosity of the main flavor compounds in baijiu. As can be seen from Table 1, different flavor compounds have different characteristic absorption bands, which provides a physical basis for detecting the concentration of flavor compounds using multispectral imaging technology. At the same time, different flavor compounds also have varying degrees of influence on the surface tension and viscosity of the baijiu, providing a basis for detecting the concentration of flavor compounds through the hydrodynamic properties of microbubbles.

[0048] In this embodiment, by acquiring transmission multispectral images of baijiu samples in the ultraviolet to near-infrared bands, optical density feature vectors reflecting chemical bond absorption are extracted. A standard ultrasonic pulse excitation is applied to the baijiu to generate microscopic bubble clusters. The rising velocity gradient and morphological distortion rate, reflecting surface tension and viscosity determined by the concentration of flavor substances, are extracted. The optical density feature vector, rising velocity gradient, and morphological distortion rate are fused with attention weights in the latent space to obtain a cross-modal fusion feature input mapping model. By utilizing the coupling of optical absorption features and hydrodynamic features in a physical mechanism, the physical limitation that visible light images cannot image the internal components of transparent baijiu is eliminated, achieving non-destructive image detection of the flavor substance content in baijiu.

[0049] In a preferred embodiment, reference Figure 6 Before acquiring transmission multispectral images of baijiu samples in the ultraviolet to near-infrared bands, target feature band combinations sensitive to the known basic aroma type of the baijiu samples are matched from a preset band combination database based on the known basic aroma type of the baijiu samples. The basic aroma types of baijiu include soy sauce aroma, strong aroma, light aroma, rice aroma, phoenix aroma, Dong aroma, soy sauce aroma, sesame aroma, special aroma, and mixed aroma. The composition and content of flavor substances in baijiu of different aroma types vary significantly, thus their light absorption characteristics also differ in different bands. The preset band combination database stores the optimal feature band combinations corresponding to each basic aroma type. These optimal feature band combinations are obtained through spectral analysis and statistical learning of a large number of baijiu samples of different aroma types, and can reflect the concentration information of the main flavor substances in baijiu of that aroma type to the greatest extent.

[0050] Based on the wavelength intervals of each band in the target characteristic band combination, a timing exposure control signal is generated and sent to the corresponding multispectral light source and image sensor. This ensures that the multispectral light source sequentially switches its emission and the image sensor synchronously exposes, acquiring a transmission multispectral image without spectral crosstalk. The generation process of the timing exposure control signal is as follows: First, based on the wavelengths of each band in the target characteristic band combination, the corresponding narrowband filter number in the multispectral light source is determined. Then, exposure control signals for each band are generated sequentially in ascending order of wavelength. The duration of each exposure control signal is equal to the exposure time of that band, and the time interval between two adjacent exposure control signals is equal to the time required for the multispectral light source to switch bands. This ensures that during the image sensor exposure, the multispectral light source only emits light of the corresponding band, avoiding spectral crosstalk between different bands.

[0051] After sending the timing exposure control signal to the corresponding multispectral light source and image sensor, the dynamic average brightness value of the current frame image acquired by the image sensor in the current band is obtained. The formula for calculating the dynamic average brightness value is:

[0052] in, This represents the dynamic average brightness value of the current frame image. The height of the image. The width of the image. For the first in the image Line number The grayscale value of the column pixels.

[0053] The system determines whether the dynamic average brightness value falls within a preset standard brightness range, which is [1000, 4000]. This range is determined based on the dynamic range and quantization accuracy of the image sensor, ensuring sufficient contrast and signal-to-noise ratio. If the dynamic average brightness value is below the lower limit of the preset standard brightness range, an exposure extension command is generated, increasing the exposure time of the next adjacent band by a fixed step size of 10 μs. If the dynamic average brightness value is above the upper limit of the preset standard brightness range, an exposure shortening command is generated, decreasing the exposure time of the next adjacent band by a fixed step size, until the brightness of the images acquired in all bands falls within the preset standard brightness range.

[0054] refer to Figure 2 When extracting the optical density feature vectors of each band from the transmission multispectral image, the background multispectral image of the blank container without any liquor sample is first acquired. The acquisition conditions of the background multispectral image are exactly the same as those of the transmission multispectral image, including the band of the multispectral light source, exposure time, and image sensor parameters, to ensure that the background multispectral image can accurately reflect the optical characteristics of the container wall and the ambient lighting conditions.

[0055] Brightness thresholding was performed on the background multispectral image to extract pixel regions with brightness values ​​exceeding a preset highlight threshold as the container wall reflective highlight areas. The preset highlight threshold was 4500, which was determined based on the maximum quantization value of the image sensor and the reflectivity of the container wall. The container wall reflective highlight areas are caused by specular reflection of incident light by the container wall. The pixel values ​​in these areas exhibit saturation and cannot reflect the true light absorption characteristics of the liquor sample, thus requiring special processing.

[0056] A morphological dilation operation is performed on the specular highlight area reflected from the container wall to generate a specular mask region. The morphological dilation operation uses a 3×3 square structuring element, and the dilation operation is performed twice. The morphological dilation operation can expand the range of the specular region, ensuring that all pixels affected by specular reflection are included within the specular mask region.

[0057] A pixel-by-pixel difference operation is performed between the transmission multispectral image and the background multispectral image in the spatial dimension to eliminate optical offset interference caused by container wall refraction, resulting in a differential multispectral image. During the pixel-by-pixel difference operation, the pixel values ​​falling within the specular mask region in both the transmission and background multispectral images are set to zero; difference calculations are only performed on pixels outside the specular mask region to eliminate local saturation interference caused by specular reflection. The formula for the pixel-by-pixel difference operation is:

[0058] in, wavelength In the lower differential multispectral image, the first Line number The grayscale value of the column pixels, wavelength The first in the lower transmission multispectral image Line number The grayscale value of the column pixels, wavelength The first in the background multispectral image Line number The grayscale value of the column pixels, This is the area for the highlight mask.

[0059] A two-dimensional Fourier frequency domain transform is performed on the differential multispectral image to locate specific frequency bands corresponding to the absorption peaks of chemical bonds in flavor substances, and the frequency domain amplitude distribution of these specific frequency bands is extracted. The formula for calculating the two-dimensional Fourier transform is as follows:

[0060] in, wavelength Two-dimensional Fourier transform results of lower difference multispectral images. and For frequency domain coordinates, and This represents the height and width of the image.

[0061] The chemical bond absorption peaks of flavor compounds exhibit periodic brightness variations in the spatial domain and energy concentrations at specific frequencies in the frequency domain. By performing frequency domain analysis on a large number of flavor compound samples with different concentrations, the specific frequency band corresponding to the chemical bond absorption peak of each flavor compound can be determined. In this embodiment, the center frequency of the specific frequency band is 0.1 cycles / pixel, and the bandwidth is 0.05 cycles / pixel.

[0062] The frequency domain amplitude distribution is subjected to global mean pooling along the spatial channel dimension. The pooled frequency domain amplitudes are then arranged in band order to form the optical density feature vector. The formula for global mean pooling is:

[0063] in, wavelength The mean amplitude in the frequency domain. and For the width and height of a specific frequency band region, and This represents the coordinate range of a specific frequency band region in the frequency domain. The amplitude is in the frequency domain. The combination of target characteristic bands corresponding to different aroma types of baijiu is shown in Table 2.

[0064] Table 2. Combinations of target feature bands corresponding to different types of Baijiu.

[0065] Table 2 shows the target feature band combinations, number of bands, and main flavor compounds detected for different basic aroma types of baijiu. As can be seen from Table 2, the target feature band combinations differ for different aroma types of baijiu, which is due to the varying composition and content of flavor compounds in each type. By matching the target feature band combinations to the basic aroma type of baijiu, the number of bands collected can be reduced, detection efficiency improved, and detection accuracy ensured.

[0066] In this embodiment, the container wall refraction interference is eliminated by performing pixel-by-pixel difference operations on the transmission multispectral image and the background multispectral image, and the frequency domain amplitude distribution is extracted by locating the specific frequency band region corresponding to the absorption peak of the chemical bond of flavor substances in the frequency domain, thus eliminating the influence of container wall refraction and local saturation interference on feature extraction; the stability of image data acquisition for different types of baijiu under different bands is improved by matching the target feature band according to the baijiu aroma type and adjusting the exposure time based on the dynamic average brightness value.

[0067] In a preferred embodiment, reference Figure 3 When extracting the rising velocity gradient and morphological distortion rate of microbubble swarms from high-speed temporal image sequences, an adjacent frame difference operation is performed on the high-speed temporal image sequence, combined with an edge detection operator to extract the motion contour edges of the microbubbles. The calculation formula for the adjacent frame difference operation is as follows:

[0068] in, For the first Frame and the The difference image of the frame image Line number The grayscale value of the column pixels, For the first The first frame of the image Line number The grayscale value of the column pixels, For the first The first frame of the image Line number The grayscale value of the column pixels.

[0069] The difference image is binarized, and the binarization threshold is determined using the Otsu adaptive thresholding method. The Otsu adaptive thresholding method determines the optimal threshold by maximizing the inter-class variance and can automatically adapt to images under different lighting conditions. After binarization, the regions with a pixel value of 1 in the difference image represent the movement areas of the bubble.

[0070] Within the motion region, the Canny edge detection operator is used to extract the contour edges of the bubbles. The Canny edge detection operator first applies Gaussian filtering to the image to eliminate noise, then calculates the gradient magnitude and direction of the image, followed by non-maximum suppression to refine the edges, and finally uses a double thresholding method to determine the final edges.

[0071] Before performing minimum bounding ellipse fitting on the moving contour edge, concave point detection is performed on the moving contour edge to identify concave contour segments where adjacent microbubbles adhere together. Concave point detection uses a contour curvature-based method. For each point on the contour, its curvature value is calculated; points with negative curvature values ​​and absolute values ​​greater than a preset curvature threshold are identified as concave points. The preset curvature threshold is... When two adjacent air bubbles stick together, two indentations are formed at the point of adhesion. The contour segment between these two indentations is called the concave contour segment.

[0072] A normal direction is constructed at the concave contour segment, and the adjacent microbubbles that are stuck together are separated by contour cutting along the normal direction to obtain independent bubble contours. Specifically, a straight line is formed by connecting two concave points, and this straight line is the cutting line. The stuck bubble contours are separated along the cutting line to obtain two independent bubble contours.

[0073] Calculate the convex hull of the individual bubble contours and remove edge burrs with convex hull defect areas smaller than a preset defect threshold. The convex hull is the smallest convex polygon containing all points on the contour. Convex hull defects refer to the regions between the contour and the convex hull; these regions are typically edge burrs caused by image noise or minor fluctuations on the bubble surface. The preset defect threshold is 5 pixels². Regions with convex hull defect areas smaller than this threshold are removed from the contour to eliminate the influence of edge burrs on ellipse fitting.

[0074] The contours of the isolated bubbles after removal are fitted with a minimum bounding ellipse to avoid distortion in the calculation of morphological distortion rate caused by bubble adhesion. The process of minimum bounding ellipse fitting has been described above and will not be repeated here.

[0075] Based on the centroid coordinate displacement of the moving contour edge over continuous time, the instantaneous buoyancy within adjacent time intervals is calculated, and the buoyancy gradient is obtained by differentiating the instantaneous buoyancy along the time axis. For each independent bubble, its centroid coordinate change is tracked in continuous time-series images, and its instantaneous buoyancy and buoyancy gradient are calculated. For the buoyancy gradient and morphological distortion rate of all bubbles, their mean and standard deviation are calculated, and the mean is used as the feature value of the buoyancy gradient and morphological distortion rate of the liquor sample.

[0076] refer to Figure 4 The optical density feature vector is fused with the buoyancy gradient and morphological distortion rate in the latent space using attention weights to obtain cross-modal fused features. The optical density feature vector is mapped to optical latent space features, and the buoyancy gradient and morphological distortion rate are concatenated and mapped to fluid latent space features. This mapping process is implemented using two independent fully connected layers. The first fully connected layer maps the optical density feature vector to 256-dimensional optical latent space features, and the second fully connected layer maps the concatenated fluid feature vector to 256-dimensional fluid latent space features. The ReLU function is used for activation in both fully connected layers.

[0077] Using optical latent space features as the query matrix and fluid latent space features as the key and value matrices, the cross-attention coefficient matrix is ​​calculated. The formula for calculating the cross-attention coefficient matrix is ​​as described above and will not be repeated here.

[0078] After calculating the cross-attention coefficient matrix, a sparsity regularization constraint based on information entropy is applied to the cross-attention coefficient matrix, and then the information entropy of the cross-attention coefficient matrix is ​​calculated. The formula for calculating information entropy is:

[0079] in, The information entropy of the cross-attention coefficient matrix, The first element in the cross-attention coefficient matrix Line number The element values ​​of the column, denoted as the dimension of the cross-attention coefficient matrix.

[0080] Information entropy reflects the uniformity of the weight distribution in the cross-attention coefficient matrix. A higher information entropy indicates a more uniform weight distribution and a greater likelihood of spurious associations; a lower information entropy indicates a more concentrated weight distribution and a stronger physical coupling. When the information entropy exceeds a preset threshold, a preset proportion of elements at the end of the cross-attention coefficient matrix are set to zero, while non-zero weight elements representing strong physical coupling are retained. The preset information entropy threshold is 3.0, and the preset proportion is 30%.

[0081] The sparsed cross-attention coefficient matrix is ​​multiplied with the fluid latent space features to obtain weighted fluid features, suppressing interference from spurious correlations between optical and fluid features. The weighted fluid features are then added element-wise with the optical latent space features to form cross-modal fusion features.

[0082] refer to Figure 5 A flavor compound concentration mapping model was constructed based on cross-modal fusion features. The cross-modal fusion features were input into the flavor compound concentration mapping model, which outputs the detection results of flavor compound concentrations in baijiu samples. The flavor compound concentration mapping model adopts a multilayer perceptron structure, which consists of an input layer, three hidden layers, and an output layer connected sequentially. The input layer has 256 neurons; the three hidden layers have 128, 64, and 32 neurons, respectively; and the output layer has 8 neurons.

[0083] Residual connections are introduced between hidden layers. Each hidden layer contains a linear transformation layer, a batch normalization layer, and a ReLU activation function layer. The batch normalization layer can accelerate the model training process and improve the model's stability. The calculation formula for residual connections has been described previously and will not be repeated here.

[0084] The output layer employs a linear activation function to output predicted concentrations of various flavor compounds. The mean squared error between the predicted concentrations and the actual physicochemical analysis values ​​is used as the target loss function to update the parameters of the flavor compound concentration mapping model. The formula for calculating the mean squared error loss function has been described previously and will not be repeated here.

[0085] The Adam optimization algorithm was used to update the model parameters. The Adam algorithm combines the advantages of momentum and RMSprop algorithms, and can adaptively adjust the learning rate to improve the training efficiency of the model. The learning rate was set to 0.001, the batch size to 64, and the number of training epochs to 200. During training, an early stopping strategy was adopted: training was stopped when the validation set loss did not decrease for 10 consecutive epochs to prevent overfitting. The structural parameters of the multilayer perceptron regression network are shown in Table 3.

[0086] Table 3. Structural parameters of the multilayer perceptron regression network.

[0087] Table 3 shows the structural parameters of the multilayer perceptron regression network. As can be seen from Table 3, the network consists of one input layer, three hidden layers, and one output layer. Residual connections and batch normalization operations are introduced between the hidden layers, and the output layer uses a linear activation function. This network structure can effectively learn the nonlinear mapping relationship between cross-modal fusion features and flavor compound concentration, improving the accuracy of flavor compound concentration detection.

[0088] In this embodiment, the interference of bubble adhesion on feature extraction is eliminated by cutting and separating the microscopic bubble adhesion contour and removing burrs, followed by ellipse fitting to calculate the morphological distortion rate. The sparsity regularization constraint based on information entropy is applied to the cross-attention coefficient matrix to suppress the interference of false correlation between optical features and fluid features. The flavor substance concentration mapping model is constructed by using a multilayer perceptron structure that includes residual connections and batch normalization, which improves the training efficiency and generalization ability of the model.

Claims

1. A method for detecting the quality of baijiu (Chinese liquor) based on image recognition, characterized in that, include: A transmission multispectral image of a liquor sample in the ultraviolet to near-infrared band is acquired, and the optical density feature vector of each band is extracted from the transmission multispectral image. A standard ultrasonic pulse was applied to the liquor sample to generate a microbubble cluster, and a high-speed time-series image sequence of the microbubble cluster was captured. The rising velocity gradient and morphological distortion rate of the microbubble cluster were extracted from the high-speed time-series image sequence. The optical density feature vector is fused with the buoyancy gradient and the morphological distortion rate in the latent space using attention weights to obtain cross-modal fusion features. A flavor compound concentration mapping model is constructed based on the cross-modal fusion features. The cross-modal fusion features are input into the flavor compound concentration mapping model, and the flavor compound concentration detection results of the liquor sample are output.

2. The image recognition-based liquor quality detection method according to claim 1, characterized in that, Extracting optical density feature vectors for each band from the transmission multispectral image includes: Obtain a background multispectral image of a blank container without a baijiu sample, and perform a pixel-by-pixel difference operation between the transmission multispectral image and the background multispectral image in the spatial dimension to obtain a difference multispectral image. A two-dimensional Fourier frequency domain transform is performed on the differential multispectral image to locate a specific frequency band region in the frequency domain corresponding to the absorption peak of the chemical bond of flavor substances. The frequency domain amplitude distribution of the specific frequency band region is extracted, and the frequency domain amplitude distribution is subjected to global mean pooling along the spatial channel dimension. The pooled frequency domain amplitudes are arranged in band order to form the optical density feature vector.

3. The image recognition-based liquor quality detection method according to claim 1, characterized in that, Extracting the rising velocity gradient and morphological distortion rate of the microbubble swarm from the high-speed temporal image sequence includes: Perform adjacent frame difference operation on the high-speed temporal image sequence, and combine edge detection operator to extract the motion contour edge of micro bubbles; Based on the centroid coordinate displacement of the motion contour edge in a continuous time sequence, the instantaneous buoyancy velocity within adjacent time intervals is calculated, and the buoyancy velocity gradient is obtained by differentiating the instantaneous buoyancy velocity along the time axis. Perform minimum bounding ellipse fitting on the edge of the motion contour, calculate the weighted sum of the change in the ratio of the major and minor axes of the ellipse of the same microbubble in adjacent frames and the change in the ellipse deflection angle, and determine the weighted sum as the morphological distortion rate.

4. The image recognition-based liquor quality detection method according to claim 1, characterized in that, The optical density feature vector, the buoyancy gradient, and the morphological distortion rate are fused in the latent space using attention weights to obtain cross-modal fused features, including: The optical density feature vector is mapped to optical latent space features, and the buoyancy velocity gradient and the morphological distortion rate are concatenated and mapped to fluid latent space features. Using the optical latent space features as the query matrix and the fluid latent space features as the key matrix and value matrix, the cross-attention coefficient matrix is ​​calculated, and the cross-attention coefficient matrix is ​​multiplied by the fluid latent space features to obtain the weighted fluid features. The weighted fluid features and the optical latent space features are added element-wise to form the cross-modal fusion features.

5. The image recognition-based liquor quality detection method according to claim 1, characterized in that, A flavor compound concentration mapping model is constructed based on the cross-modal fusion features. The cross-modal fusion features are input into the flavor compound concentration mapping model, and the output flavor compound concentration detection results of the liquor sample include: The cross-modal fusion feature is input into a regression network comprising a multilayer perceptron, wherein the multilayer perceptron comprises an input layer, at least two hidden layers and an output layer connected in sequence, and residual connections are introduced between the hidden layers; The output layer outputs predicted concentration values ​​of various flavor substances; The mean square error between the predicted concentration value and the actual physicochemical analysis value is used as the target loss function to update the parameters of the flavor substance concentration mapping model until the target loss function converges, and the final flavor substance concentration detection result of the liquor sample is output.

6. The image recognition-based liquor quality detection method according to claim 1, characterized in that, Before collecting the transmission multispectral images of the liquor samples in the ultraviolet to near-infrared bands, the process also includes: Based on the known basic aroma categories of the liquor samples, target feature band combinations sensitive to the basic aroma categories are matched from a preset band combination database; According to the wavelength interval of each band in the target characteristic band combination, a timing exposure control signal is generated and sent to the corresponding multispectral light source and image sensor, so that the multispectral light source switches to emit light sequentially and the image sensor performs exposure synchronously, thereby acquiring the transmission multispectral image without spectral crosstalk.

7. The image recognition-based liquor quality detection method according to claim 2, characterized in that, Before performing pixel-by-pixel difference operations between the transmission multispectral image and the background multispectral image in the spatial dimension, the method further includes: The background multispectral image is segmented by brightness threshold, and pixel regions with brightness values ​​exceeding a preset highlight threshold are extracted as the container wall reflective highlight areas; A morphological dilation operation is performed on the reflective specular area of ​​the container wall to generate a specular mask area; When performing the pixel-by-pixel difference operation, the pixel values ​​of the pixels in the transmission multispectral image and the background multispectral image that fall into the specular mask region are set to zero, and the difference calculation is performed only on pixels in the non-spectral mask region.

8. The image recognition-based liquor quality detection method according to claim 3, characterized in that, Before performing minimum bounding ellipse fitting on the edges of the motion contour, the method further includes: Concave point detection is performed on the edge of the motion contour to identify concave contour segments where adjacent microbubbles adhere together. A normal direction is constructed at the concave contour segment, and the adjacent adhered microbubbles are contoured and separated along the normal direction to obtain independent bubble contours. Calculate the convex hull of the independent bubble profile, remove edge burrs with a convex hull defect area smaller than a preset defect threshold, and perform the minimum circumscribed ellipse fitting on the independent bubble profile after removal to avoid distortion in the calculation of morphological distortion rate caused by bubble adhesion.

9. The image recognition-based liquor quality detection method according to claim 4, characterized in that, After calculating the cross-attention coefficient matrix, the method further includes: Apply sparsity regularization constraints based on information entropy to the cross-attention coefficient matrix, calculate the information entropy of the cross-attention coefficient matrix, and when the information entropy exceeds a preset information entropy threshold, set the elements at the end of the cross-attention coefficient matrix to zero according to a preset proportion, while retaining the non-zero weight elements that represent strong physical coupling relationships. The sparsed cross-attention coefficient matrix is ​​multiplied with the fluid latent space features to obtain the weighted fluid features, thus suppressing interference from spurious correlations between optical features and fluid features.

10. The image recognition-based liquor quality detection method according to claim 6, characterized in that, After sending the timing exposure control signal to the corresponding multispectral light source and image sensor, the method further includes: Obtain the dynamic average brightness value of the current frame image acquired by the image sensor in the current band; Determine whether the dynamic average brightness value is within a preset standard brightness range. If the dynamic average brightness value is lower than the lower limit of the preset standard brightness range, generate an exposure extension command and increase the exposure time of the next adjacent band by a fixed step size. If the dynamic average brightness value is higher than the upper limit of the preset standard brightness range, an exposure shortening command is generated to reduce the exposure time of the next adjacent band by a fixed step size until the brightness of the images acquired in all bands falls within the preset standard brightness range.