A method and system for identifying contamination in fruit fungi culture media based on hyperspectral imaging

CN121415397BActive Publication Date: 2026-08-14MACHENG LONGTENG ECOLOGICAL AGRI CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-21
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0005]本发明提供一种基于高光谱成像的果菌培养基污染识别方法及系统以解决上述现有技术中存在的在复杂纹理背景下对早期的污染点识别精度不高的问题

Benefits of technology

[0036]本发明的有益效果为:本发明通过构建反应扩散模型,将光谱维度的分析与空间维度的结构约束进行了深度融合。综合了基于预设污染菌种库的靶向识别和基于正常菌丝体光谱统计的异常检测,并将所述两种互补的光谱证据共同作为非线性反应项的驱动力,从而能够将隐藏在复杂背景下的早期、微弱污染信号放大,提升了检测的灵敏度。利用从高光谱数据中分解出的菌丝体结构先验信息,引导污染信号沿菌丝网络方向增强和传播,同时抑制垂直方向的噪声干扰,能够形成空间上完整、边界清晰的污染区域掩码,实现了对培养基污染早期、精确的识别,降低了漏检率和误报率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121415397B_ABST
    Figure CN121415397B_ABST
Patent Text Reader

Abstract

This invention relates to the field of culture medium detection technology, and discloses a method and system for identifying contamination in fruit fungi culture media based on hyperspectral imaging. The method includes acquiring a data cube of a hyperspectral image of the culture medium; performing non-negative tensor decomposition to obtain a set of spatial factor maps and corresponding spectral vectors; calculating the Parshall distance between each spectral vector and a preset library of contaminating bacterial species to generate contamination affinity coefficients corresponding to each spatial factor map; calculating the Mahalanobis distance of each pixel in the data cube to generate a global spectral distortion map; initializing a contamination potential field with the same spatial size as the hyperspectral image, and iteratively updating it through a reaction-diffusion equation until convergence; and performing threshold segmentation on the converged contamination potential field to obtain a binary mask of the contamination region. This invention, by constructing a reaction-diffusion model, deeply integrates spectral dimension analysis with spatial dimension structural constraints, achieving early and accurate identification of culture medium contamination.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of culture medium detection technology, specifically to a method and system for identifying contamination in fruit fungi culture media based on hyperspectral imaging. Background Technology

[0002] Microbial contamination of culture media is a common and serious problem in the artificial cultivation of edible and medicinal fungi. The proliferation of contaminating microorganisms not only competes with the target species for nutrients and living space, but also secretes harmful metabolites and can even directly infect the mycelium, ultimately leading to strain degeneration, reduced yield, and deterioration in quality, causing serious economic losses to the industry.

[0003] Traditional detection methods, such as acquiring and analyzing images using RGB cameras, struggle to identify subtle spectral differences between early contamination and normal mycelium, especially in the early stages of contamination or when the color of the contaminating fungus is similar to that of the culture medium or mycelium, making it prone to missed detections and misjudgments. Hyperspectral imaging technology can simultaneously acquire spatial image information of the target and continuous spectral information for each pixel, providing a new approach for high-precision detection.

[0004] However, many current hyperspectral detection applications focus on pixel-by-pixel spectral feature analysis, which to some extent ignores the spatial correlation between pixels and the morphological and structural features of contaminated areas. Furthermore, these methods are insufficient for extracting weak contamination signals that are highly mixed with the mycelial background spectrum. Considering the complex network-like texture structure of mycelia themselves, and the fact that the occurrence and spread of contamination are often closely related to this structure, developing a detection method that can deeply integrate spectral and spatial structural features and effectively amplify early weak contamination signals is of great significance for achieving early warning of contamination in mycelial culture media. Summary of the Invention

[0005] This invention provides a method and system for identifying contamination in fruit and fungal culture media based on hyperspectral imaging to solve the problem of low accuracy in identifying early contamination points against complex texture backgrounds in the prior art.

[0006] In a first aspect, the method for identifying contamination in fruit fungus culture media based on hyperspectral imaging of the present invention includes the following steps:

[0007] A data cube containing a hyperspectral image of a culture medium is acquired, and non-negative tensor decomposition is performed on the data cube to obtain a set of spatial factor maps and corresponding spectral vectors.

[0008] Calculate the Parshall distance between each spectral vector and the preset contaminant strain spectral library to generate contamination affinity coefficients corresponding to each spatial factor map; calculate the Mahalanobis distance of each pixel in the data cube based on the covariance matrix of the normal mycelial spectrum to generate a global spectral distortion map.

[0009] A contamination potential field with the same spatial size as the hyperspectral image is initialized and iteratively updated through a reaction-diffusion equation until convergence. The reaction-diffusion equation includes an isotropic diffusion term and a nonlinear reaction term, wherein the isotropic diffusion term is defined by an isotropic diffusion tensor determined based on the local structure tensor of the spatial factor map, to enhance diffusion along the hyphal structure direction and suppress diffusion perpendicular to the direction.

[0010] The value of the nonlinear response term at each pixel is calculated by combining the pollution affinity coefficients corresponding to each spatial factor map, the pixel values ​​of each spatial factor map at the pixel, and the pixel values ​​of the global spectral distortion map at the pixel, in order to amplify the signal of the potential pollution area; threshold segmentation is performed on the converged pollution potential field to obtain the binary mask of the pollution area.

[0011] Preferably, the step of performing nonnegative tensor decomposition on the data cube to obtain a set of spatial factor graphs and corresponding spectral vectors includes:

[0012] The data cube of the hyperspectral image is represented as a third-order tensor. Using the Tucker decomposition model, the third-order tensor is decomposed into the product of a core tensor and three factor matrices. The columns of the factor matrices representing the spectral dimension are the spectral vectors. The two-dimensional matrix reconstructed by the core tensor and the other two factor matrices representing the spatial dimension is the spatial factor graph.

[0013] Preferably, the step of calculating the Parshall distance between each spectral vector and a preset contaminant strain spectral library, and generating contamination affinity coefficients corresponding to each spatial factor map, includes:

[0014] For each spectral vector obtained from nonnegative tensor decomposition, calculate the Parshall distance between the spectral vector and the pre-stored standard spectral vectors of Aspergillus niger, Penicillium, and Rhizopus in the contaminating microorganism spectral library, and select the minimum value among them. ; using Gaussian kernel function Will This is converted into a pollution affinity coefficient ranging from [0, 1], where This is the preset bandwidth parameter.

[0015] Preferably, the step of calculating the Mahalanobis distance of each pixel in the data cube based on the covariance matrix of the normal mycelial spectrum to generate a global spectral distortion map includes:

[0016] A clean, uncontaminated mycelial region was manually selected from the hyperspectral image of the culture medium as a reference sample region; the mean vector of the spectral vectors of all pixels within the reference sample region was calculated. Covariance Matrix For the spectral vector of each pixel in the data cube According to the formula Calculate Mahalanobis distance The Mahalanobis distances of all pixels together constitute the global spectral distortion map.

[0017] Preferably, the anisotropic diffusion term is defined by an anisotropic diffusion tensor determined based on the local structure tensor of the spatial factor graph, including:

[0018] Calculate each spatial factor plot gradient vector The local structure tensor is constructed by summing the outer products of each gradient vector after Gaussian smoothing. Local structure tensor Calculated using the following formula:

[0019] ;in, For Gaussian kernel;

[0020] For local structure tensor Eigenvalues ​​are obtained by performing eigenvalue decomposition. and the corresponding feature vectors Based on this, a non-isotropic diffusion tensor is constructed. Isotropic diffusion tensor Calculated using the following formula:

[0021] ;

[0022] in, c are positive parameters that control the diffusion intensity.

[0023] Preferably, the value of the nonlinear response term at each pixel is calculated by combining the pollution affinity coefficients corresponding to each spatial factor map, the pixel values ​​of each spatial factor map at that pixel, and the pixel values ​​of the global spectral distortion map at that pixel, including:

[0024] At pixel At the point, nonlinear reaction term Calculated using the following formula:

[0025] ;

[0026] in, For global spectral distortion map at pixel points pixel values, For the k-th spatial factor map at pixel point pixel values, The pollution affinity coefficient corresponding to the k-th spatial factor map. This represents the summation of the results over k spatial factor graphs.

[0027] Preferably, the iterative update of the reaction-diffusion equation until convergence includes:

[0028] An iterative solution is performed using an operator splitting scheme. In the (n+1)th iteration, the contamination potential field... The update formula is: ;

[0029] in, For time step, For the isotropic diffusion tensor, It is a nonlinear reaction term. For divergence operators, For gradient operators, This represents element-wise multiplication. This represents the element-wise square;

[0030] The conditions for stopping iteration are: iteration stops when the set maximum number of iterations is reached, or when the contamination potential field obtained from two consecutive iterations stops. When the norm difference is less than a preset threshold, it is determined to be converged and the iteration stops.

[0031] Preferably, the step of performing threshold segmentation on the converged contamination potential field to obtain a binary mask of the contamination region includes:

[0032] The converged pollution potential field is used as a grayscale image, and the optimal segmentation threshold T is calculated using Otsu's method. Each pixel of the grayscale image is traversed. If the pixel value of the pixel is greater than or equal to the threshold T, a value of 1 is assigned to the corresponding position in the binary mask; otherwise, a value of 0 is assigned.

[0033] Preferably, the cube for acquiring hyperspectral image data of the culture medium comprises:

[0034] Images of culture medium samples were acquired using a pushbroom or snapshot hyperspectral camera in the spectral range of 400 to 1000 nanometers to obtain the hyperspectral image data cube.

[0035] Secondly, the fruit and fungus culture medium contamination identification system based on hyperspectral imaging of the present invention includes a memory and a processor. The memory stores computer instructions, and when the processor executes the computer instructions, it implements the above-mentioned fruit and fungus culture medium contamination identification method based on hyperspectral imaging.

[0036] The beneficial effects of this invention are as follows: By constructing a reaction-diffusion model, this invention deeply integrates spectral analysis with spatial structural constraints. It combines targeted identification based on a pre-set contaminant strain library with anomaly detection based on statistical analysis of normal mycelial spectra, and uses these two complementary spectral evidences together as the driving force for the nonlinear reaction term. This amplifies early, weak contamination signals hidden in complex backgrounds, improving detection sensitivity. Utilizing prior information about mycelial structure decomposed from hyperspectral data, it guides the contamination signal to amplify and propagate along the mycelial network direction while suppressing vertical noise interference. This forms a spatially complete and clearly defined contamination area mask, enabling early and accurate identification of culture medium contamination and reducing false positive and false negative rates. Attached Figure Description

[0037] Figure 1 This is a schematic flowchart of a method for identifying contamination in fruit fungi culture media based on hyperspectral imaging, provided in an embodiment of the present invention. Detailed Implementation

[0038] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.

[0039] like Figure 1 As shown, an embodiment of the method for identifying contamination in fruit fungus culture media based on hyperspectral imaging provided by the present invention includes the following steps:

[0040] S1, acquire the data cube of the hyperspectral image of the culture medium, perform non-negative tensor decomposition on the data cube to obtain a set of spatial factor maps and corresponding spectral vectors.

[0041] Specifically, images of culture medium samples are acquired using a pushbroom or snapshot hyperspectral camera in the spectral range of 400 to 1000 nanometers, forming a three-dimensional data cube, also known as a hyperspectral image data cube. The two dimensions of the three-dimensional data cube are spatial coordinates x and y, and the third dimension is the spectral wavelength λ. This three-dimensional data cube is unfolded along the spectral dimension into a two-dimensional matrix, where each row represents the complete spectrum of a pixel, and each column represents the spatial image under a specific wavelength band. Then, a nonnegative matrix factorization algorithm is performed on this two-dimensional matrix, decomposing it into the product of a basis matrix and a coefficient matrix. Each column vector of the basis matrix is ​​reconstructed into a two-dimensional image, resulting in a set of spatial factor maps. Each spatial factor map represents the abundance distribution of a basic spectral component across the entire image space. Each row vector of the coefficient matrix is ​​then used to represent the abundance distribution of each spatial factor. Figure 1 A corresponding spectral vector represents the spectral characteristics of that basic spectral component.

[0042] S2, calculate the Parshall distance between each spectral vector and the preset contaminant strain spectral library, and generate the contamination affinity coefficient corresponding to each spatial factor map; based on the covariance matrix of the normal mycelial spectrum, calculate the Mahalanobis distance of each pixel in the data cube, and generate a global spectral distortion map.

[0043] Specifically, by performing hyperspectral scanning on pure culture samples of various common contaminating fungi such as Penicillium and Trichoderma, the average spectral features of these samples were extracted to construct a pre-defined contaminating fungi spectral library containing spectral vectors of various standard contaminating fungi. Then, each obtained spectral vector and each standard contaminating spectral vector in the spectral library were normalized, and the sum of these vector elements was made equal to 1. The Parshall distance between the normalized spectral vector and each standard contaminating spectrum in the library was then calculated. For each spectral vector, the minimum distance to all standard contaminating spectra in the library was taken, and this minimum distance value was mapped to a contamination affinity coefficient between 0 and 1 using an exponential decay function; the smaller the distance, the higher the affinity coefficient. Simultaneously, multiple normal mycelial regions were manually selected from images of uncontaminated culture medium samples, and the spectral data of all pixels within these regions were extracted. The mean vector and covariance matrix of this set of normal spectral data were calculated. Finally, each pixel in the original hyperspectral data cube was traversed, and the Mahalanobis distance between the spectral vector of that pixel and the mean vector of the normal mycelial spectrum was calculated. The Mahalanobis distances of all pixels together constitute a global spectral distortion map.

[0044] S3, initialize a contamination potential field with the same spatial size as the hyperspectral image, and iteratively update it through the reaction-diffusion equation until convergence; the reaction-diffusion equation includes an isotropic diffusion term and a nonlinear reaction term, wherein: the isotropic diffusion term is defined by an isotropic diffusion tensor determined based on the local structure tensor of the spatial factor map, to enhance diffusion along the hyphal structure direction and suppress diffusion perpendicular to the direction.

[0045] Specifically, a two-dimensional matrix with the exact same dimensions as the hyperspectral image is created as the contamination potential field, and all initial values ​​are set to 0. Then, using a discretized time-stepping approach, the value of each pixel in the field is updated according to a partial differential equation at each time step. The update amount of this equation is determined by the sum of the diffusion and reaction terms. This iterative process continues until the maximum change in the entire contamination potential field between two consecutive updates is less than a preset minimum threshold, at which point convergence is determined.

[0046] The construction process of the non-isotropic diffusion term is as follows: First, from all spatial factor maps obtained by non-negative tensor decomposition, a structural map that can represent the texture of the mycelial network is selected or weighted and fused. Then, the image gradient in the neighborhood of each pixel on the structural map is calculated, and a [missing term] is constructed based on these gradients. The local structure tensor matrix is ​​obtained. Eigenvalue decomposition is performed on this tensor, yielding two eigenvalues ​​and their corresponding eigenvectors. The eigenvectors corresponding to larger eigenvalues ​​are perpendicular to the hyphal orientation, while those corresponding to smaller eigenvalues ​​are parallel to it. A new diffusion tensor is constructed based on these two eigenvalues ​​and eigenvectors. This diffusion tensor has a large diffusion coefficient in the direction parallel to the hyphal orientation and a very small diffusion coefficient in the perpendicular direction. The diffusion term is the divergence of the product of this diffusion tensor and the gradient of the contamination potential field, allowing the contamination potential signal to preferentially propagate and converge along the hyphal structure.

[0047] S4, the value of the nonlinear reaction term at each pixel is calculated by combining the pollution affinity coefficients corresponding to each spatial factor map, the pixel values ​​of each spatial factor map at the pixel, and the pixel values ​​of the global spectral distortion map at the pixel, so as to amplify the signal of the potential pollution area; threshold segmentation is performed on the converged pollution potential field to obtain the binary mask of the pollution area.

[0048] Specifically, at each pixel location, the pixel value of each spatial factor map at that point is multiplied by the corresponding pollution affinity coefficient of the spatial factor map. The products of all factor maps are then summed to obtain a comprehensive pollution spectral evidence value. Next, this pollution spectral evidence value is multiplied by the value of the global spectral distortion map at that pixel location to obtain a comprehensive excitation signal that integrates target identification and anomaly detection. Finally, this comprehensive excitation signal and the current pollution potential field value at that point are calculated using a nonlinear function, such as a function containing a cubic term. This ensures that when the comprehensive excitation signal is strong, the response term is positive, driving the potential field value to increase; conversely, when the signal is weak, the response term is negative, suppressing the potential field value, thereby achieving nonlinear amplification of the potential pollution signal.

[0049] After the reaction diffusion process converges, a contamination potential field is obtained, where the values ​​of potentially contaminated areas approach 1, and the values ​​of uncontaminated areas approach 0. A fixed segmentation threshold is set, for example, 0.5. Each pixel in the contamination potential field is iterated over; if the pixel value is greater than the threshold, a value of 1 is assigned to the corresponding position in the output binary mask image, representing a contaminated area; if the pixel value is less than or equal to the threshold, a value of 0 is assigned, representing a normal area. This generates a binary mask image that clearly marks the location and shape of all contaminated areas.

[0050] In an optional embodiment, performing nonnegative tensor decomposition on the data cube to obtain a set of spatial factor graphs and corresponding spectral vectors includes:

[0051] The data cube of the hyperspectral image is represented as a third-order tensor. Using the Tucker decomposition model, the third-order tensor is decomposed into the product of a core tensor and three factor matrices. The columns of the factor matrices representing the spectral dimension are the spectral vectors. The two-dimensional matrix reconstructed by the core tensor and the other two factor matrices representing the spatial dimension is the spatial factor graph.

[0052] For example, a size of 512 pixels 512 pixels A 200-band hyperspectral image data cube can be represented as a cube with dimension 1. Let X be a third-order tensor. The Tucker decomposition is applied to this tensor X with the goal of finding a core tensor G and three factor matrices A, B, and C such that tensor X is approximately equal to the mode product of the core tensor G and the three factor matrices. In this decomposition, matrices A and B correspond to the two spatial dimensions, while matrix C corresponds to the spectral dimension, and nonnegativity constraints are imposed on all elements during the decomposition process.

[0053] For example, let the rank of the decomposition be... , , Then the size of the factor matrix A is The size of B is The size of C is The size of the core tensor G is After decomposition, the 10 column vectors of the spectral factor matrix C are the 10 required spectral vectors. For the k-th spectral vector, i.e., the k-th column of C, its corresponding spatial factor plot... It is The two-dimensional matrix is ​​reconstructed by multiplying the k-th two-dimensional slice of the core tensor G with the spatial factor matrices A and B. In this way, 10 spatial factor maps and their corresponding 10 spectral vectors are obtained, each pair representing a fundamental component of the original hyperspectral data.

[0054] In an optional embodiment, the step of calculating the Parshall distance between each spectral vector and a preset contaminant strain spectral library, and generating contamination affinity coefficients corresponding to each spatial factor map, includes:

[0055] For each spectral vector obtained from nonnegative tensor decomposition, calculate the Parshall distance between the spectral vector and the pre-stored standard spectral vectors of Aspergillus niger, Penicillium, and Rhizopus in the contaminating microorganism spectral library, and select the minimum value among them. ; using Gaussian kernel function Will This is converted into a pollution affinity coefficient ranging from [0, 1], where This is the preset bandwidth parameter.

[0056] Specifically, prepare a database containing standard spectra of known contaminating microorganisms. For example, this database stores standard spectral vectors for Aspergillus niger, Penicillium, and Rhizopus, with each vector having the same dimension as the number of bands in a hyperspectral image, i.e., 200 dimensions. Then, for each spectral vector obtained from nonnegative tensor decomposition, for example, a total of 10, perform the following calculation one by one: using one of the spectral vectors... For example, we calculate the Parshall distance between it and the standard spectral vectors of Aspergillus niger, Penicillium, and Rhizopus in the database, obtaining three distance values, assumed to be 0.15, 0.42, and 0.78 respectively. After obtaining these three distance values, we select the smallest one, 0.15. This smallest distance represents the spectral vector... In terms of spectral characteristics, it is most similar to Aspergillus niger. To convert the distance value into an affinity coefficient representing the probability of contamination, a Gaussian kernel function is used for mapping. Setting the bandwidth parameter σ to a value, for example, 0.2, results in an affinity coefficient of 0.7. This process is repeated for all 10 spectral vectors, ultimately generating 10 one-to-one contamination affinity coefficients. Each contamination affinity coefficient is in the range of 0 to 1, with higher values ​​indicating a higher probability that the corresponding component is a known contaminant.

[0057] In an optional embodiment, the step of calculating the Mahalanobis distance of each pixel in the data cube based on the covariance matrix of the normal mycelial spectrum to generate a global spectral distortion map includes:

[0058] A clean, uncontaminated mycelial region was manually selected from the hyperspectral image of the culture medium as a reference sample region; the mean vector of the spectral vectors of all pixels within the reference sample region was calculated. Covariance Matrix For the spectral vector of each pixel in the data cube According to the formula Calculate Mahalanobis distance The Mahalanobis distances of all pixels together constitute the global spectral distortion map.

[0059] Specifically, through the human-computer interaction interface, in Selecting a region on a pixel hyperspectral image, for example, a A rectangular region of pixels was defined, and it was confirmed that this region contained only healthy, uncontaminated mycelium. Then, the spectral data of all 900 pixels within this region were extracted, with each pixel corresponding to a 200-dimensional spectral vector. Based on these 900 spectral vector samples, their mean vector μ was calculated. The mean vector μ is a 200-dimensional vector representing the average spectral characteristics of normal mycelium. Simultaneously, the covariance matrix Σ of these 900 samples was calculated. The covariance matrix Σ is a... The matrix represents the variation and correlation of the normal mycelial spectrum across different wavelengths.

[0060] After obtaining the mean vector μ and covariance matrix Σ, traverse the entire For each pixel in the hyperspectral image, a 200-dimensional spectral vector x is extracted and calculated using the Mahalanobis distance formula. The calculated Mahalanobis distance value represents the degree of deviation between the spectrum of the current pixel and the normal mycelial spectral distribution. The Mahalanobis distance values ​​calculated for all pixels are combined into a single vector vector. The two-dimensional image is a global spectral distortion map. Brighter or larger pixels in the image indicate that the spectral characteristics are significantly different from those of normal mycelium, and there is a greater possibility of abnormality or contamination.

[0061] In an optional embodiment, the anisotropic diffusion term is defined by an anisotropic diffusion tensor determined based on the local structure tensor of the spatial factor graph, including:

[0062] Calculate each spatial factor plot gradient vector The local structure tensor is constructed by summing the outer products of each gradient vector after Gaussian smoothing. Local structure tensor Calculated using the following formula:

[0063] ;in, For Gaussian kernel;

[0064] For local structure tensor Eigenvalues ​​are obtained by performing eigenvalue decomposition. and the corresponding feature vectors Based on this, a non-isotropic diffusion tensor is constructed. Isotropic diffusion tensor Calculated using the following formula:

[0065] ;

[0066] in, c are positive parameters that control the diffusion intensity.

[0067] For example, for the 10 spatial factor maps obtained earlier, the gradient vector of each map at each pixel location is calculated, and this vector contains the rate of change of image intensity in the horizontal and vertical directions. At each pixel, the outer product of each gradient vector is calculated to obtain a... The matrix. Then, these 10 outer product matrices are Gaussian smoothed, for example using a... A Gaussian kernel is used for convolution to integrate neighborhood information, and then the 10 smoothed matrices are summed to obtain the result for that pixel. Local structure tensor J.

[0068] Then, feature decomposition is performed on the structure tensor J of each pixel to obtain the eigenvalues. and and the corresponding feature vectors and Among them, the feature vector It points towards the edge direction where the local strength is strongest, and This points to a direction perpendicular to it, extending along the structure or texture. It is constructed based on eigenvalues ​​and eigenvectors. The diffusion tensor D is constructed such that... The parameter α is set to a very small value, such as 0.01, and the parameter c is a positive number, such as 0.05. The construction of the diffusion tensor D makes... The diffusion intensity in the direction is limited to a very small base level α to protect edges in the image from blurring. And... In terms of direction, the diffusion intensity is adjusted according to the difference in eigenvalues: if and A large difference indicates the presence of a sharp edge, and the diffusion intensity is close to α; if the difference is small, it indicates a smooth region, and the diffusion intensity will be larger, thus promoting smoothness within the region. In this way, an isotropic diffusion tensor field that can adapt to the local image structure is generated across the entire image.

[0069] In an optional embodiment, the value of the nonlinear response term at each pixel is calculated by combining the pollution affinity coefficients corresponding to each spatial factor map, the pixel values ​​of each spatial factor map at that pixel, and the pixel values ​​of the global spectral distortion map at that pixel, including:

[0070] At pixel At the point, nonlinear reaction term Calculated using the following formula:

[0071] ;

[0072] in, For global spectral distortion map at pixel points pixel values, For the k-th spatial factor map at pixel point pixel values, The pollution affinity coefficient corresponding to the k-th spatial factor map. This represents the summation of the results over k spatial factor graphs.

[0073] For example, taking the pixel at coordinates (100, 150) in an image as an example, the calculation process of the nonlinear response term is explained as follows: First, obtain all the necessary data for this location. Read the pixel value M of this point from the global spectral distortion map, assuming it is 15.2. Then, read the 10 pixel values ​​corresponding to this point from the 10 spatial factor maps. arrive Assume their values ​​are 0.8, 0.2, 0.9, etc. Simultaneously, obtain 10 pollution affinity coefficients corresponding to the 10 spatial factor maps. arrive Let's assume their values ​​are 0.95, 0.1, 0.8, etc. Then, substitute the data into the above formula for calculation, and we get the nonlinear response term R for that pixel as 25.08. This calculation process is repeated for every pixel in the image, thereby generating a response term field of the same size as the original image.

[0074] In an optional embodiment, the iterative update of the reaction-diffusion equation until convergence includes:

[0075] An iterative solution is performed using an operator splitting scheme. In the (n+1)th iteration, the contamination potential field... The update formula is: ;

[0076] in, For time step, For the isotropic diffusion tensor, It is a nonlinear reaction term. For divergence operators, For gradient operators, This represents element-wise multiplication. This represents the element-wise square;

[0077] The conditions for stopping iteration are: iteration stops when the set maximum number of iterations is reached, or when the contamination potential field obtained from two consecutive iterations stops. When the norm difference is less than a preset threshold, it is determined to be converged and the iteration stops.

[0078] For example, first initialize a The pollution potential field U is defined, and all elements are set to 0. Simultaneously, iteration parameters are set, such as a time step Δt of 0.05, a maximum number of iterations of 1000, and a convergence threshold of one in a million. After the iteration process begins, in each iteration, for example from the nth to the (n+1th)th iteration, the current pollution potential field is... Update the process. After each iteration, calculate the old and new potential fields. and The difference between The norm is the square root of the sum of the squares of the differences between all pixels. The iteration process stops if the norm is less than one part per million of a set threshold, or if the number of iterations reaches 1000. The final potential field is the converged result, and its numerical distribution represents the probability of contamination in each region.

[0079] In an optional embodiment, the step of performing threshold segmentation on the converged contamination potential field to obtain a binary mask of the contamination region includes:

[0080] The converged pollution potential field is used as a grayscale image, and the optimal segmentation threshold T is calculated using Otsu's method. Each pixel of the grayscale image is traversed. If the pixel value of the pixel is greater than or equal to the threshold T, a value of 1 is assigned to the corresponding position in the binary mask; otherwise, a value of 0 is assigned.

[0081] Specifically, the result obtained after iterative convergence of the reaction-diffusion equation The pollution potential field U is processed as a single-channel grayscale image. The pixel values ​​in this image range from 0 to 1, reflecting the pollution potential at each location. Otsu's method, also known as the maximum inter-class variance method, is applied to the grayscale image to determine a global segmentation threshold T. This method first calculates the grayscale histogram of the image, then iterates through all possible grayscale levels as thresholds, and calculates the inter-class variance for each possible threshold, classifying pixels into foreground and background classes. The grayscale level that maximizes the inter-class variance is selected as the optimal threshold T; for example, a calculated T value of 0.58 is obtained.

[0082] After determining the optimal threshold T, create a new size that is also [value missing]. The binary mask image is generated, and all pixel values ​​are initialized to 0. Then, each pixel in the contamination potential field image is traversed, and its potential value is read. For the pixel located at coordinates (i, j), its potential value is... .if If the value is greater than or equal to the threshold T (0.58), then the pixel value at the corresponding coordinate (i, j) in the binary mask image is set to 1, indicating that the point is determined to be a contaminated area. If the value is less than 0.58, the pixel value at the corresponding mask position remains 0, indicating that the point is a non-contaminated area. After traversing all pixels, the generated binary mask image can clearly mark the outline and range of the detected contaminated areas.

[0083] The implementation principle of the hyperspectral imaging-based fruit fungal culture medium contamination identification method of this invention is as follows: This invention, by constructing a reaction-diffusion model, can deeply integrate the fine analysis of the spectral dimension with the structural constraints of the spatial dimension. This invention integrates two complementary spectral evidences: one is targeted identification based on a pre-set contamination strain library, and the other is anomaly detection based on the statistical analysis of normal mycelial spectra. By using these two pieces of evidence together as the driving force of the nonlinear reaction term, this invention can significantly amplify early, weak contamination signals hidden in the complex mycelial background, effectively improving detection sensitivity. Furthermore, this invention utilizes prior information on mycelial structure decomposed from hyperspectral data to construct an isotropic diffusion term. This diffusion term can guide the contamination signal to amplify and propagate along the mycelial network direction, while suppressing noise interference perpendicular to this direction. Ultimately, it can generate a spatially complete and clearly defined contamination region mask, achieving early and accurate identification of culture medium contamination, significantly reducing the false negative and false positive rates.

[0084] An embodiment of the fruit and fungus culture medium contamination identification system based on hyperspectral imaging provided by the present invention includes a memory and a processor. The memory stores computer instructions, and when the processor executes the computer instructions, it implements the fruit and fungus culture medium contamination identification method based on hyperspectral imaging in the above embodiment.

[0085] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for identifying contamination in fruit fungi culture media based on hyperspectral imaging, characterized in that, The process includes the following steps: acquiring a data cube of a hyperspectral image of a culture medium, performing non-negative tensor decomposition on the data cube to obtain a set of spatial factor maps and corresponding spectral vectors; Calculate the Parshall distance between each spectral vector and the preset contaminant strain spectral library to generate contamination affinity coefficients corresponding to each spatial factor map; calculate the Mahalanobis distance of each pixel in the data cube based on the covariance matrix of the normal mycelial spectrum to generate a global spectral distortion map. A contamination potential field with the same spatial size as the hyperspectral image is initialized and iteratively updated through a reaction-diffusion equation until convergence. The reaction-diffusion equation includes an isotropic diffusion term and a nonlinear reaction term, wherein the isotropic diffusion term is defined by an isotropic diffusion tensor determined based on the local structure tensor of the spatial factor map, to enhance diffusion along the hyphal structure direction and suppress diffusion perpendicular to the direction. The value of the nonlinear response term at each pixel is calculated by combining the pollution affinity coefficients corresponding to each spatial factor map, the pixel values ​​of each spatial factor map at the pixel, and the pixel values ​​of the global spectral distortion map at the pixel, in order to amplify the signal of the potential pollution area; threshold segmentation is performed on the converged pollution potential field to obtain the binary mask of the pollution area.

2. The method for identifying contamination in fruit fungus culture media based on hyperspectral imaging according to claim 1, characterized in that, The nonnegative tensor decomposition of the data cube yields a set of spatial factor graphs and corresponding spectral vectors, including: The data cube of the hyperspectral image is represented as a third-order tensor. Using the Tucker decomposition model, the third-order tensor is decomposed into the product of a core tensor and three factor matrices. The columns of the factor matrices representing the spectral dimension are the spectral vectors. The two-dimensional matrix reconstructed by the core tensor and the other two factor matrices representing the spatial dimension is the spatial factor graph.

3. The method for identifying contamination in fruit fungus culture media based on hyperspectral imaging according to claim 1, characterized in that, The calculation of the Parshall distance between each spectral vector and the preset contaminant strain spectral library, and the generation of contamination affinity coefficients corresponding to each spatial factor map, includes: For each spectral vector obtained from nonnegative tensor decomposition, calculate the Parshall distance between the spectral vector and the pre-stored standard spectral vectors of Aspergillus niger, Penicillium, and Rhizopus in the contaminating microorganism spectral library, and select the minimum value among them. ; using Gaussian kernel function Will This is converted into a pollution affinity coefficient ranging from [0, 1], where This is the preset bandwidth parameter.

4. The method for identifying contamination in fruit fungus culture media based on hyperspectral imaging according to claim 1, characterized in that, The covariance matrix based on the normal mycelial spectrum is used to calculate the Mahalanobis distance of each pixel in the data cube, generating a global spectral distortion map, including: A clean, uncontaminated mycelial region was manually selected from the hyperspectral image of the culture medium as a reference sample region; the mean vector of the spectral vectors of all pixels within the reference sample region was calculated. Covariance Matrix For the spectral vector of each pixel in the data cube According to the formula Calculate Mahalanobis distance The Mahalanobis distances of all pixels together constitute the global spectral distortion map.

5. The method for identifying contamination in fruit fungi culture media based on hyperspectral imaging according to claim 1, characterized in that, The anisotropic diffusion term is defined by an anisotropic diffusion tensor determined based on the local structure tensor of the spatial factor graph, including: Calculate each spatial factor plot gradient vector The local structure tensor is constructed by summing the outer products of each gradient vector after Gaussian smoothing. Local structure tensor Calculated using the following formula: ;in, For Gaussian kernel; For local structure tensor Eigenvalues ​​are obtained by performing eigenvalue decomposition. and the corresponding feature vectors Based on this, a non-isotropic diffusion tensor is constructed. Isotropic diffusion tensor Calculated using the following formula: ; in, c are positive parameters that control the diffusion intensity.

6. The method for identifying contamination in fruit fungi culture media based on hyperspectral imaging according to claim 1, characterized in that, The value of the nonlinear response term at each pixel is calculated by combining the pollution affinity coefficients corresponding to each spatial factor map, the pixel values ​​of each spatial factor map at that pixel, and the pixel values ​​of the global spectral distortion map at that pixel, including: At pixel At the point, nonlinear reaction term Calculated using the following formula: ; in, For global spectral distortion map at pixel points pixel values, For the k-th spatial factor map at pixel point pixel values, The pollution affinity coefficient corresponding to the k-th spatial factor map. This represents the summation of the results over k spatial factor graphs.

7. The method for identifying contamination in fruit fungus culture media based on hyperspectral imaging according to claim 1, characterized in that, The iterative update of the reaction-diffusion equation until convergence includes: An iterative solution is performed using an operator splitting scheme. In the (n+1)th iteration, the contamination potential field... The update formula is: ; in, For time step, For the isotropic diffusion tensor, It is a nonlinear reaction term. For divergence operators, For gradient operators, This represents element-wise multiplication. This represents the element-wise square; The conditions for stopping iteration are: iteration stops when the set maximum number of iterations is reached, or when the contamination potential field obtained from two consecutive iterations stops. When the norm difference is less than a preset threshold, it is determined to be converged and the iteration stops.

8. The method for identifying contamination in fruit fungi culture media based on hyperspectral imaging according to claim 1, characterized in that, The threshold segmentation of the converged contamination potential field to obtain a binary mask of the contamination region includes: The converged pollution potential field is used as a grayscale image, and the optimal segmentation threshold T is calculated using Otsu's method. Each pixel of the grayscale image is traversed. If the pixel value of the pixel is greater than or equal to the threshold T, a value of 1 is assigned to the corresponding position in the binary mask; otherwise, a value of 0 is assigned.

9. The method for identifying contamination in fruit fungus culture media based on hyperspectral imaging according to claim 1, characterized in that, The cube for acquiring hyperspectral image data of the culture medium includes: Images of culture medium samples were acquired using a pushbroom or snapshot hyperspectral camera in the spectral range of 400 to 1000 nanometers to obtain the hyperspectral image data cube.

10. A system for identifying contamination in fruit fungi culture media based on hyperspectral imaging, characterized in that, It includes a memory and a processor. The memory stores computer instructions. When the processor executes the computer instructions, it implements the method for identifying contamination in fruit fungi culture media based on hyperspectral imaging as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Hyperspectral image-based method for predicting growth of rot funguses

    CN104297165A

  • Method for quickly classifying bacterial colonies on culture medium on basis of hyperspectral imaging technology

    CN105651679A