An artificial intelligence-based food colony detection analysis method and system
By employing gradient elution-layered filtration pretreatment and AI dual-branch attention fusion analysis, the problems of long detection time and low classification accuracy in food colony detection have been solved, enabling real-time detection and accurate estimation of low-concentration colony concentrations, thereby improving the ability to prevent and control food safety risks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YINUO (TIANJIN) TESTING SERVICE CO LTD
- Filing Date
- 2025-11-07
- Publication Date
- 2026-06-26
Smart Images

Figure CN121521798B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and more specifically, to an artificial intelligence-based method and system for detecting and analyzing bacterial colonies in food. Background Technology
[0002] Food safety is a core concern in the field of public health. During production, processing, transportation, and storage, food is susceptible to microbial contamination and bacterial colony growth. The types and concentrations of these colonies (especially pathogenic ones) directly determine the safety of the food. Therefore, accurate and efficient detection and analysis of bacterial colonies in food is crucial for controlling food safety risks and protecting consumer health. This is particularly true for ready-to-eat foods and cold-chain foods, which have short distribution cycles and are directly accessible to consumers, placing higher demands on the accuracy, timeliness, and low-concentration detection capabilities of bacterial colony testing.
[0003] A food colony detection method is available. First, the food sample to be tested is aseptically homogenized. Then, the homogenized sample solution is inoculated into a specific culture medium and incubated at a constant temperature for a preset time. After visible colonies form on the culture medium, the size, color, edge morphology and other appearance characteristics of the colonies are observed by optical microscope. The colony types are classified by combining experience. At the same time, the number of colonies on the culture medium is counted by plate counting method, and then the colony concentration in the food sample is calculated.
[0004] The existing solutions mentioned above have several drawbacks: First, the culture process takes a long time (usually 24-72 hours), which is insufficient to meet the immediate testing needs in fast-moving food distribution scenarios. Second, relying solely on the appearance of colonies for classification is susceptible to factors such as the angle of observation and the growth state of the colonies, resulting in low classification accuracy. Furthermore, the plate counting method has a large statistical error for low-concentration colonies (such as less than 100 CFU per gram of sample), which cannot accurately reflect the actual degree of food contamination and is therefore insufficient to effectively support the prevention and control of food safety risks. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a food microbial colony detection and analysis method and system based on artificial intelligence, which can at least alleviate the aforementioned technical problems.
[0006] The technical solutions provided in this application are as follows:
[0007] A method and system for detecting and analyzing bacterial colonies in food based on artificial intelligence, the method comprising:
[0008] Step 1: Perform gradient elution-layer filtration pretreatment on the food sample to be tested to generate a sample with impurities removed.
[0009] Step 2: Simultaneously perform colony microscopic image acquisition and near-infrared spectral data acquisition on the impurity-removed colony samples to generate initial multimodal data;
[0010] Step 3: Perform spatiotemporal calibration on the initial multimodal data to generate spatiotemporally calibrated multimodal data;
[0011] Step 4: Perform multi-dimensional colony feature extraction and screening on the spatiotemporally calibrated multimodal data to generate a strongly correlated feature subset;
[0012] Step 5: Perform AI dual-branch attention fusion analysis on the strongly correlated feature subset to generate colony classification results and estimated colony concentration values;
[0013] Step 6: Perform multi-reference system correction on the colony classification results and estimated colony concentration values to generate corrected detection results.
[0014] An artificial intelligence-based food microbial colony detection and analysis system includes:
[0015] The gradient elution-layer filtration pretreatment unit is used to perform gradient elution-layer filtration pretreatment on the food samples to be tested to generate samples with impurities removed and bacterial colonies removed.
[0016] The multimodal data synchronous acquisition unit simultaneously performs colony microscopic image acquisition and near-infrared spectral data acquisition on the impurity-removed colony sample to generate initial multimodal data;
[0017] The multimodal data spatiotemporal calibration unit performs spatiotemporal calibration processing on the initial multimodal data to generate spatiotemporally calibrated multimodal data;
[0018] The multi-dimensional colony feature extraction and screening unit performs multi-dimensional colony feature extraction and screening on the spatiotemporally calibrated multimodal data to generate a strongly correlated feature subset.
[0019] The AI dual-branch attention fusion analysis unit performs AI dual-branch attention fusion analysis on strongly correlated feature subsets to generate colony classification results and estimated colony concentration values.
[0020] The multi-reference system correction unit performs multi-reference system correction on the colony classification results and estimated colony concentrations to generate corrected test results.
[0021] The technical advantages of the artificial intelligence-based food microbial colony detection and analysis method provided in this application are as follows:
[0022] I. Effectively shortens testing time, better meeting the real-time testing needs of fast-moving food distribution scenarios.
[0023] In this application, step 1 directly processes the uncultured food sample to be tested through "gradient elution-layer filtration pretreatment" to remove food matrix impurities and retain colony activity, without relying on culture medium to form visible colonies; subsequent steps 2 to 6 are all based on the pretreated impurity-free colony sample for direct data collection, analysis and correction. The entire detection process does not require waiting for colony culture, which significantly shortens the total detection time and is more in line with the timeliness requirements of detection in the context of rapid food circulation.
[0024] II. Improve the accuracy of colony classification and reduce the subjective error of traditional appearance-based judgment.
[0025] This application's solution improves classification accuracy through a multi-step collaborative process: Step 2 simultaneously acquires "colony microscopic images (appearance morphology information)" and "near-infrared spectral data (biochemical composition information)" to generate initial multimodal data, which provides richer classification basis compared to traditional single appearance features; Step 3 performs spatiotemporal calibration processing on the initial multimodal data to ensure that the morphological data and biochemical data of the same colony accurately correspond, avoiding classification interference caused by data misalignment; Step 4 extracts multi-dimensional colony features and filters strongly correlated feature subsets to eliminate redundant features that interfere with classification; Step 5 uses AI dual-branch attention fusion analysis to collaboratively fuse strongly correlated morphological features and strongly correlated biochemical features, replacing traditional manual experience judgment with data-driven AI analysis, reducing subjective errors and making the colony classification results more accurate.
[0026] Third, it reduces the concentration estimation error of low-concentration bacterial colonies, and more accurately reflects the actual degree of food contamination.
[0027] This application provides a multi-step solution to address this issue: Step 2 uses near-infrared spectral data to capture the biochemical characteristics of low-concentration colonies (even with a small number of colonies, their biochemical components can still be reflected by the spectrum), providing a valid basis for estimating the concentration of low-concentration colonies; Step 5 performs concentration estimation based on a dual-branch fusion feature vector (integrating morphology and biochemical characteristics), which, compared to the traditional method that relies solely on colony counting, utilizes the correlation between features and concentration to achieve estimation in low-concentration scenarios with lower error; Step 6 uses multi-reference system correction processing, combining standard sample data and environmental parameters to correct the estimation results, further reducing the bias in estimating the concentration of low-concentration colonies, making the final corrected detection results more reflective of the actual contamination level of food, and providing a more reliable basis for food safety risk prevention and control. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the process of the food colony detection and analysis method and system based on artificial intelligence, as described in this application.
[0029] Figure 2This is a schematic diagram of the structure of the artificial intelligence-based food colony detection and analysis system according to an embodiment of this application. Detailed Implementation
[0030] like Figure 1 As shown in the embodiments of this application, a method and system for detecting and analyzing microbial colonies in food based on artificial intelligence are provided. The method includes:
[0031] Step 1: Perform gradient elution-layer filtration pretreatment on the food sample to be tested to generate a sample with impurities removed.
[0032] Step 2: Simultaneously perform colony microscopic image acquisition and near-infrared spectral data acquisition on the impurity-removed colony samples to generate initial multimodal data;
[0033] Step 3: Perform spatiotemporal calibration on the initial multimodal data to generate spatiotemporally calibrated multimodal data;
[0034] Step 4: Perform multi-dimensional colony feature extraction and screening on the spatiotemporally calibrated multimodal data to generate a strongly correlated feature subset;
[0035] Step 5: Perform AI dual-branch attention fusion analysis on the strongly correlated feature subset to generate colony classification results and estimated colony concentration values;
[0036] Step 6: Perform multi-reference system correction on the colony classification results and estimated colony concentration values to generate corrected detection results.
[0037] Optionally, step 1 specifically includes:
[0038] Step 1.1: Mix the food sample to be tested with the elution buffer and perform gradient pressure cyclic elution to generate a colony-matrix mixture;
[0039] Step 1.2: Perform initial filtration on the colony-substrate mixture to generate a colony mixture free of large particulate impurities;
[0040] Step 1.3: Perform fine filtration on the bacterial colony mixture after removing large particulate impurities to generate impurity-free bacterial colony samples.
[0041] Preferably, the specific implementation process of step 1.1 is as follows: The processing objects are the food sample to be tested and the sterile eluent (the eluent is a sterilized phosphate buffer with a pH value in the neutral range, used to avoid introducing exogenous microorganisms to interfere with subsequent detection); First, the food sample to be tested (different forms of food such as meat, fruits and vegetables, and dairy products need to be sterilely homogenized first to ensure uniform dispersion of the sample matrix) and the sterile eluent are mixed at a ratio of 1:5 to 1:10 (this ratio can be adjusted according to the water content of the food matrix; for samples with high water content, the proportion of eluent can be appropriately reduced), and the mixed system is injected into a sterile reaction vessel with pressure regulation function. The entire mixing process is carried out in a sterile environment at 20-25℃ (this temperature range can maintain colony activity and avoid low temperature causing colony dormancy or high temperature destroying colony structure); Next, a gradient pressure cyclic elution process is performed: in the first stage, a low pressure of 0.01-0.03 MPa is applied for 5-10 minutes, so that... The eluent slowly penetrates the food matrix, loosening the colonies attached to the matrix surface (avoiding initial high pressure that could cause matrix structure rupture and release non-target impurities). In the second stage, the pressure is gradually increased to an intermediate level of 0.05-0.08 MPa, maintained at this pressure, and circulated for 3-5 times, with each rinse spaced 2-3 minutes apart, allowing the loosened colonies to peel off from the matrix surface and disperse into the eluent. In the third stage, the pressure is reduced to an initial low pressure level of 0.01-0.03 MPa and maintained for 2-3 minutes to ensure that any colonies remaining on the inner wall of the container are washed into the mixture. Through the above gradient pressure cyclic elution process, colony peeling efficiency can be improved while avoiding colony rupture (unlike traditional fixed pressure elution, which can easily lead to incomplete elution or high pressure that damages the colony structure), ultimately generating a colony-matrix mixture. This colony-matrix mixture will be used as the processing target in step 1.2 for subsequent primary filtration to remove large particulate impurities.
[0042] Preferably, the specific implementation process of step 1.2 is as follows: The object to be processed is the colony-matrix mixture generated in step 1.1; First, the colony-matrix mixture is introduced into a primary filtration device with negative pressure assistance. A primary filtration membrane with a preset pore size is installed in the primary filtration device (the pore size of the primary filtration membrane is selected according to the type of food matrix; when processing fruit and vegetable samples containing coarse fiber, the pore size is set to 5-10 μm, and when processing meat paste samples, the pore size is set to 2-5 μm to ensure that large particulate impurities such as fiber and fruit pulp residue can be intercepted, while allowing colonies and small molecule eluent to pass through). The operating temperature of the device is maintained at 20-25℃ (consistent with the temperature in step 1.1 to avoid temperature fluctuations affecting colony morphology); Then, the negative pressure assistance system is activated. The system drives the colony-matrix mixture through a primary filtration membrane at a stable negative pressure of -0.02 to -0.05 MPa (this negative pressure range balances filtration efficiency and colony protection; excessively high negative pressure can cause colonies to be squeezed and deformed, while excessively low negative pressure results in slow filtration speed). During filtration, the primary filtration membrane traps large-particle matrix impurities (such as fibers, tissue fragments, undissolved food particles, etc.) in the mixture, preventing these impurities from clogging the subsequent fine filtration membrane or interfering with colony microscopic imaging. After filtration, the permeate below the primary filtration membrane is collected to generate a colony mixture free of large-particle impurities. This colony mixture free of large-particle impurities will be used as the processing target in step 1.3 for subsequent fine filtration to remove trace small-molecule impurities.
[0043] Preferably, the specific implementation process of step 1.3 is as follows: The treatment object is the bacterial colony mixture with large particulate impurities removed generated in step 1.2; First, the bacterial colony mixture with large particulate impurities removed is introduced into a cross-flow filtration fine filtration device, in which a microporous filter membrane is installed (the pore size of the microporous filter membrane is set to 0.45-0.8μm, which can intercept most common food colonies, while allowing small molecule impurities such as soluble sugars and proteins to pass through), and the operating temperature of the device is maintained at 20-25℃; Next, the cross-flow filtration system is started: the bacterial colony mixture with large particulate impurities removed flows parallel to the surface of the microporous filter membrane at a speed of 0.5-1.5m / s, while a low pressure difference of 0.01-0.03MPa is applied to drive the mixture through the filter membrane (this cross-flow speed can avoid membrane blockage caused by the accumulation of bacteria on the filter membrane surface, and the low pressure difference is lower than the intermediate pressure level in step 1.1 to prevent pressure buildup). This process, known as colony breaking, differs from traditional vertical filtration, where colony accumulation reduces filtration efficiency and can even break colonies. During filtration, the microporous membrane traps colonies in the mixture, while small molecule impurities are discharged with the permeate. After filtration, the cross-flow system is shut off, and the microporous membrane surface is rinsed with a sterile buffer solution (with the same composition as the eluent) matching the membrane area. The buffer solution volume is controlled at 0.5-1 mL per square centimeter of membrane. The trapped colonies are rinsed and collected in a sterile container. This fine filtration process removes residual trace amounts of small molecule impurities from the mixture, ensuring that subsequent detection targets only pure colonies (avoiding interference from small molecule impurities in near-infrared spectral data acquisition or artifacts in microscopic imaging). This process ultimately generates a decontaminated colony sample, which will be used in step 2 for simultaneous colony microscopic image acquisition and near-infrared spectral data acquisition.
[0044] Preferably, the specific implementation process of step 2 is as follows:
[0045] The sample being processed is a decontaminated colony sample (a mixture of pure colonies retained on a microporous filter membrane and a small amount of sterile buffer solution, free from food matrix impurities). The core of step 2 is to achieve the synchronous acquisition of colony morphology and biochemical information through "sample positioning adaptation - synchronous trigger control - dual-modal data acquisition - data association integration", avoiding sample state changes (such as colony drying, position shift) or data misalignment caused by traditional separate acquisition. Finally, initial multimodal data (including colony microscopic images, near-infrared spectral data and associated metadata) is generated, providing a complete data foundation for the spatiotemporal calibration in step 3.
[0046] Step 2 specifically includes the following steps:
[0047] Step 2.1: Location marking and fixation of impurity colony samples
[0048] The sample to be processed is a decontaminated bacterial colony sample. First, a microporous filter membrane carrying the decontaminated bacterial colony sample is placed on a customized sterile sample stage. Three triangularly distributed positioning markers are pre-set on the surface of the sample stage (the markers are made of an inert material that does not reflect near-infrared light and does not interfere with microscopic imaging, avoiding interference with dual-modal data acquisition). Next, a small amount of sterile buffer solution (consistent with step 1.3) is gently applied to the surface of the filter membrane to ensure the decontaminated bacterial colony sample remains moist (avoiding drying which could lead to colony shrinkage or changes in biochemical composition). Simultaneously, the negative pressure adsorption function of the stage is used to fix the filter membrane (the negative pressure value is controlled within a range that prevents membrane deformation; a common range is -0.01 to -0.02 MPa, such as -0.015 MPa), preventing membrane displacement during acquisition. Through the above processing, a positioning-marked bacterial colony sample is generated. This positioning-marked bacterial colony sample will be used as the common processing object for subsequent microscopic image acquisition and near-infrared spectroscopy acquisition. The positioning markers on its surface are used for coordinate correlation of subsequent data, while the moist state and fixation process ensure the stability of colony characteristics during acquisition.
[0049] Step 2.2: Synchronous acquisition of trigger signal generation and device linkage
[0050] The processing objects are the localized and labeled colony samples and the time synchronization device (used to control the time consistency of the dual acquisition devices). First, the time synchronization device reads the identification signal of the localization marker point on the sample platform (confirming that the localized and labeled colony samples are in place) and generates a synchronous acquisition trigger signal (the trigger signal is an electrical signal, and the pulse width is set to a range that can be recognized by the dual acquisition devices, with a general angle of 10~20μs, such as 15μs). Then, the synchronous acquisition trigger signal is transmitted to the fully automated colony microscopy imager and the near-infrared spectroscopy analyzer respectively: after receiving the trigger signal, the fully automated colony microscopy imager starts the imaging process, and after receiving the same trigger signal, the near-infrared spectroscopy analyzer starts the spectral scanning process synchronously. This synchronous acquisition trigger signal ensures that the time difference between the acquisition of localized and labeled colony samples by the two devices is controlled within a preset range (with a general angle of ≤50ms, such as 30ms), avoiding changes in colony state (such as a decrease in moisture) caused by time intervals in traditional separate acquisition, and generating a device synchronous start state. This device synchronous start state directly ensures that the subsequently acquired dual-modal data is consistent in the time dimension, providing a prerequisite for the synchronous processing of acquisition time in step 3.1.
[0051] Step 2.3: Acquisition of colony microscopic images and recording of metadata
[0052] The processing targets are locally labeled bacterial colony samples and a fully automated colony microscopy imager that is running synchronously. First, the fully automated colony microscopy imager selects an appropriate objective lens based on the colony type of the locally labeled sample (preset based on prior sample information, such as cocci or bacilli). The general objective lens magnification is 20-40x; 20x is used for cocci to cover more colonies, and 40x for bacilli to clearly reveal morphological details. Next, the device automatically focuses on the colony area on the filter membrane surface (the focusing reference is the area between the localized markers to avoid focusing on the markers themselves), and adjusts the exposure time according to the brightness characteristics of the colonies (generally 50-200ms; if the colony color is light, set to 1ms). (50ms for darker colors, 80ms for darker colors to avoid overexposure leading to blurred edges or underexposure resulting in lost details); then, perform image acquisition to generate an image containing colony morphology (outline, aggregation state) and positioning markers, denoted as a colony micrograph; finally, record key information in the metadata of the colony micrograph: acquisition timestamp (consistent with the time of the synchronous acquisition trigger signal), objective magnification, exposure time, and pixel coordinates of the positioning markers in the image; this colony micrograph and its metadata will be associated with subsequent near-infrared spectral data, the timestamp in its metadata is used for time synchronization in step 3.1, and the pixel coordinates of the positioning markers are used for coordinate mapping in step 3.2.
[0053] Step 2.4: Acquisition of near-infrared spectral data of bacterial colonies and recording of metadata.
[0054] The processing targets are locally labeled bacterial colony samples and a near-infrared spectroscopy analyzer that is simultaneously activated. First, the near-infrared spectroscopy analyzer, based on the localization markers on the labeled bacterial colony samples, adjusts the position of the spectral acquisition probe using a robotic arm, ensuring that the probe's scanning area completely overlaps with the imaging area of the fully automated colony microscopy imager (the size of the scanning area is set according to the imaging area; the general angle is consistent with the image field of view, such as 5×5mm). Next, the spectral acquisition parameters are set: the spectral range is selected to cover the characteristic absorption peaks of the colony's biochemical components (such as proteins, polysaccharides, and metabolites) (the general angle is 900~1700nm, which can effectively distinguish the biochemical differences between different colonies); the spectral resolution is set to the range that can capture subtle absorption peaks (the general angle is 4~8cm⁻¹, such as...). (6cm⁻¹), the number of scans is set to reduce noise interference (general angle is 32~64 times, such as 48 times, to reduce random noise by averaging multiple scans); then, a spectral scanning operation is performed to generate a spectral curve reflecting the biochemical components of the colony, which is recorded as the colony near-infrared spectral data; finally, key information is recorded in the metadata of the colony near-infrared spectral data: acquisition timestamp (consistent with the time of the synchronous acquisition trigger signal, to ensure that it is the same as the timestamp of the colony micrograph), spectral range, resolution, number of scans, and spatial coordinates of the positioning markers in the spectral scanning area; this colony near-infrared spectral data and its metadata will be integrated with the colony micrograph, and the timestamp in its metadata is used for time synchronization in step 3.1, and the spatial coordinates of the positioning markers are used for coordinate mapping in step 3.2.
[0055] Step 2.4: Generation of Initial Multimodal Data
[0056] The processing objects are colony microscopic images (including metadata) and colony near-infrared spectral data (including metadata). First, the two types of data are associated according to the acquisition timestamp (because the synchronous acquisition trigger signal ensures that the timestamps are consistent, the two types of data with the same timestamp are directly matched). Next, the pixel coordinates of the positioning markers in the colony microscopic images are initially associated with the spatial coordinates of the positioning markers in the colony near-infrared spectral data (the correspondence between the two is recorded to provide an initial association basis for the coordinate mapping in step 3.2). Finally, the associated colony microscopic images, colony near-infrared spectral data and their metadata are encapsulated into a unified data format (such as HDF5 format, which is convenient for subsequent data reading and processing) to generate initial multimodal data. This initial multimodal data will be used as the processing object in step 3, where the timestamps are used for synchronous processing at the acquisition time, and the positioning marker coordinates are used for coordinate mapping processing.
[0057] Optionally, step 3 specifically includes:
[0058] Step 3.1: Perform acquisition time synchronization processing on the initial multimodal data to generate time-synchronized multimodal data;
[0059] Step 3.2: Perform coordinate mapping processing on the multi-modal data with synchronized timestamps to generate multi-modal data after spatio-temporal calibration.
[0060] I. Preferably, the specific implementation process of Step 3.1 is as follows
[0061] The processing object is the initial multi-modal data generated in Step 2 (including colony microscopic images and their metadata, colony near-infrared spectral data and their metadata); the core of Step 3.1 is to solve the small deviation in the acquisition times of the two types of data in the initial multi-modal data (even if synchronously triggered, there may still be differences in device response speeds), and through "timestamp extraction - deviation determination - synchronization correction", ensure that the bimodal data is completely aligned in the time dimension, provide a data basis with consistent time for subsequent coordinate mapping, and finally generate multi-modal data with synchronized timestamps.
[0062] First, extract timestamp information from the initial multi-modal data: read the acquisition timestamp (denoted as T1) from the metadata of the colony microscopic image, and read the acquisition timestamp (denoted as T2) from the metadata of the colony near-infrared spectral data; the acquisition timestamps here are all the time records corresponding to the synchronous acquisition trigger signal in Step 2. In theory, T1 and T2 should be the same, but in practice, there may be a small deviation due to device response delay, so it is necessary to further determine whether the deviation is within an acceptable range.
[0063] Next, perform time deviation determination processing on T1 and T2: calculate the time difference ΔT = |T1 - T2|, and compare ΔT with a preset time deviation threshold (the general range is ≤50 ms, such as 30 ms, and this threshold is determined according to the stability of the colony biochemical components during the acquisition period to ensure that there is no significant change in colony characteristics within the deviation); if ΔT ≤ the preset threshold, it is determined that the time deviation of the initial multi-modal data is acceptable, and directly mark the initial multi-modal data as "time-aligned data to be coordinate mapped"; if ΔT > the preset threshold, time synchronization correction needs to be performed: taking the one with the earlier timestamp (e.g., if T1 < T2, then using T1 as the reference), perform linear interpolation processing on the data with the later timestamp (such as near-infrared spectral data) (based on the time series continuity of the spectral data, supplement the spectral data point corresponding to T1) to eliminate the time deviation and generate "multi-modal data after time correction".
[0064] Finally, the above processing results are integrated: regardless of whether interpolation correction is performed, the final time-consistent colony microscopic image, colony near-infrared spectral data and their metadata are encapsulated to generate time-synchronized multimodal data; this time-synchronized multimodal data will be used as the processing object in step 3.2, and the location marker information contained therein (the pixel coordinates of the location markers in the image metadata and the spatial coordinates of the location markers in the spectral metadata) will be used for subsequent coordinate mapping processing to ensure that the time-consistent bimodal data can be further correlated in the spatial dimension.
[0065] Preferably, the specific implementation process of step 3.2 is as follows:
[0066] The processing object is the time-synchronized multimodal data generated in step 3.1; the core of step 3.2 is to establish a precise mapping relationship between the pixel coordinate system of the colony microscopic image and the spatial coordinate system of the colony near-infrared spectral data, solve the spatial misalignment problem between the two types of data (such as regional mismatch caused by slight offset of the acquisition probe position), ensure that each colony pixel in the image can correspond to a unique spectral acquisition point, provide a spatially consistent data foundation for "multi-dimensional feature extraction and association" in step 4, and finally generate spatiotemporally calibrated multimodal data.
[0067] First, the coordinates of the positioning markers are extracted from the real-time synchronized multimodal data: the pixel coordinates of three positioning markers are read from the metadata of the colony microscopic image, denoted as the pixel coordinate set P={P1(x1,y1),P2(x2,y2),P3(x3,y3)} (where x represents the horizontal axis coordinate of the pixel coordinate system, y represents the vertical axis coordinate, and each coordinate value corresponds to the specific pixel position of the marker in the image); the spatial coordinates of the same three positioning markers are read from the metadata of the colony near-infrared spectral data, denoted as the spatial coordinate set S={S1(a1,b1),S2(a2,b2),S3(a3,b3)} (where a represents the horizontal axis coordinate of the spatial coordinate system, b represents the vertical axis coordinate, and each coordinate value corresponds to the actual physical position of the marker on the sample platform, with the unit matching the physical size of the image pixel); these two coordinate sets are the core reference for constructing the mapping relationship. Since the markers are fixed on the sample platform, the correspondence between their pixel coordinates and spatial coordinates can reflect the overall transformation law of the two coordinate systems.
[0068] Next, a coordinate system mapping matrix is constructed: based on coordinate sets P and S, a perspective transformation algorithm is used to calculate the mapping matrix M (a 3x3 matrix, suitable for nonlinear transformations between planar coordinate systems, unlike traditional linear transformations, and adaptable to projection distortion caused by small angular offsets of the acquisition device); the elements of the mapping matrix M have the following meanings: the first and second rows correspond to the linear correlation coefficients between pixel coordinates x and y and spatial coordinates a and b, respectively, and the third row corresponds to the projection correction coefficients. Each element value in the matrix is obtained by solving the corresponding equations of P and S (e.g., P1=M×S1, P2=M×S2, P3=M×S3, solving the elements of M by solving the simultaneous equations); the physical meaning of this mapping matrix M is "the transformation rule for converting any point (a,b) in the spatial coordinate system into the corresponding point (x,y) in the pixel coordinate system", ensuring accurate correlation of spatial dimensions.
[0069] Then, perform full-area coordinate mapping processing: substitute the spatial coordinates of all spectral acquisition points of the colony near-infrared spectral data (denoted as S_i(a_i,b_i), where i is the acquisition point number) into the mapping matrix M, and calculate the pixel coordinates P_i(x_i,y_i)=M×S_i(a_i,b_i) corresponding to each acquisition point; at the same time, match the calculated P_i(x_i,y_i) with the pixel coordinates of the colony microscopic image. If a certain P_i(x_i,y_i) exceeds the image pixel range (e.g., x_i is greater than the image width or less than 0), then determine that the acquisition point corresponds to the image background area and mark it as a "non-colony associated spectral point" (which will not participate in feature extraction in subsequent step 4); through this processing, generate a "spectral acquisition point-image pixel association table" to record each valid spectral acquisition point and its corresponding image pixel position.
[0070] Finally, the spatiotemporally correlated data is integrated: the real-time synchronized multimodal data is bound to the "spectral acquisition point-image pixel association table" to ensure that each pixel in the colony microscopic image (especially the colony region pixels) can access the corresponding near-infrared spectral data, and the spectral data can also be traced back to the corresponding image pixel position; the bound data is encapsulated to generate spatiotemporally calibrated multimodal data; the spatiotemporal consistency of this spatiotemporally calibrated multimodal data ensures that the colony morphological features (from image pixels) extracted in step 4 can be accurately correlated with the biochemical features (from the corresponding spectral data).
[0071] Optionally, step 4 specifically includes:
[0072] Step 4.1A: Perform adaptive threshold segmentation on the colony microscopic images in the spatiotemporally calibrated multimodal data to generate preliminary colony region images;
[0073] Step 4.2A: Perform edge restoration processing on the preliminary colony area image to generate a complete colony edge contour image;
[0074] Step 4.3A: Perform topological parameter calculation on the complete colony edge contour image to generate a colony morphology feature vector.
[0075] Preferably, the specific implementation process of step 4.1A is as follows:
[0076] The processing object is the colony microscopic image in the spatiotemporally calibrated multimodal data generated in step 3 (this image has been spatiotemporally calibrated and aligned with the near-infrared spectral data in the spatiotemporal dimension, containing clear colony areas and background areas); the core of step 4.1A is to solve the problem of missegmentation in traditional fixed threshold segmentation when the colony image is unevenly illuminated and the gray levels of the colony and the background are similar through the "dynamic adaptive threshold segmentation" technology, accurately separate the colony area from the background area, generate a preliminary colony area image, and provide a reliable regional basis for subsequent edge repair.
[0077] First, grayscale normalization is performed on the colony microscopic images: the colored colony microscopic images are converted into grayscale images (preserving brightness information and removing color interference), and the global grayscale mean μ and standard deviation σ of the grayscale image are calculated; based on μ and σ, a grayscale normalization range is set (the general angle is [μ-2σ, μ+2σ]), and grayscale values outside this range are truncated and linearly mapped to the [0, 255] interval to generate a grayscale normalized image; this process can compress extreme grayscale interference (such as reflective points at the image edges), making the grayscale difference between colonies and the background more stable and avoiding the influence of extreme values on subsequent threshold calculations.
[0078] Next, dynamic window segmentation and local threshold calculation are performed: a variable-sized sliding window is used to traverse the grayscale normalized image (the window size is dynamically adjusted according to the estimated colony size; generally, for colonies with smaller diameters, the window size is set to 3×3 to 5×5 pixels; for colonies with larger diameters, the window size is set to 7×7 to 11×11 pixels, ensuring that the window can cover local features without crossing the boundaries of multiple colonies); a local threshold T is calculated for the grayscale value within each sliding window. The formula for T is based on the local mean μ_local and the local standard deviation σ_local (generally, T = μ_local k × σ_local, where k is an adjustment coefficient set according to the colony type, such as k = 0.8 for cocci and k = 1.0 for bacilli, by lowering the threshold to highlight low-grayscale colonies or raising the threshold to suppress high-grayscale background). This dynamic window and local threshold design, unlike the adaptive threshold of traditional fixed windows (such as the Otsu algorithm), can adapt to the local grayscale characteristics of colonies of different sizes, reducing the problem of small colonies being misclassified as background or the edges of large colonies being over-segmented.
[0079] Then, region segmentation and binarization are performed: the gray value of each pixel in the grayscale normalized image is compared with the local threshold T of the sliding window. If the pixel gray value is ≤ T (colony areas are usually darker than the background), it is marked as a foreground pixel (assigned a value of 1), otherwise it is marked as a background pixel (assigned a value of 0), generating a preliminary binarized image. Small-area noise removal is performed on the preliminary binarized image (generally, connected regions with an area < 5 pixels are removed, as these regions are mostly noise rather than real colonies), generating a preliminary colony region image. In this preliminary colony region image, the colony region is presented as continuous foreground pixels, and the background region has a value of 0. However, there may be edge breaks or holes caused by image blurring, which need to be repaired in subsequent step 4.2A.
[0080] Finally, the coordinate information of the preliminary colony area image and the original colony microscopic image is associated (preserving the pixel-level correspondence) and used as the processing object in step 4.2A to ensure that edge repair is only applied to the colony area and does not interfere with the background.
[0081] Preferably, the specific implementation process of step 4.2A is as follows:
[0082] The processing object is the preliminary colony area image generated in step 4.1A (including the complete colony body and some broken edges and holes); the core of step 4.2A is to solve the edge deformation problem caused by traditional morphological expansion / erosion repair through the "curvature-constrained edge repair" technology, accurately restore the natural edge contour of the colony, generate a complete colony edge contour image, and provide an accurate contour basis for subsequent topology parameter calculation.
[0083] First, the edge pixel set of the preliminary colony area image is extracted: the Canny edge detection algorithm is used to extract edges from the preliminary colony area image (with dual thresholds set, a high threshold for detecting strong edges and a low threshold for connecting weak edges; the general angles are high threshold = 80° and low threshold = 40°, adapted to the gray-scale gradient characteristics of colony edges), resulting in an edge pixel set E = {e1, e2, ..., en} (each ei is the coordinate (x, y) of an edge pixel); connectivity analysis is performed on the edge pixel set E to mark broken edge segments (defined as two edges with an Euclidean distance > 2 pixels and no other edge pixels connecting them), generating a broken edge marking map; this marking map clearly shows the location of the edges that need to be repaired, providing a basis for targeted repair.
[0084] Next, the repair path calculation for the fractured edges is performed: for each pair of fracture endpoints (denoted as A(xa,ya) and B(xb,yb)) in the fractured edge marker map, the optimal repair path is searched within the foreground pixels of the initial colony area image (ensuring the repair path is located inside the colony); the path search adopts the curvature constraint principle: calculate the local curvature of the edge segments where A and B are located (curvature values reflect the degree of edge curvature, the larger the curvature, the steeper the edge), and predict the curvature trend of the repair path based on the local curvature (if the curvature of the edge where point A is located is positive, and the curvature of the edge where point B is located is positive, then the repair path should maintain positive curvature); the shortest path that satisfies the curvature trend is selected from the foreground pixels between A and B through a dynamic programming algorithm to generate the repair path pixel set; this method differs from the traditional straight-line connection repair, which can avoid the repair path conflicting with the natural morphology of the colony (such as forcibly repairing the arc edge into a straight line), and ensure that the repaired edge conforms to the morphological characteristics of colony growth.
[0085] Then, hole filling and edge smoothing are performed: for the internal holes in the initial colony area image (defined as background pixel areas completely surrounded by foreground pixels), a seed filling algorithm is used to fill them (starting from any background pixel inside the hole, spreading outwards to fill the edge pixels), generating a colony area image without holes; for the complete edge after merging the repair path pixel set and the original edge pixel set E, Gaussian smoothing is performed (the Gaussian kernel size is set to 3×3 pixels, and the standard deviation angle is generally 0.5~1.0, such as 0.8), eliminating the connection traces between the repair path and the original edge, making the edge transition natural; through the above processing, a complete colony edge contour image is generated, in which the colony edges are continuous and without holes, and the edge morphology conforms to the natural growth characteristics of colonies.
[0086] Finally, the coordinate information of the complete colony edge contour image is associated with that of the preliminary colony region image to ensure that the contour pixels correspond one-to-one with the original image pixels. This information is then used as the processing object in step 4.3A to provide accurate edge data for the calculation of topology parameters.
[0087] Preferably, the specific implementation process of step 4.3A is as follows:
[0088] The processing object is the complete colony edge contour image (including continuous edges and internal filling areas) generated in step 4.2A; the core of step 4.3A is to extract not only traditional global morphological parameters through the "multi-scale topological parameter extraction" technology, but also add local edge feature parameters to comprehensively characterize the differences in colony morphology (such as the roundness of cocci, the aspect ratio of bacilli, and the degree of unevenness of the colony surface), and generate colony morphological feature vectors to provide morphological basis for subsequent feature selection and AI analysis.
[0089] First, extract the single-colony contours from the complete colony edge contour image: Perform connected component analysis on the complete colony edge contour image to mark each independent colony region (the foreground pixels of the same colony constitute a connected region), and extract the edge contours of each connected region (i.e., the complete edges generated in step 4.2A) to obtain the single-colony contour set C={C1,C2,...,Cm} (m is the number of colonies, and each Ci is the edge pixel coordinate sequence of the i-th colony). This process decomposes the multi-colony image into the contours of individual colonies, ensuring that subsequent parameter calculations are based on individual colonies and avoiding parameter confusion between different colonies.
[0090] Next, the global topological parameters of a single colony are calculated: For each single colony outline Ci, the following global parameters are calculated:
[0091] 1. Colony area S: The number of foreground pixels enclosed by Ci (unit: pixel², which can be converted to actual area by pixel physical size, e.g., 1 pixel = 0.5 μm, then 1 pixel² = 0.25 μm²).
[0092] 2. Colony perimeter L: The number of edge pixels contained in Ci (unit: pixels, conversion method is the same as area);
[0093] 3. Roundness R: The calculation formula is R=4πS / L² (the closer the value is to 1, the closer the colony is to a circle, which is used to distinguish between cocci and bacilli).
[0094] 4. Major-minor axis ratio A: Calculated using the minimum bounding rectangle algorithm, it is the ratio of the major axis length to the minor axis length (the larger the value, the finer and longer the colony, used to refine the morphological differences of bacilli).
[0095] 5. Convexity K: The ratio of the area of the colony's convex hull to the actual area S (the convex hull is the smallest convex polygon containing Ci; the closer K is to 1, the smoother the colony's edge, used to distinguish between colonies with smooth edges and those with wrinkled edges).
[0096] These global parameters describe the size, shape, and plumpness of colonies as a whole, and are the basic characteristics for distinguishing colony species.
[0097] Then, the local topological parameters of a single colony are calculated: for the edge pixel sequence of each single colony outline Ci, sampling points are taken at a preset step size (generally 5~10 pixels, such as 8 pixels), and the local curvature k of each sampling point is calculated (reflecting the curvature of the edge at that point; positive curvature indicates that the edge is convex outward, and negative curvature indicates that it is concave inward); the distribution characteristics of local curvature are statistically analyzed: the mean curvature μk (reflecting the overall curvature trend), the standard deviation of curvature σk (reflecting the smoothness of the edge; the smaller σk is, the smoother the edge), and the proportion of convex points P+ (the proportion of positive curvature sampling points to the total sampling points, used to distinguish the surface convexity and concavity differences); these local parameters supplement the edge detail features that global parameters cannot characterize, such as some colonies that are round overall (high global roundness) but have wrinkles on the surface (large local curvature standard deviation), which can be effectively distinguished by local parameters.
[0098] Finally, global and local parameters are integrated to generate colony morphology feature vectors: For each single colony, its global parameters (S, L, R, A, K) and local parameters (μk, σk, P+) are arranged in a fixed order to form an 8-dimensional colony morphology feature vector Vi=[S,L,R,A,K,μk,σk,P+] (each dimension of the vector corresponds to a parameter, and the value is the specific calculation result of that parameter); the morphology feature vectors of all single colonies are summarized to generate a colony morphology feature vector set suitable for multi-colony samples (each vector corresponds to the morphological feature of a single colony); this colony morphology feature vector set will be used as the processing object in step 4.3, and will participate in feature screening together with the colony biochemical feature vectors to ensure that morphological features fully participate in the generation of subsequent strongly correlated feature subsets.
[0099] Optionally, step 4 specifically includes:
[0100] Step 4.1B: Construct a correlation model based on the near-infrared spectral data of known bacterial colonies and the corresponding biochemical index data to generate a spectral feature-biochemical feature correlation model;
[0101] Step 4.2B: Perform biochemical feature mapping processing on the near-infrared spectral data and the spectral feature-biochemical feature correlation model in the spatiotemporally calibrated multimodal data to generate colony biochemical feature vectors;
[0102] Step 4.3: Based on the colony morphology feature vector and colony biochemical feature vector, colony feature screening is performed to obtain strongly correlated morphological features and strongly correlated biochemical features, so as to generate a strongly correlated feature subset.
[0103] Preferably, the specific implementation process of step 4.1B is as follows: The processing objects are near-infrared spectral data of known bacterial colonies (including different categories such as pathogenic bacteria and non-pathogenic bacteria, covering common bacterial colony types in the detection scenario) and corresponding biochemical index data (obtained through precise laboratory detection methods, such as high-performance liquid chromatography to measure metabolite concentration and Fourier transform infrared spectroscopy to measure cell wall component ratio); the core of step 4.1B is to solve the problem of poor generalization ability of traditional spectral-biochemical correlation models due to the lack of screening of key spectral features through the construction technology of "feature-optimized partial least squares regression model", establish a precise mapping relationship between spectral features and biochemical indicators, generate a spectral feature-biochemical feature correlation model, and provide reliable model support for the subsequent extraction of biochemical features of samples to be detected.
[0104] First, preprocessing is performed on the near-infrared spectral data of known bacterial colonies: Savitzky-Golay smoothing algorithm (with a smoothing window size of 3-5 points, such as 5 points, balancing noise removal and feature preservation) is used to eliminate spectral random noise; multivariate scattering correction (MSC) is used to reduce spectral baseline shift caused by colony particle scattering; first-order derivative transformation (with a difference window size of 2-4 points, such as 4 points) is used to enhance subtle differences in spectral characteristic peaks (e.g., when characteristic peaks of different colony metabolites overlap, derivative transformation can improve peak separation), generating preprocessed standard spectral data; this processing ensures that subsequent feature extraction is based on high-quality spectral data, avoiding noise and scattering interference with model construction.
[0105] Next, spectral feature extraction and key feature screening are performed: multi-dimensional spectral features are extracted from the preprocessed standard spectral data, including characteristic peak intensity (maximum absorbance in the spectral curve), characteristic peak position (absorption wavelength corresponding to a specific biochemical component), characteristic peak area (integral value under the characteristic peak, reflecting the comprehensive information of component content and peak intensity), and characteristic peak half-width (reflecting peak sharpness and related to component purity). Based on the extracted spectral features and corresponding biochemical index data, variable importance projection (VIP) analysis is used to screen key spectral features (features with a VIP value ≥ 1 are judged as key features; the VIP value reflects the degree of influence of the spectral feature on the biochemical index, and the higher the value, the greater the influence). Redundant spectral features with a VIP value < 1 (such as background absorption features unrelated to biochemical indexes) are removed, generating a key spectral feature set. This screening step can reduce the dimensionality of the model input, avoid irrelevant features causing model overfitting, and improve the model's generalization ability.
[0106] Then, construct and validate the spectral feature-biochemical feature correlation model: Using the key spectral feature set as the input and the corresponding biochemical index data as the output, construct a partial least squares regression (PLS) model; adopt 5-fold cross-validation (randomly divide the standard data set into 5 parts, 4 parts for the training set and 1 part for the validation set, cycle 5 times to ensure that each sample participates in the validation) to optimize the model parameters (such as the number of principal components, the general range is 5-10 principal components, such as 8, and determine the optimal number of principal components by minimizing the error of the validation set); verify the model performance (take the coefficient of determination R²≥0.85 and the root mean square error RMSE≤the preset threshold as the model qualification standard, the closer R² is to 1 and the smaller RMSE is, the higher the model accuracy); if the model performance does not meet the standard, return to readjust the spectral preprocessing parameters or screening criteria until the model is qualified; finally generate a spectral feature-biochemical feature correlation model with qualified performance; this model will be used as the core tool in step 4.2B for mapping the near-infrared spectral data of the sample to be detected to biochemical features, ensuring the accuracy of subsequent biochemical feature extraction.
[0107] Preferably, the specific implementation process of step 4.2B is as follows: The processing object is the near-infrared spectral data in the spatio-temporally calibrated multi-modal data generated in step 3 (spatially and temporally aligned with the colony microscopic image, each spectral acquisition point corresponding to a unique colony area) and the spectral feature-biochemical feature correlation model generated in step 4.1B; the core of step 4.2B is to ensure the consistency of the preprocessing method of the spectral data of the sample to be detected and the standard spectral data used for model training through the "consistent preprocessing + model mapping" technology, avoid mapping deviation caused by preprocessing differences, accurately extract the biochemical features of the colony to be detected, generate a colony biochemical feature vector, and provide biochemical dimension data for subsequent feature screening.
[0108] First, perform consistent preprocessing on the near-infrared spectral data in the spatio-temporally calibrated multi-modal data: strictly follow the preprocessing process and parameters of the standard spectral data in step 4.1B (that is, the same Savitzky-Golay smoothing window size, multiplicative scatter correction method, and first derivative difference window size) to generate the preprocessed spectral data of the sample to be detected; this consistent processing is the key to ensuring accurate model mapping - if the preprocessing method of the spectral data to be detected is different from the standard spectrum, it will cause spectral feature deviation, and then the biochemical feature mapping result will deviate. Traditional methods often ignore the preprocessing consistency and cause detection errors. This step solves this problem by strictly unifying the preprocessing process.
[0109] Next, extract the key spectral features of the spectral data to be detected: using the key spectral feature set determined in step 4.1B (such as peak intensity and peak position at a specific wavelength), extract the corresponding spectral features from the preprocessed spectral data to be detected to generate the key spectral feature set to be detected; it is necessary to ensure that the dimensions and feature definitions of the key spectral feature set to be detected are completely consistent with the key spectral feature set used for model training in step 4.1B (e.g., if 10 key features are used for model training, the same 10 features should also be extracted from the sample to be detected, in the same order), to avoid the model failing to map properly due to mismatch in feature dimensions.
[0110] Then, biochemical feature mapping and vector construction are performed: the set of key spectral features to be detected is input into the spectral feature-biochemical feature association model generated in step 4.1B. The model outputs the biochemical index data of the corresponding colony, including the concentration of metabolites (such as the concentration of toxins specific to pathogenic bacteria and the concentration of organic acids in non-pathogenic bacteria), the proportion of cell wall components (such as the proportion of peptidoglycan in Gram-positive bacteria and the proportion of lipopolysaccharide in Gram-negative bacteria), and enzyme activities (such as the activity of hydrolases related to colony growth). These biochemical index data are arranged in a preset order (such as the concentration of metabolites → the proportion of cell wall components → enzyme activities) to generate a fixed-dimensional colony biochemical feature vector. Since the spatiotemporally calibrated near-infrared spectral data is aligned with the colony microscopic image, each colony biochemical feature vector corresponds to a colony morphology feature vector generated in step 4.3A (i.e., the morphology of the same single colony corresponds one-to-one with the biochemical feature vector), generating a colony biochemical feature vector set. This colony biochemical feature vector set, together with the colony morphology feature vector set, is used as the processing object in step 4.3, providing a complete data foundation for cross-modal feature screening.
[0111] Preferably, the specific implementation process of step 4.3 is as follows:
[0112] The processing objects are the colony morphology feature vector set generated in step 4.3A (each vector corresponds to the morphological parameters of a single colony) and the colony biochemical feature vector set generated in step 4.2B (each vector corresponds to the biochemical parameters of the same single colony, and there is a one-to-one correspondence with the morphology vector). The core of step 4.3 is to solve the problem of traditional feature screening that only screens a single mode and does not consider cross-modal redundancy by using the screening technique of "cross-modal feature correlation analysis + feature importance assessment". It accurately retains features that are strongly correlated with colony type and concentration, removes redundant and weakly correlated features, and generates a subset of strongly correlated features, which provides efficient and accurate feature input for subsequent AI dual-branch fusion analysis.
[0113] First, perform internal screening of single-modal features: For the colony morphology feature vector set, calculate the Pearson correlation coefficient (r) between each morphological feature (such as colony area S, roundness R, convexity K) and the colony species label (such as 0 representing non-pathogenic bacteria, 1 representing pathogenic bacteria) and the actual concentration data. Screen morphological features with an absolute value of r ≥ 0.6 (the closer the absolute value of r is to 1, the stronger the correlation between the feature and the species / concentration; 0.6 is an empirical threshold to balance feature retention and redundancy removal), generating a subset of strongly correlated morphological features. For the colony biochemical feature vector set, use the same method to calculate the Pearson correlation coefficient between each biochemical feature (such as toxin concentration, peptidoglycan ratio) and the colony species label and the actual concentration data. Screen biochemical features with an absolute value of r ≥ 0.6, generating a subset of strongly correlated biochemical features. This step first removes weakly correlated features from within the single modality to reduce the computational load of subsequent cross-modal screening.
[0114] Next, cross-modal feature redundancy analysis is performed: the pairwise correlation coefficient between strongly correlated morphological feature subsets and strongly correlated biochemical feature subsets (i.e., the correlation coefficient between each morphological feature and each biochemical feature) is calculated. If the absolute value of the correlation coefficient between two features (such as the morphological feature "convexity K" and the biochemical feature "peptidoglycan percentage") is ≥0.7 (judged as highly redundant; 0.7 is an empirical threshold to avoid retaining features that repeatedly represent the same colony characteristics), then the feature importance is evaluated (the feature importance score is calculated using the random forest algorithm; the higher the score, the greater the contribution of the feature to subsequent classification and concentration estimation). Features with higher scores are retained, and redundant features with lower scores are removed. For example, if the importance score of "convexity K" is 0.8 and the importance score of "peptidoglycan percentage" is 0.6, then "convexity K" is retained and "peptidoglycan percentage" is removed. This cross-modal redundancy analysis can solve the problem that traditional screening does not consider the redundancy of different modal features, and avoid the subsequent AI model from being inefficient and affected in accuracy due to inputting redundant features.
[0115] Finally, a strongly correlated feature subset is generated: the strongly correlated morphological features and strongly correlated biochemical features after single-modal screening and cross-modal redundancy removal are integrated in a fixed order (e.g., morphological features first, then biochemical features) to form a strongly correlated feature vector corresponding to each single colony; the strongly correlated feature vectors of all single colonies are summarized to generate a strongly correlated feature subset; this strongly correlated feature subset will be used as the processing object in step 5 and input into the AI dual-branch attention fusion analysis unit for the generation of colony classification results and colony concentration estimates.
[0116] Referencing colony morphology feature vector The technical definition logic is that the colony biochemical feature vector is uniformly denoted as... (where j represents the single colony number, and the morphological feature vector) The i-values are in one-to-one correspondence to ensure accurate correlation between the morphology and biochemical characteristics of the same colony. The eight dimensions of this vector are all constructed based on the "spectral feature-biochemical feature correlation model" generated in step 4.1B and the "preprocessed spectral data to be detected" in step 4.2B. The technical essence and overall logic of each dimension are as follows:
[0117] Characteristic metabolite concentration It is a core dimension characterizing the pathogenicity and contamination level of bacterial colonies. Its processing targets are the spectral features of metabolites strongly correlated with pathogenicity / non-pathogenicity in the pre-processed spectral data to be detected (such as toxin absorption peaks of pathogenic bacteria and organic acid absorption peaks of non-pathogenic bacteria). By inputting these spectral features into a spectral feature-biochemical feature correlation model, and obtaining the mass concentration value (unit: mg / L) through partial least squares regression mapping, it can directly distinguish whether a colony is pathogenic (e.g., ...). (Even if identified as a potential pathogen), it can provide a biochemical basis for subsequent concentration estimation of pollution intensity. In addition to marker metabolites, the proportion of cell wall characteristic components... Focusing on colony structural attributes, this study uses the associated spectral characteristic peak areas of key cell wall components (such as peptidoglycan in Gram-positive bacteria and lipopolysaccharide in Gram-negative bacteria) in the preprocessed spectral data to be detected. The ratio (in %) of this peak area to the total spectral peak area of cell wall components is calculated to supplement colony structural differences that cannot be distinguished by morphological characteristics (e.g., morphologically similar Staphylococcus and Escherichia coli can be distinguished by their spectral characteristics). (Accurately distinguishing numerical differences) provides structural and biochemical support for colony classification.
[0118] Key enzyme activity This method focuses on reflecting colony metabolic activity. The target data is the full width at half maximum (FWHM) of the spectral characteristic peaks related to enzyme-catalyzed products in the pretreated spectral data (higher enzyme activity corresponds to higher product concentration and a wider FWHM). Using a pre-defined mapping relationship between spectral and biochemical characteristics, the enzyme activity value (unit: U / mL) is obtained. The activity level can be used to determine colony growth rate and pathogenicity (e.g., pathogenic bacteria typically have higher toxin-synthesizing enzyme activity). The ratio of biochemical component characteristic peak areas is also considered. This method quantifies the ratio (unitless) of the spectral characteristic peak areas of two complementary biochemical components (e.g., pathogenic and non-pathogenic components). The processing object is the peak area of the corresponding component in the preprocessed spectral data to be detected, which can intuitively reflect the dominance of different biochemical components in the colony (e.g., ...). This indicates that the pathogenic component is dominant, thus avoiding the biased judgment caused by testing a single component.
[0119] Local biochemical concentration standard deviation The focus is on the spatial uniformity of biochemical components. The processing object is the concentration of characteristic metabolites at multiple local spectral acquisition points corresponding to a single colony in the spatiotemporally calibrated multimodal data (i.e., the concentrations obtained by model mapping for each local point). ), by calculating these The standard deviation (unit: mg / L) reflects the colony growth status (e.g., This indicates that the colonies are growing evenly. This indicates localized pollution concentration; subsequent concentration estimations can be based on this value for spatial distribution correction. Detection rate of characteristic biochemical components. Using local spectral acquisition points of the same single colony as the processing object, statistics are compiled on those exceeding the detection threshold (e.g., the pathogenic toxin detection threshold is set to...). The percentage of local points (in %) can clearly define the spatial extent of bacterial contamination (e.g., Indicates pollution across the entire region. (This indicates localized contamination), providing a spatial dimension for determining the degree of food contamination.
[0120] Temperature stability coefficient of biochemical components This method is used to correct the effect of ambient temperature on biochemical characteristics. The processed objects include real-time temperature monitoring (real-time environmental parameters from step 6.2) and single colony data. The measured values and the preset "temperature-concentration correction curve" in the model were calculated. The ratio of the measured value to the theoretical value at the standard temperature (25℃) (unitless) is used to determine the degree of interference of temperature fluctuations on biochemical characteristics (e.g., or (Further adjustments are needed in the multi-reference system correction in step 6). Biochemical-morphological correlation coefficient. This achieves cross-modal feature consistency verification, using single colonies. Value and the same colony morphology feature vector The colony area S in the figure represents the treatment object. Calculate the Pearson correlation coefficient (unitless) between the two. If... The morphology and biochemical characteristics are highly consistent, if This indicates the possible presence of contaminants or abnormal feature extraction. The fusion weights in the subsequent AI dual-branch attention fusion analysis in step 5 can be adjusted based on this value.
[0121] In summary, the colony biochemical feature vector A complete technical logic loop is formed: In terms of data sources, all dimensions can be traced back to the spectral preprocessing, model building, or spatiotemporal calibration steps mentioned earlier, with no data lacking a source; in terms of technical functions, each dimension serves feature selection ( ), concentration estimation compensation ( ), environmental correction ( ) and cross-modal fusion weight adjustment ( (No redundant output); In terms of detection targets, it comprehensively characterizes the biochemical properties of colonies from seven dimensions, including pathogenicity, structure, activity, distribution, and environmental adaptability, and correlates with morphological feature vectors. They complement each other and jointly support the core detection needs of "colony classification + concentration estimation", ensuring the accuracy and reliability of the technical solution covering the entire detection process.
[0122] Optionally, step 5 specifically includes:
[0123] Step 5.1: Input the strongly correlated morphological features and strongly correlated biochemical features from the strongly correlated feature subset into the constructed AI dual-branch basic model to obtain the dual-branch fusion feature vector, dual-branch classification probability, dual-branch morphological feature confidence, and dual-branch biochemical feature confidence.
[0124] Step 5.2: Perform weight calculation processing on the confidence scores of the two-branch morphological features and the two-branch biochemical features to generate the two-branch dynamic attention weights;
[0125] Step 5.3: Perform a fusion process on the initial classification probability of the two branches and the dynamic attention weight of the two branches to generate the final colony classification result;
[0126] Step 5.4: Perform concentration estimation processing based on the final colony classification result and the dual-branch fusion feature vector to obtain the estimated colony concentration value.
[0127] Detailed implementation of steps 5.1-5.3 (including the role of the original network layer and innovative logic of the AI dual-branch basic model)
[0128] I. Preferably, the specific implementation process of step 5.1 is as follows:
[0129] The processing object is the strongly correlated feature subset generated in step 4.3 (including strongly correlated morphological features and strongly correlated biochemical features, each corresponding to the same single colony, with redundant features removed); the core of step 5.1 is to use the "improved CNN (ResNet) - improved Transformer" dual-branch basic model to address the essential differences between the two types of features (morphological features have spatial topology, and biochemical features have sequence correlation), and to supplement the original network layers with new modules to achieve accurate feature extraction and preliminary analysis, ultimately generating dual-branch fusion feature vectors, dual-branch classification probabilities, dual-branch morphological feature confidence, and dual-branch biochemical feature confidence.
[0130] (I) Overall Structure and Design Logic of the AI Dual-Branch Basic Model
[0131] The model includes a morphological feature branch (ResNet network), a biochemical feature branch (Transformer network), and a feature fusion layer, wherein:
[0132] Morphological feature branch: Based on the original ResNet network, the feature weights of key morphological parameters are strengthened to address the spatial correlation of strongly correlated morphological features (such as colony area S and roundness R).
[0133] Biochemical characteristics branch: For the sequence correlation of strongly correlated biochemical characteristics (such as metabolite concentration C1, enzyme activity A1) (parameters correspond to different spectral bands), based on the original Transformer network, we improve and adapt to the serialization processing of discrete biochemical parameters.
[0134] Feature fusion layer: Integrates deep features from both branches to provide a complete feature base for subsequent concentration estimation.
[0135] (ii) Morphological feature branch (ResNet network):
[0136] In a specific scenario, the core layers of the ResNet network include convolutional layers, residual connection layers, batch normalization (BN) layers, ReLU activation layers, global average pooling (GAP) layers, and fully connected layers (FC). The processing logic of each layer for strongly correlated morphological features is as follows:
[0137] Convolutional layer: Processes strongly correlated morphological features (input in vector form, such as [S,R,K,μk,σk]); performs spatial feature extraction, captures local correlations between features (such as the co-variation of roundness R and convexity K) through 3×3 convolutional kernels, and generates an initial morphological feature map (the dimension varies with the number of convolutional kernels, such as 64 channels).
[0138] Residual connection layer: The processing objects are the input (strongly correlated morphological features) and output (initial morphological feature map) of the convolutional layer. It performs a "cross-layer connection" action on the two, skips the intermediate BN and ReLU layers, and directly superimposes the input and output to solve the gradient vanishing problem in deep networks and ensure that subtle morphological features (such as the roughness σk of the colony edge) are not submerged, thereby generating residual enhanced feature maps.
[0139] BN layer and ReLU layer: The processing object is the feature map output by the residual connection layer; the BN layer performs normalization to stabilize the feature value range (avoiding training fluctuations caused by the difference between the values of S and σk); the ReLU layer performs non-linear activation to enhance the model's ability to fit complex morphology-type mapping relationships in order to generate normalized activation feature maps.
[0140] GAP layer: The processing object is the normalized activation feature map. It performs "high-dimensional feature reduction" on it, and averages the normalized activation feature map into a fixed-dimensional vector (such as 256 dimensions) to generate the basic feature vector of morphological branch.
[0141] FC layer: Performs "feature-class mapping" on the basic feature vector of morphological branch, mapping the basic feature vector of morphological branch to the dimension of the number of colony types to be classified (e.g., K=5 types, output 1×5 vector); after softmax activation, generates the morphological branch classification probability Pm (each element Pm[k] represents the initial probability of the colony belonging to the kth class, and ∑Pm[k]=1).
[0142] In another specific scenario, considering that ResNet's convolutional layers pay "equal attention" to all morphological features, they cannot distinguish between key features (such as the discriminative power of R for cocci / bacilli) and secondary features (such as the universality of S), resulting in limited classification accuracy. Therefore, a "colony morphology attention module" is added between the convolutional layer and the GAP layer, specifically implemented as follows:
[0143] The residual enhancement feature map is mapped one-to-one with the strongly correlated morphological features according to the channel (e.g., channel 1 corresponds to S, channel 2 corresponds to R). Then, the feature map of each channel is weighted element by element with the corresponding importance score (the higher the score, the greater the channel weight) to generate a weighted morphological feature map (the key feature channel signal is enhanced, and the secondary channel is weakened) and input into the original GAP layer. Subsequent GAP layer processing is similar to the above description and will not be repeated here.
[0144] Based on the morphological branch classification probability Pm output by the FC layer, the confidence score Cm of the bi-branch morphological features is calculated (value from 0 to 1): Cm = the maximum value of Pm and the second largest value of Pm; for example, if Pm = [0.1, 0.8, 0.1] (leaning towards class 2), then Cm = 0.8 - 0.1 = 0.7; the higher the value of Cm, the higher the certainty of the classification result of the morphological branch under the synergistic effect of the original ResNet layer and the innovative attention module.
[0145] In one scenario, the biochemical feature branch (Transformer network) includes: multi-head self-attention layer, layer normalization layer (Layer Norm), feedforward neural network (FFN), and encoder stacked layers.
[0146] Multi-head self-attention layer: The processing object is the serialized data corresponding to strongly correlated biochemical features. It performs "multi-dimensional association capture" on it to calculate the long / short distance association between features in parallel through multiple attention heads (such as the implicit association between C1 and the proportion of cell wall components C2), thereby generating association-enhanced sequence vectors.
[0147] Layer Norm: Processes the output (association enhancement sequence vector) of the multi-head self-attention layer, performs "normalization" on it, stabilizes the mean and variance of the sequence vector, avoids training fluctuations caused by the numerical difference between C1 (mg / L level) and A1 (U / mL level), and generates normalized sequence vectors.
[0148] FFN layer: The object processed is a normalized sequence vector. A "non-linear transformation" is performed on it. Complex biochemical-species mapping relationships (such as the strong correlation between toxin concentration and pathogenic bacteria category) are fitted through "ReLU + linear layer" to generate non-linear enhanced sequence vectors.
[0149] Encoder stacking layer: Using "multi-head self-attention + Layer Norm + FFN + Layer Norm" as the basic unit, stack 6 layers, and perform "deep association extraction" on the nonlinear enhancement sequence vector to gradually strengthen the biochemical association (such as the synergistic change of enzyme activity A1 and metabolite C1) to generate the basic feature vector of biochemical branches (such as 256 dimensions).
[0150] FC layer: The processing object is the basic feature vector of the biochemical branch. It performs the "feature-class mapping" action on it, outputs a 1×K-dimensional vector, and after softmax activation, generates the biochemical branch classification probability Pb (with the same dimension as Pm, ∑Pb[k]=1).
[0151] In another scenario, considering that Transformer can handle structured sequence data (such as text tokens), while strongly correlated biochemical features are discrete parameters (such as [C1, C2, A1]), direct input would lead to chaotic association capture. Therefore, a "biochemical sequence encoding module" is added before the multi-head self-attention layer. Specifically, the processing object is a strongly correlated biochemical feature vector, and a preset "feature-sequence position mapping table" is used (such as C1 corresponding to position 1, C2 corresponding to position 2). The strongly correlated biochemical features are converted into a fixed-length sequence according to the mapping table (such as 5-dimensional features → a sequence of length 5) to obtain sequence elements. Then, the sequence elements are normalized to the [0,1] interval (to adapt to the Transformer input format) to construct a biochemical sequence vector as the serialized data directly input to the multi-head self-attention layer.
[0152] Based on the biochemical branch classification probability Pb output by the FC layer, the confidence score Cb of the bi-branch biochemical features (value 0~1) is calculated in the same way as Cm; for example, Pb=[0.7,0.2,0.1] (leaning towards class 1), then Cb=0.7-0.2=0.5; the higher the Cb value, the higher the reliability of the biochemical branch classification result under the synergistic effect of the original Transformer layer and the innovative coding module.
[0153] The feature fusion layer processes the "weighted morphological feature vector" (256-dimensional) output from the morphological branch GAP layer and the "biochemical branch basic feature vector" (256-dimensional) output from the biochemical branch Encoder stacked layer. It performs a "channel dimension splicing" action to merge the two vectors into a 512-dimensional dual-branch fusion feature vector. This vector integrates morphological spatial features and biochemical sequence association features and is directly used as the core input for concentration estimation in step 5.4.
[0154] Preferably, in the specific technical implementation of step 5.2, the processing objects are the dual-branch morphological feature confidence Cm (from the original FC layer of the morphological branch) and the dual-branch biochemical feature confidence Cb (from the newly added FC layer of the biochemical branch) generated in step 5.1. The core of step 5.2 is to calculate the dual-branch dynamic attention weight based on the "classification result certainty" (i.e., Cm and Cb) of the two branches. Its technical essence is to transform the reliability of the branches into quantitative fusion weights, providing a basis for the classification fusion in step 5.3.
[0155] Cm comes from the original FC layer in the morphological branch: Pm, the output of the FC layer, reflects the degree of support of morphological features for classification. Cm is the "deterministic indicator" of Pm - the higher the Cm, the more fully the morphological features extracted by the ResNet layer (convolution, residual connection) and the attention module support the classification.
[0156] Cb comes from the newly added FC layer in the biochemical branch: Pb output by the FC layer reflects the degree of support of biochemical features for classification, and Cb is the "reliability index" of Pb - the higher the Cb, the clearer the support for classification is for the biochemical associations captured by the Transformer layer (multi-head self-attention, FFN) and the encoding module.
[0157] Specifically, the calculation process for dynamic weights is as follows:
[0158] 1. First step: Calculate the relative percentage of confidence levels (reflecting the differences in branch reliability).
[0159] The processing objects are Cm and Cb; the "normalization calculation" action is performed to generate the confidence ratio of morphological branch r_m=Cm / (Cm+Cb) and the confidence ratio of biochemical branch r_b=Cb / (Cm+Cb); for example, if Cm=0.7 and Cb=0.5, then r_m=0.7 / (0.7+0.5)≈0.58 and r_b≈0.42; the sum of r_m and r_b is 1 to ensure the normalization of weight allocation.
[0160] 2. Second step: Introduce minimum weight constraint (to avoid loss of information in a single branch)
[0161] The original network may have excessively small r_m or r_b due to sample specificity (such as extremely low Cm caused by ambiguous colony morphology). If weights are directly assigned according to proportion, the effective information of that branch will be completely ignored. Therefore, a constraint threshold β is set (generally 0.1~0.2, such as β=0.15), and a "weight adjustment" action is performed:
[0162] If r_m < β, then the morphological branch weight Wm = β, and the biochemical branch weight Wb = 1 - β;
[0163] If r_b < β, then the biochemical branch weight Wb = β, and the morphological branch weight Wm = 1 - β;
[0164] If both are ≥β, then Wm=r_m, Wb=r_b.
[0165] For example, when Cm=0.9 (morphologically reliable) and Cb=0.1 (biochemically ambiguous), r_m=0.9 / (0.9+0.1)=0.9≥0.15, r_b=0.1<0.15, and after correction, Wb=0.15 and Wm=0.85. This correction ensures that the basic information of biochemical branches (such as the key metabolite C1) still participates in subsequent fusion, avoiding the waste of the extraction results of the original Transformer layer.
[0166] The dual-branch dynamic attention weights Wm and Wb directly reflect the relative reliability of the two branches. Wm corresponds to the contribution of the morphological branch (original ResNet + innovative module), and Wb corresponds to the contribution of the biochemical branch (original Transformer + innovative module). This result serves as the core input of step 5.3, ensuring that the fusion process is tilted towards the branch with higher reliability.
[0167] Preferably, in a scenario, when step 5.3 is specifically implemented, the processing objects are the dual-branch classification probabilities generated in step 5.1 (the original FC layer output Pm of the morphological branch and the newly added FC layer output Pb of the biochemical branch) and the dual-branch dynamic attention weights Wm and Wb generated in step 5.2; the core of step 5.3 is to make the classification opinions of the high reliability branch dominate through "weighted probability fusion" while retaining the effective information of the low reliability branch, and finally generate the final colony classification result.
[0168] In summary, Pm reflects the morphological characteristics' influence on the classification; Pb reflects the biochemical characteristics' influence on the classification; Wm and Wb are the "weighting coefficients" of the two conclusions, ensuring that highly reliable conclusions have a greater impact in the fusion process—this logic differs from traditional fixed weights (such as Wm=Wb=0.5) and can adapt to the differences in the reliability of features of different samples.
[0169] Specifically, the weighted fusion process is as follows:
[0170] Step 1: Calculate the fusion classification probability Pf
[0171] The processing objects are Pm, Pb, Wm, and Wb; for each colony category k (k=1,2,...,K), a "weighted summation" operation is performed to generate the fusion probability Pf[k]=Wm×Pm[k]+Wb×Pb[k]; for example:
[0172] Pm=[0.1,0.8,0.1] (morphological tendency type 2), Pb=[0.7,0.2,0.1] (biochemical tendency type 1);
[0173] Wm=0.58, Wb=0.42 (from the example in step 5.2);
[0174] Then Pf[1]=0.58×0.1+0.42×0.7≈0.058+0.294=0.352;
[0175] Pf[2]=0.58×0.8+0.42×0.2≈0.464+0.084=0.548;
[0176] Pf[3]=0.58×0.1+0.42×0.1≈0.058+0.042=0.1;
[0177] After fusion, ∑Pf[k]=1, which conforms to the probability distribution rule.
[0178] Step 2: Determine the final colony classification results
[0179] The processing object is the fusion classification probability Pf; the "maximum value filtering" action is executed to find the category k_max corresponding to the element with the largest value in Pf (i.e., Pf[k_max]=max(Pf[1],Pf[2],...,Pf[K])), and the k_max category is taken as the final colony classification result; in the example above, Pf[2] is the largest (0.548), so the final classification result is "the second type of colony".
[0180] The final colony classification result will be directly input into step 5.4 to match the concentration mapping relationship of the corresponding category in the "standard colony concentration-feature database"; at the same time, the value of Pf[k_max] (e.g., 0.548) will be recorded to verify the reliability of the classification result (the higher the value, the higher the reliability).
[0181] Optionally, step 5.4 specifically includes:
[0182] Step 5.4.1: Construct a database based on the multi-dimensional fusion features of standard colony samples at different concentrations and actual concentration data to generate a standard colony concentration-feature database;
[0183] Step 5.4.2: Calculate and compensate for the time interval between the detection time and the sample collection time of the sample to be tested, in order to generate a concentration compensation factor;
[0184] Step 5.4.3: Perform concentration calculation based on the standard colony concentration-feature database and concentration compensation factor, and perform concentration estimation based on the final colony classification result and the dual-branch fusion feature vector to obtain the estimated colony concentration value.
[0185] Preferably, the specific implementation process of step 5.4.1 is as follows: the processing objects are standard colony samples with different concentration gradients (covering common colony types in the detection scenario, such as Salmonella in pathogenic bacteria and lactic acid bacteria in non-pathogenic bacteria, with at least 5 concentration gradients set for each colony), multi-dimensional fusion features of standard colony samples (which must be consistent with the feature extraction logic of the sample to be detected), and actual concentration data of standard colony samples (measured by the laboratory plate counting method, serving as the benchmark true value for concentration estimation). The core of step 5.4.1 is to construct a three-in-one standard colony concentration-feature database of "category-concentration-feature", which solves the problem of poor adaptability of traditional single feature-concentration databases, provides an accurate matching basis for the concentration estimation of the sample to be detected, and ensures that the extraction logic of the database features and the features of the sample to be detected is consistent, avoiding estimation deviations caused by differences in feature dimensions.
[0186] First, obtain the multi-dimensional fusion features of standard colony samples: For standard colony samples of each concentration gradient, strictly follow the processing flow of steps 1-5.1 (ensuring consistency with the feature extraction environment and parameters of the sample to be tested) – first perform gradient elution-layered filtering preprocessing to generate impurity-free colony samples, then simultaneously collect initial multimodal data and perform spatiotemporal calibration, then extract strongly correlated feature subsets, and finally input them into the AI dual-branch basic model (morphological branch is ResNet, biochemical branch is Transformer) to generate a dual-branch fusion feature vector consistent with the dimensions of the sample to be tested (e.g., 512 dimensions, each dimension corresponding to deep correlation features of morphology or biochemistry, for example, the first 256 dimensions are weighted morphological features of the morphological branch, and the last 256 dimensions are biochemical feature correlation vectors of the biochemical branch); denote the dual-branch fusion feature vector of each standard colony sample as... Where c represents the concentration gradient number and k represents the colony type number, ensuring that each feature vector can be traced back to a specific type and concentration.
[0187] Secondly, the actual concentration data of the standard colony samples were labeled: the actual concentration value of each standard colony sample was measured by the laboratory plate count method (a traditional but reliable concentration measurement method), and recorded as follows. (Unit is CFU / g, CFU is colony forming unit), and With the corresponding Binding, forming "feature-concentration" association pairs; for example, Salmonella ( The third concentration gradient of ) The corresponding association pair is This ensures that each feature vector has a clearly defined true concentration value.
[0188] Finally, a structured standard colony concentration-feature database was constructed: A tabular storage structure was adopted, where each row represents a "colony type-concentration gradient" combination (e.g., row 1 corresponds to Salmonella-concentration 1, row 2 corresponds to Salmonella-concentration 2, and row K×C corresponds to Lactic acid bacteria-concentration C). Each column is divided into three parts: the first column is the colony type identifier (e.g., "Salmonella" "Lactic acid bacteria"), the second column is the dual-branch fused feature vector column (for storage). The 512-dimensional numerical values, with each row's column element being a complete vector; the third column is the actual concentration value column (stored). Simultaneously, an index is created for the database (with colony species as the primary index and concentration gradient as the secondary index) to facilitate the rapid screening of standard features and concentration data for the corresponding species in subsequent step 5.4.3. This standard colony concentration-feature database will serve as the core matching basis for step 5.4.3. Its design of "feature extraction logic consistent with the sample to be tested" is different from traditional databases (which mostly use single morphological or spectral features, and the extraction method is different from that of the sample to be tested), which can significantly improve the accuracy of concentration estimation.
[0189] Preferably, in the specific technical implementation of step 5.4.2, the processing object is the acquisition time of the sample to be tested (i.e., the acquisition timestamp of the multimodal data synchronous acquisition unit in step 2). The detection time of the sample to be detected (i.e., the timestamp of the classification result output by the AI dual-branch basic model in step 5.1). Step 5.3 generates the final colony classification result (used to determine the growth rate characteristics of the colonies to be tested); the core of step 5.4.2 is to solve the problem that "the colony may grow and cause concentration changes during the time interval between sample collection and testing". By calculating the time interval and combining it with the colony growth rate model, a concentration compensation factor is generated to provide a time dimension correction basis for subsequent concentration estimation, avoiding the overestimation or underestimation of concentration caused by ignoring the time interval in the traditional method.
[0190] First, calculate the time interval for the samples to be tested: the processing object is... and ; Perform the "time difference calculation" action to generate time intervals. (Unit is hours, if) If the colony growth is extremely small within hours, the compensation factor can be directly set to 1.0 without further calculations. For example, if... , ,but For hours, the compensation factor needs to be further calculated.
[0191] Secondly, the growth rate model of the colonies to be tested is determined: the treatment object is the final colony classification result generated in step 5.3 (such as "Salmonella" and "Lactobacillus") and the preset "colony type-growth rate correlation table" (this table is determined in advance in the laboratory, recording the specific growth rate of different colonies at 20-25℃ (the general treatment temperature of steps 1-2)). The unit is For example, Salmonella Lactic acid bacteria ); Perform the "species-rate matching" action, and read the corresponding specific growth rate from the association table based on the final colony classification result. The innovation of this step lies in "matching growth rates according to species," which differs from the traditional method of using a fixed growth rate (such as uniform growth rate). The rough treatment can be adapted to the different growth characteristics of different colonies.
[0192] Finally, the concentration compensation factor is calculated: the treatment object is the time interval. Compared to growth rate ; based on the exponential growth model of microbial growth (simplified to ,in For the concentration at the time of collection, To determine the concentration at the time of detection, the "compensation factor derivation" action is executed to generate a concentration compensation factor. (The physical meaning of the compensation factor is "to restore the concentration estimated at the time of detection to the actual concentration at the time of collection". Since step 5.4.3 estimates the concentration at the time of detection, it needs to be multiplied by...) (Corrected to the concentration at the time of collection); for example, if , Hours, ; generated concentration compensation factor The input will be directly entered into step 5.4.3 to perform time correction on the initial concentration estimate.
[0193] Preferably, in a given scenario, when step 5.4.3 is specifically implemented, the objects being processed are the standard colony concentration-feature database generated in step 5.4.1 and the concentration compensation factor generated in step 5.4.2. The final colony classification result generated in step 5.3 (e.g., "Salmonella") and the dual-branch fusion feature vector generated in step 5.1. (512-dimensional feature vector of the sample to be tested); The core of step 5.4.3 is to achieve accurate estimation of the concentration of the sample to be tested through the coherent processing of "category screening - feature matching - concentration calculation - time correction". Its innovation lies in "similarity matching based on AI dual-branch fusion features" and "multi-factor correction" (category constraint + time compensation), which is different from the traditional concentration calculation based on only a single feature (such as colony count) and can improve the estimation accuracy of complex samples (such as mixed colonies, low-concentration colonies).
[0194] First, target category data in the standard colony concentration-feature database is filtered: the processing objects are the standard colony concentration-feature database and the final colony classification results; the "database index query" action is executed, using the final colony classification results as the first-level index, to filter out all "double-branch fusion feature vector-actual concentration" association pairs of concentration gradients under this category in the database, denoted as the target dataset. (in (where n is the species number of the colony to be tested and n is the concentration gradient number of that species). This screening step avoids cross-category matching (such as matching the characteristics of Salmonella with the concentration of lactic acid bacteria), ensuring the correctness of the matching basis.
[0195] Secondly, the feature similarity between the sample to be detected and the target dataset is calculated: the processing object is the dual-branch fused feature vector of the sample to be detected. With the target dataset In The cosine similarity algorithm (which measures the directional similarity between two vectors; the closer the value is to 1, the more similar the features) is used to perform a "similarity calculation" operation for each vector. Calculation and similarity (Where "·" represents the vector dot product, and "||·||" represents the vector magnitude); The top 3 standard feature vectors with the highest similarity are selected (denoted as...). ) and their corresponding actual concentrations Similarity S1, S2, S3; selecting the first 3 similar features instead of a single feature can avoid estimation bias caused by errors in individual standard samples and improve the robustness of the results.
[0196] Then, calculate the initial concentration estimate of the sample to be tested: the sample to be processed is the selected sample. Together with S1, S2, and S3, perform a "weighted average calculation" action, using similarity as the weight (the higher the similarity, the greater the weight), to generate initial concentration estimates. For example, if , , , , , ,but This weighted calculation method can make full use of the information of highly similar standard samples to ensure that the initial estimate is accurate.
[0197] Finally, execution time compensation and final concentration determination: the object of processing is the initial concentration estimate. The concentration compensation factor generated in step 5.4.2 Perform the "concentration correction" action to generate the final estimated colony concentration. (Restore the estimated concentration at the time of detection to the actual concentration at the time of collection); for example, if , ,but The final estimated colony concentration will be input into step 6 along with the final colony classification result generated in step 5.3.
[0198] Optionally, step 6 specifically includes:
[0199] Step 6.1: Based on the multimodal feature-detection result database of standard colony samples, perform first reference system correction on the colony classification results and estimated colony concentration values to generate a first-corrected detection result;
[0200] Step 6.2: Perform a second reference system correction process on the detection results after the first correction based on real-time environmental parameters to generate the detection results after the second correction as the final corrected detection results.
[0201] Preferably, the specific implementation process of step 6.1 is as follows: the processing objects are the final colony classification results, estimated colony concentrations, strongly correlated feature subsets (including strongly correlated morphological features and strongly correlated biochemical features), and the preset "standard colony multimodal feature-detection result database"; the core of step 6.1 is to use the "feature-prediction bias" correlation of standard samples to perform benchmark correction on the detection results, and solve the systematic bias that the AI dual-branch basic model may have in complex samples (such as classifying low-concentration colonies with a tendency to classify high-similarity categories). Its innovation lies in "bias transfer based on feature matching", which is different from the traditional method of directly correcting with true values and can improve the pertinence of correction.
[0202] (I) Structure and Function of Standard Colony Multimodal Characteristics - Detection Result Database
[0203] This database serves as the core basis for the first reference system. Its construction logic is the same as that of the standard concentration-feature database (ensuring consistency in feature extraction), but it stores richer content:
[0204] The rows represent standard colony samples (covering all categories involved in step 5.3, with each category containing samples of different concentrations and different morphological / biochemical variations);
[0205] The columns include: strongly correlated morphological feature vectors (consistent with the output dimension of step 4.3A), strongly correlated biochemical feature vectors (consistent with the output dimension of step 4.3B), and the AI dual-branch model prediction classification results (denoted as...). AI dual-branch model predicts concentration values (denoted as...) ), standard sample true classification (denoted as ), standard sample true concentration (denoted as );
[0206] By comparison and , and It can quantify the prediction bias of the model under different feature combinations, and provide a "bias template" for the correction of the sample to be detected.
[0207] (ii) Correction of the first reference frame for classification results
[0208] 1. The processing object is a subset of strongly correlated features of the sample to be detected (denoted as...). ,in For strongly correlated morphological characteristics, (For strongly correlated biochemical characteristics), and the final colony classification result (denoted as...) ), standard database "predicted classification as All sample data;
[0209] 2. Perform the "Feature Similarity Matching" action: Calculate The cosine similarity (calculated separately for morphological and biochemical features) of the strongly correlated feature subsets of the above samples in the standard database was used to select the top 5 standard samples with the highest similarity (denoted as ). to );
[0210] 3. Generate a "Classification Bias Coefficient Matrix": In a standard database, for each predicted class... Compared with the real classification Pre-calculate the deviation coefficient (The rows of the matrix represent the predicted classification, the columns represent the true classification, and the elements are the bias coefficients, reflecting the predicted classification.) The actual time is (probability)
[0211] 4. Perform "classification correction" action: based on the selected... to The true classification, combined with the classification bias coefficient matrix, is used to... Perform weighted correction—if the true classification of the majority of standard samples is consistent with... Consistent, and the coefficient of deviation Then keep Otherwise, the true classification with the highest bias coefficient is taken as the corrected classification result (denoted as ). ).
[0212] (iii) Correction of the first reference system for concentration estimates
[0213] 1. The object of treatment is the estimated colony concentration (denoted as...). (The selected items in step 6.1.2) to The standard database is classified as Concentration deviation data;
[0214] 2. Calculate the concentration deviation of the standard samples: For to Calculate separately (Positive values indicate that the model overestimates, while negative values indicate that it underestimates.)
[0215] 3. Generate a "concentration deviation calibration curve": In the standard database, for each category... Using the principal components of strongly correlated feature subsets (such as the first two principal components obtained by PCA dimensionality reduction, reflecting the overall strength of the features) as the horizontal axis and the average concentration deviation as the vertical axis, a calibration curve (describing the relationship between feature strength and model deviation) is fitted.
[0216] 4. Perform the "concentration correction" action: Adjust the concentration of the sample to be tested... Map the data to the horizontal axis of the calibration curve and read the corresponding average deviation. , combined to average deviation Calculate the concentration value after correction. (The weights are set based on the feature matching degree).
[0217] (iv) Output the detection results after one calibration
[0218] The object to be processed is and ; Perform the "Result Binding" action to generate a calibrated detection result (including calibration classification and calibration concentration). This result will be directly used as the processing object in step 6.2 to ensure the complete transmission of the deviation correction logic of the first reference system.
[0219] II. Preferably, in the specific technical implementation of step 6.2
[0220] The object being processed is the detection result after one correction generated in step 6.1. and The core of step 6.2 is to eliminate the influence of environmental fluctuations on the detection results (such as high temperature causing colony morphology to expand, and acidic environment changing spectral characteristics). Its innovation lies in "multi-parameter collaborative correction", which is different from traditional single-factor correction (such as only considering temperature) and can adapt to deviation compensation in complex environments.
[0221] (a) Real-time environmental parameter acquisition and preprocessing
[0222] The data processed is raw environmental data collected by sensors (T is in °C, range 15-35; pH is dimensionless, range 5-9; H is in %, range 30-70). An "outlier filtering" action is performed: outliers exceeding the normal range are removed (e.g., (T=50℃) is clearly abnormal and replaced with the average temperature of the same batch of samples); a "standardization" action is performed: parameters are mapped to the [0,1] interval (e.g., ...). Generate standardized environmental parameter vectors This ensures that parameters can be directly and collaboratively calculated.
[0223] (II) Construction Logic of the Environmental Parameter-Correction Coefficient Correlation Model
[0224] This model is trained using laboratory data, and its core principle is to quantify the relationship between environmental parameters and detection bias: the input is a standardized environmental parameter vector. The colony category k is used as the input; the output consists of two correction coefficients: a taxonomic environmental coefficient and a colony classification coefficient. (Adjust the stability of the classification results, range 0.9-1.1), concentration environmental coefficient (Adjust the concentration value deviation, range 0.8-1.2); Model structure: Employs an improved multilayer perceptron (MLP), with a "category-environment interaction layer" embedded after the input layer (integrating category encoding with...) Element-wise multiplication amplifies the differences in environmental sensitivity among different categories (e.g., lactic acid bacteria are more sensitive to pH, while Salmonella are more sensitive to temperature). The output layer is mapped to a coefficient range via sigmoid activation. Training data: Detection results of standard samples were collected under different combinations of environmental parameters, and the results were compared with the baseline environment. The deviation of ) is used as the model training label.
[0225] (III) Specific Implementation of Secondary Correction
[0226] 1. The object being processed is , , Environmental parameter-correction coefficient correlation model;
[0227] 2. Perform the "Coefficient Query" action: [The command will be inserted here] and Input association model, output corresponding and For example, if the ambient temperature is higher than the baseline ( ),salmonella( )of (The model tends to underestimate, so it needs to be adjusted upwards);
[0228] 3. Perform the "classification stability correction" action: If (If there are large environmental fluctuations), then re-examine the second-highest deviation term in the classification bias coefficient matrix in step 6.1. If the second-highest term is consistent with... If the difference in the coefficient of deviation is <0.1, then both are considered as candidate classifications (e.g., "E. coli (major) / Salmonella (minor)"); otherwise, retain. Generate secondary correction classification ;
[0229] 4. Perform the "Precise Concentration Calibration" action: Calculate the secondary correction concentration. ;For example, , ,but .
[0230] The object to be processed is and The "result encapsulation" action is performed to generate the final corrected detection result (including the confirmed / candidate classification and corresponding concentration). This result will be directly input into step 7 for risk assessment, forming a logical closed loop of "detection-correction-assessment" to ensure that deviations caused by environmental factors are effectively compensated.
[0231] Specifically, the core of the improved MLP is to add a "category-environment interaction layer" to the traditional MLP, forming a four-stage structure: "input layer → category-environment interaction layer → hidden layer (including layer normalization and activation) → output layer". The design goal of this architecture is to address the "different sensitivity of different colony categories to environmental parameters" (e.g., lactic acid bacteria are sensitive to pH, Salmonella are sensitive to temperature), strengthen the association information between categories and the environment through the interaction layer, capture complex mapping relationships through the hidden layer, and finally output accurate environmental correction coefficients (classification environmental coefficient \gamma_k, concentration environmental coefficient \lambda_k).
[0232] The input layer is the "data reception and normalization" stage of the improved MLP, and its processing object is the "normalized environment parameter vector". "and "colony category encoding vector" Its core function is to convert two types of heterogeneous data (environmental parameters are continuous values, and categories are discrete values) into vectors of a unified format, providing adapted input for subsequent interaction layers.
[0233] First, determine the format and meaning of the input data:
[0234] Standardized environmental parameter vector : The preprocessing result from step 6.2, with a dimension of 3 (corresponding to temperature) pH value ,humidity Each element takes a value in the range [0,1], representing the corresponding environmental parameter relative to the baseline environment ( The degree of deviation. For example, Indicates: Temperature is higher than the baseline ( pH is lower than the baseline ( ), humidity higher than the baseline ( ).
[0235] Colony category encoding vector K_{enc}: One-hot encoding (or weighted encoding) is performed on the primary corrected classification k_{corr1} output in step 6.1. The dimension is equal to the total number of colony categories to be detected (generally 5~10 dimensions, such as 5 dimensions, corresponding to 5 common colony categories). For example, if k_{corr1} is "lactic acid bacteria" (category number 2), then K_{enc}=[0,1,0,0,0]; if weighted encoding is used (more closely reflecting sensitivity differences), then K_{enc}=[0,1.2,0,0,0] (1.2 is the sensitivity weight of lactic acid bacteria, generally 1.0~1.5, the higher the sensitivity, the greater the weight).
[0236] Next, the input vector concatenation operation is performed: ... and Concatenate the vectors along the channel dimension to generate the input layer output vector. , dimension is " Dimension+ "Dimension". For example, For 3D, If it is 5-dimensional, then It is 8-dimensional, and the order of the elements is fixed as " → → →Category 1 encoding →Category 2 encoding →... →Category n encoding. This concatenation process ensures that environmental parameters and category information are uniformly incorporated into subsequent processing, avoiding the category sensitivity loss problem caused by traditional MLPs that only input environmental parameters.
[0237] Finally, the input layer output vector It is directly used as the processing object of the "category-environment interaction layer" to ensure that the data format is adapted to subsequent interactive operations.
[0238] Preferably, the specific implementation process of the category-environment interaction layer is as follows: The category-environment interaction layer is the core innovative layer that distinguishes the improved MLP from the traditional MLP, and the object it processes is the output of the input layer. The core function is to "strengthen the sensitivity differences of different colony categories to environmental parameters"—traditional MLPs directly input environmental parameters and category information into the hidden layer without establishing a specific association between the two, resulting in the inability to distinguish the difference between "lactic acid bacteria being sensitive to pH" and "salmonella being sensitive to temperature". The interaction layer achieves this association strengthening through element-wise multiplication.
[0239] First, construct a category sensitivity weight matrix: based on the "colony category-environment sensitivity data table" determined in advance in the laboratory (e.g., lactic acid bacteria have a sensitivity coefficient of 1.3 to pH and 0.8 to temperature; Salmonella has a sensitivity coefficient of 1.4 to temperature and 0.7 to pH), construct the sensitivity weight matrix. The dimensions of this matrix are... Consistent, of which:
[0240] correspond The three dimensions are: element values are the sensitivity coefficients of the current category to this environmental parameter (read from the data table);
[0241] correspond n dimensions: element value is 1.0 (the category code itself already reflects the category identifier, no additional weighting is needed).
[0242] For example, if the current category is lactic acid bacteria (pH sensitive), then (The first three elements correspond to the sensitivity coefficients of temperature, pH, and humidity, and the fifth element corresponds to the category code position of lactic acid bacteria, with a value of 1.0).
[0243] Next, perform interactive operations: convert the input layer's output... With sensitivity weight matrix Element-wise multiplication (i.e., multiplying corresponding elements in the vector) generates a category-environment interaction feature vector. For example, if (Higher temperature, lower pH, type of lactic acid bacteria) The technical essence of this operation is to amplify the feature values of environmental parameters that are sensitive to the current category (such as the pH dimension of lactic acid bacteria) (0.3→0.39) and weaken the insensitive dimensions (such as the temperature dimension) (0.8→0.64), thereby prioritizing the capture of the influence of sensitive environmental parameters in subsequent layers.
[0244] Finally, the category-environment interaction feature vector As the processing object of the hidden layer, it ensures that the enhanced category-environment association information can be further captured by subsequent nonlinear mapping, thus avoiding sensitive information being buried in the hidden layer.
[0245] Preferably, the specific implementation process of the hidden layer is as follows: the hidden layer is the "non-linear feature extraction" stage of the improved MLP, and the processing object is the output of the category-environment interaction layer. Its core function is to capture through multi-layer nonlinear transformation. The complex mapping relationship between "category-environment association" and "correction coefficient" (e.g., the concentration environment coefficient for "lactic acid bacteria + low pH" needs to be increased). Traditional MLP hidden layers only focus on general mappings. In this scenario, the number of hidden layers, neurons, and activation functions are adjusted to adapt to the scenario requirements of environmental correction.
[0246] First, determine the structural parameters of the hidden layer:
[0247] Number of layers: The general rule is 2 layers (to avoid overfitting due to too many layers, and to avoid failing to capture complex mappings due to too few layers), which are denoted as hidden layer 1 and hidden layer 2 respectively;
[0248] Number of neurons: The number of neurons in hidden layer 1 is equal to the number of neurons in the input vector. 2 to 3 times the dimension (e.g.) If the dimension is 8, then the hidden layer 1 is set to have 16 neurons; the number of neurons in the hidden layer 2 is half that of the hidden layer 1 (e.g., 8 neurons), and the dimension is gradually reduced to focus on key features.
[0249] Layer normalization: A layer normalization operation is added before each hidden layer. The object of the operation is the output vector of the previous layer. The operation is to perform "mean normalization and variance normalization" to avoid training instability caused by fluctuations in environmental parameters (such as when the temperature deviation of different batches of samples is large, layer normalization can stabilize the input distribution).
[0250] Next, perform the nonlinear transformation:
[0251] Hidden layer 1: Processes objects after layer normalization A linear feature vector is generated through fully connected operations (the weight matrix has a dimension of "16×8", and each neuron corresponds to a weighted sum of 8 input features). Then, the feature vector of hidden layer 1 is generated by passing it through the ReLU activation function (which performs the action of "keeping the original value when the value is greater than 0 and setting it to 0 when the value is less than 0"). (16-dimensional). The reason for choosing the ReLU activation function is that its nonlinear characteristics can effectively capture the non-monotonic mapping between the "degree of deviation of environmental parameters and the correction coefficient" (e.g., when the pH is 10% lower, the coefficient is increased by 5%, and when it is 20% lower, the coefficient is increased by 12%).
[0252] Hidden layer 2: Processes objects after layer normalization Linear feature vectors are generated through fully connected operations (weight matrix dimension "8×16"), and then hidden layer 2 feature vectors are generated through the ReLU activation function. (8-dimensional). The role of this layer is to further compress redundant features and focus on the core features that are directly related to the correction coefficients (such as the interaction feature of "lactic acid bacteria + low pH" is preferentially retained).
[0253] Finally, the feature vectors of hidden layer 2 As the processing object of the output layer, it ensures that the core correlation features extracted by nonlinearity can be accurately transmitted to the output stage, providing a high-quality feature foundation for the calculation of correction coefficients.
[0254] Preferably, the specific implementation process of the output layer is as follows: the output layer is the "correction coefficient generation" stage of the improved MLP, and the processing object is the output of hidden layer 2. Its core function is to map the core features extracted from the hidden layer into correction coefficients (classification environment coefficients) that meet the requirements of the scene. Concentration environmental coefficient Traditional MLP output layers are mostly used for classification or regression. In this scenario, the output dimension and activation function are adjusted to adapt to the coefficient range requirements.
[0255] First, determine the structure and objectives of the output layer:
[0256] Output dimension: 2-dimensional, corresponding to the classification environment coefficients. (Used to adjust the stability of classification results, range 0.9~1.1) and concentration environmental coefficient (Used to adjust for deviations in concentration estimates, ranging from 0.8 to 1.2).
[0257] Fully connected operations: The object being processed is (8-dimensional), the 8-dimensional features are mapped to a 2-dimensional linear output vector through a fully connected weight matrix (dimension "2×8"). (Each element is a weighted sum of features from 8 hidden layers).
[0258] Next, the activation mapping action is performed: the sigmoid activation function is used to... Perform a transformation, and then map the result to the target range using linear scaling:
[0259] Classification of environmental coefficients The sigmoid function outputs in the range [0,1], and its scaling formula is as follows: (0.9 is the lower limit, 0.2 is the range width), ensuring ;
[0260] Concentration Environmental Coefficient The sigmoid function outputs in the range [0,1], and its scaling formula is as follows: (0.8 is the lower limit, 0.4 is the range width), to ensure .
[0261] For example, if ,but , (This indicates that the current environment has little impact on the classification results, with a coefficient close to 1.0); if ,but , (This indicates that the current environmental conditions have caused the concentration estimate to be too low, and it needs to be adjusted upward by 9%).
[0262] Finally, the output layer outputs and It is directly used as the core parameter of "secondary calibration" in step 6.2, and is used for classification stability calibration and concentration accuracy calibration respectively, to ensure that the output of the improved MLP can directly serve the environmental deviation compensation of the detection results.
[0263] Optionally, the method further includes step 7:
[0264] Step 7.1: Call the multi-parameter dynamic risk assessment model, and determine the food safety risk level by integrating the colony pathogenicity weight, concentration gradient coefficient and food category risk benchmark value, based on the corrected test results;
[0265] Step 7.2: Obtain the construction scenario-adaptive processing suggestion mapping rules based on the processing scenario parameters of the food to be tested. By associating the risk level with the processing constraints corresponding to the scenario parameters, execute rule matching based on the food safety risk level to generate targeted processing suggestion output results.
[0266] Preferably, the specific implementation process of step 7.1 is as follows: the object of processing is the final corrected detection result generated in step 6 (including the final corrected colony classification). Final corrected colony concentration The core of step 7.1 is to break through the limitations of traditional risk assessment that relies solely on a single concentration parameter by using a multi-parameter dynamic risk assessment model. It integrates the three core risk factors of "pathogenicity, concentration, and food category" to achieve dynamic determination of risk level. The technical essence of this is to adapt to the differences in the contribution of risk factors in different scenarios through dynamic weighting (rather than fixed weights) between parameters (such as the higher "food category risk benchmark value" for ready-to-eat foods and the higher "pathogenicity weight" for pathogenic bacteria), so as to ensure that the risk level determination is more in line with the actual food safety scenario.
[0267] Determining core risk parameters (model input layer)
[0268] 1. Colony pathogenicity weighting Calculation
[0269] The processing target is the final corrected colony classification. The pre-defined "colony pathogenicity-weight association table" (this table is constructed using national food safety standards and industry risk databases, classifying colonies into three categories: highly pathogenic bacteria, moderately pathogenic bacteria, and non-pathogenic bacteria, with each category corresponding to a fixed weight range);
[0270] Perform the "Classification-Weight Matching" action: If If it is a highly pathogenic bacterium (such as Salmonella or Listeria), then Use a value of 0.7~0.9 (general guideline, 0.8 for example); if it is a moderately pathogenic bacterium (such as common Escherichia coli), then Use 0.4~0.6 (0.5 for example); if it is a non-pathogenic bacterium (such as lactic acid bacteria), then Take a value of 0.1 to 0.3 (for example, take a value of 0.2);
[0271] to this end, It directly reflects the risk basis of the colony itself. Even if the concentration of highly pathogenic colonies is low, the overall risk is still high, avoiding the problem of "misjudging highly pathogenic colonies at low concentrations as low risk" caused by the traditional approach of only looking at the concentration.
[0272] 2. Concentration gradient coefficient Calculation
[0273] The target of the treatment is the final corrected colony concentration. (Unit: CFU / g), Preset "Concentration Gradient-Coefficient Mapping Table" (This table is divided into gradients according to the degree of impact of colony concentration on human health, and each gradient corresponds to a coefficient, with the coefficient being larger for higher concentrations);
[0274] Perform the "concentration-gradient matching" action: If (High concentration), then Take a value between 1.0 and 1.2 (for example, take 1.1); if (Medium concentration), then Take a value between 0.6 and 0.9 (0.8 is used as an example); if (Low concentration), then Take a value of 0.3~0.5 (0.4 is used as an example); if (Extremely low concentration), then Take a value of 0.1 to 0.2 (for example, take 0.15).
[0275] The quantitative concentration amplifies the risk. Under the same pathogenicity, the higher the concentration, the greater the risk coefficient. Moreover, the gradient division is more refined than the traditional "threshold judgment" (such as only dividing into "qualified / unqualified"), and can distinguish the difference between medium risk and high risk.
[0276] 3. Risk benchmark values for food categories The determination
[0277] The processing targets are the category parameters of the food to be tested (which need to be entered into the system in advance, such as ready-to-eat food, food requiring heating and processing, and frozen food), and the preset "Food Category-Risk Baseline Value Table" (this table is set based on the risk exposure level of the food consumption method, with higher baseline values for foods that are consumed directly).
[0278] Perform the "Category-Baseline Matching" action: If the food to be tested is a ready-to-eat food (such as cold dishes or ready-to-eat meat), then Use 0.8~1.0 (0.9 for example); if it is a food that requires heating (such as raw meat, sashimi, which needs to be cooked before consumption), then Use 0.4~0.6 (0.5 for example); if it is frozen food (such as frozen vegetables, which need to be thawed before processing), then Take a value of 0.2 to 0.3 (for example, take 0.25);
[0279] It reflects the inherent risks of food consumption scenarios. Since ready-to-eat foods do not have a subsequent sterilization process, the risk benchmark value is higher, avoiding the unreasonable judgment that "ready-to-eat foods and processed foods have the same risk level at the same concentration" due to the neglect of food categories in traditional assessments.
[0280] (ii) Dynamic integration of multiple parameters (model calculation layer)
[0281] The object of treatment is the colony pathogenicity weight. Concentration gradient coefficient Food category risk benchmark The multi-parameter dynamic risk assessment model employs a "dynamic weighted summation" algorithm, which differs from the traditional fixed-weight summation (e.g., ...). Its innovation lies in: according to The size is dynamically adjusted to adjust the weight ratio of each parameter. The higher the level (the higher the pathogenicity). The larger the proportion of the pathogen itself, the more important it is to ensure that pathogenicity becomes the core factor in risk assessment.
[0282] Detailed calculation process:
[0283] 1. Calculate the dynamic weight allocation coefficients: Let... (0.5 is the balance coefficient to ensure) When it is 0.2 , When it is 0.8 ),but The dynamic weight is , and The merged dynamic weight is ;
[0284] 2. Calculate the consolidation coefficient : (The risks of concentration and food category are averaged and integrated to avoid the excessive influence of a single factor.)
[0285] 3. Calculate the risk score : ( The value range is 0.1 to 1.0.
[0286] For example: If (Salmonella, highly pathogenic) (concentration ), (Ready-to-eat food), then , , .
[0287] (III) Determination of food safety risk level (model output layer)
[0288] The object of processing is risk score The pre-defined "risk score-level mapping rule" (this rule has been verified through risk assessment experiments and industry standards, and the higher the score, the higher the level).
[0289] Perform the "score-level matching" action:
[0290] like It was determined to be "extremely high risk" (it must be destroyed immediately and is prohibited from any circulation);
[0291] like It was determined to be "high-risk" (sales are prohibited, and secondary testing is required for confirmation).
[0292] like It is classified as "medium risk" (limited to specific usage scenarios, such as consumption after processing).
[0293] like It was determined to be "low risk" (allowed to circulate normally, with a risk warning marked);
[0294] As in the example above If the risk level is high, it will be classified as "extremely high risk". This food safety risk level will serve as the core input for step 7.2, ensuring that the risk assessment results directly contribute to the generation of subsequent handling recommendations.
[0295] Preferably, in the specific technical implementation of step 7.2, the processing objects are the food safety risk level generated in step 7.1, the processing scenario parameters of the food to be tested (which need to be entered into the system in advance, including four core scenarios: cold chain storage, immediate sales, industrial processing, and home consumption), and the preset "scenario-adaptive processing suggestion mapping rule library". The core of step 7.2 is to break the limitation of the traditional "single risk level corresponds to a single suggestion" by constructing a three-dimensional mapping rule of "risk level-scenario parameters-processing constraints" to generate targeted processing suggestions adapted to specific scenarios. Its technical essence is that the processing priority and feasibility of the same risk level are different in different scenarios (e.g., "high risk" needs to be removed from the shelves immediately in the "immediate sales" scenario, while it can be temporarily stored and tested again in the "cold chain storage" scenario). Suggestions need to be dynamically matched in combination with scenario constraints.
[0296] (I) Construction of the scenario-adaptive processing suggestion mapping rule base
[0297] The rule base adopts a "three-dimensional table" structure to ensure that each rule accurately corresponds to "risk level - scenario parameters - handling suggestions". The table dimensions are defined as follows:
[0298] Food safety risk level (extremely high risk, high risk, medium risk, low risk);
[0299] Example: Processing scenario parameters of the food to be tested (cold chain storage, immediate sales, industrial processing, home consumption);
[0300] Cell content: Processing suggestions and corresponding constraints (constraints include time limits, operational requirements, and secondary testing standards to ensure the suggestions are executable);
[0301] The rule base is constructed based on:
[0302] 1. "Risk Exposure Urgency" of Scenarios: The urgency of handling is highest in the immediate sales scenario (food needs to be distributed quickly and consumers can buy it directly), while the urgency is lower in the cold chain storage scenario (low temperature delays bacterial growth).
[0303] 2. “Feasibility of subsequent processing” in the scenario: The industrial processing scenario (where risks can be reduced through high-temperature sterilization, dilution, etc.) has the highest feasibility, while the home consumption scenario (where consumers have limited operational capabilities) has lower feasibility.
[0304] Example rule base snippet:
[0305] Risk level Cold chain storage scenarios Instant sales scenarios Industrial processing scenarios Home consumption scenarios Extremely high risk Immediately transfer to a dedicated isolation cold storage facility and destroy within 24 hours; reheating is strictly prohibited. Remove products from shelves immediately, seal all products from the same batch, and contact regulatory authorities for filing. Immediately cease processing, destroy all semi-finished products containing this raw material, and thoroughly disinfect all equipment. Do not consume. It is recommended to dispose of this as hazardous waste and keep it out of reach of children. High risk Store temporarily in a cold storage at 0-4℃, and conduct a second test within 48 hours. If the result is still high-risk, destroy the product. Immediately cease sales, guide consumers who have already purchased the products to return them, and send the same batch of products for testing. Assess whether the sterilization process can be reduced to a low-risk level (e.g., sterilization at 121°C for 30 minutes); if not, destroy the raw materials. It is not recommended to consume this product. If you do consume it, ensure that the core temperature reaches above 75°C and remains elevated for at least 5 minutes.
[0306] (ii) Dynamic matching and generation of processing suggestions
[0307] 1. The processing objects are food safety risk levels, processing scenario parameters of the food to be tested, and scenario-adaptive processing suggestion mapping rule library;
[0308] 2. Perform the "dual-dimensional positioning" action: using the food safety risk level as the row index and the processing scenario parameters as the column index, locate the unique corresponding cell (i.e., the target processing suggestion and constraints) in the rule base.
[0309] 3. Perform the "Constraint Refinement" action: Based on the final corrected colony concentration from step 6. Refine the specific values in the constraints (examples will be given after a general explanation):
[0310] If the scenario is "cold chain storage" and the risk level is "high risk," the general approach to the constraint "secondary detection time" is "adjusted according to concentration; the higher the concentration, the shorter the time." For example: if This is further specified as "a second test to be completed within 24 hours"; if The requirement is further specified as "a second test to be completed within 48 hours";
[0311] If the scenario is "industrial processing" and the risk level is "medium risk," the general perspective for the "sterilization temperature" constraint is "adjust according to the type of bacterial colony; highly pathogenic colonies require higher temperatures." For example: If For common Escherichia coli, the criteria are specified as "center temperature ≥ 70°C for 2 minutes"; for Salmonella, the criteria are specified as "center temperature ≥ 80°C for 5 minutes".
[0312] 4. Generate targeted handling suggestions output: Integrate the identified handling suggestions with the refined constraints to form structured text (e.g., "
Handling Suggestion
Constraints
[0313] The targeted treatment recommendations are directly delivered to food production / sales companies or consumers, ensuring that the recommendations are implementable. At the same time, they form a logical closed loop with the risk level in step 7.1 and the concentration data in step 6. The refinement of the constraints depends on the final corrected concentration, avoiding the problem of recommendations being unenforceable due to being divorced from actual test data.
[0314] like Figure 2 As shown in the embodiments of this application, an artificial intelligence-based food colony detection and analysis system is also provided, which includes:
[0315] The gradient elution-layer filtration pretreatment unit is used to perform gradient elution-layer filtration pretreatment on the food samples to be tested to generate samples with impurities removed and bacterial colonies removed.
[0316] The multimodal data synchronous acquisition unit simultaneously performs colony microscopic image acquisition and near-infrared spectral data acquisition on the impurity-removed colony sample to generate initial multimodal data;
[0317] The multimodal data spatiotemporal calibration unit performs spatiotemporal calibration processing on the initial multimodal data to generate spatiotemporally calibrated multimodal data;
[0318] The multi-dimensional colony feature extraction and screening unit performs multi-dimensional colony feature extraction and screening on the spatiotemporally calibrated multimodal data to generate a strongly correlated feature subset.
[0319] The AI dual-branch attention fusion analysis unit performs AI dual-branch attention fusion analysis on strongly correlated feature subsets to generate colony classification results and estimated colony concentration values.
[0320] The multi-reference system correction unit performs multi-reference system correction on the colony classification results and estimated colony concentrations to generate corrected test results.
[0321] In specific implementation, the gradient elution-layer filtration pretreatment unit may include a sterile gradient pressure reactor capable of performing gradient elution-layer filtration pretreatment on the food samples to be tested. The multimodal data synchronous acquisition unit may include a sterile autofocus microscopic imager (for synchronous acquisition of microscopic images of colonies on decontaminated colony samples) and a near-infrared spectroscopy analyzer (for near-infrared spectral data acquisition). The multimodal data spatiotemporal calibration unit, the multi-dimensional colony feature extraction and screening unit, the AI dual-branch attention fusion analysis unit, and the multi-reference system correction unit for detection results are deployed as software modules on electronic devices such as backend servers or backend server clusters.
[0322] The following are comparative experimental examples of the technical effects of the proposed solution:
[0323] Experiment 1: Timeliness Comparison Experiment
[0324] 1. Experimental subjects and conditions
[0325] Sample type: ready-to-eat chicken breast samples (30 samples in total, 100g each, all contaminated with the same amount of Escherichia coli, meeting the requirements of rapid distribution scenarios).
[0326] Controlled variables: ambient temperature (25℃), aseptic operation standards for sample pretreatment, and proficiency of testing personnel were consistent, with the only difference being the testing protocol (traditional protocol vs. the protocol of this application).
[0327] Traditional procedure: homogenize samples → inoculate onto nutrient agar medium → incubate at 37°C for 48 hours (until visible colonies form) → observe under a microscope + plate counting → output results;
[0328] The workflow of this application is as follows: sample gradient elution-layer filtering preprocessing (30 minutes) → simultaneous acquisition of microscopic images and near-infrared spectra (20 minutes) → spatiotemporal calibration + feature screening + AI dual-branch fusion + multi-reference system correction (1 hour 10 minutes) → output results.
[0329] 2. Detection Indicators and Comparison Results
[0330] Testing Plan Average total time per sample The percentage of samples meeting the requirement of "results within 4 hours for ready-to-eat foods" Traditional solution 48.5 hours 0% (all require more than 48 hours) This application proposal 2.0 hours 100% (all completed within 2 hours)
[0331] 3. Effect Analysis
[0332] Traditional methods rely on 48 hours of culture medium cultivation, which is completely unsuitable for the distribution needs of ready-to-eat chicken breast that require rapid detection within 4 hours. The proposed method does not require colony cultivation and reduces the total time to 2 hours through a process of "pretreatment-multimodal collection-rapid analysis", which 100% meets the real-time detection needs of rapid distribution scenarios and has significantly improved timeliness compared to traditional methods.
[0333] Experiment 2: Comparison Experiment on the Accuracy of Colony Classification
[0334] 1. Experimental subjects and conditions
[0335] Sample type: Cold chain beef samples (50 samples in total, each containing one target bacterial colony, of which 25 samples contained Salmonella and 25 samples contained Escherichia coli. The two types of colonies are easily confused under a traditional microscope).
[0336] Controlled variables: Colony concentration (all 10³ CFU / g, excluding the interference of concentration on classification), microscopic observation magnification (40×), and spectral acquisition band (900-1700nm) were consistent;
[0337] Traditional classification method: Classification is based on microscopic observation of colony color (all milky white) and edge morphology (all irregular circles), combined with the experience of the testing personnel.
[0338] The classification method of this application is as follows: Simultaneous acquisition of microscopic images (morphological features) and near-infrared spectra (Salmonella contains unique toxin spectral peaks, Escherichia coli contains unique lipopolysaccharide spectral peaks) → screening of strongly correlated features after spatiotemporal calibration → AI dual-branch fusion analysis and classification.
[0339] 2. Detection Indicators and Comparison Results
[0340] Testing Plan Salmonella classification accuracy Escherichia coli classification accuracy Overall average classification accuracy Traditional solution 68% 72% 70% This application proposal 96% 98% 97%
[0341] 3. Effect Analysis
[0342] Traditional methods rely solely on easily confused morphological features, resulting in a classification accuracy of only 70%. This application's method, through the fusion of "morphological + biochemical" dual-modal data, captures the specific biochemical spectral differences between the two types of colonies. Combined with AI analysis to replace human experience-based judgment, the overall classification accuracy is improved to 97%, effectively reducing the risk of subjective misjudgment in traditional methods and achieving significantly higher classification accuracy than traditional methods.
[0343] Experiment 3: Comparison Experiment on Estimation Error of Low-Concentration Colony Concentration
[0344] 1. Experimental subjects and conditions
[0345] Sample type: Fresh-cut lettuce samples (40 samples in total, each containing low concentrations of bacterial colonies, with concentration gradients of 10 CFU / g, 50 CFU / g, 80 CFU / g, and 100 CFU / g, 10 samples of each, covering the low concentration range where traditional methods have significant errors).
[0346] Controlled variables: bacterial species (all were Listeria monocytogenes), number of test replicates (each sample was tested 3 times and the average value was taken);
[0347] Traditional concentration estimation method: plate count method (counting the number of colonies on the culture medium and converting it to sample concentration; at low concentrations, it is easy to miss counts due to the small number of colonies).
[0348] The concentration estimation method in this application is as follows: near-infrared spectroscopy captures the biochemical characteristics of low-concentration colonies → dual-branch fusion feature vector matching standard database → multi-reference system correction (compensation for ambient temperature and sample humidity) → outputting the estimated concentration value.
[0349] 2. Detection Indicators and Comparison Results
[0350] Testing Plan 10 CFU / g sample error rate 50 CFU / g sample error rate 80 CFU / g sample error rate 100 CFU / g sample error rate Overall average error rate Traditional solution 35% 28% 22% 18% 25.75% This application proposal 10% 8% 6% 4% 7.0%
[0351] 3. Effect Analysis
[0352] Traditional methods are prone to missing counts when counting low-concentration colonies on plates, resulting in an overall average error rate of 25.75%, especially with a rate exceeding 35% for 10 CFU / g samples. The proposed method captures the specific biochemical signals of low-concentration colonies using near-infrared spectroscopy (without relying on colony counting), and combines this with multi-reference frame correction to compensate for environmental interference, reducing the overall average error rate to 7.0%. Even for low-concentration samples of 10 CFU / g, the error rate is only 10%, effectively solving the problem of large estimation errors at low concentrations in traditional methods.
[0353] Experiment 4: Comprehensive Performance Comparison Experiment in Multiple Scenarios
[0354] 1. Experimental subjects and conditions
[0355] Sample types: Covering 3 typical fast-circulation scenarios (20 ready-to-eat salads, 20 cold chain salmon, and 20 fresh-cut apples, each sample containing different types and concentrations of bacterial colonies).
[0356] Testing scenario requirements: ready-to-eat salads need results within 2 hours (immediate requirement); cold chain salmon needs to accurately distinguish Vibrio parahaemolyticus from other bacterial colonies (classification requirement); fresh-cut apples contain low concentrations of bacterial colonies (10-50 CFU / g, low concentration requirement).
[0357] Comparison metrics: total time spent, classification accuracy, and low concentration error rate (to comprehensively evaluate the adaptability of the solution to multiple scenarios).
[0358] 2. Comparison Results
[0359] Testing Plan Average cooking time for ready-to-eat salads Accuracy of cold chain salmon classification Average error rate of fresh-cut apples Percentage of samples meeting the needs of all scenarios Traditional solution 72 hours 65% 30% 0% (None of them can meet the requirements of any scenario) This application proposal 1.8 hours 95% 9% 100% (meets the needs of all scenarios)
[0360] 3. Effect Analysis
[0361] Traditional solutions, due to their combined shortcomings in time consumption, classification accuracy, and low-concentration error, are completely unsuitable for diverse rapid distribution scenarios such as ready-to-eat food, cold chain, and low-concentration products. The solution proposed in this application, through a coherent process of "preprocessing - multimodal acquisition - AI fusion - correction," meets the requirements of various scenarios in terms of immediacy (1.8 hours), classification accuracy (95%), and low-concentration error (9%). It is 100% adaptable to multiple rapid distribution scenarios, and its overall performance is significantly improved compared to traditional solutions, better supporting the diverse needs in actual testing.
[0362] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for detecting and analyzing bacterial colonies in food based on artificial intelligence, characterized in that, include: Step 1: Perform gradient elution-layer filtration pretreatment on the food sample to be tested to generate a sample with impurities removed. Step 2: Simultaneously perform colony microscopic image acquisition and near-infrared spectral data acquisition on the impurity-removed colony samples to generate initial multimodal data; Step 3: Perform spatiotemporal calibration on the initial multimodal data to generate spatiotemporally calibrated multimodal data; Step 4: Perform multi-dimensional colony feature extraction and screening on the spatiotemporally calibrated multimodal data to generate a strongly correlated feature subset; Step 5: Perform AI dual-branch attention fusion analysis on the strongly correlated feature subset to generate colony classification results and estimated colony concentration values; Step 6: Perform multi-reference system correction on the colony classification results and estimated colony concentration values to generate corrected detection results; Step 5 specifically includes: Step 5.1: Input the strongly correlated morphological features and strongly correlated biochemical features from the strongly correlated feature subset into the constructed AI dual-branch basic model to obtain the dual-branch fusion feature vector, dual-branch classification probability, dual-branch morphological feature confidence, and dual-branch biochemical feature confidence. Step 5.2: Perform weight calculation processing on the confidence scores of the two-branch morphological features and the two-branch biochemical features to generate the two-branch dynamic attention weights; Step 5.3: Perform a fusion process on the initial classification probability of the two branches and the dynamic attention weight of the two branches to generate the final colony classification result; Step 5.4: Perform concentration estimation processing based on the final colony classification result and the dual-branch fusion feature vector to obtain the estimated colony concentration value.
2. The method for detecting and analyzing microbial colonies in food based on artificial intelligence according to claim 1, characterized in that, Step 1 specifically includes: Step 1.1: Mix the food sample to be tested with the elution buffer and perform gradient pressure cyclic elution to generate a colony-matrix mixture; Step 1.2: Perform initial filtration on the colony-substrate mixture to generate a colony mixture free of large particulate impurities; Step 1.3: Perform fine filtration on the bacterial colony mixture after removing large particulate impurities to generate impurity-free bacterial colony samples.
3. The method for detecting and analyzing microbial colonies in food based on artificial intelligence according to claim 1, characterized in that, Step 3 specifically includes: Step 3.1: Perform acquisition time synchronization processing on the initial multimodal data to generate time-synchronized multimodal data; Step 3.2: Perform coordinate mapping processing on the time-synchronized multimodal data to generate spatiotemporally calibrated multimodal data.
4. The method for detecting and analyzing microbial colonies in food based on artificial intelligence according to claim 1, characterized in that, Step 4 specifically includes: Step 4.1A: Perform adaptive threshold segmentation on the colony microscopic images in the spatiotemporally calibrated multimodal data to generate preliminary colony region images; Step 4.2A: Perform edge restoration processing on the preliminary colony area image to generate a complete colony edge contour image; Step 4.3A: Perform topological parameter calculation on the complete colony edge contour image to generate a colony morphology feature vector.
5. The method for detecting and analyzing microbial colonies in food based on artificial intelligence according to claim 4, characterized in that, Step 4 specifically includes: Step 4.1B: Construct a correlation model based on the near-infrared spectral data of known bacterial colonies and the corresponding biochemical index data to generate a spectral feature-biochemical feature correlation model; Step 4.2B: Perform biochemical feature mapping processing on the near-infrared spectral data and the spectral feature-biochemical feature correlation model in the spatiotemporally calibrated multimodal data to generate colony biochemical feature vectors; Step 4.3: Based on the colony morphology feature vector and colony biochemical feature vector, colony feature screening is performed to obtain strongly correlated morphological features and strongly correlated biochemical features, so as to generate a strongly correlated feature subset.
6. The method for detecting and analyzing microbial colonies in food based on artificial intelligence according to claim 1, characterized in that, Step 5.4 specifically includes: Step 5.4.1: Construct a database based on the multi-dimensional fusion features of standard colony samples at different concentrations and actual concentration data to generate a standard colony concentration-feature database; Step 5.4.2: Calculate and compensate for the time interval between the detection time and the sample collection time of the sample to be tested, in order to generate a concentration compensation factor; Step 5.4.3: Perform concentration calculation based on the standard colony concentration-feature database and concentration compensation factor, and perform concentration estimation based on the final colony classification result and the dual-branch fusion feature vector to obtain the estimated colony concentration value.
7. The method for detecting and analyzing microbial colonies in food based on artificial intelligence according to claim 1, characterized in that, Step 6 specifically includes: Step 6.1: Based on the multimodal feature-detection result database of standard colony samples, perform first reference system correction on the colony classification results and estimated colony concentration values to generate a first-corrected detection result; Step 6.2: Perform a second reference system correction process on the detection results after the first correction based on real-time environmental parameters to generate the detection results after the second correction as the final corrected detection results.
8. The method for detecting and analyzing food microbial colonies based on artificial intelligence according to any one of claims 1 to 7, characterized in that, The method further includes step 7: Step 7.1: Call the multi-parameter dynamic risk assessment model, and determine the food safety risk level by integrating the colony pathogenicity weight, concentration gradient coefficient and food category risk benchmark value, based on the corrected test results; Step 7.2: Obtain the construction scenario-adaptive processing suggestion mapping rules based on the processing scenario parameters of the food to be tested. By associating the risk level with the processing constraints corresponding to the scenario parameters, execute rule matching based on the food safety risk level to generate targeted processing suggestion output results.
9. A food microbial colony detection and analysis system based on artificial intelligence, characterized in that, include: The gradient elution-layer filtration pretreatment unit is used to perform gradient elution-layer filtration pretreatment on the food samples to be tested to generate samples with impurities removed and bacterial colonies removed. The multimodal data synchronous acquisition unit simultaneously performs colony microscopic image acquisition and near-infrared spectral data acquisition on the impurity-removed colony sample to generate initial multimodal data; The multimodal data spatiotemporal calibration unit performs spatiotemporal calibration processing on the initial multimodal data to generate spatiotemporally calibrated multimodal data; The multi-dimensional colony feature extraction and screening unit performs multi-dimensional colony feature extraction and screening on the spatiotemporally calibrated multimodal data to generate a strongly correlated feature subset. The AI dual-branch attention fusion analysis unit performs AI dual-branch attention fusion analysis on strongly correlated feature subsets to generate colony classification results and estimated colony concentration values. The multi-reference system correction unit for test results performs multi-reference system correction on the colony classification results and estimated colony concentration values to generate corrected test results; Specifically, AI dual-branch attention fusion analysis is performed on strongly correlated feature subsets to generate colony classification results and estimated colony concentrations, including: The strongly correlated morphological features and strongly correlated biochemical features in the strongly correlated feature subset are input into the constructed AI dual-branch basic model to obtain the dual-branch fusion feature vector, dual-branch classification probability, dual-branch morphological feature confidence, and dual-branch biochemical feature confidence. Weight calculations are performed on the confidence scores of the two-branch morphological features and the two-branch biochemical features to generate dynamic attention weights for the two branches. The initial classification probability of the two branches and the dynamic attention weights of the two branches are fused to generate the final colony classification result; Concentration estimation is performed based on the final colony classification results and the dual-branch fusion feature vector to obtain the estimated colony concentration.