Method for identifying mastitis in a dairy animal, server and unmarked online raw milk somatic cell detection device
By collecting cell images of raw milk samples in real time on the milking line, extracting and fusing their population characteristics, the problem of low accuracy in detecting mastitis in dairy animals was solved, and highly accurate identification of breast health status was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2026-05-27
- Publication Date
- 2026-06-26
AI Technical Summary
Existing technologies for detecting mastitis in dairy animals have low accuracy and cannot achieve continuous sampling of raw milk samples, resulting in high randomness and low accuracy in detection results.
By installing label-free online raw milk somatic cell detection devices on the milking line, cell images of raw milk samples are acquired in real time, and population morphological features, texture features, subpopulation features, and cell concentration are extracted. Based on these features, the health status of the breast is identified.
It enables accurate identification of the health status of dairy animals' udders, improves the accuracy and continuity of detection, and avoids the randomness problem of detection at a single moment.
Smart Images

Figure CN122289271A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of food composition analysis technology, and in particular to a method for identifying mastitis in dairy animals, a server, and a label-free online raw milk somatic cell detection device. Background Technology
[0002] As consumers place increasing demands on food safety, the health of dairy animals' udders and the quality of raw milk have become a major concern.
[0003] Currently, it is typically necessary to extract raw milk samples, stain them, and then perform somatic cell counts on the stained samples. Furthermore, based on information such as the number of somatic cells obtained from the tests, the health status of the udder of the dairy animal that produced the raw milk sample can be identified.
[0004] However, this method has the problem of low accuracy in identifying breast health status. Summary of the Invention
[0005] This application provides a method for identifying mastitis in dairy animals, a server, and a label-free online raw milk somatic cell detection device, which solves the technical problem of low accuracy in identifying the health status of dairy animals' breasts and achieves the technical effect of improving the accuracy of identifying the health status of dairy animals' breasts.
[0006] To achieve the above objectives, the main technical solutions adopted in this application include: In a first aspect, embodiments of this application provide a method for identifying mastitis in dairy animals.
[0007] During the milking production process, cell images of raw milk samples are acquired in real time. The cell images include somatic cells distributed in a single layer in the raw milk sample. The somatic cells in the cell images within a preset time period are detected and tracked, and the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all the somatic cells are extracted. The population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all the somatic cells are aggregated to obtain the cell population features of the raw milk sample. Based on the cell population features, the udder health status of the dairy animals that produced the raw milk sample is determined.
[0008] Secondly, embodiments of this application provide a server, including: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the method described in any of the above embodiments.
[0009] Thirdly, embodiments of this application provide a label-free online raw milk somatic cell detection device, including branch pipelines, detection pools, automatic image acquisition modules, and the server shown in the second aspect; The two ends of the branch pipe are connected to the main pipe of the milking production line, and are used to obtain raw milk samples from the main pipe of the milking production line in real time during the production process of the milking production line; when the raw milk sample flows through the detection pool in the branch pipe, the automatic image acquisition module captures cell images in real time and sends the cell images to the server, so that the server executes the first aspect and any possible method of the first aspect; wherein, the somatic cells in the raw milk sample in the cell image are distributed in a single layer.
[0010] In this embodiment, by acquiring cell images of raw milk samples in real time during the milking production process, and extracting the population morphology, texture, subpopulation, and somatic cell concentration of all somatic cells from the cell images, and then identifying the udder health status of the dairy animals producing the raw milk samples based on these features, the accuracy of identifying the udder health status of dairy animals is improved.
[0011] Furthermore, by detecting and tracking somatic cells in cell images within a preset time period, this application improves the data validity of individual somatic cells, avoids the randomness that may exist when detecting raw milk samples at only one moment, and further improves the accuracy of identifying the udder health status of dairy animals.
[0012] Furthermore, the method of obtaining cell population characteristics by fusing population morphological characteristics, population texture characteristics, population subpopulation characteristics, and somatic cell concentration, and then identifying and making decisions about the udder health status of dairy animals based on these cell population characteristics, enriches the key features and further improves the accuracy of dairy animal health status detection. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0014] Figure 1 A flowchart illustrating a method for identifying mastitis in dairy animals, provided as an embodiment of this application; Figure 2 A flowchart of an online raw milk somatic cell analysis method for mastitis is provided as an embodiment of this application; Figure 3A schematic diagram illustrating the construction of a cell population feature as provided in an embodiment of this application; Figure 4 A structural diagram of a server provided in an embodiment of this application; Figure 5 This is a structural diagram of a label-free online raw milk somatic cell detection device provided in an embodiment of this application. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0016] Somatic cell count in raw milk is a core indicator for assessing udder health and the quality and safety of raw milk in dairy animals. An elevated somatic cell count (SCC) is a major marker of mastitis in dairy animals. Mastitis in dairy animals not only leads to decreased milk production but also seriously affects the quality and safety of dairy products. Dairy animals can include various livestock that produce raw milk, such as dairy cows, buffalo, camels, and sheep.
[0017] In existing techniques for detecting mastitis in dairy animals, after collecting raw milk samples, somatic cells in the samples are typically stained with a dye to make them observable. This allows for the counting of somatic cells in the raw milk sample, and mastitis detection is then performed based on the counting results.
[0018] Based on this method, each test typically requires selecting one or more time points and separating one or more raw milk samples from the produced raw milk at those times. These raw milk samples can then be stained and tested. Clearly, this method cannot achieve continuous sampling of raw milk samples, resulting in a high degree of randomness in the sample composition. This can easily lead to low accuracy in the test results based on these raw milk samples.
[0019] To address the aforementioned issues, this application proposes a label-free online raw milk somatic cell detection device. Based on this device, a branch pipe connected to the main pipeline of the milking line can acquire raw milk samples in real time from the main pipeline. After obtaining cell images of the raw milk sample, the sample is returned to the milking line. This process enables continuous sampling and continuous acquisition of cell images of the raw milk sample. Compared to cell images extracted from a single raw milk sample at a given moment, cell images acquired from the flowing raw milk sample clearly contain richer information. Therefore, based on this richer information, a more accurate identification of the udder health status of dairy animals can be achieved.
[0020] Furthermore, this application detects and tracks somatic cells in cell images within a preset time period, extracts the population morphological features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells, and identifies the udder health status of dairy animals based on these population morphological features, population texture features, population subpopulation features, and somatic cell concentration, thereby further improving the richness of the data and the accuracy of the identification.
[0021] According to an embodiment of this application, a method for identifying mastitis in dairy animals is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed on a server via a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here. The server can be a mobile terminal, a personal computer, a server, etc.
[0022] Figure 1 A flowchart illustrating a method for identifying mastitis in dairy animals, as provided in this application embodiment, is shown below. Figure 1 As shown, with the server as the execution entity, this process includes the following steps: S101. During the milking production process, cell images of raw milk samples are collected in real time; the cell images include somatic cells distributed in a single layer in the raw milk sample.
[0023] For example, in the actual production process of a milking line, an unlabeled online raw milk somatic cell detection device introduces raw milk samples from the main pipeline of the milking line into a branch pipeline, and allows the raw milk samples to flow through a detection pool. The server can use the automatic image acquisition module in the unlabeled online raw milk somatic cell detection device to acquire cell images of the raw milk samples flowing through the detection pool in real time.
[0024] In one implementation, the somatic cells of the raw milk sample are distributed in a monolayer within the detection pool. Therefore, in the cell image, the somatic cells of the raw milk sample are distributed in a monolayer.
[0025] In one implementation, the milking line is a production line used to obtain raw milk from dairy animals and perform preliminary processing.
[0026] In one implementation, the automatic image acquisition module can acquire cell images at a preset frequency. For example, the sampling frequency can be 100-2000 frames per minute.
[0027] In one implementation, since the somatic cells in the cell image are not stained, the optical features of the somatic cells in the cell image are revealed based on the light illuminating the detection cell by a spatial light source.
[0028] In one implementation, somatic cells are a general term for all types of cells present in raw milk, and their quantity and state can reflect the health of dairy animals.
[0029] In one implementation, the boundary of the detection pool can be captured in the cell image. Therefore, if a somatic cell cannot be detected in the cell image, it indicates that the somatic cell has flowed out of the detection pool along the branch pipe.
[0030] S102. Based on the detection results of somatic cells in cell images within a preset time period, extract the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells.
[0031] For example, the server can detect cell images acquired within a preset time period and obtain detection results. These detection results may include somatic cells from the cell images within the preset time period. Furthermore, the server can extract features from these somatic cells and, based on the feature extraction results, generate population morphology features, population texture features, and population subpopulation features for all somatic cells. Additionally, the server can calculate the somatic cell concentration in the raw milk sample based on information such as the number of extracted somatic cells.
[0032] In one implementation, the preset time period can be a preset detection time. This preset time period can include two parts: the detection start time and the detection execution duration.
[0033] Optionally, the detection start time can be a time selected by the user to start the detection. For example, the detection start time can be the time when the user clicks the "Start Detection" button through the server. Alternatively, the detection start time can be a user-preset start time.
[0034] For example, if a user clicks the "Start Detection" button at 12:05, the detection start time can be 12:05.
[0035] For example, users can preset the start time of the detection to 12 o'clock.
[0036] For example, the detection start time can be preset to 5 minutes after the raw milk production line starts working. Or, the detection start time can be preset to 5 minutes after the last detection ended.
[0037] Optionally, the detection execution time can be a preset duration. For example, the duration can be 1 minute, 5 minutes, 10 minutes, etc.
[0038] In one implementation, the server can perform target detection of the somatic cell using a trained target detection algorithm. Optionally, the target detection algorithm can be used to determine the somatic cell location in the cell image and delineate the somatic cell region.
[0039] In one implementation, the server can extract various features of each somatic cell from its somatic cell region. These features may include morphological features and texture features.
[0040] In one implementation, the server can perform a fusion analysis based on the initial morphological and texture features of each somatic cell in each cell image to obtain the group morphological and texture features of all somatic cells.
[0041] In another implementation, the server can first fuse the initial morphological and texture features of the same somatic cell in multiple cell images to obtain the cell morphological and texture features of a single somatic cell. Then, the server can fuse and analyze these features to obtain the group morphological and texture features of all somatic cells.
[0042] In one implementation, morphological characteristics refer to the appearance features of somatic cells, such as area, perimeter, roundness, and aspect ratio.
[0043] In one implementation, texture features are those that describe the texture structure of the somatic cell surface, such as roughness and smoothness, or contrast, correlation, energy, and entropy calculated based on the gray-level co-occurrence matrix (GLCM).
[0044] In one implementation, the server can analyze and obtain the initial subpopulation features of each somatic cell in each cell image based on the initial morphological and texture features of each somatic cell in each cell image.
[0045] Furthermore, the server can perform fusion analysis to obtain the population subpopulation characteristics of all somatic cells. Alternatively, the server can first perform fusion analysis to obtain the cell subpopulation characteristics of each somatic cell, and then perform fusion analysis based on the cell subpopulation characteristics to obtain the population subpopulation characteristics of all somatic cells.
[0046] In another implementation, the server can analyze the cell subpopulation characteristics of each somatic cell based on its morphological and textural features. Furthermore, the server can perform a fusion analysis of these cell subpopulation characteristics to obtain the overall subpopulation characteristics of all somatic cells.
[0047] In one implementation, the subgroup feature is the probability feature of the somatic cell corresponding to different subgroups.
[0048] In one implementation, somatic cell concentration is the number of somatic cells per unit volume of raw milk.
[0049] S103. The population morphology, texture, subpopulation and concentration of all somatic cells are aggregated to obtain the cell population characteristics of the raw milk sample.
[0050] For example, the server can splice together the population morphological features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells to obtain the aggregated cell population features of the raw milk sample.
[0051] In one implementation, the server can sequentially splice together the morphological features, texture features, subpopulation features, and somatic cell concentration of the population to obtain the cell population features of the raw milk sample.
[0052] In another implementation, the server can pre-define a data structure for step S104. Population morphological features, population texture features, population subpopulation features, and somatic cell concentration correspond to fixed positions within this data structure. The server can write these population morphological features, population texture features, population subpopulation features, and somatic cell concentration into these fixed positions to obtain the final cell population features.
[0053] S104. Based on cell population characteristics, determine the udder health status of dairy animals used to produce raw milk samples.
[0054] For example, the server uses a pre-established decision model or rule to judge and decide on the health status of the dairy animals that produced the raw milk sample based on the calculated cell population characteristics, and then determines the health status of the dairy animals' udders.
[0055] In one implementation, breast health status can include different conditions such as "healthy", "subclinical mastitis", and "clinical mastitis".
[0056] In one implementation, the pre-established decision model can be a machine learning-based decision model, such as a support vector machine, decision tree, or neural network. Alternatively, the decision model can also be a decision rule based on expert experience, directly determining the health status of dairy animals according to different value ranges and combinations of cell population characteristics. Preferably, this embodiment uses a support vector machine algorithm and uses a radial basis function as the kernel function.
[0057] In one implementation, the decision model pre-training method first requires acquiring multiple training samples of a dairy animal, as well as the udder health status label of the dairy animal from which each training sample originates. The cell population features corresponding to each training sample are then obtained. These cell population features and the udder health status label are then input into a selected machine learning algorithm for training. Preferably, during training, key hyperparameters (such as the penalty coefficient C and kernel function coefficient γ) of the support vector machine algorithm model are optimized using grid search and cross-validation techniques to obtain the classification decision model with the strongest generalization ability.
[0058] The trained model can learn the cell population characteristics of raw milk samples from a specific dairy animal, and the optimal dividing boundaries for the three categories of "healthy," "subclinical mastitis," and "clinical mastitis" within the model's feature space. Furthermore, for subsequently collected raw milk samples, after extracting the cell population characteristics, the category to which the raw milk sample belongs can be determined based on the dividing boundaries of the three categories within the model's feature space.
[0059] In this embodiment, by performing target detection and analysis on cell images of raw milk samples collected in real time from the milking line within a preset time period, the morphological characteristics, texture characteristics, subpopulation characteristics, and somatic cell concentration of all somatic cells within that preset time period are obtained. Furthermore, these morphological characteristics, texture characteristics, subpopulation characteristics, and somatic cell concentration are aggregated to obtain cell population characteristics. Based on these cell population characteristics, decisions are made regarding the udder health status of dairy animals, thus improving the accuracy of udder health status detection. Moreover, the method of fusing the morphological characteristics, texture characteristics, subpopulation characteristics, and somatic cell concentration of all somatic cells to obtain cell population characteristics increases the richness of key features in the decision-making process, further improving the accuracy of udder health status detection in dairy animals.
[0060] In one example, in step S102 above, somatic cells in cell images within a preset time period are detected and tracked, and the population morphological features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells are extracted, including: S1021. Use the trained target detection algorithm to detect cell images within a preset time period to obtain somatic cells in each cell image.
[0061] For example, the server uses a pre-trained target detection algorithm to detect somatic cells in the cell images according to the time sequence of cell image acquisition, and obtains the somatic cells contained in each frame of cell image.
[0062] In one implementation, the somatic cells identified by the target detection algorithm can be specifically represented as the bounding box and confidence level of each somatic cell.
[0063] In one implementation, the target detection algorithm can also identify information such as the boundary contour of each somatic cell.
[0064] In one implementation, the server can receive cell images uploaded by the automatic image acquisition module in real time. Once the server receives the cell images from the automatic image acquisition module, it can input the received cell image of the current frame into the target detection algorithm for processing.
[0065] In another implementation, the server can receive cell images uploaded by the automatic image acquisition module in real time and write them to a cache. The server can then read cell images from the cache in a first-in, first-out (FIFO) order and input them into the target detection algorithm for processing.
[0066] In one implementation, the object detection algorithm can be a deep learning algorithm. For example, Faster Region-based Convolutional Neural Networks (Faster RCNN), You Only Look Once (YOLO), Single Shot MultiBox Detector (SSD), or other Transformer-based detection models.
[0067] In one implementation, to improve the detection capability for small cells (10-15 μm in diameter), the server can cluster the bounding boxes of each somatic cell in the training samples of raw milk to obtain a bounding box size suitable for somatic cells in the raw milk. Then, the server can train the target detection algorithm based on this bounding box size. The bounding boxes generated by this target detection algorithm can better fit the cell size, improving the accuracy of target detection and reducing the probability of missed detections.
[0068] S1022. Match somatic cells in cell images to obtain the position sequence of the same somatic cell in cell images within a preset time period.
[0069] For example, the server can match somatic cells in cell images from different frames to identify the same somatic cell in different frames. Furthermore, the server can generate a position sequence of the somatic cell based on the frames in which the same somatic cell appears and its position within the cell image of those frames.
[0070] In one implementation, the server can determine the coordinates of the center point of each somatic cell based on the bounding box of each somatic cell, and use the coordinates of the center point as the somatic cell position.
[0071] In one implementation, the server can track somatic cells by matching somatic cells in cell images of two adjacent frames.
[0072] Specifically, when two adjacent cell images are the current frame and the previous frame, the somatic cell matching process can include: Step 1: If the first somatic cell in the cell image of the current frame matches the second somatic cell in the cell image of the previous frame, then write the somatic cell position of the first somatic cell in the current frame into the position sequence of the second somatic cell in the previous frame.
[0073] Step 2: If the first somatic cell in the cell image of the current frame does not match the second somatic cell in the cell image of the previous frame, then the position sequence of the first somatic cell will be generated based on the somatic cell position of the first somatic cell in the current frame.
[0074] In another implementation, considering the risk of somatic cells occluding each other in the cell image, step 2 above can be further expanded into the following steps: Step 21: If the first somatic cell in the cell image of the current frame does not match the somatic cell in the second cell image of the previous frame, then obtain the third somatic cell that has not flowed out of the detection pool and whose position sequence has not been updated.
[0075] Step 22: Match the first somatic cell with the third somatic cell. If a match is found, update the somatic cell position of the first somatic cell to the position sequence of the third somatic cell. Otherwise, generate the position sequence of the first somatic cell.
[0076] In one implementation, the server can match two somatic cells based on one or more of the somatic cell's morphological features, texture features, image features, and other information.
[0077] In one implementation, the server can determine that a somatic cell has flowed out of the detection pool if the position sequence of a somatic cell has not been updated after being continuously matched with somatic cells in a preset number of frames of cell images.
[0078] Optionally, the preset number of frames can be 5 frames, 6 frames, 7 frames, 10 frames, etc.
[0079] In one implementation, the position sequence can be a set of coordinates. These coordinates represent the somatic cell position of a somatic cell.
[0080] In another implementation, the position sequence can be a set of time and coordinates. The time is the time when the cell image of the somatic cell in that frame was captured. The coordinates are the somatic cell location.
[0081] S1023. Based on the position sequence of each somatic cell, extract the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells from the cell images within a preset time period.
[0082] For example, the server can extract the initial morphological features and initial texture features of somatic cells from each frame of cell image, and then fuse multiple initial morphological features and initial texture features of the same somatic cell based on the position sequence of each somatic cell to obtain the cell morphological features and cell texture features of each somatic cell.
[0083] Furthermore, the server can fuse the morphological and textural features of all somatic cells based on the morphological and textural features of each individual somatic cell to obtain the group morphological and textural features of all somatic cells.
[0084] Furthermore, the server can analyze population subpopulation characteristics and somatic cell concentration based on the cell morphology and cell texture characteristics of each somatic cell.
[0085] In this example, by detecting somatic cells in cell images and matching somatic cells in each frame of cell images, a positional sequence of somatic cells is generated. Based on this positional sequence, the initial morphological and texture features of somatic cells are fused and analyzed to obtain the population morphological features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells. This improves the effectiveness of each somatic cell data point, thereby enhancing the effectiveness of population morphological features, population texture features, population subpopulation features, and somatic cell concentration. This provides more accurate data for decision-making regarding the udder health status of dairy animals, thus improving decision-making accuracy.
[0086] In one example, in step S1023 above, the process of extracting the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells from cell images within a preset time period based on the position sequence of each somatic cell specifically includes: S201. Based on the position of the somatic cell in the position sequence of each somatic cell, extract multiple cell masks of the somatic cell from the cell image and form a set of somatic cell masks.
[0087] For example, the server can crop the cell image based on the bounding boxes of somatic cells detected in step S1021 above, obtaining individual images of multiple somatic cells. Furthermore, the server can identify the boundaries of somatic cells in each image to obtain the boundary information of each somatic cell. Finally, the server can generate a cell mask for each individual image based on the boundary information in that individual image.
[0088] The server can also determine the individual image corresponding to the position of each somatic cell based on the position sequence of each somatic cell. The server can then add the cell mask of that individual image to the mask set of that somatic cell.
[0089] In one implementation, the algorithm for generating the cell mask can be threshold segmentation, edge detection, or a deep learning model, etc.
[0090] In one implementation, the cell mask can be a binary image representing the distribution area of somatic cells in a cell image. Here, a pixel value of 1 indicates a cell, and 0 indicates background.
[0091] In one implementation, in this step, each somatic cell position in the position sequence of a somatic cell can correspond to a cell mask of that somatic cell.
[0092] Optionally, the cell mask corresponding to each somatic cell position in a somatic cell position sequence can form a set of masks for that somatic cell.
[0093] In one implementation, the server can also filter somatic cells within the preset time period, thereby improving the data validity of the somatic cells being analyzed.
[0094] For example, the server can delete somatic cells in the location sequence whose number of somatic cell positions is less than a preset length threshold. These somatic cells are those that have just entered the detection pool or are about to leave it. Since these somatic cells are detected at the edges of the cell image, their cell morphology has a high probability of distortion. Deleting these somatic cells can improve the effectiveness of population analysis.
[0095] S202. Extract morphological features from the cell masks in each mask set to obtain the initial morphological feature set for each somatic cell.
[0096] For example, the server can perform morphological operations to extract features from each cell mask, obtaining the initial morphological features of each cell mask. For the initial morphological features of cell masks in a mask set, the server can write these initial morphological features into an initial morphological feature set.
[0097] In one implementation, the initial morphological feature can be the static geometric features of a somatic cell in a single frame image, which may include information such as area, perimeter, roundness, and aspect ratio.
[0098] In one implementation, for each segmented cell mask, the area... It can be calculated by multiplying the total number of pixels with a value of 1 within the cell mask by the physical area of a single pixel.
[0099] In one implementation, for each segmented cell mask, the perimeter is... The cell outline length can be obtained by approximation using polygons.
[0100] In one implementation, for each segmented cell mask, the circularity... The calculation formula can be: When the cell mask When it is a perfect circle, As cell edges become rough (e.g., due to pseudopodia extension) or the shape becomes elongated, The value gradually approaches 0.
[0101] Optionally, this roundness is used to distinguish rounded lymphocytes from irregularly sloughed epithelial cells.
[0102] In one implementation, for each segmented cell mask, the aspect ratio is... The calculation formula is: in, To fit the major axis of the ellipse, This is the minor axis of the fitted ellipse. The aspect ratio is... Used to describe the degree of stretching of cells.
[0103] S203. Perform fusion calculation on the initial morphological features in each initial morphological feature set to obtain the cell morphological features of each somatic cell.
[0104] For example, the server can use a morphological fusion algorithm to fuse multiple initial morphological feature data from an initial set of morphological features. The fused feature is the cell morphological feature corresponding to a somatic cell.
[0105] In one implementation, the initial morphological features in the initial morphological feature set represent the morphological features of a somatic cell at multiple angles during flow. Therefore, the cell morphological features obtained by fusing multiple initial morphological features can more comprehensively describe the morphology of the somatic cell, avoiding inaccuracies caused by random factors such as noise, angle, and deformation when using a single frame image to describe the morphological features of a somatic cell.
[0106] In one implementation, the morphological fusion algorithm can be a weighted average, principal component analysis, or a deep learning model. For example, the server can calculate the mean of all initial morphological features in the initial morphological feature set to obtain the final cell morphological features.
[0107] In one implementation, cell morphological characteristics include information such as cell area, perimeter, roundness, and aspect ratio.
[0108] S204. Perform statistical analysis on the morphological characteristics of all somatic cells to obtain the population morphological characteristics of all somatic cells.
[0109] For example, the server can perform statistical analysis on the cell morphology features of somatic cells detected within a preset time period, calculate the distribution parameters of the morphological features (such as mean, variance, percentile) or extract advanced features (such as morphological symmetry, texture complexity).
[0110] In one implementation, the morphological features may include information such as the arithmetic mean, standard deviation, variance, coefficient of variation, skewness, and kurtosis of the morphological features of all somatic cells.
[0111] In one implementation, the morphological feature may include the arithmetic mean of the morphological features of all somatic cells. This arithmetic mean can be used to reflect information such as the average area, average perimeter, average roundness, and average aspect ratio of all somatic cells. It can also reflect information such as the average size and shape of the somatic cell population.
[0112] Optionally, the server can calculate the standard deviation, variance, and coefficient of variation of all somatic cells in terms of area, perimeter, roundness, and aspect ratio based on the average area, average perimeter, average roundness, average aspect ratio, and the area, perimeter, roundness, and aspect ratio of each somatic cell.
[0113] Optionally, the standard deviation, variance, and coefficient of variation are used to describe the dispersion and heterogeneity within a somatic cell population.
[0114] Optionally, the skewness is used to quantify the symmetry of the distribution of cell morphological features. The kurtosis is used to quantify the degree to which the data is concentrated near the mean. Based on the skewness and kurtosis, distribution tail variations caused by cell swelling or morphological variations can be sensitively captured.
[0115] The formula for calculating this skewness is: in, This refers to the skewness. This represents the total number of all somatic cells. For the first Cellular morphological characteristics of individual cells. This represents the mean of the cellular morphological characteristics of all somatic cells. The standard deviation of cell morphology characteristics for all somatic cells.
[0116] Optionally, if This indicates right skewness, meaning there is a long tail on the right side of the distribution (the larger value end). This may suggest that the sample contains a small number of large foreign cells or clusters of epithelial cells.
[0117] The formula for calculating the kurtosis is: in, For peak value. This represents the total number of all somatic cells. For the first Cellular morphological characteristics of individual cells. This represents the mean of the cellular morphological characteristics of all somatic cells. σ represents the standard deviation of cell morphology characteristics for all somatic cells. 3 represents the theoretical kurtosis of the normal distribution. Subtracting 3 from the formula adjusts the kurtosis of the normal distribution to 0, facilitating direct comparison of differences between other distributions and the normal distribution.
[0118] Alternatively, kurtosis implies a high concentration of cellular characteristics and a homogeneous population. Low kurtosis, on the other hand, suggests a multimodal distribution of the population, indicating the presence of mixed cell subpopulations.
[0119] In this example, an initial morphological feature set is obtained by extracting multiple cell masks from the mask set of each somatic cell, and the cell morphological features of somatic cells are obtained by fusing multiple initial morphological features from the initial morphological feature set. Finally, the population morphological features are obtained by statistical analysis of the cell morphological features of all somatic cells. This method improves the data validity and richness of the population morphological features of raw milk samples, provides more effective data for subsequent detection of mammary gland health status in dairy animals, and improves the accuracy of mammary gland health status detection in dairy animals.
[0120] In one example, in step S1023 above, the process of extracting the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells from cell images within a preset time period based on the position sequence of each somatic cell specifically includes: S205. Based on the position of each somatic cell in the position sequence, extract multiple gray-level co-occurrence matrices of the somatic cells from the cell image and form a set of gray-level co-occurrence matrices of the somatic cells.
[0121] For example, the server can crop the cell image based on the bounding boxes of the somatic cells detected in step S1021 above to obtain individual images of multiple somatic cells. Furthermore, the server can process each somatic image to obtain a grayscale co-occurrence matrix.
[0122] In one implementation, the gray-level co-occurrence matrix is a statistical matrix used to describe the spatial dependence of gray levels in an image. Its element values represent the frequency at which a pair of pixels simultaneously exhibit a specific gray-level combination at a specific direction and distance.
[0123] In one implementation, the server can construct a grayscale co-occurrence matrix in four directions (0°, 45°, 90°, 135°) for each individual image after converting it to grayscale.
[0124] In one implementation, the server can traverse individual images based on a sliding window, calculate the frequency of any two pixels in the individual image that are ringing, or use a fast Fourier transform to accelerate matrix calculation and obtain the gray-level co-occurrence matrix.
[0125] In one implementation, the server can perform normalization processing after converting individual images to grayscale to reduce the impact of lighting.
[0126] In one implementation, the server can also filter somatic cells within the preset time period, thereby improving the data validity of the somatic cells being analyzed.
[0127] For example, the server can delete somatic cells in the location sequence whose number of somatic cell positions is less than a preset length threshold. These somatic cells are those that have just entered the detection pool or are about to leave it. Since these somatic cells are detected at the edges of the cell image, their cell morphology has a high probability of distortion. Deleting these somatic cells can improve the effectiveness of population analysis.
[0128] S206. Extract texture features from the gray-level co-occurrence matrices in each gray-level co-occurrence matrix set to obtain the initial texture feature set for each somatic cell.
[0129] For example, the server extracts features from each gray-level co-occurrence matrix in the gray-level co-occurrence matrix set to obtain the initial texture features corresponding to each gray-level co-occurrence matrix. Then, the server can combine the initial texture features corresponding to each gray-level co-occurrence matrix in the gray-level co-occurrence matrix set into an initial texture feature set.
[0130] In one implementation, the gray-level co-occurrence matrix itself is a two-dimensional matrix and cannot be directly used for texture analysis. The server can quantify the texture information it contains through preset statistical indicators to obtain the initial texture features.
[0131] In one implementation, the initial texture features statistically analyzed by the server may include five key indicators: contrast, correlation, energy, homogeneity, and entropy.
[0132] In one implementation, contrast is used to reflect image sharpness and the depth of texture grooves, and can characterize local grayscale changes in somatic cells. The calculation formula is: in, For contrast. The gray-level co-occurrence matrix represents the first... OK. The gray-level co-occurrence matrix represents the first... List. The coordinates in the gray-level co-occurrence matrix are The value of the position.
[0133] Optionally, high contrast typically corresponds to a large difference in grayscale between the cell nucleus and cytoplasm, or a strong granular appearance within the cell. For example, when breast tissue is infected by a virus, neutrophils engulf a large number of bacteria, significantly enhancing the granular appearance within the cells and further increasing the contrast. In this case, high contrast can serve as an indirect indicator of inflammation or infection.
[0134] In one implementation, correlation is used to measure the similarity of elements in the gray-level co-occurrence matrix along the row or column direction, and can be used to measure gray-level linear dependence. The calculation formula is: in, It is a correlation. The gray-level co-occurrence matrix represents the first... OK. The gray-level co-occurrence matrix represents the first... List. The coordinates in the gray-level co-occurrence matrix are The value of the position. and The gray-level co-occurrence matrix is the first... The mean and standard deviation of the marginal distribution of the row. and The gray-level co-occurrence matrix is the first... The mean and standard deviation of the marginal distribution of the column.
[0135] In one implementation, energy is used to characterize the uniformity and regularity of image texture. The calculation formula is: in, It is energy. The gray-level co-occurrence matrix represents the first... OK. The gray-level co-occurrence matrix represents the first... List. The coordinates in the gray-level co-occurrence matrix are The value of the position.
[0136] In one implementation, homogeneity is used to describe how close the gray-level distribution is to the diagonal. The calculation formula is: in, It is homogeneous. The gray-level co-occurrence matrix represents the first... OK. The gray-level co-occurrence matrix represents the first... List. The coordinates in the gray-level co-occurrence matrix are The value of the position.
[0137] Alternatively, high homogeneity means that the grayscale changes in the image are gradual. Inflammatory cells often have decreased homogeneity due to nuclear fragmentation or changes in chromatin distribution.
[0138] In one implementation, entropy is used to describe the complexity of image texture, including its randomness or complexity. The calculation formula is: in, Entropy. The gray-level co-occurrence matrix represents the first... OK. The gray-level co-occurrence matrix represents the first... List. The coordinates in the gray-level co-occurrence matrix are The value of the position. Represents extremely small positive numbers, used to avoid The problem of undefined logarithms.
[0139] Alternatively, during apoptosis or necrosis, the disintegration and disorder of the cell contents increase, which usually leads to an increase in entropy.
[0140] S207. Perform fusion calculation on the initial texture features in each initial texture feature set to obtain the cell texture features of each somatic cell.
[0141] For example, for each initial texture feature set, the server can fuse multiple initial texture features contained therein to generate a cell texture feature corresponding to a somatic cell.
[0142] In one implementation, the server can average the initial texture features of multiple frames to eliminate noise interference from a single frame, thereby obtaining the comprehensive cell texture features of the somatic cell. Alternatively, the server can employ a weighted fusion strategy, assigning weights based on the somatic cell's motion speed or morphological stability in its trajectory, to calculate the comprehensive cell texture features of the somatic cell.
[0143] S208. Perform statistical analysis on the cell texture features of all somatic cells to obtain the population texture features of all somatic cells.
[0144] For example, the server performs global statistical analysis on the cell texture features of all somatic cells to generate population-level population texture features, which are used to reflect the distribution patterns and differences of somatic cell texture features in the population.
[0145] In one implementation, the server calculates descriptive statistics such as the mean, standard deviation, and variance of all somatic cell texture features.
[0146] In this example, an initial texture feature set is obtained by extracting multiple gray-level co-occurrence matrices from the gray-level co-occurrence matrix set of each somatic cell. The initial texture features in the initial texture feature set are then fused to obtain the cell texture features of the somatic cells. Finally, statistical analysis is performed on the cell texture features of all somatic cells to obtain the population texture features. This method improves the data validity and richness of the population texture features of the raw milk sample, provides more effective data for subsequent detection of the udder health status of dairy animals, and improves the accuracy of udder health status detection in dairy animals.
[0147] In one example, in step S1023 above, the extraction process of the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells from cell images within a preset time period based on the position sequence of each somatic cell specifically includes: S209. Assemble the cell morphology and cell texture features of each somatic cell to obtain the cell splicing features of each somatic cell.
[0148] For example, the server can obtain the cell morphology features of each somatic cell based on step S203 above, and the cell texture features of each somatic cell based on step S207 above. Then, the server can stitch together the cell morphology features and cell texture features to obtain the cell stitching features.
[0149] S210. Project the cellular splicing features of each somatic cell onto a preset standard cell phenotype space to obtain the cell subpopulation probability of each somatic cell. The standard cell phenotype space includes subpopulation standard cell features of multiple subpopulation types.
[0150] For example, the server stores a pre-constructed standard cell phenotype space. The server can project the cellular splicing features of each somatic cell onto the preset standard cell phenotype space, mapping the probability of each somatic cell belonging to each subpopulation type. The probability of a somatic cell belonging to each subpopulation type is the cell subpopulation probability of that somatic cell.
[0151] In one implementation, the standard cell phenotype space is a pre-constructed multidimensional space for classifying and characterizing somatic cells, which contains subgroup standard cell characteristics of multiple subgroup types.
[0152] In one implementation, the server can use a preset classification algorithm to project the cell splicing features of the somatic cell onto multiple subpopulation types, and calculate the probability value of the cell splicing features to each subpopulation type. The probability values of the cell splicing features to each subpopulation type constitute the probability of that cell subpopulation.
[0153] In another implementation, the server can compare the cellular splicing features of a somatic cell with the subpopulation standard cellular features of each subpopulation type in the standard cell phenotypic space, thereby calculating the correlation index between the somatic cell's cellular features and the subpopulation standard cellular features of each subpopulation type. Furthermore, the server can normalize the correlation index between the somatic cell and each subpopulation type to obtain the probability value of the somatic cell belonging to each subpopulation type. The probability values of the somatic cell belonging to each subpopulation type constitute the cell subpopulation probability.
[0154] In another implementation, the server can calculate the probability between the cell splicing features of a somatic cell and the subgroup standard cell features of multiple subgroup types in the standard cell phenotypic space based on the posterior probability of the Gaussian mixture model.
[0155] The cell splicing characteristics of each somatic cell in the raw milk sample can be denoted as: The server calculates the cell splicing features. The formula for calculating the posterior probability of the K subgroups in the standard cell phenotype space is as follows: in, for For the first The posterior probability of each subgroup type. It is the first The mixing coefficients of each subgroup satisfy the following conditions: . Indicates It is the mean vector. The first covariance matrix is the first... The probability density function of a multivariate Gaussian distribution (also known as a normal distribution). Indicates the first Subgroup types.
[0156] S211. Statistically analyze the initial subpopulation probabilities of all somatic cells to obtain the subpopulation characteristics of the entire somatic cell population.
[0157] For example, the server can obtain the population subpopulation characteristics of all somatic cells relative to each subpopulation type by performing fusion statistics on the cell subpopulation probabilities of all somatic cells.
[0158] In one implementation, the server can calculate the mean probability of cell subpopulations for all somatic cells to obtain the final overall population subpopulation characteristics. This method preserves information about transitional cells (such as cells in the intermediate stages of differentiation or apoptosis) and is more robust.
[0159] In another implementation, the server can determine the subpopulation type with the highest probability value among all somatic cells based on the cell subpopulation probability of each somatic cell. The server can then calculate the proportion of somatic cells belonging to each subpopulation type among all somatic cells, obtaining the proportion value of each subpopulation type. Furthermore, the server can combine the proportion values of the probabilities of each subpopulation to form the subpopulation characteristics of the population.
[0160] For example, when K subgroup types are included, the subgroup characteristics of the population can be one. Dimensional vector. For example, this A dimensional vector can be denoted as The characteristics of this subgroup can directly reflect the compositional proportion of somatic cells belonging to different subgroups. For example, this subgroup can be lymphocytes, neutrophils, macrophages, etc.
[0161] In this example, by projecting the cell splicing features of somatic cells onto the standard cell phenotype space, the cell subpopulation features of somatic cells are obtained. Then, by integrating the cell subpopulation features of all somatic cells, the population subpopulation features are obtained. This method enables a precise characterization of the population of somatic cells in the population subpopulation features, providing more accurate and effective data support for the detection of mammary gland health status in dairy animals, thereby improving the accuracy of mammary gland health status detection in dairy animals.
[0162] In one example, in step S1023 above, the extraction process of the somatic cell concentration of all somatic cells from cell images within a preset time period based on the position sequence of each somatic cell specifically includes: S212. Count the number of somatic cells detected in the cell image within the preset time period.
[0163] In one implementation, the server can count the somatic cells flowing into or out of the detection pool. The number of somatic cells flowing into the detection pool is taken as the number of detected somatic cells. Alternatively, the number of somatic cells flowing out of the detection pool is taken as the number of detected somatic cells.
[0164] In another implementation, the server can count the somatic cells flowing into and out of the detection pool separately. Then, the server can use the average of the number of somatic cells flowing into and out of the detection pool as the number of detected somatic cells.
[0165] In one implementation, the server may include the following steps when calculating the number of somatic cells flowing out of the detection pool: Step 1: If the somatic cell is not detected in a number of consecutive preset number of cell images, then the somatic cell is determined to have flowed out of the detection pool.
[0166] Step 2: If it is determined that the somatic cell has flowed out of the detection pool, then increment the somatic cell count by 1.
[0167] Step 3: Obtain the final statistical count of somatic cells.
[0168] In one implementation, the server may include the following steps when calculating the number of somatic cells flowing into the detection pool: Step 1: If no matching somatic cells are found in the cell image of the preceding frame, then the somatic cell stream is determined to be a newly flowing somatic cell into the detection pool.
[0169] Step 2: If new somatic cells are detected entering the detection pool, increment the somatic cell count by 1.
[0170] Step 3: Obtain the final statistical count of somatic cells.
[0171] S213. Calculate the product of the flow rate of the raw milk sample and the duration of the preset time period to obtain the volume parameter.
[0172] For example, the server can obtain the flow rate of a raw milk sample within a preset time period. Then, the server can calculate the product of the flow rate and the preset time period to obtain the volume parameter.
[0173] In one implementation, the flow rate of the raw milk sample refers to the volume of raw milk passing through a specific cross-section per unit time, which reflects the speed of the flow of raw milk in pipelines or other flow channels.
[0174] In one implementation, the server can use a flow sensor installed in a branch pipe of an unlabeled online raw milk somatic cell detection device. The server can use this flow sensor to obtain the flow rate of the raw milk sample in the branch pipe at various times.
[0175] S214. The somatic cell concentration in the raw milk sample is obtained based on the ratio of the somatic cell count to the volume parameter.
[0176] For example, the formula for calculating somatic cell concentration can be: in, This refers to the somatic cell concentration. The number of somatic cells within a preset time period. For traffic. The duration of the preset time period. This is a volume parameter, representing the volume of raw milk flowing through the branch pipeline per unit time.
[0177] In one implementation, the somatic cell concentration, as the most fundamental macroscopic parameter, directly reflects the number of somatic cells in a unit of raw milk sample. The unit of somatic cell concentration can be cells / mL.
[0178] In one implementation, in the early stages of subclinical mastitis, although the total cell count may not yet have reached a significant threshold (e.g. However, its growth rate and minute concentration fluctuations can be captured by a high-precision real-time counting module.
[0179] In this example, the volume parameter is obtained by calculating the product of the raw milk sample flow rate and the duration of the preset time period. The somatic cell concentration is determined based on the ratio of the number of outflowing somatic cells to the volume parameter within the preset time period. This method enables a more accurate determination of the somatic cell content in raw milk, provides more reliable data for assessing the health status of dairy animals, and effectively improves the accuracy of dairy animal health status detection.
[0180] In one example, in step S103 above, the population morphological characteristics, population texture characteristics, population subpopulation characteristics, and somatic cell concentration of all the somatic cells are aggregated to obtain the cell population characteristics of the raw milk sample, including: S313. By splicing together the morphological features, texture features, population subpopulation features, and somatic cell concentration of all somatic cells, the cell population characteristics of the raw milk sample within a preset time period are obtained.
[0181] For example, after acquiring the morphological features, texture features, population subpopulation features, and somatic cell concentration of all somatic cells, the server can concatenate these different types of data according to a certain order rule to ultimately form the cell population characteristics of the raw milk sample within a preset time period.
[0182] In one example, the standard cell phenotype space serves as a universal reference coordinate system, enabling automatic classification and proportion statistics of somatic cells, thus overcoming the shortcomings of traditional methods in distinguishing specific cell types. In this example, the construction and training of the standard cell phenotype space can be implemented using an unsupervised learning clustering algorithm. This process may include: S301. Multiple training samples are obtained by sampling raw milk produced by dairy animals in different health states; and the cell splicing features of each training sample are extracted; the cell splicing features include the cell morphology features and cell texture features of somatic cells in the training samples.
[0183] For example, the server first collects a large amount of raw milk from different healthy dairy animals as training samples. Then, the server extracts the morphological and texture features of each somatic cell in these training samples and splices them together to obtain the cell splicing features of each somatic cell.
[0184] In one implementation, the training samples can come from different healthy dairy animals. Alternatively, some training samples can come from different udders of the same healthy dairy animal. Or, some training samples can be raw milk produced at different times from the same udder of the same healthy dairy animal. Optionally, the time interval between any two training samples from the same udder of the same healthy dairy animal should be greater than a preset interval. For example, the preset interval could be 24 hours, one week, etc.
[0185] In one implementation, the training sample can be the cell splicing features of each somatic cell generated from the extracted raw milk. Alternatively, the training sample can be the cell splicing features of each somatic cell collected from the production line.
[0186] It should be noted that since this embodiment is clustering somatic cells, after obtaining the cell splicing features of multiple somatic cells in each training sample based on the training samples, the training samples corresponding to the somatic cells can be disregarded, and only the somatic cells can be processed.
[0187] In one implementation, to ensure the stability and efficiency of subsequent main clustering analysis, the server can preprocess the training samples.
[0188] Alternatively, the server can use the Density-Based Spatial Clustering of Applications with Noise (DBSCAN) algorithm to identify and isolate extremely sparse outliers in the baseline feature library.
[0189] Optionally, the server can perform moderate downsampling of the dominant dense regions in the data body and protective oversampling of potentially valuable sparse regions to balance the learnability of various phenotypes without distorting the overall distribution.
[0190] Among them, extremely sparse outliers can correspond to imaging artifacts or extremely rare abnormal cells.
[0191] In one implementation, the cellular splicing features of all somatic cells constitute the final baseline cell feature library.
[0192] S302. Cluster the cell splicing features to obtain multiple subgroup types and subgroup standard cell features for each subgroup type.
[0193] For example, the server can employ a selected clustering algorithm to cluster the cell splicing features of all somatic cells. This clustering process can be unsupervised clustering. The server can obtain the final clustering result. This clustering result can include multiple subgroup types. Furthermore, the server can also calculate the subgroup standard cell features of each subgroup type based on the cell splicing features contained in each subgroup type.
[0194] In one implementation, the clustering algorithm can be a Gaussian Mixture Model (GMM). GMM assumes that the distribution of all cells is a mixture of K Gaussian distributions. Its probability density function is defined as: in, Let x be the probability of x appearing in the distribution described by the entire model. This refers to the cell splicing characteristics of a somatic cell. This represents the number of subgroup types. It is the first The mixing coefficients of each subgroup satisfy the following conditions: . Indicates It is the mean vector. The first covariance matrix is the first... The probability density function of a multivariate Gaussian distribution (also known as a normal distribution). It describes In the The probability density under a Gaussian distribution.
[0195] Based on the above formula, the server iteratively optimizes the mean vector of the model using the expectation-maximization algorithm. Covariance Matrix Parameters such as these.
[0196] To determine the optimal number of subgroups (Gaussian component count) The server employs a model selection framework: fitting multiple GMM models within a reasonable preset range (e.g., K=2 to 15), and calculating the Bayesian Information Criterion (BIC) and Akaike Information Criterion (AIC) for each model. By selecting K that minimizes the BIC / AIC value, an optimal balance can be achieved between model complexity and goodness of fit. For example, the number of subgroups K=5.
[0197] S303. Generate a biological explanation for each subgroup based on the subgroup characteristics of the subgroup.
[0198] For example, the clustering results define K subpopulation types. Each subpopulation type is mathematically described by its "center" (standard cellular features of the subpopulation) and "range" (covariance matrix) in the feature space. These K subpopulations constitute a "standard cellular phenotype space reference template." Each subpopulation can be biologically interpreted based on its central features. For example, this biological interpretation could be "small and regular," "large and granular," or "elongated," etc.
[0199] In one implementation, this biological explanation can be corroborated with cytological knowledge to determine the cell type corresponding to each subpopulation type. For example, different subpopulation types can correspond to different somatic cells such as lymphocytes, neutrophils, and macrophages.
[0200] In one implementation, to verify the effectiveness of clustering, the server can also calculate the average silhouette coefficient of the cell splicing features of the K subpopulation types to ensure sufficient separation between different subpopulation types. Visualization using t-SNE or UMAP dimensionality reduction reveals clear separation boundaries between different subpopulation types in the feature space.
[0201] In one implementation, K-means intelligent initialization, multiple runs for optimization, and a small regularization (such as adding 1e-6*I) can be used in GMM training to prevent overfitting.
[0202] In one example, the optical features of the raw milk sample in the cell image are revealed based on the light from a spatial light source illuminating the detection cell.
[0203] For example, when a server controls a spatial light source to illuminate the detection cell from the bottom upwards, the differences in density and thickness of different structures within the cell lead to varying degrees of light absorption and scattering. Higher-density areas (such as the cell nucleus) scatter or absorb more light. The automatic image acquisition module can capture images of the somatic cells in the detection cell from above. Areas within the somatic cells that absorb and scatter more light become dark areas, while areas that absorb and scatter less light become bright areas. These are captured by the automatic image acquisition module and converted into a cell image. Therefore, the optical features in this cell image can include contour features with variations in brightness and texture features.
[0204] For example, when the server controls the spatial light source to illuminate the detection cell from the side, the light shines on the somatic cells at a low angle, and some of the light is scattered or reflected by the somatic cell structure. The tiny undulations and edges of the cell surface strongly scatter or reflect the light. This light scattered by the cells enters the objective lens, forming bright areas, which are captured by the automatic image acquisition module. The unscattered direct light is identified by the automatic image acquisition module as dark background areas. This strong contrast of light and shadow can greatly enhance the details and sharpness of the cell surface and edges, producing a three-dimensional relief-like effect. Therefore, the optical features in this cell image can include information such as the details and edge contrast of the somatic cell surface.
[0205] For example, when the server controls polarized light to shine into the detection cell, the automatic image acquisition module can capture the optical anisotropy characteristics of somatic cells.
[0206] In one implementation, the spatial light source is a device capable of emitting light into a specific spatial region. The emitted light has specific characteristics such as intensity, wavelength, and illumination range, and is used to illuminate the raw milk sample cells in the detection pool.
[0207] In one implementation, the detection pool is a specific spatial location for observing and analyzing cells in a raw milk sample. A spatial light source illuminates this area, allowing the cells to appear in the image.
[0208] In one implementation, the cell outline is the boundary shape of the cell in the image. It reflects the external characteristics of the cell and is an important basis for cell identification, classification and other analyses.
[0209] In one implementation, the automatic image acquisition module is equipped with a camera that can capture cell images of the detection pool.
[0210] In this example, by setting up a spatial light source to reveal the cell outline, high-precision capture and clear presentation of cell morphology in raw milk samples were achieved. This enabled observation of cells in raw milk samples without the use of chemical reagents, clear observation of somatic cells under environmentally friendly conditions, and improved efficiency of somatic cell feature extraction under environmentally friendly conditions. As a result, more detailed and accurate data were provided for the detection of dairy animal health status, thus effectively improving the accuracy of dairy animal health status detection.
[0211] In one example, after obtaining cell images of a raw milk sample, the server can further preprocess the cell images to optimize image quality. This process includes: S401. In the flat field correction stage, the pre-acquired dark field image and flat field image are called to perform calculations on the cell image directly acquired in each frame, thereby effectively eliminating the problems of lens vignetting and uneven lighting.
[0212] For example, the calculation formula can be: in, This is the optimized cell image. These are cell images obtained directly from acquisition. This is a dark field image. This is a flat-field image.
[0213] Optionally, this flat field correction is used to effectively eliminate lens vignetting and uneven lighting.
[0214] S402. Contrast-limited adaptive histogram equalization (CLAHE) algorithm is used to perform contrast stretching.
[0215] For example, the server can set the slice grid size to 8×8 and the contrast limit to 2.0. Based on this grid and contrast limit, the server can process the cell image to obtain a cell image with significantly enhanced local contrast between cells and background.
[0216] S403. Perform Gaussian filtering on the cell image.
[0217] For example, the server can use a 3×3 size, standard deviation A Gaussian kernel is used to perform convolution filtering on the image to obtain a cell image after smoothing out noise.
[0218] In this example, a comprehensive processing approach was adopted, which included flat field correction to eliminate lens vignetting and uneven lighting, CLAHE algorithm to enhance local cell contrast, and Gaussian filtering to smooth noise. This approach enabled high-quality preprocessing of raw milk sample cell images, making cell morphology features clearer and edge details more prominent. This improved the effectiveness of the cell population features extracted subsequently, and thus effectively improved the accuracy of dairy animal health status detection.
[0219] Figure 2 A flowchart of an online raw milk somatic cell analysis method provided in this application embodiment is shown below. Figure 1 Based on the illustrated embodiments, as Figure 2 As shown, with the server as the execution entity, this process includes the following steps: S501. Perform a preprocessing procedure on each frame of cell image acquired.
[0220] For example, the high-speed camera in the automatic image acquisition module begins to acquire cell images of the raw milk sample flowing through the detection pool.
[0221] The server can first preprocess the cell image. This preprocessing process may include flat-field correction using pre-trained images to eliminate optical non-uniformities, contrast-limited adaptive histogram equalization to enhance the difference between the target and the background, and applying Gaussian filtering to smooth noise, thereby laying a high-quality image foundation for subsequent analysis.
[0222] S502. Use the target detection model to perform target detection on the preprocessed cell image, and select all potential somatic cells in the cell image to obtain the detection box and confidence score for each somatic cell.
[0223] S503. To eliminate duplicate counting of the same somatic cell in multiple consecutive frames, somatic cells in consecutive frame cell images can be matched to determine the position sequence of the same somatic cell in consecutive frame cell images.
[0224] S504. When somatic cells leave the field of view, a count is performed to ensure the accuracy of the somatic cell count and to calculate the accurate somatic cell concentration.
[0225] For example, the server can count somatic cells once for those whose trajectories continuously match and are eventually determined to have "left the detection field of view," thereby ensuring that the final calculated somatic cell concentration (SCC, unit: cells / mL) is highly accurate.
[0226] Alternatively, the field of view can be a detection pool. Or, the field of view can be the area where a cell image is captured.
[0227] Optionally, the server can also display the somatic cell concentration in real time on the user interface.
[0228] S505, Create an asynchronous analysis thread.
[0229] For example, the asynchronous thread is used to perform in-depth analysis on located and tracked somatic cells.
[0230] S506. Perform instance segmentation and feature extraction on the counted somatic cells.
[0231] For example, instance segmentation involves generating pixel-level precision polygonal boundaries for the localized somatic cells using the StarDist instance segmentation model. Feature extraction is used to extract morphological and texture features from the individual targets segmented in each frame.
[0232] In one implementation, the thread calls the StarDist instance segmentation model to perform pixel-level segmentation of the image within the bounding box of the somatic cells, generating polygonal boundaries that accurately describe the cell outlines, thereby obtaining a precise mask for each cell.
[0233] In one implementation, the server can extract the multidimensional feature vector of each segmented somatic cell.
[0234] Optionally, the multidimensional feature vector mainly includes: 1) morphological features, such as area, perimeter, roundness, and aspect ratio; 2) texture features, such as contrast, correlation, energy, and entropy calculated based on the gray-level co-occurrence matrix (GLCM).
[0235] S507. By statistically aggregating the characteristics of somatic cells, an overall characteristic description of the raw milk sample is formed, and the cell population characteristics are obtained.
[0236] For example, the server does not analyze somatic cells or single somatic cells in a single frame of cell image in isolation, but rather performs statistical analysis on the features of all somatic cells in multiple consecutive frames of cell images within a preset time period to achieve a quantitative characterization of the somatic cell population in the raw milk sample.
[0237] In one implementation, the aggregated cell population characteristics constitute a holistic description of the current raw milk sample, including macroscopic and mesoscopic indicators such as somatic cell concentration, average morphology of the cell population, morphological distribution variance, and the proportion of specific texture patterns.
[0238] In one implementation, the cell population characteristics are mainly divided into the following four parts: cell number information, population morphological characteristics, population texture characteristics, and population subpopulation characteristics.
[0239] Optionally, the cell count information includes the total number of somatic cells and the average number of somatic cells passing through the field of view within a preset time period. This indicator, as the most basic macroscopic parameter, directly reflects the cell concentration of the sample.
[0240] Optionally, the server can statistically analyze the population morphological characteristics for each somatic cell. The morphological characteristics of each somatic cell may include area, perimeter, roundness, and aspect ratio. The population morphological characteristics of all somatic cells may include parameters such as mean, standard deviation, skewness obtained after normalization of the third central moment, and kurtosis obtained after normalization of the fourth central moment.
[0241] Optionally, the group texture features may include five texture features—contrast, correlation, energy, homogeneity, and entropy—obtained by the server through statistical analysis of the gray-level co-occurrence matrix (GLCM) of each somatic cell.
[0242] Among them, contrast is used to quantify the depth of texture and grooves, correlation is used to quantify the linear dependence of gray levels, energy is used to quantify texture uniformity, homogeneity is used to quantify local texture uniformity, and entropy is used to quantify texture randomness.
[0243] Furthermore, the server can statistically obtain parameters such as the mean and standard deviation of all cells based on the specificity, correlation, energy, homogeneity, and entropy of each cell.
[0244] Optionally, the server can use a probabilistic method to calculate the degree to which each cell belongs to each standard subgroup, and by integrating the attribution information of all somatic cells, generate the population subgroup characteristics of the overall subgroup distribution of the raw milk sample.
[0245] In one implementation, the server arranges all the calculated features in a fixed order to form a high-dimensional feature vector. This high-dimensional feature vector is the cell population feature. This cell population feature is used as input to the health classification model.
[0246] In one implementation, the cell population characteristics may include dozens of features such as 'average concentration, average area, area variance, area skewness, proportion of large cells, average texture contrast, cell area-texture contrast correlation coefficient, etc.'
[0247] In one implementation, the construction process of the high-dimensional feature vector of the cell population characteristics can be as follows: Figure 3 As shown.
[0248] S508. Input the cell population characteristics into the classification decision model to directly determine the udder health status of the dairy animals corresponding to the raw milk samples.
[0249] The model, built using support vector machines or random forest algorithms, has been trained on databases of healthy, subclinical, and clinical mastitis samples, and is able to... For example, the server inputs cell population characteristics into a pre-trained classification decision model for breast health status in real time.
[0250] In one implementation, the classification decision model can be built based on a support vector machine (SVM) or random forest algorithm, with its training data derived from raw milk produced by dairy animals with a large-scale known udder health status. This classification decision model can be used to determine three udder health statuses: "healthy," "subclinical mastitis," or "clinical mastitis." The model can output the classification confidence score of the current raw milk sample relative to each udder health status.
[0251] In one implementation, the classification decision model can collect a large number of training samples of raw milk with known health states during the model training phase. The server can extract cell population features of all somatic cells from these training samples. The server can then use these cell population features to train the final classification decision model.
[0252] S509. Once a risk of illness is identified, an alarm signal will be triggered immediately.
[0253] For example, once the server determines that the classification result is "subclinical mastitis" or "clinical mastitis," it determines that the dairy animal's udder is at risk of disease. At this time, the server can immediately trigger an alarm signal.
[0254] In one implementation, the server can determine the disease when the clinical or subclinical classification confidence level is greater than a set threshold. For example, the set threshold can be 0.9.
[0255] In one implementation, the server can display a flashing red warning on the user interface to trigger an alarm. The server can also log events.
[0256] In another implementation, the server can send alarm signals to the ranch management system via a network interface.
[0257] In this embodiment, a fully automated, label-free online detection system is achieved, enabling intelligent diagnosis of cell health status from cell images.
[0258] Based on the above embodiments, when two adjacent cell images are the current frame and the previous frame, the process of the server matching somatic cells in different cell images may include: S601. Based on the position sequence of each somatic cell in the previous frame, predict the expected position of these somatic cells in the next frame.
[0259] For example, the server first obtains the position sequence of each somatic cell in the previous frame of the cell image. The server can extract the motion trend of the somatic cell from the position sequence. Then, based on the motion trend and the somatic cell position in the position sequence, the server can predict the expected position of the somatic cell in the next frame.
[0260] S602. Match the expected position of each somatic cell in the previous frame with the somatic cell position of each somatic cell in the current frame to calculate the first matching matrix.
[0261] For example, if the preceding frame includes M individual cells and the current frame includes H individual cells, then the first matching matrix is an M×H matrix.
[0262] In one implementation, each value in the first matching matrix can be used to represent the deviation between the predicted position of a somatic cell in a previous frame and the somatic cell position of a somatic cell in the current frame. For example, this deviation can be calculated based on Euclidean distance.
[0263] In one implementation, the smaller the value of the first matching matrix, the closer the predicted position of the somatic cell in the previous frame is to the position of the somatic cell in the current frame. Correspondingly, the greater the probability that the somatic cell in the previous frame and the somatic cell in the current frame are the same somatic cell.
[0264] S603. Match the cell splicing features of each somatic cell in the previous frame with the cell splicing features of each somatic cell in the current frame to calculate the second matching matrix.
[0265] For example, if the preceding frame includes M individual cells and the current frame includes H individual cells, then the first matching matrix is an M×H matrix.
[0266] In one implementation, each value in the first matching matrix can be used to represent the feature similarity between a somatic cell in a previous frame and a somatic cell in the current frame. For example, this feature similarity can be calculated based on algorithms such as Euclidean similarity, Pearson similarity, and cosine similarity.
[0267] In one implementation, the larger the value of the second matching matrix, the closer the features of the somatic cells in the previous frame are to those in the current frame. Correspondingly, the greater the probability that the somatic cells in the previous frame and the somatic cells in the current frame are the same somatic cell.
[0268] S604. Based on the first matching matrix and / or the second matching matrix, perform optimal matching to determine the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame.
[0269] In one implementation, the server can determine the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame based on the first matching matrix.
[0270] Optionally, the server can use the first matching matrix as a cost matrix and adopt a cost-optimal strategy to determine the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame.
[0271] For example, the server can select a set of values from a matrix, ensuring that each row and column is uniquely covered and non-repeating, and guaranteeing that the sum of the values in this set is minimized, thus achieving optimal cost. The server can select this set of values through traversal, iteration, recursion, etc. Furthermore, based on this set of values, the server can determine that the somatic cell in the current frame corresponding to each value in the set that is less than a first matching threshold is the same somatic cell as the somatic cell in the previous frame.
[0272] Optionally, the server can determine the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame by selecting the minimum value in the first matching matrix.
[0273] For example, this step may include: Step 1: The server can select the minimum value in the first matching matrix. If the minimum value is less than the first matching threshold, the server can determine that the somatic cell in the current frame corresponding to the minimum value is the same somatic cell as the somatic cell in the previous frame.
[0274] Step 2: The server can delete the row and column corresponding to the somatic cells of the current frame and the somatic cells of the previous frame corresponding to the minimum value in the first matching matrix, and update the first matching matrix.
[0275] Step 3: If the first matching matrix does not exist, or the minimum value is greater than the first matching threshold, then end the matching process. Otherwise, return to step 1. Note that the first matching matrix will not exist after all somatic cells in the current frame have been matched or all somatic cells in the previous frame have been matched.
[0276] Step 4: If the matching ends, determine the current frame somatic cell that did not match the previous frame somatic cell as the newly entered somatic cell in the detection pool, and establish its corresponding position sequence for the somatic cell.
[0277] In another implementation, the server can determine the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame based on the second matching matrix.
[0278] Optionally, the server can use the second matching matrix as a cost matrix and adopt a cost-optimal strategy to determine the correspondence between the somatic cells of the current frame and the somatic cells of the previous frame.
[0279] For example, the server can select a set of values from a matrix, ensuring that each row and column is uniquely covered and non-repeating, and guaranteeing that the sum of the set of values is maximized, thereby achieving optimal cost. The server can select this set of values through traversal, iteration, recursion, etc. Furthermore, based on this set of values, the server can determine that the somatic cell in the current frame corresponding to each value in the set that is greater than a second matching threshold is the same somatic cell as the somatic cell in the previous frame.
[0280] Optionally, the server can determine the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame by selecting the maximum value in the second matching matrix.
[0281] For example, this step may include: Step 1: The server can select the maximum value in the second matching matrix. If the maximum value is greater than the second matching threshold, the server can determine that the somatic cell in the current frame corresponding to the maximum value is the same somatic cell as the somatic cell in the previous frame.
[0282] Step 2: The server can delete the row and column corresponding to the somatic cells of the current frame and the somatic cells of the previous frame corresponding to the maximum value in the second matching matrix, and update the second matching matrix.
[0283] Step 3: If the second matching matrix does not exist, or its maximum value is less than the second matching threshold, then end the matching process. Otherwise, return to step 1. Note that the second matching matrix will not exist after all somatic cells in the current frame have been matched or all somatic cells in the previous frame have been matched.
[0284] Step 4: If the matching ends, determine the current frame somatic cell that did not match the previous frame somatic cell as the newly entered somatic cell in the detection pool, and establish its corresponding position sequence for the somatic cell.
[0285] In another implementation, the server can determine the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame based on the fusion result of the first matching matrix and the second matching matrix.
[0286] Optionally, the server can calculate a fusion matrix of the first matching matrix and the second matching matrix. Then, the server can use this fusion matrix as a cost matrix and employ a cost-optimal strategy to determine the correspondence between the somatic cells of the current frame and the somatic cells of the previous frame.
[0287] For example, this step may include: Step 1: Calculate the derivative of each value in the second matching matrix to obtain the third matrix.
[0288] Step 2: Normalize each value in the third matrix to obtain the fourth matrix.
[0289] Step 3: Normalize each data point in the first matrix to obtain the fifth matrix.
[0290] Step 4: According to the preset weights, the fourth matrix and the fifth matrix are weighted and merged to obtain the sixth matrix.
[0291] Step 5: Based on the sixth matrix, the server can determine the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame. This process is similar to the determination process of the first matching matrix, and will not be described again here.
[0292] S605. Update the trajectory sequence of the somatic cells based on the correspondence between the somatic cells in the current frame and the somatic cells in the previous frame.
[0293] For example, if it is determined that the somatic cell in the current frame is the same somatic cell as the somatic cell in the previous frame, then the position sequence of that somatic cell is updated according to the somatic cell position in the current frame. If the somatic cell in the current frame does not match any of the somatic cells in the previous frame, then the position sequence of that somatic cell is generated.
[0294] In this example, by accurately matching somatic cells in the current frame and the previous frame, the tracking of the same somatic cell is achieved, avoiding repeated calculations of the same somatic cell and providing a basis for the feature calculation of the same somatic cell. This improves the data validity of each somatic cell, enhances the data validity of the cell population features of all somatic cells, and further improves the detection accuracy of the mammary gland health status of dairy animals based on the cell population features.
[0295] Figure 4 A structural diagram of a server provided in an embodiment of this application is shown below. Figure 4As shown, the server 700 includes one or more processors 701 and a memory 702. The various components are interconnected via different buses. The processors can process instructions executed within the server. The memory 702 stores instructions executable by at least one processor 701 to cause at least one processor 701 to perform the methods shown in the above embodiments. The server also includes a communication interface 703 for communicating with other devices or communication networks.
[0296] Figure 5 A structural diagram of a label-free online raw milk somatic cell detection device provided in this application embodiment is shown below. Figure 5 As shown, the label-free online raw milk somatic cell detection device includes: branch pipelines, detection pools, automatic image acquisition module, and server.
[0297] Branch pipes are connected to the main pipeline of the milking line and are used to obtain raw milk samples from the main pipeline in real time. The raw milk samples flow through the branch pipes into the testing pool and then return to the main pipeline. The cells in the raw milk samples in the testing pool are distributed in a monolayer.
[0298] In one implementation, the branch pipeline and the detection pool can be part of an online sampling module. This online sampling module may also include a solenoid valve, a pool depth regulator, and a flow sensor (flow meter).
[0299] The automatic image acquisition module is used to capture images of raw milk samples flowing through the detection pool in real time and obtain cell images. The automatic image acquisition module is also used to send the cell images to a server, so that the server can execute the mastitis identification method for dairy animals described in the above embodiments.
[0300] In one implementation, the automatic image acquisition module may include a microscope system. This microscope system may be equipped with a high-speed camera, a focusing collimating lens, a spatial light source, and a high-magnification objective lens. The microscope system can acquire cell images using the high-speed camera, focusing collimating lens, spatial light source, and high-magnification objective lens.
[0301] Optionally, light from the spatial light source can be focused and collimated through a collimating lens to illuminate the detection cell, thereby making the somatic cells in the detection cell visible. A high-speed camera can then observe and photograph the somatic cells in the detection cell using a high-magnification objective lens.
[0302] In one implementation, the server may include a control module and an automatic image analysis module.
[0303] Optionally, the control module can also control the motorized displacement stage in the autofocus module through the autoalignment module to achieve autofocus of the high-speed camera and improve the clarity of cell images captured by the high-speed camera.
[0304] Optionally, when the motorized stage moves, it can move the microscope system, thereby adjusting the imaging position. Specifically, when the motorized stage moves, it can move the high-speed camera and high-magnification objective lens in the microscope system.
[0305] Optionally, the control module may also include an automatic dynamic imaging module. This automatic dynamic imaging module can generate and display the cell image by acquiring information uploaded by the microscope system.
[0306] Optionally, the automatic image analysis module can implement the mastitis identification method for dairy animals described in the above embodiments.
[0307] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for identifying mastitis in dairy animals, characterized in that, The method includes: During the milking production process, cell images of raw milk samples are acquired in real time; the cell images include somatic cells distributed in a single layer in the raw milk sample; Based on the detection results of somatic cells in the cell images within a preset time period, the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells are extracted. The population morphological characteristics, population texture characteristics, population subpopulation characteristics, and somatic cell concentration of all the somatic cells are aggregated to obtain the cell population characteristics of the raw milk sample; Based on the characteristics of the cell population, a decision is made regarding the udder health status of the dairy animals that produced the raw milk sample.
2. The method according to claim 1, characterized in that, Somatic cells in the cell images within a preset time period are detected and tracked to extract the population morphological features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells, including: The trained target detection algorithm is used to detect the cell images within a preset time period to obtain the somatic cells in each cell image; Match somatic cells in the cell images to obtain the position sequence of the same somatic cell in the cell images within a preset time period; Based on the location sequence of each somatic cell, the population morphological features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells are extracted from the cell images within a preset time period.
3. The method according to claim 2, characterized in that, Based on the location sequence of each somatic cell, the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells are extracted from the cell images within a preset time period, including: Based on the somatic cell position in the position sequence of each somatic cell, multiple cell masks of the somatic cells are extracted from the cell image and formed into a mask set of the somatic cells; Morphological features are extracted from the cell masks in each mask set to obtain the initial morphological feature set of each somatic cell. The initial morphological features in each set of initial morphological features are fused and calculated to obtain the cell morphological features of each somatic cell. Statistical analysis was performed on the morphological characteristics of all the somatic cells to obtain the population morphological characteristics of all the somatic cells.
4. The method according to claim 3, characterized in that, Based on the location sequence of each somatic cell, the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells are extracted from the cell images within a preset time period, including: Based on the somatic cell position in the position sequence of each somatic cell, multiple gray-level co-occurrence matrices of the somatic cells are extracted from the cell image and a set of gray-level co-occurrence matrices of the somatic cells is formed. Texture features are extracted from the gray-level co-occurrence matrix in each set of gray-level co-occurrence matrices to obtain the initial texture feature set for each somatic cell; The initial texture features in each set of initial texture features are fused to obtain the cell texture features of each somatic cell. Statistical analysis was performed on the cell texture features of all the somatic cells to obtain the population texture features of all the somatic cells.
5. The method according to claim 4, characterized in that, Based on the location sequence of each somatic cell, the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells are extracted from the cell images within a preset time period, including: By splicing together the cell morphology features and cell texture features of each somatic cell, the cell splicing features of each somatic cell are obtained; The cell splicing features of each somatic cell are projected onto a preset standard cell phenotype space to map and obtain the cell subpopulation probability of each somatic cell; the standard cell phenotype space includes subpopulation standard cell features of multiple subpopulation types. The initial subpopulation probabilities of all somatic cells are statistically analyzed to obtain the population subpopulation characteristics of all somatic cells.
6. The method according to claim 5, characterized in that, The process of generating the standard cell phenotype space includes: Multiple training samples were obtained from raw milk produced by dairy animals in different health states; and cell splicing features of each training sample were extracted; the cell splicing features included the cell morphology features and cell texture features of somatic cells in the training sample; Clustering of the cell splicing features yields multiple subpopulation types and subpopulation standard cell features for each subpopulation type; Based on the subgroup characteristics of the subgroup, a biological explanation for each subgroup is generated.
7. The method according to claim 2, characterized in that, Based on the location sequence of each somatic cell, the population morphology features, population texture features, population subpopulation features, and somatic cell concentration of all somatic cells are extracted from the cell images within a preset time period, including: The number of somatic cells detected in the cell image within the preset time period is counted. The volume parameter is obtained by multiplying the flow rate of the raw milk sample by the duration of a preset time period. The somatic cell concentration in the raw milk sample is obtained based on the ratio of the somatic cell count to the volume parameter.
8. The method according to any one of claims 1-7, characterized in that, The optical properties of the raw milk sample in the cell image are revealed based on the light from the spatial light source illuminating the detection cell.
9. A server, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method of any one of claims 1 to 8.
10. A label-free online raw milk somatic cell detection device, characterized in that, The device includes: a branch pipe, a detection pool, an automatic image acquisition module, and a server as described in claim 9; The two ends of the branch pipeline are connected to the main pipeline of the milking production line, and are used to obtain raw milk samples from the main pipeline of the milking production line in real time during the production process of the milking production line. When the raw milk sample flows through the detection pool in the branch pipeline, the automatic image acquisition module captures cell images in real time and sends the cell images to the server so that the server executes the method of any one of claims 1 to 8; In the cell image, the somatic cells in the raw milk sample are distributed in a single layer.