Method for measuring the percentage of visible eye white in a dairy cow

By using image recognition and intelligent analysis technology, the system automatically locates the eye area of ​​dairy cows and calculates the percentage of visible sclera, solving the problems of low efficiency and strong subjectivity in manual measurement in existing technologies. This enables efficient and accurate measurement of the percentage of sclera in dairy cows and supports dairy cow emotion recognition and heat stress monitoring.

CN120827335BActive Publication Date: 2025-11-28CHINA AGRI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511344837.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-19
Publication Date
2025-11-28
Estimated Expiration
2045-09-19

AI Technical Summary

Technical Problem

In existing technologies, the measurement of the percentage of visible sclera in dairy cows relies on manual observation and measurement, which suffers from low efficiency, high subjectivity, and difficulty in data standardization, resulting in poor reliability and universality of the results.

Method used

By employing image recognition and intelligent analysis technologies, a deep learning target detection model is used to automatically locate the eye region of dairy cows. Combined with image preprocessing and contour fitting, the percentage of visible sclera is calculated, achieving automated and highly accurate measurement.

Benefits of technology

It improves the accuracy and repeatability of measurements, supports large-scale data acquisition and analysis, has rapid response capabilities, is suitable for high-throughput monitoring and dynamic behavior recognition, and provides highly standardized and consistent data results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120827335B_ABST
    Figure CN120827335B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of dairy cow visible eye white percentage measurement method.The present application is realized by introducing image recognition and intelligent analysis technology, the automatic positioning and proportion calculation of visible eye white area in dairy cow eye image, improve the accuracy, repeatability and operability of measurement, overcome the problems such as low efficiency, strong subjectivity, data difficult to standardize caused by relying on manual observation and manual measurement in prior art, and then provide reliable data support for dairy cow emotion recognition, heat stress monitoring and animal welfare evaluation, promote the development of this kind of research to standardization, large-scale direction.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of dairy cow health monitoring, in particular heat stress monitoring, and specifically to a method for measuring the percentage of visible eye white of a dairy cow. BACKGROUND

[0002] Studies have shown that when a cow is under stress, fear or pain, its pupils may dilate, which is a manifestation of sympathetic nervous activation. In addition, when a cow feels uneasy or stressed, more eye white will be exposed, indicating that it has been subjected to corresponding adverse stimulation. In particular, when a dairy cow is in a heat stress state, its sympathetic nervous system is excited and the level of cortisol is elevated, which may also exhibit similar behavioral responses, including increased eye white. In addition, dairy cows in a heat stress state are usually accompanied by changes in body position, frequent head lifting, prolonged eye opening time, etc., which may make the eye white more obvious.

[0003] By observing the changes in the eye white of a dairy cow, it can be used as a valuable and non-invasive indicator for assessing its heat stress level. Some research data also support this view, that is, in a hot environment, the eye white area of a dairy cow is significantly larger than that in a heat-neutral state, and the change in the eye white area is positively correlated with respiratory rate, core body temperature, plasma cortisol concentration and other classic heat stress indicators. Therefore, the measurement based on the change in eye white can not only reflect the psychological stress level of a dairy cow, but also serve as a simple and reliable method for monitoring heat stress.

[0004] For the measurement of the percentage of visible eye white of a dairy cow, existing studies generally use the method of manually positioning the pupil and the long and short axes of the eye by an experienced observer observing the eyeball of the dairy cow from the side or directly from the front to calculate the percentage of visible eye white. However, manual measurement is time-consuming and labor-intensive, and is easily affected by subjective factors, making it difficult to achieve large-scale and efficient data collection and analysis. Moreover, due to the subjective errors in manual measurement by different researchers, the reliability of the results is reduced, and the data results of each study are difficult to unify and share, which further leads to the lack of universality of the research conclusions. SUMMARY

[0005] In view of the defects in the prior art, the present application aims to provide a method for measuring the percentage of visible eye white of a dairy cow. By introducing image recognition and intelligent analysis technology, the method realizes automatic positioning and proportion calculation of the visible eye white area in the eye image of a dairy cow, improves the accuracy, repeatability and operability of the measurement, and overcomes the problems of low efficiency, strong subjectivity and difficulty in standardizing data caused by relying on manual observation and measurement in the prior art, thereby providing reliable data support for dairy cow emotion recognition, heat stress monitoring and animal welfare evaluation, and promoting the development of such research in the direction of standardization and scaling.

[0006] To achieve the above objectives, the technical solution adopted by the present application is as follows:

[0007] A method for measuring visible eye white percentage of a dairy cow, characterized in that it comprises the following steps:

[0008] S1, image acquisition of the eye of the dairy cow;

[0009] S2, screening of the image collected in S1, and elimination of invalid images;

[0010] S3, identification of the eye position in the image screened in S2, and clipping of the eye position image to obtain an eye region ROI;

[0011] S4, preprocessing of the eye region ROI obtained in S3 to obtain an optimized binary image;

[0012] S5, extraction of all contour regions in the optimized binary image obtained in S4, and screening of the iris and sclera regions; specifically:

[0013] (1) the iris is usually located at the center of the image, has a deep color, a regular contour, and is in an elliptical shape;

[0014] (2) the sclera is distributed around the iris, has a bright white structure, is not completely closed, and a candidate point set of the sclera boundary is extracted according to the geometric center of the iris.

[0015] S6, complete approximation and contour reconstruction of the contour regions obtained in S5, and then fitting of an elliptical model to the reconstructed contour of the boundary of the iris and sclera regions by using the least square method to obtain parameters such as the major axis, the minor axis, the area, and the rotation angle;

[0016] S7, obtaining of the areas of the fitted ellipses of the iris and the sclera according to the fitting results of S6, and calculation of the visible eye white percentage (PSV) of the dairy cow according to the following formula:

[0017] ;

[0018] S8, verification of the calculation results obtained in S7; specifically:

[0019] (1) empirical threshold judgment (PVS should be between 10% and 70%);

[0020] (2) repeatability and consistency test of images of the same dairy cow in the same period.

[0021] On the basis of the above scheme,

[0022] The invalid images in S2 include blurred images, closed-eye images, and occluded images.

[0023] On the basis of the above scheme, the specific steps of S3 include:

[0024] S31 Establish a target detection model for the eye region of dairy cows:

[0025] The input image is ,in H, W, C These represent the image's height (number of pixels), width (number of pixels), and number of channels, respectively; using a deep neural network model. Learn a set of bounding boxes containing the eye region from the image:

[0026] ;

[0027] In the above formula, and The first The horizontal and vertical coordinates (in pixels) of the center point of each candidate box; These are the width (in pixels) and height (in pixels) of the detection box, respectively. The confidence score represents the probability that the box represents the cow's eye area. θ The parameters obtained from model training; N The number of candidate boxes detected;

[0028] S32 uses a training set with labeled cow eye regions. The above detection model is trained; whereby The labels are the ground truth bounding boxes of the corresponding images; M is the number of training samples.

[0029] S33 for each image Input Model Select the set of detection boxes with the highest confidence ( x, y, w, h The boundary of the ROI in the eye region is calculated according to the following formula; x, y, w, h These are the x-coordinate of the center point of the detection frame, the y-coordinate of the center point of the detection frame, the width of the detection frame, and the height of the detection frame, respectively. x, y, w, h (All units are pixels)

[0030] ;

[0031] The image of the eye region is obtained by cropping.

[0032] Based on the above scheme, the preprocessing steps in S4 include:

[0033] Extract the red channel image to suppress blue bokeh;

[0034] Binarization is performed using Otsu's method;

[0035] Secondary image cropping is performed by constructing a minimum bounding rectangle region based on the scleral boundary.

[0036] Remove image defects to optimize image structure.

[0037] The image defects include background speckle, reflection noise and edge artifact, and the method for removing the image defects includes open operation, area filtering, hole filling, median filtering and the like.

[0038] The method has the beneficial effects that:

[0039] (1) High degree of automation: from image acquisition to PVS output, no manual intervention is required, and remote calling and batch processing are supported;

[0040] (2) High accuracy: deep learning target detection model and NURBS contour fitting are used to effectively suppress reflection and image noise interference;

[0041] (3) Strong standardization: unified image processing and structure analysis process ensure the comparability and consistency of data measurement results;

[0042] (4) Strong practicability: automatic labeling and edge detection algorithm are used to adapt to the on-site breeding environment and intelligent farm application requirements;

[0043] (5) Fast response: single image processing time is not more than 5 seconds, suitable for high-throughput monitoring and dynamic behavior recognition scene. BRIEF DESCRIPTION OF DRAWINGS

[0044] The present application has the following drawings:

[0045] Figure 1 The present application has the following drawings:

[0046] Figure 2 The present application has the following drawings:

[0047] Figure 3 The present application has the following drawings:

[0048] Figure 4 The present application has the following drawings:

[0049] Figure 5 The present application has the following drawings:

[0050] Figure 6 The present application has the following drawings:

[0051] Figure 7 The present application has the following drawings:

[0052] Figure 8 The present application has the following drawings:

[0053] Figure 9 The present application has the following drawings:

[0054] Figure 10 This is a diagram showing the effect of median filtering.

[0055] Figure 11 Example of ellipse fitting deviation;

[0056] Figure 12 This is the result of fitting an ellipse. Detailed Implementation

[0057] The present invention will be further described in detail below with reference to the accompanying drawings.

[0058] Bull's eye ( Figure 2 Similar to the structure of the human eye, the iris of a cow is located outside the pupil and inside the sclera. Figure 3 The method for measuring the percentage of visible sclera in cows provided by this invention not only avoids subjective errors caused by manual measurement and improves the accuracy of data results, but also enables large-scale data collection and standardized quantitative analysis. Specifically, it includes the following steps:

[0059] S1. Use fixed or mobile camera equipment to capture images of the cow's eyes. The image resolution should be no less than 720P. The acquisition angle should include the front or side front of the cow's head (within the range of 30°–60°) to ensure that the eye images are complete and clear.

[0060] S2. Perform quality screening on the images acquired in S1, removing invalid images such as blurry, closed-eye, and occluded images. Prioritize images of the cow's profile (front view) during screening to ensure the eye area is complete and clear, facilitating subsequent image processing. Manually remove blurred or closed-eye images caused by occlusion, shaking, or other factors. Two major problems still exist in the filtered images:

[0061] (1) The image acquisition environment is the dairy cow shed feeding area. This area is an outdoor open environment. Strong light and reflection from surrounding objects can easily generate more noise points in the image.

[0062] (2) The structure of the bull's eye is special, with a convex center and concave sides. The ellipsoidal surface has strong light-gathering ability, and there is a large light spot in the center of the bull's eye in the image.

[0063] These interfering factors can severely affect the edge recognition of the iris and sclera. The subsequent image preprocessing stage will crop, denoise, and process the light spots on the screened images to lay the foundation for subsequent contour extraction.

[0064] In actual operation, the image after screening needs to be segmented first. Image segmentation is the division of the target and background of the collected image, and finally the target area with pixel value of 1 and the background area with pixel value of 0 are obtained. In the image of the cow's eye, the target area is the iris and sclera area of the cow's eye, and the remaining area belongs to the background area. This process aims to extract regions with semantic or specific features from an image and separate them from the background or other objects. Image segmentation can be based on pixel-level attributes (such as grayscale, color, texture, etc.) or object-level attributes (such as shape, size, contour, etc.). Common image segmentation methods include threshold segmentation, edge detection, region growing, clustering analysis, and horizontal segmentation. Image segmentation has wide applications in computer vision, medical image processing, remote sensing image analysis, and other fields, and is a key step in many image processing and analysis tasks.

[0065] The image of the cow's eye area obtained after image segmentation is still large, and the relative proportion of the cow's eye area is small, resulting in too many irrelevant areas. In addition, there are still a lot of noise in the inside, outside, edge and irrelevant area of the cow's eye area, as shown in the figure, which will inevitably affect the accuracy and efficiency of subsequent image processing and analysis. Figure 4

[0066] S3 uses the "cow eye area target detection model" trained on the ModelArts platform to automatically identify the eye position in the image and return the detection box coordinates. According to the detection box coordinates, the original image is cropped to obtain the eye area (ROI).

[0067] Specifically, the "cow eye area target detection model" trained on the ModelArts platform is essentially a target detection model based on deep convolutional neural network (CNN), which is used to automatically detect the bounding box of the cow's eye area in the image. Its mathematical expression and running process are as follows:

[0068] (1) Model structure and basic principles

[0069] Let the input image be , where H, W, C represent the height, width, and channel number (usually 3) of the image, respectively.

[0070] Through the deep neural network model (CNN), a set of bounding boxes containing the eye area is learned from the image:

[0071] ;

[0072] Where:

[0073] is the ​The center point coordinates of the candidate box;

[0074] respectively the width and height of the box;

[0075] is a confidence score, representing the probability that the box is a cow eye region;

[0076] is a parameter obtained by model training;

[0077] is the number of detected candidate boxes.

[0078] (2) Model training process

[0079] The model is trained using a supervised learning method, and the input is a training set of labeled cow eye regions , where is the true boundary box label in the image . The training goal is to minimize the multi-task loss function:

[0080] ;

[0081] where:

[0082] is the position regression loss;

[0083] is the classification confidence loss;

[0084] and are weight factors.

[0085] During training, Ascend training resources are called on the ModelArts platform, and the PyTorch framework is used to automatically complete the model parameter optimization process.

[0086] (3) Eye region cropping

[0087] In the model inference stage, input the model for each image , select the highest confidence group of detection boxes x, y, w, h , and calculate the boundary of the eye region ROI according to the following formula:

[0088] ;

[0089] Crop the eye region image, which can be used for subsequent iris-sclera boundary recognition and eye white area calculation.

[0090] (4) Model deployment instructions

[0091] The model is deployed through the AI application service module after training on the ModelArts platform, serving as a cloud API interface for the front-end image processing module to call. The system automatically calls the model service when receiving an image, returns the bounding box coordinate data, and completes the eye region extraction.

[0092] Through image cropping, the partial noise problem in S2 can be solved. First, cropping can remove irrelevant areas in the overall image, focusing on the cow's eye area for subsequent analysis, thereby improving the efficiency and accuracy of analysis. Second, cropping can reduce data volume, speeding up processing and analysis speed. In addition, cropping also helps to remove noise inside, outside and edge of the cow's eye area, optimizing image quality, making subsequent processing and analysis more accurate and reliable. Therefore, it is necessary to crop the image. At the same time, cropping after image segmentation, that is, cropping after obtaining the cow's eye area, is more accurate and effective. Because cropping must be based on the size and position of the cow's eye area to ensure that the cropping is in place and as much irrelevant area as possible is removed.

[0093] Here, a boundary rectangle parallel to the XY axis is constructed based on the minimum bounding rectangle of the cow's eye. The reason for not cropping according to the minimum bounding rectangle is that the minimum bounding rectangle may have a certain angle, and directly cropping according to the minimum bounding rectangle may cause the cropped image to rotate, which is not convenient for subsequent processing ( Figure 5 ). The rectangle cropping method based on the minimum bounding rectangle can surround the cow's eye area to the greatest extent, adapt to different shapes and directions of the cow's eye, and maintain the stability of the geometric structure of the image, without causing image distortion or rotation due to cropping. This way simplifies the subsequent processing steps, reduces the complexity of processing, and is beneficial to subsequent analysis and processing.

[0094] S4. The eye ROI image cropped in S3 is subjected to the following multi-stage preprocessing operations: (1) extract the red channel image to suppress blue light spots; (2) apply Otsu method for binaryzation; (3) construct a minimum bounding rectangle based on the sclera boundary for secondary image cropping ( Figure 6 ); (4) use open operation, area filtering, hole filling, median filtering and other methods to remove background noise, reflection noise and edge artifacts, and optimize image structure ( Figures 7-10 ).

[0095] S5. Extract all contour regions from the binary image pre-processed in S4, and screen out the iris and sclera regions according to the contour area, position, long-short axis ratio and other features: (1) The iris is usually located in the center of the image, with deep color, regular contour and oval shape; (2) The sclera is distributed around the iris, with bright white structure and incomplete closure, and the candidate point set of the sclera boundary is extracted according to the geometric center of the iris.

[0096] S6. Complete approximation of the contour regions extracted in S5 is performed in the cv2.CHAIN_APPROX_NONE mode, and NURBS (Non-Uniform Rational B-Spline) curve is used for contour reconstruction to improve the boundary smoothness and structural fidelity. The least square method is used to fit the ellipse model for the iris and sclera boundary contours respectively, and the parameters such as long axis, short axis, area and rotation angle are obtained. Figures 11-12 ).

[0097] Specifically, the cv2.findContours function in the OpenCV library is used and the approximation mode is set to cv2.CHAIN_APPROX_NONE, which is used to extract all edge points of the target region contour to ensure the complete preservation of the boundary shape. This function is one of the standard functions widely used in the OpenCV (Open Source Computer Vision Library) open source image processing library, which belongs to the prior art and is described in detail in the OpenCV official document and development manual (https: / / docs.opencv.org). Compared with the compression mode (such as CHAIN_APPROX_SIMPLE), this mode can provide higher precision contour representation, which is convenient for subsequent fitting and reconstruction processing by NURBS curve.

[0098] S7. According to the fitting results in S6, the iris fitted ellipse area (Iris Area, I) and the sclera fitted ellipse area (Sclear Area, S) are obtained, and the visible eye white percentage (PVS) of the cow is calculated by the following formula:

[0099] ;

[0100] S8. The system performs the following verification on the PVS calculation result calculated in S7: (1) Empirical threshold judgment (PVS should be between 10% and 70%); (2) Repetitive consistency test of images of the same cow in the same period.

[0101] Actual example

[0102] With a certain lactating Holstein cow as the research object, 30 eye images are collected, and 25 qualified images are successfully extracted after S1-S4 steps.

[0103] In step S6, the contour points are completely extracted by cv2.CHAIN_APPROX_NONE, the boundary is smoothed and reconstructed by NURBS curve, and the least square method is used to fit the elliptical model, so that the long axis, short axis and area parameters of the iris and the sclera are obtained. For example, the fitting result of an image is: (1) the iris ellipse area I = 832.5 pixels; (2) the sclera ellipse area S = 1480.2 pixels.

[0104] Therefore, it can be seen from the calculation that the percentage of white eye PVS = (S-I) / S x 100% = 43.75%.

[0105] The average of the calculation results of the system for 25 images is PVS = 41.3%, and more than 95% of the sample results are within the effective range of 10% to 70%, and through consistency verification with the same cow image at the same period, the re-measurement deviation is less than ± 3%.

[0106] Comparison analysis with prior art

[0107] Compared with the traditional eye white estimation method based on single threshold value or rough contour extraction (such as using only cv2.CHAIN_APPROX_SIMPLE or not performing NURBS reconstruction), the present application has significant advantages in contour fidelity and area calculation accuracy.

[0108] The verification results in the public image data set show that the average contour boundary fitting error of the traditional method is ± 7.8 pixels, while the present application is controlled within ± 3.1 pixels;

[0109] When there are light spots or slight blurring in the image, the robustness of the present application is obviously better, and the success rate of eye white recognition is improved by about 22%;

[0110] After the method of the present application is deployed on a cloud platform, the processing time of a single image is less than 0.8 seconds, which has practical engineering application feasibility.

[0111] In summary, the present application is superior to the prior art in terms of structural accuracy, calculation stability and automation degree, and has significant technical progress and application value.

[0112] The contents not described in detail in the specification belong to the prior art known to those skilled in the art.

Claims

1. A method of measuring the percentage of visible ocular discharge in a dairy cow, characterized in that, The method comprises the following steps: S1, image acquisition of the eye of a dairy cow; S2, screening of the image collected in S1 to eliminate invalid images; S3, identification of the eye position in the image screened in S2, and clipping of the eye position image to obtain an eye region ROI; S4, preprocessing of the eye region ROI obtained in S3 to obtain an optimized binary image; S5, extraction of all contour regions in the optimized binary image obtained in S4, and screening of the iris and sclera regions; S6, complete approximation of the contour regions obtained in S5 and contour reconstruction, and then fitting of the boundary reconstruction contour of the iris and sclera regions with an elliptical model; S7, obtaining of the iris fitted ellipse area and the sclera fitted ellipse area according to the fitting result of S6, and calculation of the visible eye white percentage of the dairy cow according to the following formula: ; In the above formulae, is the area of the ellipse fitted to the iris, is the area of the ellipse fitted to the sclera, S8, verification of the calculation result obtained in S7.

2. The method for measuring the visible eye white percentage of a dairy cow according to claim 1, characterized in that: The invalid images in S2 include blurred images, closed-eye images and occluded images.

3. A method of measuring visible ocular white percentage in a dairy cow as claimed in claim 1, characterized in that: The specific steps of S3 include: S31, establishment of a target detection model for the eye region of a dairy cow: The input image is wherein H, W, C respectively represent the height, width, and channel number of the image; a deep neural network model is used to learn a set of bounding boxes containing the eye region from the image: ​ ; In the above formula, and The first The horizontal and vertical coordinates of the center point of each candidate box; These are the width and height of the detection frame, respectively; The confidence score represents the probability that the box represents the cow's eye area. The parameters obtained from model training; The number of candidate boxes detected; S32 training set of labeled cow eye region is used The detection model is trained; wherein is the true boundary box label corresponding to the image; M is the number of training samples; S33 For each image input model , select the group of detection boxes with the highest confidence x, y, w, h , calculate the boundary of the eye region ROI according to the following formula; x, y, w, h respectively the horizontal coordinate of the center point of the detection box, the vertical coordinate of the center point of the detection box, the width of the detection box and the height of the detection box: ; Clipping to obtain an eye region image.

4. A method of measuring visible ocular white percentage of a dairy cow as claimed in claim 1, wherein, The specific steps of the preprocessing in S4 include: Extraction of a red channel image to suppress blue light spots; Application of the Otsu method for binaryzation; Construction of a minimum circumscribed rectangle region based on the sclera boundary for secondary image clipping; Removal of image defects to optimize the image structure.

Citation Information

Patent Citations

  • Sclera identification method, equipment and computer readable storage medium

    CN107330402A

  • Cosmetic contact lens recognition processing method and system based on deep neural network

    CN114998981A