Fermented sausage adulteration detection method based on microscopic image analysis

By combining optical microscopy imaging technology and image processing algorithms with support vector machines and cluster analysis, the problem of extracting meat fiber and connective tissue features in sausage quality inspection was solved, and efficient and reliable identification of adulterants was achieved.

CN121767360AActive Publication Date: 2026-03-31NANTONG HUITEXIANG FOOD CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-03
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing sausage quality testing methods struggle to accurately capture the characteristics of meat fibers and connective tissue at the microscopic level. In particular, they are unable to accurately identify adulterants when faced with complex adulterants, leading to a decline in testing efficiency and accuracy.

Method used

Microscopic images of fermented sausages were obtained using optical microscopy imaging technology. Grayscale conversion and edge enhancement were performed, and a threshold segmentation algorithm was used to extract the meat fiber region. Morphological operations were combined to quantify the connective tissue content, and a support vector machine classification model and cluster analysis were used to identify adulterants. Finally, the detection parameters were optimized through neural networks to improve accuracy.

Benefits of technology

It enables precise analysis of the microstructure of meat products and efficient identification of adulteration types, significantly improving the automation and reliability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121767360A_ABST
    Figure CN121767360A_ABST
Patent Text Reader

Abstract

The invention provides a fermented sausage adulteration detection method based on microscopic image analysis, which is characterized in that on the basis of a high-resolution microscopic image, microscopic characteristics of meat fibers and connective tissues are accurately extracted and quantified, and adulterated components and pure meat are effectively distinguished through the characteristics; specifically, a meat fiber region is extracted from an enhanced clear image set, a fiber structure and a background are separated by adopting a threshold segmentation algorithm, a fiber region mask is obtained, and fiber diameter distribution characteristics are judged; if the classification result is determined as an adulteration component, an abnormal distribution subset is extracted from the combination vector, and abnormal features are grouped through clustering analysis to obtain an adulteration type subdivision result; comparing and matching with a preset pure meat microscopic feature library according to an adulteration type subdivision result, judging an area with the matching degree lower than a threshold value, and obtaining a final adulteration identification report; the accurate analysis of the microstructure of the meat product and the efficient identification of the adulteration type are realized, and the automation degree and the reliability of the detection are obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of food testing technology, and in particular to a method for detecting adulteration in fermented sausages based on microscopic image analysis. Background Technology

[0002] Fermented sausages, a popular meat product, are directly related to food safety and consumer health. Researching scientific methods to test their quality is crucial not only for ensuring food authenticity but also for maintaining market fairness and consumer trust. Currently, sausage quality testing is a major focus due to frequent adulteration, which severely impacts product quality and industry reputation. Microscopic image analysis-based detection methods, capable of deeply analyzing the microstructure of ingredients, have become a key direction for solving this problem. However, limitations and technical difficulties in existing technologies mean this field still faces numerous challenges and urgently requires innovative breakthroughs. Current sausage quality testing methods largely rely on chemical analysis or sensory evaluation, which have significant limitations in detecting adulteration. Chemical analysis typically quantitatively detects specific components, such as protein or fat content, but struggles to comprehensively capture complex adulteration methods, such as the addition of plant proteins or inferior meats. Sensory evaluation is influenced by subjective factors, lacking objectivity and repeatability. A common problem with these methods is their inability to reveal the true composition of sausages at the microscopic level, especially when facing novel adulterants, where detection efficiency and accuracy significantly decrease. This makes microstructure-based detection methods a research hotspot. At the microscopic level, sausage quality is closely related to the microstructure of meat fibers, fat globules, and additives. The core technical challenge lies in accurately acquiring and analyzing these microstructural features. The diameter distribution and arrangement patterns of meat fibers in sausages vary depending on the meat source; for example, pork and inferior meat show significant differences in muscle fiber thickness and arrangement. However, acquiring high-resolution microscopic images requires complex and expensive imaging techniques, increasing detection costs and operational difficulty. More importantly, even with clear microscopic images, extracting key features from complex image data, such as the diameter distribution of muscle fibers or the content of connective tissue, and converting them into quantifiable indicators remains an unsolved problem. The extraction and comparison of these features directly affect the accuracy of adulteration detection. Therefore, accurately extracting the features of meat fibers and connective tissue from the microscopic images of sausage samples, and using these features to distinguish different meat sources or identify adulterants, has become a key issue in the field of quality inspection. For example, in actual testing, technicians may need to extract microscopic images from sausage samples, only to find that the distribution characteristics of muscle fiber diameters from different meat sources are difficult to clearly distinguish in the images. This is especially true when the sample is mixed with plant protein or inferior meat, as subtle differences in fiber structure are easily masked by background noise. This situation makes it difficult to accurately determine whether adulteration exists, even when using high-resolution microscopic imaging equipment. Furthermore, the quantitative analysis of connective tissue content is also a major challenge, as its uneven distribution and intertwining with meat fibers increase the complexity of feature extraction. These technical difficulties mean that existing detection methods often fail to provide reliable results when faced with complex adulteration scenarios.Therefore, how to accurately extract and quantify the microscopic features of meat fibers and connective tissue based on high-resolution microscopic images, and effectively distinguish adulterated ingredients from pure meat through these features, has become a key issue in the field of fermented sausage quality testing. Summary of the Invention

[0003] This invention provides a method for detecting adulteration in fermented sausages based on microscopic image analysis, mainly comprising: By collecting fermented sausage samples and using optical microscopy imaging technology, initial microscopic image data were obtained from the samples, resulting in a raw image set containing the distribution of meat fibers and connective tissue. The original image set is subjected to grayscale conversion and edge enhancement processing, and Gaussian filtering is used to remove noise to obtain an enhanced and clear image set for subsequent feature separation. Meat fiber regions are extracted from the enhanced clear image set. A threshold segmentation algorithm is used to separate the fiber structure from the background to obtain a fiber region mask and determine the fiber diameter distribution characteristics. If the standard deviation of the diameter distribution in the fiber region mask exceeds the preset threshold, it is marked as a potential adulteration region, and the connective tissue boundary is refined through morphological operations to obtain the quantified connective tissue content index. A combined vector of quantified connective tissue content index and fiber diameter distribution characteristics is obtained, and a support vector machine classification model is used to classify the vector to determine whether there are adulterants. If the classification result is determined to be adulterated, then an abnormal distribution subset is extracted from the combination vector, and the abnormal features of the group are grouped through cluster analysis to obtain the adulteration type subdivision result; The adulteration type subdivision results are compared and matched with the preset pure meat micro-feature database. Areas with a matching degree lower than the threshold are identified to obtain the final adulteration identification report. High-risk feature subsets are extracted from the final adulteration identification report, and detection parameters are adjusted using a neural network optimization model to obtain an optimized microstructure analysis framework, which is used to improve the accuracy of the next detection.

[0004] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: This invention discloses a method for detecting adulteration in fermented sausages based on microscopic image analysis. Addressing the technical challenge of accurately distinguishing meat fibers from connective tissue and identifying adulteration types in traditional meat product adulteration detection, this invention proposes a solution integrating image processing, feature extraction, and intelligent classification. The invention acquires microscopic images of fermented sausage samples using an optical microscope. Grayscale conversion, Gaussian filtering, and edge enhancement are used to generate a clear image set. A threshold segmentation algorithm is used to extract meat fiber regions and generate a mask, analyzing the fiber diameter distribution characteristics. When the standard deviation of the diameter distribution exceeds the standard, potential adulteration areas are marked, and morphological operations are used to refine the connective tissue boundaries and quantify its content. Combining the combined vector of fiber features and connective tissue content, a support vector machine classification model is applied to determine adulteration components. If adulteration is confirmed, cluster analysis is used to further subdivide the adulteration type, and the results are compared with a feature library of pure meat to generate an adulteration identification report. Finally, detection parameters are optimized based on a neural network to improve subsequent detection accuracy. This invention achieves precise analysis of the microstructure of meat products and efficient identification of adulteration types, significantly improving the automation and reliability of the detection process. Attached Figure Description

[0005] Figure 1 This is a flowchart of a method for detecting adulteration in fermented sausages based on microscopic image analysis according to the present invention.

[0006] Figure 2 This is a schematic diagram of a method for detecting adulteration in fermented sausages based on microscopic image analysis according to the present invention.

[0007] Figure 3 This is another schematic diagram of a method for detecting adulteration in fermented sausages based on microscopic image analysis according to the present invention. Detailed Implementation

[0008] The technical solutions of the present invention will be clearly and thoroughly described below with reference to the accompanying drawings. The described embodiments are merely some embodiments of the present invention.

[0009] like Figure 1-3 This embodiment of a method for detecting adulteration in fermented sausages based on microscopic image analysis may specifically include: Step S101: By collecting fermented sausage samples and using optical microscopy imaging technology, initial microscopic image data is obtained from the samples to obtain an original image set containing the distribution of meat fibers and connective tissue.

[0010] Uniformly distributed sample slices were obtained from fermented sausages using a sample acquisition device. Optical microscopy was used to obtain a set of microscopic images containing the distribution of meat fibers and connective tissue. Image preprocessing algorithms were employed to denoise and enhance the microscopic image set, resulting in clear images of meat fibers and connective tissue. Image segmentation algorithms, based on grayscale values ​​and edge detection, separated the meat fiber and connective tissue regions from the clear images, yielding segmented tissue structure images. If the pixel proportion of the meat fiber region in the segmented tissue structure image exceeded a preset threshold, a feature extraction algorithm was used to calculate the texture features and distribution density of the meat fibers, resulting in a fiber feature dataset. Based on the fiber feature dataset, a clustering analysis algorithm was used to group the meat fibers according to their distribution density, obtaining fiber distribution classification results. By comparing the fiber distribution classification results with a preset tissue structure template, it was determined whether the tissue structure of the fermented sausage met the standard, resulting in a structural consistency judgment result. Based on the structural consistency judgment result, data storage technology was used to save the fiber feature dataset and consistency judgment result to a database, generating tissue structure analysis data.

[0011] For example, 0.5 mm thick slices were collected from fermented sausage samples using automated sampling equipment. A high-precision cutter ensured uniform slices. Immediately after slicing, the slices were placed on glass slides and fixed with a fixative (such as 4% formaldehyde solution) for 10 minutes to maintain the integrity of the tissue structure. Next, the samples were imaged using an optical microscope (400x magnification, 0.2 μm / pixel resolution) with an exposure time of 50 ms. Ten images of different regions were acquired, each 2048 × 2048 pixels, generating a raw image set containing the distribution of meat fibers and connective tissue. This set was saved in TIFF format for lossless storage. The image preprocessing stage used a MATLAB-based image processing algorithm. First, the images were converted to grayscale, from RGB images to 8-bit grayscale. Then, Gaussian filtering (standard deviation σ = 1.5) was applied to remove noise and enhance image clarity. Finally, the Otsu thresholding algorithm was used to automatically determine the threshold.

[0012] For example, with a grayscale threshold of 0.4, meat fibers (high grayscale areas) and connective tissue (low grayscale areas) are separated to generate a binarized image. Morphological operations (such as opening operations, with structuring elements of 3×3 pixel rectangles) are then used to remove noise in small areas while preserving the main tissue structure. The analysis process calculates the pixel proportions of meat fibers and connective tissue in the binarized image to determine the fiber area proportion (e.g., 60%) and the connective tissue proportion (e.g., 30%), and combines this with connected component analysis (based on an 8-neighborhood algorithm) to identify the average fiber length.

[0013] To ensure accuracy, cross-validation was employed, statistically averaging the analysis results from 10 images and calculating the standard deviation (e.g., fiber length standard deviation ±10 micrometers). Fiber orientation was analyzed using Fourier transform to obtain the principal orientation angle (e.g., 45° ± 5°). All steps were automated using scripts, and the data was stored in a database and correlated with fermentation process parameters (e.g., fermentation time 48 hours, temperature 25°C), forming a complete technology chain from sampling to analysis, ensuring traceability and reproducibility. The final image set and analysis data can be used for subsequent process optimization, such as adjusting the fermentation time to improve fiber distribution uniformity.

[0014] Step S102: Perform grayscale conversion and edge enhancement processing on the original image set, and use Gaussian filtering to remove noise to obtain an enhanced clear image set for subsequent feature separation.

[0015] The pixel intensity distribution is obtained from the second image set and histogram equalization is applied to obtain the third image set. Texture features are extracted from the third image set, and texture parameters are calculated using the gray-level co-occurrence matrix to generate a texture feature set. If the feature values ​​in the texture feature set exceed a preset threshold, K-means clustering is used to group the features, resulting in feature classification. Based on the feature classification results, a region growing algorithm is used to separate the target region, generating a segmented image set. Morphological features are extracted from the segmented image set and skeletonization is applied to obtain a morphological feature set. If the morphological feature set matches a preset template with a degree higher than a threshold, data storage technology is used to save the morphological feature set to a database, generating a feature analysis dataset. Based on the feature analysis dataset, statistical analysis methods are used to calculate distribution characteristics and determine the final image structure determination result.

[0016] For example, starting with the original image set of fermented sausages, the OpenCV library in Python is used for grayscale conversion, transforming the 2048×2048 pixel RGB images into 8-bit grayscale images using the `cv2.cvtColor` function, preserving pixel values ​​between 0-255 to ensure complete grayscale information. Next, Gaussian filtering is applied to remove noise, with a filter kernel size of 5×5 pixels and a standard deviation σ=2.0. This is then processed using the `cv2.GaussianBlur` function to generate a smooth image set, reducing the interference of random noise on subsequent feature separation. To enhance edge features, the Canny edge detection algorithm is used, setting a low threshold of 50 and a high threshold of 150 to detect edge contours in the grayscale image, generating a binarized image containing meat fibers and connective tissue edges. Edge pixel values ​​are set to 255, and non-edge values ​​to 0. To further improve image clarity, Laplacian sharpening was performed using a 3×3 pixel kernel. The second derivative was calculated using the cv2.Laplacian function to enhance the boundary contrast between fibers and connective tissue, outputting a sharpened image set. All processed images were saved in PNG format to ensure lossless storage. During analysis, the pixel distribution of the edge detection images was calculated, and the proportion of edge pixels to total pixels was statistically analyzed (e.g., 10%). Hough transform was used to identify the linear features of fibers, with an angular resolution of 1° and a minimum detection line length of 100 pixels, yielding the principal direction angle of fiber distribution (e.g., 30°±3°). To ensure the reliability of the results, the edge features of 10 images were statistically analyzed, and the standard deviation of edge density (e.g., ±0.5%) was calculated. The results were correlated with fermentation process parameters (e.g., pH 5.5) and stored in a MySQL database. Data traceability was achieved through automated scripts, ensuring that subsequent feature separation algorithms could directly call upon the enhanced image set.

[0017] Step S103: Extract the meat fiber region from the enhanced clear image set, use a threshold segmentation algorithm to separate the fiber structure from the background, obtain the fiber region mask, and determine the fiber diameter distribution characteristics; The specific algorithm is as follows:

[0018] Where T(x,y) represents the adaptive threshold, W(x,y) represents the local window centered at (x,y), I(u,v) represents the gray value of the image pixel, and |W| represents the number of pixels in the window, which is used to separate the fiber region from the background to obtain a preliminary fiber region mask; Pixel grayscale values ​​are obtained from a set of clear images. An adaptive threshold segmentation algorithm is used to separate the meat fiber region from the background, resulting in a preliminary fiber region mask. Based on the preliminary fiber region mask, morphological closing operations are applied to process the fiber region boundaries to eliminate small-area noise, resulting in an optimized fiber region mask. Fiber diameters are extracted from the optimized fiber region mask, and the width of the fiber region is calculated using Euclidean distance transformation, resulting in a set of fiber diameters.

[0019]

[0020] D(p) represents the fiber diameter, and p represents the number of pixels within the fiber region. This indicates the boundary of the optimized fiber region mask. This represents the Euclidean distance, used to calculate the width of the fiber region to obtain the set of fiber diameters.

[0021] For the fiber diameter set, histogram statistics are used to calculate the diameter distribution characteristics, obtaining fiber diameter distribution parameters. If the fiber diameter distribution parameters match a preset template distribution better than a threshold, principal component analysis is used to extract the main trends in fiber diameter variation, obtaining a fiber diameter feature set. Based on the fiber diameter feature set, the mean-shift algorithm is used to group the fiber diameters, obtaining fiber diameter classification results. From the fiber diameter classification results, the spatial distribution characteristics of fiber regions are extracted, and a grid partitioning method is used to calculate the density distribution of fiber regions, obtaining a spatial feature set of fiber structures.

[0022] For example, starting with an enhanced, clear image set, the Otsu thresholding algorithm is used to automatically determine the optimal threshold, separating the fiber structure from the background and generating a binary mask. The pixel value of the fiber region is set to 255, and the background is set to 0. The image used is a 2048×2048 pixel PNG grayscale image. Otsu segmentation is implemented using the OpenCV function `cv2.threshold`, automatically calculating the threshold (e.g., 180) to ensure maximum contrast between the fiber region and the background. Next, morphological closing operations are performed on the binary mask, using 7×7 pixel elliptical structuring elements. The `cv2.morphologyEx` function is used to eliminate noise in small areas and fill in tiny holes within the fiber region, maintaining the continuity of the fiber structure. Then, the fiber region is extracted based on connected component analysis. The `cv2.connectedComponentsWithStats` function is applied to label each connected component, calculate its area, filter out non-fiber regions with an area less than 500 pixels, retain the main fiber structure, and generate the final fiber region mask. To analyze the fiber diameter distribution characteristics, a distance transformation algorithm is employed. The `cv2.distanceTransform` function calculates the Euclidean distance from each fiber pixel in the mask to its nearest background pixel, yielding a thickness map of the fiber region. The maximum distance value (e.g., 20 pixels) reflects the peak fiber diameter. Further statistical analysis of the diameter distribution is performed, constructing a histogram with a bin width of 2 pixels. The mean (e.g., 15.5 pixels) and standard deviation (e.g., ±2.3 pixels) of the diameter distribution are calculated, and the results are stored in a MySQL database. SQLINSERT statements are used to record the fiber diameter statistics for each image, which are then correlated with fermentation process parameters (e.g., fermentation time of 48 hours) to generate a unique identifier for subsequent traceability. The entire process is automated using a Python script. After processing 10 images, the average standard deviation of the fiber diameter distribution (e.g., ±0.8 pixels) is calculated to ensure the stability of feature extraction. All output masks are saved in PNG format to a specified path.

[0023] Step S104: If the standard deviation of diameter distribution in the fiber region mask exceeds a preset threshold, it is marked as a potential adulteration region, and the connective tissue boundary is refined through morphological operations to obtain the quantified connective tissue content index.

[0024] If the standard deviation of the diameter distribution in the fiber region mask exceeds a preset threshold, a region labeling algorithm is used to identify potential adulterant regions, resulting in a labeled region set. Based on this set, morphological thinning operations are applied to the connective tissue boundaries, yielding a thinned boundary image. Connective tissue regions are extracted from the thinned boundary image, and the connective tissue content is calculated using pixel counting, resulting in content distribution data. Histogram analysis is used to statistically analyze the content distribution characteristics, resulting in a content distribution parameter set. If the mean of the content distribution parameter set deviates from a preset range, a mean-shifting algorithm is used to group the content distribution, resulting in grouped content categories. Based on these grouped content categories, a grid partitioning method is used to calculate the spatial density of the connective tissue regions, resulting in spatial density distribution data. Local density peaks are extracted from the spatial density distribution data, and cluster analysis is used to determine the spatial distribution characteristics of adulterant regions, resulting in a set of adulterant region features.

[0025] For example, starting with a 2048×2048 pixel PNG grayscale image, for the fiber region mask, firstly, a histogram of fiber diameter distribution is generated, with the bin width set to 1.5 pixels. The standard deviation is calculated, assuming a standard deviation of 3.2 pixels, and a preset threshold of 2.5 pixels. Regions exceeding the threshold are marked as potential adulteration regions. The marking process is automated using a Python script, using NumPy's std function to calculate the standard deviation of the diameter distribution, and setting the pixel value of connected components exceeding the threshold to 128 to distinguish normal regions (255) from the background (0). Next, morphological refinement is performed on the regions marked as potential adulteration regions. A 3×3 pixel cross-shaped structuring element is used, and the refinement operation (MORPH_THIN) is performed using OpenCV's cv2.morphologyEx function, iterating 3 times to sharpen the connective tissue boundary, retaining a boundary pixel width of 1 pixel, and generating a refined binary mask. Next, the connective tissue content was quantified based on the refined mask. The `cv2.countNonZero` function was used to count the total number of non-zero pixels in the mask. Assuming a total pixel count of 150,000, combined with the total image area (2048×2048 pixels), the connective tissue percentage was calculated to be 3.58%. To ensure logical rigor, the quantification result was correlated with production batch parameters (e.g., batch number A123, processing temperature 65°C). The percentage data, standard deviation (3.2 pixels), and batch information were stored in a PostgreSQL database using an SQL INSERT statement, generating a unique identifier (e.g., UUID8f7b3a2c). Finally, the refined mask was saved as a PNG file to a specified path, with the filename being a combination of the batch number and timestamp (e.g., A123_20251013). The entire process was executed using a Python automated script. After processing 15 images, the average connective tissue percentage (e.g., 3.62%) was calculated and recorded for subsequent quality traceability.

[0026] Step S105: Obtain the combined vector of the quantified connective tissue content index and fiber diameter distribution characteristics, and use the support vector machine classification model to classify the vector to determine whether there are any adulterants.

[0027] A fiber region mask is obtained, and fiber diameter distribution data is extracted. The mean and variance of the diameter are calculated to obtain a statistical feature set. If the variance of the statistical feature set exceeds a preset threshold, principal component analysis is used to reduce the dimensionality of the diameter distribution data, resulting in a dimensionality-reduced feature vector. The dimensionality-reduced feature vector is then classified using a support vector machine (SVM) classification model to obtain preliminary classification results. Based on the preliminary classification results, regions classified as adulterated are extracted, and the spatial distribution characteristics of fiber diameter within these regions are calculated to obtain a spatial distribution vector. If the local density of the spatial distribution vector exceeds a preset threshold, the mean-shift algorithm is used to cluster the spatial distribution vector, resulting in clustering results.

[0028]

[0029] This represents the update point of the cluster center due to mean drift. Represents the neighborhood points in the spatial distribution vector. K represents the kernel window neighborhood, K represents the kernel function, and h represents the bandwidth parameter, used for clustering and grouping adulterated regions.

[0030] By analyzing the clustering results, the area proportion of each fiber region is calculated to obtain proportion distribution data. Based on this distribution data, histogram analysis is used to statistically analyze the proportion distribution characteristics, providing the final basis for adulteration judgment.

[0031] For example, starting with a 2048×2048 pixel PNG grayscale image, a fiber region mask is first generated. The Otsu thresholding method is used, and the fiber region is automatically segmented using OpenCV's `cv2.threshold` function to obtain a binary mask, where the fiber region pixel value is 255 and the background is 0. Next, the fiber diameter distribution characteristics are calculated. Euclidean distance transform (`cv2.distanceTransform`) is used to determine the distance of each fiber pixel to the nearest background, generating a diameter distribution histogram. The bin width is set to 2.0 pixels, and the skewness of the distribution is calculated (using SciPy's `stats.skew` function). Assuming a skewness of 0.85, it characterizes the asymmetry of the fiber diameter distribution. Simultaneously, connective tissue content indicators are extracted. Connected components are analyzed using the `cv2.connectedComponentsWithStats` function, and the area of ​​each connected component is calculated. Assuming an average area of ​​12000 pixels, combined with the total image area (2048×2048 pixels), the connective tissue proportion is calculated to be 2.86%. The skewness (0.85), average area (12000 pixels), and connective tissue percentage (2.86%) were used to construct a feature vector, which was then used to construct a 3D vector [0.85, 12000, 2.86] using NumPy's array function. Subsequently, a Support Vector Machine (SVM) classification model was employed, using the SVC class from Scikit-learn (kernel function RBF, C=1.0, gamma=0.1) to classify the feature vector. The training data consisted of 1000 labeled samples (500 normal, 500 adulterated). A classification result of 1 indicated adulteration, and 0 indicated normality; the predicted result was assumed to be 1. The classification results were correlated with production batch parameters (batch number B456, processing humidity 75%). The feature vector, classification results, and batch information were stored in a MySQL database using an SQL INSERT statement, generating a unique identifier (e.g., UUID9c4d5e6f). Finally, the feature vectors and classification results were saved in JSON format to the path / data / B456_20251013.json. An automated script processed 10 images, calculated the average connective tissue percentage to be 2.90%, and stored them in the database to support quality analysis.

[0032] Step S106: If the classification result is determined to be an adulterated component, then extract the abnormal distribution subset from the combination vector, and obtain the adulteration type subdivision result by cluster analysis of the abnormal group characteristics.

[0033] Anomaly subsets are obtained from the combined vector data. Density clustering is used to group these subsets, yielding preliminary grouping results. Based on these preliminary groupings, anomaly feature sets are extracted for each group, and the statistical mean of each feature set is calculated, resulting in feature mean data. If the feature mean data exceeds a preset threshold, principal component analysis is used to reduce the dimensionality of the anomaly feature sets, resulting in dimensionality-reduced feature vectors. Based on these dimensionality-reduced feature vectors, a support vector machine (SVM) classification model is used to classify the vectors, resulting in categorical feature subsets. Spatial distribution characteristics are extracted from these categorical feature subsets, and local density values ​​between characteristics are calculated, resulting in density distribution data. If the local density values ​​of the density distribution data exceed a preset threshold, a mean-shift algorithm is used to perform secondary clustering on the density distribution data, resulting in final adulteration type groupings. Based on these final adulteration type groupings, the proportion of spatial distribution characteristics in each group is statistically analyzed, yielding the adulteration type distribution results.

[0034] For example, after extracting feature vectors from a 2048×2048 pixel PNG grayscale image, if the support vector machine classification result is 1 (indicating adulteration), an anomalous subset is selected from the feature vector set. Assume the feature vectors contain the mean fiber length (e.g., 150.5 pixels), fiber density (e.g., 0.012 fibers / pixel^2), and mean connective tissue strength (e.g., 180.0, based on grayscale value). Using NumPy's `where` function, vectors with a mean fiber length greater than 145 pixels or a fiber density less than 0.015 fibers / pixel^2 are selected, resulting in an anomalous subset; assuming 200 anomalous vectors are selected. Next, the K-means clustering algorithm (using Scikit-learn's `KMeans` class, setting the number of clusters k=3 and the random seed to 42) is used to group the anomalous subset, generating three clusters based on the three-dimensional spatial distance of the feature vectors, each representing a different type of adulteration.

[0035] For example, additive types A, B, and C. After clustering, the coordinates of the center point of each cluster are calculated. Assume the center of cluster 1 is [160.2, 0.010, 185.5], the center of cluster 2 is [148.7, 0.013, 178.2], and the center of cluster 3 is [155.0, 0.009, 190.1]. To determine the adulteration type, a predefined adulteration type mapping table (stored in a MySQL database, table name `adulteration_map`) is used. The cluster centers are matched with the feature ranges in the mapping table using an SQL SELECT statement. Assume cluster 1 corresponds to additive type A (starch-based adulteration, feature range: fiber length > 158, density < 0.011). The clustering results are associated with production batch parameters (batch number C789, processing temperature 22℃) to generate a unique identifier (e.g., UUID 7a8b9c0d), which is then stored in the database table `results_cluster` using an SQL INSERT statement, containing the cluster center, adulteration type, and batch information. Finally, the clustering results are saved in JSON format to the path / data / C789_20251013_cluster.json. An automated script processes the five images, calculates the average fiber density as 0.011 fibers / pixel^2, and stores it in the database to support adulteration traceability analysis.

[0036] Step S107: Compare and match the adulteration type subdivision results with the preset pure meat microscopic feature library, determine the matching degree below the threshold area, and obtain the final adulteration identification report.

[0037] Anomaly subsets are extracted from the adulteration identification data. The cosine similarity method is used to calculate the similarity between these subsets and a pure meat database, yielding similarity distribution data. If the average value of the similarity distribution data is below a preset threshold, the anomalous feature subsets are grouped using k-means clustering, resulting in anomalous feature grouping data. Based on these groupings, the variance of each feature group is calculated, yielding variance distribution data. If the maximum value of the variance distribution data exceeds a preset threshold, principal component analysis is used to reduce the dimensionality of the anomalous feature groupings, yielding dimensionality-reduced feature data. The Manhattan distance between each feature group and the pure meat database is calculated using the dimensionality-reduced feature data, resulting in a distance distribution set. If the mean of the distance distribution set is below a preset threshold, the dimensionality-reduced feature data is classified using a logistic regression model, yielding final adulteration classification data. Based on the final adulteration classification data, the proportion of each type of adulteration feature is statistically analyzed, yielding adulteration feature distribution data.

[0038] For example, a feature vector set extracted from a 2048×2048 pixel PNG grayscale image includes fiber texture complexity (e.g., 0.85, based on the gray-level co-occurrence matrix), mean intercellular space (e.g., 12.3 pixels), and collagen fiber strength (e.g., 175.6, based on grayscale value). First, the feature vector set is compared with a pre-defined pure meat microscopic feature library (stored in a PostgreSQL database, table name `pure_meat_features`). The feature library contains standard value ranges, such as fiber texture complexity 0.90-1.00, intercellular space 10.0-11.5 pixels, and collagen fiber strength 180.0-190.0. Using the `cosine_similarity` function from Python's SciPy library, the cosine similarity between each feature vector and its corresponding standard vector in the feature library is calculated; assuming a similarity of 0.92 for a given vector. A matching threshold of 0.95 is set. If the similarity is lower than 0.95, it is marked as an anomaly, resulting in an anomaly vector set. Assume 150 vectors are selected. Next, based on the anomaly vector set, density clustering is performed using the DBSCAN algorithm (using the DBSCAN class in Scikit-learn, with eps=0.5 and min_samples=5) to generate clusters. Assume two clusters are obtained, with center points [0.83, 12.8, 172.3] and [0.87, 11.9, 178.5], respectively. Using an SQLSELECT statement, the feature range of the cluster centers is matched from the `adulteration_types` table in the database. Assume the first cluster matches protein adulteration (feature range: texture complexity < 0.85, intercellular space > 12.5), and the second cluster matches plant fiber adulteration (feature range: collagen fiber strength < 175.0). The results are associated with the production batch information (batch number D456, processing humidity 65%) to generate a unique identifier (e.g., UUID8e9f0a1b). This identifier is then stored in the database table `adulteration_report` via an SQL INSERT statement, containing cluster centers, adulteration type, and batch information. Finally, the report is saved in JSON format to ` / data / D456_20251013_report.json`. An automated script processes 10 images, calculates an average texture complexity of 0.86, and stores the results in the database to support quality traceability.

[0039] Step S108: Extract a subset of high-risk features from the final adulteration identification report, and use a neural network optimization model to adjust the detection parameters to obtain an optimized microstructure analysis framework, which is used to improve the accuracy of the next detection.

[0040] High-risk feature subsets are extracted from the final adulteration identification report. A convolutional neural network (CNN) model is used for initial classification of these subsets to obtain preliminary classification data. If the confidence level of the preliminary classification data is lower than a preset threshold, a support vector machine (SVM) model is used for secondary classification of the high-risk feature subsets to obtain optimized classification data. Based on the optimized classification data, the microstructure vector representation of each feature subset is calculated to obtain a set of structure vectors. Using the structure vector set, the cosine similarity method is used to calculate the similarity between each vector and a preset pure sample library to obtain similarity distribution data. If the mean of the similarity distribution data is lower than a preset threshold, the structure vector set is restructured to obtain restructured feature data. Based on the restructured feature data, the detection parameters of the CNN are adjusted to obtain an optimized parameter configuration. Using the optimized parameter configuration, the microstructure analysis framework is updated to obtain the final analysis framework data.

[0041] For example, when extracting a high-risk feature subset from an adulteration identification report, the process first uses an SQL SELECT statement to query the report with batch number D789 from the `adulteration_report` table in the database to obtain a JSON file containing anomalous feature vectors. Assuming 200 anomalous vectors are extracted, each vector contains fiber distribution uniformity of 0.78 (based on grayscale gradient statistics), cell boundary sharpness of 15.2 pixels (based on edge detection), and protein density of 160.8 (based on optical density analysis). Next, the Pandas library in Python is used to filter out the high-risk feature subset, setting thresholds: fiber distribution uniformity < 0.80, cell boundary sharpness > 14.5 pixels, and protein density < 165.0, resulting in 80 high-risk vectors. Based on these vectors, a three-layer feedforward neural network was constructed (using the TensorFlow framework, with 128 hidden layer nodes, ReLU activation function, and a learning rate of 0.001). The input was a high-risk feature vector, and the output was the adjusted weights for the detection parameters. After training for 100 epochs, the loss function (mean squared error) converged to 0.015, resulting in an optimized parameter set. For example, the fiber distribution weights were adjusted from 0.5 to 0.62. To generate an optimized microstructure analysis framework, the adjusted parameters were applied to the feature extraction algorithm. The kernel size for grayscale gradient statistics was updated from 5x5 to 7x7, and the Sobel threshold for edge detection was increased from 0.1 to 0.15. For validation, 10 2048×2048 pixel PNG images were processed, and the average fiber distribution uniformity was calculated to be 0.79. Compared with historical data (stored in the PostgreSQL table `historical_features`, with an average value of 0.77), an improvement of 2.6% was confirmed. The optimized framework uses SQLINSERT statements to store new parameters into the database table detection_params, generating a record with UUID 9a2b7f4c, and saving it in JSON format to the path / data / D789_20251013_params.json to support automated invocation and quality traceability for the next detection.

[0042] The above description is merely an example and illustration of the structure of the present invention. Those skilled in the art can make various modifications or additions to the specific embodiments described, or use similar methods to replace them, as long as they do not deviate from the structure of the invention or exceed the scope defined in the claims, all of which should fall within the protection scope of the present invention.

Claims

1. A method for detecting adulteration in fermented sausages based on microscopic image analysis, characterized by, The method comprises: obtaining initial micro image data from the sample by collecting a fermented sausage sample and using optical microscope imaging technology to obtain an original image set containing meat fiber and connective tissue distribution; performing gray scale conversion and edge enhancement processing on the original image set, removing noise by using Gaussian filtering, and obtaining a clear image set after enhancement, which is used for subsequent feature separation; extracting the meat fiber region from the clear image set after enhancement, separating the fiber structure from the background by using a threshold segmentation algorithm to obtain a fiber region mask, and judging the fiber diameter distribution characteristics; if the standard deviation of the diameter distribution in the fiber region mask exceeds a preset threshold, marking it as a potential adulteration area, and refining the connective tissue boundary by morphological operation to obtain a quantified connective tissue content index; obtaining a combination vector of the quantified connective tissue content index and the fiber diameter distribution characteristics, classifying the vector by using a support vector machine classification model, and determining whether there is an adulteration component; if the classification result determines that there is an adulteration component, extracting an abnormal distribution subset from the combination vector, and grouping abnormal features by clustering analysis to obtain an adulteration type subdivision result; comparing and matching the adulteration type subdivision result with a preset pure meat micro feature library to judge the matching degree of a region below a threshold value, and obtaining a final adulteration identification report; extracting a high-risk feature subset from the final adulteration identification report, adjusting the detection parameters by using a neural network optimization model, obtaining an optimized microstructure analysis framework, and using it to improve the accuracy of the next detection.

2. A method for detecting adulteration in fermented sausages based on microscopic image analysis according to claim 1, characterized in that, The method comprises: obtaining initial micro image data from the sample by collecting a fermented sausage sample and using optical microscope imaging technology to obtain an original image set containing meat fiber and connective tissue distribution; obtaining a uniform distribution of sample slices from the fermented sausage by using a sample collection device, and obtaining a micro image set containing meat fiber and connective tissue distribution by using optical microscope imaging technology; performing denoising and enhancement processing on the micro image set by using an image preprocessing algorithm to obtain clear meat fiber and connective tissue images; separating the meat fiber and connective tissue regions from the clear images based on gray value and edge detection by using an image segmentation algorithm to obtain segmented tissue structure images; if the pixel ratio of the meat fiber region in the segmented tissue structure image exceeds a preset threshold, calculating the texture features and distribution density of the meat fiber by using a feature extraction algorithm to obtain a fiber feature data set; grouping the meat fiber according to the distribution density by using a clustering analysis algorithm based on the fiber feature data set to obtain a fiber distribution classification result; determining whether the tissue structure of the fermented sausage conforms to the standard by comparing the fiber distribution classification result with a preset tissue structure template to obtain a structure consistency determination result; 3. A method for detecting adulteration in fermented sausages based on microscopic image analysis as claimed in claim 1, wherein, storing the fiber feature data set and the consistency determination result to a database by using a data storage technology based on the structure consistency determination result to generate tissue structure analysis data. The method comprises: Obtaining pixel intensity distribution from the second image set, using histogram equalization processing to obtain the third image set; Extracting texture features from the third image set, using gray level co-occurrence matrix to calculate texture parameters, and generating a texture feature set; If the feature value in the texture feature set exceeds the preset threshold, using K-means clustering algorithm to group the features to obtain the feature classification result; According to the feature classification result, using region growing algorithm to separate the target region, and generating a segmented image set; Extracting morphological features from the segmented image set, using skeletonization processing to obtain a morphological feature set; If the morphological feature set matches the preset template with a degree higher than the threshold, using data storage technology to save the morphological feature set to the database to generate a feature analysis data set; According to the feature analysis data set, using statistical analysis method to calculate the distribution characteristics, and determining the final image structure judgment result.

4. A method for detecting adulteration in fermented sausages based on microscopic image analysis as claimed in claim 1, wherein, The meat fiber region is extracted from the enhanced clear image set, and a threshold segmentation algorithm is used to separate the fiber structure and the background to obtain a fiber region mask to judge the fiber diameter distribution characteristics; The specific algorithm is as follows: ; Wherein, T(x, y) represents an adaptive threshold, W(x, y) represents a local window with (x, y) as the center, I(u, v) represents an image pixel gray value, and |W| represents the number of window pixels, which is used to separate the fiber region and the background to obtain a preliminary fiber region mask; It includes: obtaining pixel gray value from the clear image set, using adaptive threshold segmentation algorithm to separate meat fiber region and background, and obtaining preliminary fiber region mask; According to the preliminary fiber region mask, the fiber region boundary is processed by morphological closing operation to eliminate small area noise, and an optimized fiber region mask is obtained; From the optimized fiber region mask, the fiber diameter is extracted, and the width of the fiber region is calculated by Euclidean distance transformation to obtain a fiber diameter set; ; D(p) represents the fiber diameter, p represents the pixel point within the fiber region, represents the boundary of the optimized fiber region mask, represents the Euclidean distance, used to calculate the fiber region width to obtain the fiber diameter set; For the fiber diameter set, the histogram statistical method is used to calculate the diameter distribution characteristics to obtain the fiber diameter distribution parameters; If the fiber diameter distribution parameters match the preset template distribution with a degree higher than the threshold, the principal component analysis method is used to extract the main change trend of the fiber diameter to obtain a fiber diameter feature set; According to the fiber diameter feature set, the mean shift algorithm is used to group the fiber diameter to obtain the fiber diameter classification result; From the fiber diameter classification result, the spatial distribution characteristics of the fiber region are extracted, and the grid division method is used to calculate the density distribution of the fiber region to obtain a spatial feature set of the fiber structure.

5. A method for detecting adulteration in fermented sausages based on microscopic image analysis as claimed in claim 1, wherein, If the diameter distribution standard deviation in the fiber region mask exceeds the preset threshold, it is marked as a potential adulteration region, and the connective tissue boundary is refined by morphological operation to obtain a quantitative connective tissue content index, including: If the diameter distribution standard deviation in the fiber region mask is greater than the preset threshold, the region marking algorithm is used to identify the potential adulteration region to obtain a marked region set; According to the marked region set, the connective tissue boundary is processed by morphological refinement operation to obtain a refined boundary image; From the refined boundary image, the connective tissue region is extracted, and the pixel counting method is used to calculate the connective tissue content to obtain the content distribution data; For the content distribution data, a histogram analysis method is used to analyze the content distribution characteristics, and a content distribution parameter set is obtained; If the mean value in the content distribution parameter set deviates from the preset range, a mean shift algorithm is used to group the content distribution, and a grouped content category is obtained; According to the grouped content category, a grid division method is used to calculate the spatial density of the connective tissue area, and spatial density distribution data is obtained; From the spatial density distribution data, local density peaks are extracted, and a clustering analysis method is used to determine the spatial distribution characteristics of the adulteration area, and an adulteration area feature set is obtained.

6. A method for detecting adulteration in fermented sausages based on microscopic image analysis as claimed in claim 1, wherein, The combination vector of the quantized connective tissue content index and the fiber diameter distribution characteristics is obtained, and a support vector machine classification model is used to classify the vector to determine whether there is an adulteration component, including: Obtain the fiber area mask, extract the fiber diameter distribution data, calculate the mean and variance of the diameter, and obtain a statistical feature set; If the variance in the statistical feature set exceeds the preset threshold, a principal component analysis method is used to reduce the dimension of the diameter distribution data, and a reduced feature vector is obtained; The reduced feature vector is classified by a support vector machine classification model to obtain a preliminary classification result; According to the preliminary classification result, the area classified as adulteration is extracted, and the spatial distribution characteristics of the fiber diameter in the area are calculated to obtain a spatial distribution vector; If the local density of the spatial distribution vector exceeds the preset threshold, a mean shift algorithm is used to cluster the spatial distribution vector to obtain a clustering grouping result; ; denotes a mean shift clustering center update point, denotes a neighborhood point in the spatial distribution vector, denotes a kernel window neighborhood, K denotes a kernel function, h denotes a bandwidth parameter, for clustering grouping fraud regions; Through the clustering grouping result, the area ratio of each group of fiber regions is calculated to obtain an area ratio distribution data; According to the area ratio distribution data, a histogram analysis method is used to analyze the area ratio distribution characteristics, and a final adulteration judgment basis is obtained.

7. A method for detecting adulteration in fermented sausages based on microscopic image analysis as claimed in claim 1, wherein, If the classification result is determined to be an adulteration component, an abnormal distribution subset is extracted from the combination vector, and the abnormal features are grouped by clustering analysis to obtain an adulteration type subdivision result, including: An abnormal distribution subset is obtained from the combination vector data, and a density clustering method is used to group the abnormal distribution subset to obtain a preliminary grouping result; According to the preliminary grouping result, the abnormal feature set of each group is extracted, and the statistical mean of each group is calculated to obtain a feature mean data; If the feature mean data exceeds the specified range compared with the preset threshold, a principal component analysis method is used to reduce the dimension of the abnormal feature set to obtain a reduced feature vector; According to the reduced feature vector, a support vector machine classification model is used to classify the vector to obtain a classification feature subset; From the classification feature subset, the spatial distribution characteristics are extracted, the local density values between the characteristics are calculated, and density distribution data is obtained; If the local density value of the density distribution data exceeds the preset threshold, a mean shift algorithm is used to perform secondary clustering on the density distribution data to obtain a final adulteration type grouping; According to the final adulteration type grouping, the spatial distribution characteristics of each group are counted to obtain an adulteration type distribution result.

8. A method for detecting adulteration in fermented sausages based on microscopic image analysis as claimed in claim 1, wherein, According to the adulteration type subdivision result and the preset pure meat micro feature library, a region with a matching degree lower than a threshold is obtained, and a final adulteration identification report is obtained, including: Extracting an abnormal feature subset from the adulteration identification data, calculating the similarity of the abnormal feature subset and the pure meat library using the cosine similarity method to obtain similarity distribution data; If the average value of the similarity distribution data is lower than the preset threshold, grouping the abnormal feature subset through the k-means clustering algorithm to obtain abnormal feature grouping data; According to the abnormal feature grouping data, calculating the variance value of each group of features to obtain variance distribution data; If the maximum value of the variance distribution data exceeds the preset threshold, reducing the dimension of the abnormal feature grouping data using the principal component analysis method to obtain reduced dimension feature data; Through the reduced dimension feature data, calculating the Manhattan distance of each group of features and the pure meat library to obtain a distance distribution set; If the average value of the distance distribution set is lower than the preset threshold, classifying the reduced dimension feature data through the logistic regression model to obtain final adulteration classification data; According to the final adulteration classification data, calculating the proportion of each type of adulteration feature to obtain adulteration feature distribution data.

9. A method of detecting adulteration in fermented sausages based on microscopic image analysis as claimed in claim 1, wherein, The high-risk feature subset is extracted from the final adulteration identification report, and the detection parameters are adjusted using a neural network optimization model to obtain an optimized microstructure analysis framework for improving the accuracy of the next detection, including: The high-risk feature subset is extracted from the final adulteration identification report, and the convolutional neural network model is used to classify the feature subset to obtain preliminary classification data; If the confidence of the preliminary classification data is lower than the preset threshold, the support vector machine model is used to classify the high-risk feature subset again to obtain optimized classification data; According to the optimized classification data, calculating the microstructure vector representation of each feature subset to obtain a structure vector set; Through the structure vector set, the cosine similarity method is used to calculate the similarity of each vector and the preset pure sample library to obtain similarity distribution data; If the average value of the similarity distribution data is lower than the preset threshold, the structure vector set is reorganized to obtain reorganized feature data; According to the reorganized feature data, adjusting the detection parameters of the convolutional neural network to obtain optimized parameter configurations; Through the optimized parameter configurations, updating the microstructure analysis framework to obtain final analysis framework data.

Citation Information

Patent Citations

  • Fiber segmentation method, diameter calculation method, storage medium and device

    CN115205222A

  • Textile defect classification detection method

    CN119313943A

  • Microscopic vision detection method for mixing animal-derived adulterated raw materials into fish meal

    CN120107958A

  • Figure data analysis-based fiber identification system in antibacterial polyester-cotton composite fiber

    CN120472455A