一种基于图像分割的鸡冠多特征测量方法及系统

By using image segmentation and pose coordinate system construction, combined with calibration objects for scale transformation, accurate measurement of rooster comb height, area, and color features was achieved. This solved the problems of low efficiency and poor accuracy in traditional manual measurement, provided a standardized data interface, and improved the efficiency and consistency of data recording.

CN122415708APending Publication Date: 2026-07-17HENAN AGRICULTURAL UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HENAN AGRICULTURAL UNIVERSITY
Filing Date
2026-04-22
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

Traditional methods for manually measuring the shape and color of chicken combs are inefficient, subjective, and inconsistent, making it difficult to meet the automated data collection needs of modern smart agriculture. Furthermore, the randomness of chicken head posture, the complexity of comb shape, and the variability of lighting conditions lead to low image measurement accuracy and poor stability.

Method used

By acquiring chicken head images and performing pixel-level segmentation using a pre-trained instance segmentation model, a head pose coordinate system is constructed. Scale transformation is then performed using a calibration object to achieve accurate measurement of the chicken comb height, area, and color features.

Benefits of technology

It improves the accuracy and stability of multi-feature measurement of chicken combs, solves the problems of chicken head posture changes, complex comb morphology, changes in lighting conditions and inconsistent shooting scale, provides a standardized data interface, and improves the efficiency and consistency of data recording.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122415708A_ABST
    Figure CN122415708A_ABST
Patent Text Reader

Abstract

This application discloses a method and system for measuring multiple features of a rooster comb based on image segmentation. The method includes: acquiring an image of a rooster head to be measured; the image of the rooster head to be measured includes a rooster head and a calibration object; performing pixel-level segmentation of the image of the rooster head to be measured based on a pre-trained instance segmentation model to obtain a rooster comb region mask, a rooster eye region mask, and a calibration object mask; determining a reference origin based on the rooster eye region mask; determining the coordinate axis direction based on the rooster comb region mask and the rooster eye region mask; constructing a head posture coordinate system; calculating the rooster comb pixel height and rooster comb pixel area based on the rooster comb region mask in the head posture coordinate system; determining the rooster comb color feature value based on the rooster comb region mask; converting the rooster comb pixel height and rooster comb pixel area into the actual rooster comb height and actual rooster comb area based on the relationship between the calibration object mask and the actual size of the calibration object; and outputting the rooster comb multi-feature measurement result based on the actual rooster comb height, actual rooster comb area, and rooster comb color feature value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of combining computer vision with smart farming, and relates to, but is not limited to, a method and system for measuring multiple features of chicken combs based on image segmentation. Background Technology

[0002] In large-scale poultry farming and genetic breeding, the morphological and color characteristics of the chicken comb, such as its height, area, and color, are key phenotypic indicators for assessing the health status, production performance, and breed purity of chickens. Accurate measurement of these parameters is crucial for achieving refined farming management, efficient breeding selection, and scientific research. Traditional methods relying on visual inspection and manual measurement based on human experience are inefficient, subjective, inconsistent, and stressful for chickens, and can no longer meet the demands of modern smart agriculture for automated data collection.

[0003] To automate the measurement of rooster comb morphology and color features, images of rooster heads can be captured and measured using image processing algorithms. However, the posture of the rooster's head in the image is random, potentially exhibiting rotation and tilt at arbitrary angles, leading to a lack of uniform spatial reference for measurement. Furthermore, the rooster comb has a complex shape and irregular edges, deviating from standard geometry. The complex and variable lighting conditions in the breeding environment easily create highlights and shadows on the comb surface. The distance between the camera and the rooster during shooting is also difficult to maintain consistently, resulting in inconsistent image scale. These issues lead to low accuracy, poor stability, and insufficient robustness in image-based measurements.

[0004] Therefore, there is an urgent need for a multi-feature measurement method for rooster combs based on image segmentation. Summary of the Invention

[0005] In view of this, embodiments of this application provide a method and system for measuring multiple features of a rooster comb based on image segmentation, which at least solves the problem of inaccurate measurement of multiple features of a rooster comb caused by random changes in the rooster's head posture, complex and irregular rooster comb shape, changes in lighting conditions, and inconsistent shooting scale.

[0006] The technical solution of this application embodiment is implemented as follows: In a first aspect, embodiments of this application provide a method for measuring multiple features of a rooster's comb based on image segmentation, characterized in that the method includes: Acquire an image of the chicken head to be tested; the image of the chicken head to be tested includes the chicken head and the corresponding calibration object; The chicken head image to be tested is segmented at the pixel level based on a pre-trained instance segmentation model to obtain a chicken comb region mask, a chicken eye region mask, and a calibration object mask. Based on the corn eye region mask, the reference origin of the chicken head is determined; based on the comb region mask and the corn eye region mask, the coordinate axis direction is determined; the coordinate axis direction is used to describe the chicken head orientation; based on the reference origin and the coordinate axis direction, a head posture coordinate system is constructed. In the head pose coordinate system, the rooster comb pixel height and rooster comb pixel area are calculated based on the rooster comb region mask; the rooster comb color feature value is determined based on the rooster comb region mask. Obtain the actual size of the calibration object; based on the relationship between the calibration object mask and the actual size of the calibration object, convert the rooster comb pixel height and the rooster comb pixel area into the actual rooster comb height and the actual rooster comb area, respectively; Based on the actual height of the rooster comb, the actual area of ​​the rooster comb, and the color feature value of the rooster comb, output the multi-feature measurement results of the rooster comb.

[0007] Secondly, embodiments of this application provide a multi-feature measurement system for rooster combs based on image segmentation. The system includes: an image acquisition module, an instance segmentation module, a pose coordinate system construction module, a feature calculation module, a scale conversion module, and a result output module. The image acquisition module is used to acquire an image of the chicken head to be tested; the image of the chicken head to be tested includes the chicken head and the corresponding calibration object; The instance segmentation module is used to perform pixel-level segmentation on the chicken head image to be tested based on a pre-trained instance segmentation model to obtain a chicken comb region mask, a chicken eye region mask, and a calibration object mask. The posture coordinate system construction module is used to determine the reference origin of the chicken head based on the corn eye region mask; determine the coordinate axis direction based on the comb region mask and the corn eye region mask; the coordinate axis direction is used to describe the chicken head orientation; and construct a head posture coordinate system based on the reference origin and the coordinate axis direction. The feature calculation module is used to calculate the rooster comb pixel height and rooster comb pixel area based on the rooster comb region mask in the head pose coordinate system; and to determine the rooster comb color feature value based on the rooster comb region mask. The scale conversion module is used to obtain the actual size of the calibration object; based on the relationship between the calibration object mask and the actual size of the calibration object, the rooster comb pixel height and the rooster comb pixel area are converted into the actual height and actual area of ​​the rooster comb, respectively. The result output module is used to output multi-feature measurement results of the rooster comb based on the actual height of the rooster comb, the actual area of ​​the rooster comb, and the color feature value of the rooster comb.

[0008] The beneficial effects of the technical solutions provided in this application include at least the following: This application acquires a test image of a chicken head, which includes the chicken head and a corresponding calibration object. The chicken head provides the main subject for feature extraction, while the calibration object, with a known real-world size, serves as a reference for converting the pixel dimensions of the test chicken head image into physical dimensions. A pre-trained instance segmentation model performs pixel-level segmentation on the test chicken head image, obtaining a comb region mask, a chicken eye region mask, and a calibration object mask. These masks generate pixel-level digital contours for the comb region, chicken eye region, and calibration object, defining the specific pixels included in each mask. Based on the chicken eye region mask, a reference origin for the chicken head is determined. The coordinate axis directions are also determined based on the comb and chicken eye region masks, describing the chicken head's orientation. A head pose coordinate system is constructed based on the reference origin and coordinate axis directions. This constructed head pose coordinate system normalizes the chicken's head pose. Regardless of whether the chicken's head is facing forward, sideways, tilted back, or tilted down in the image being tested, the measurements of the comb's height and area are performed within this head posture coordinate system. The measurement results are independent of the chicken's specific rotational posture within the image, improving the accuracy of automated measurement. Within the head posture coordinate system, the comb pixel height and area are calculated based on a comb region mask; the comb color feature value is also determined based on the comb region mask. Parallel extraction of multiple features is achieved by calculating the comb pixel height, area, and color feature value. Measurement within the head posture coordinate system ensures the invariance of the measurement results to the chicken's posture. Area statistics and color sampling analysis based on the overall mask avoid interference from edge errors or localized lighting spots, resulting in highly robust height, area, and color features. The actual dimensions of the calibration object are obtained; based on the relationship between the calibration object mask and the actual dimensions of the calibration object, the comb pixel height and area are converted into the actual comb height and area, respectively. Based on the relationship between the calibration mask and the actual size of the calibration object, the actual height and area of ​​the rooster comb are calculated, solving the problem of inconsistent image scale and inaccurate measurement results caused by different shooting distances. By calibrating the rooster comb pixel height and area to a uniform real physical scale, the actual rooster comb height and area obtained from rooster head images taken at different times, with different devices, and at different distances are comparable. Based on the actual rooster comb height, actual area, and color feature values, multi-feature measurement results of the rooster comb are output, providing a standardized data interface for subsequent chicken health assessment, breeding analysis, or automated detection, improving the efficiency and consistency of data recording, and avoiding errors that may occur during manual summarization. Therefore, this application achieves high accuracy in measuring multi-feature rooster combs even when the rooster's head posture changes randomly, the rooster comb shape is complex and irregular, lighting conditions vary, and the shooting scale is inconsistent. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein: Figure 1 A flowchart illustrating a method for measuring multiple features of a rooster comb based on image segmentation, provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a multi-feature measurement system for rooster comb based on image segmentation, provided in an embodiment of this application. Detailed Implementation

[0010] 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. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0011] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0012] It should be noted that the terms "first, second, and third" used in the embodiments of this application are merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0013] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which the embodiments of this application pertain. It should also be understood that terms such as those defined in general dictionaries should be understood to have a meaning consistent with their meaning in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0014] This application provides a method for measuring multiple features of a rooster's comb based on image segmentation. Figure 1 A flowchart illustrating a multi-feature measurement method for rooster comb based on image segmentation provided in this application embodiment is shown below. Figure 1 As shown, the method includes at least the following steps: Step S110: Obtain the image of the chicken head to be tested; the image of the chicken head to be tested includes the chicken head and the corresponding calibration object; The image of the chicken head to be tested is a digital image containing the complete chicken head and a calibration object of known size.

[0015] The marker can be any reference object with a pre-known physical size. For example, a checkerboard marker of a specific size or a circular marker of a known diameter. The marker is placed next to the chicken head or in the background and is photographed in the same frame as the chicken head.

[0016] Each measurement of the chicken head image involves a single image containing both the chicken head and its corresponding calibration object. The method of this application can batch process multiple acquired chicken head images. The chicken head provides the main subject for feature extraction in this application, while the corresponding calibration object is a known real-world size, providing a reference for converting the pixel dimensions of the chicken head images to their physical dimensions.

[0017] Step S120: The chicken head image to be tested is segmented at the pixel level based on the pre-trained instance segmentation model to obtain the chicken comb region mask, the chicken eye region mask and the calibration object mask; Pixel-level segmentation involves analyzing the input image of a chicken head to be tested, classifying and assigning each pixel in the image to identify which pixels belong to the comb region, which belong to the eye region, which belong to the marker region, and distinguishing pixels from other background pixels.

[0018] After pixel-level segmentation, the output rooster comb region mask, rooster eye region mask, and calibration object mask are three binary images of the same size as the original rooster head image to be tested, with only black and white content.

[0019] Each of the rooster comb region mask, chicken eye region mask, and marker mask defines the precise outline of the rooster comb region, chicken eye region, and marker in the image and the position of all pixels.

[0020] The obtained rooster comb region mask, corn eye region mask, and calibration object mask generate pixel-level digital contours for the rooster comb region, corn eye region, and calibration object, defining the specific pixels included in each mask. These masks form the data foundation for all subsequent measurements, color analysis, and scale conversions.

[0021] Step S130: Based on the corn eye region mask, determine the reference origin of the chicken head; based on the comb region mask and the corn eye region mask, determine the coordinate axis direction; the coordinate axis direction is used to describe the chicken head orientation; based on the reference origin and the coordinate axis direction, construct a head posture coordinate system; The pixels in the comb and eye regions are merged, and the coordinate axis direction that best represents the chicken's head orientation is extracted from the overall spatial distribution of these pixels. A head pose coordinate system is constructed with the center point of the determined eye region as the origin and the extracted chicken head orientation as the coordinate axis direction.

[0022] By constructing a head posture coordinate system, the head posture of chickens was normalized. Regardless of whether the chicken's head is facing forward, sideways, tilted back, or tilted down in the image of the chicken's head to be tested, the measurement of the height and area of ​​the comb is carried out under this fixed head posture coordinate system. The measurement results are independent of the specific rotation posture of the chicken's head in the image of the chicken to be tested, thus improving the accuracy of automated measurement.

[0023] Step S140: In the head pose coordinate system, the height and area of ​​the rooster comb pixels are calculated based on the rooster comb region mask; the color feature value of the rooster comb is determined based on the rooster comb region mask. Within the same rooster comb region mask, calculate the statistical values ​​of the rooster comb color to determine the rooster comb color feature values ​​that can stably represent the rooster comb color. For example, the statistical values ​​of the rooster comb color could be the average value of the rooster comb color across the RGB channels.

[0024] Parallel extraction of multiple features was achieved by calculating the rooster's comb pixel height, area, and color feature values. Measurements were taken in the head pose coordinate system, ensuring the invariance of the measurement results to the rooster's head pose. Area statistics and color sampling analysis were performed based on the entire mask, avoiding interference from edge errors or local lighting spots, resulting in highly robust height, area, and color data.

[0025] Step S150: Obtain the actual size of the calibration object; based on the relationship between the calibration object mask and the actual size of the calibration object, convert the rooster comb pixel height and the rooster comb pixel area into the actual height and actual area of ​​the rooster comb, respectively. The actual dimensions of the calibration object are determined in advance. For example, when the calibration object is a cube, the actual dimensions of the calibration object can be that the side length of the cube is 10 millimeters.

[0026] The pixel size of the calibration object in the chicken head image under test is measured using a calibration object mask. By comparing the actual size and pixel size of the calibration object in each chicken head image under test, the relationship between the pixel size and the actual size of the chicken head image under test is calculated. This relationship can be a conversion ratio. Note that the relationship between the pixel size and the actual size is different for each chicken head image under test.

[0027] Applying the above relationships, the rooster comb pixel height and rooster comb pixel area are converted into the actual rooster comb height and actual rooster comb area.

[0028] Based on the relationship between the calibration mask and the actual size of the calibration object, the actual height and area of ​​the rooster's comb were calculated, solving the problem of inaccurate measurement results caused by inconsistent image scales of the rooster's head due to different shooting distances. Pixel-based measurement results were calibrated to a uniform real-world scale, making the comb size data obtained from rooster head images taken at different times, with different devices, and at different distances comparable. This provides reliable data with practical physical significance for subsequent accurate analysis, health assessment, and breeding selection.

[0029] Step S160: Based on the actual height of the rooster comb, the actual area of ​​the rooster comb, and the color feature value of the rooster comb, output the multi-feature measurement result of the rooster comb.

[0030] The system integrates the actual height, area, and color characteristics of the chicken comb to generate multi-feature measurement results. This provides a standardized data interface for subsequent health assessments, breeding analyses, or automated testing, improving the efficiency and consistency of data recording and avoiding errors that may occur during manual data aggregation.

[0031] This application acquires a test image of a chicken head, which includes the chicken head and a corresponding calibration object. The chicken head provides the main subject for feature extraction, while the calibration object, with a known real-world size, serves as a reference for converting the pixel dimensions of the test chicken head image into physical dimensions. A pre-trained instance segmentation model performs pixel-level segmentation on the test chicken head image, obtaining a comb region mask, a chicken eye region mask, and a calibration object mask. These masks generate pixel-level digital contours for the comb region, chicken eye region, and calibration object, defining the specific pixels included in each mask. Based on the chicken eye region mask, a reference origin for the chicken head is determined. The coordinate axis directions are also determined based on the comb and chicken eye region masks, describing the chicken head's orientation. A head pose coordinate system is constructed based on the reference origin and coordinate axis directions. This constructed head pose coordinate system normalizes the chicken's head pose. Regardless of whether the chicken's head is facing forward, sideways, tilted back, or tilted down in the image being tested, the measurements of the comb's height and area are performed within this head posture coordinate system. The measurement results are independent of the chicken's specific rotational posture within the image, improving the accuracy of automated measurement. Within the head posture coordinate system, the comb pixel height and area are calculated based on a comb region mask; the comb color feature value is also determined based on the comb region mask. Parallel extraction of multiple features is achieved by calculating the comb pixel height, area, and color feature value. Measurement within the head posture coordinate system ensures the invariance of the measurement results to the chicken's posture. Area statistics and color sampling analysis based on the overall mask avoid interference from edge errors or localized lighting spots, resulting in highly robust height, area, and color features. The actual dimensions of the calibration object are obtained; based on the relationship between the calibration object mask and the actual dimensions of the calibration object, the comb pixel height and area are converted into the actual comb height and area, respectively. Based on the relationship between the calibration mask and the actual size of the calibration object, the actual height and area of ​​the rooster comb are calculated, solving the problem of inconsistent image scale and inaccurate measurement results caused by different shooting distances. By calibrating the rooster comb pixel height and area to a uniform real physical scale, the actual rooster comb height and area obtained from rooster head images taken at different times, with different devices, and at different distances are comparable. Based on the actual rooster comb height, actual area, and color feature values, multi-feature measurement results of the rooster comb are output, providing a standardized data interface for subsequent chicken health assessment, breeding analysis, or automated detection, improving the efficiency and consistency of data recording, and avoiding errors that may occur during manual summarization. Therefore, this application achieves high accuracy in measuring multi-feature rooster combs even when the rooster's head posture changes randomly, the rooster comb shape is complex and irregular, lighting conditions vary, and the shooting scale is inconsistent.

[0032] Optionally, determining the reference origin of the chicken head based on the corn region mask includes: obtaining the coordinates of all pixels in the corn region mask to obtain a set of corn region pixels; calculating the geometric center of the corn based on the corn region pixel set; and using the geometric center as the reference origin of the chicken head.

[0033] The geometric center of the corn is calculated based on the pixel set of the corn region. This geometric center is also called the center point or centroid. It is obtained by calculating the arithmetic mean of the coordinates of all points within the pixel set of the corn region.

[0034] Using the geometric center of the chicken's eye as the reference origin provides a stable, reliable, and easily obtainable spatial reference point for the normalized measurement of the chicken's head posture.

[0035] Optionally, determining the coordinate axis direction based on the rooster comb region mask and the rooster eye region mask includes: obtaining the pixel points corresponding to the rooster comb region mask and the rooster eye region mask respectively to obtain a rooster head region pixel point set; performing principal component analysis on the rooster head region pixel point set to obtain a first principal axis and a second principal axis; the first principal axis corresponds to the direction along the line connecting the rooster beak and the back of the rooster's head, and the second principal axis represents the rooster head height direction orthogonal to the first principal axis; and determining the coordinate axis direction based on the first principal axis and the second principal axis.

[0036] Principal component analysis was performed on the pixel set of the chicken's head region to calculate the two mutually perpendicular principal axes that best describe the distribution of these points: the first principal axis and the second principal axis. The first principal axis represents the direction with the largest variance in the point set distribution, corresponding to the direction along the line connecting the chicken's beak and the back of its head. The second principal axis is orthogonal to the first principal axis and represents the height direction of the chicken's head.

[0037] The direction along the line connecting the chicken's beak and the back of its head can be either from the chicken's beak to the back of its head or from the back of its head to the chicken's beak.

[0038] Optionally, the method further includes: acquiring a second historical chicken head image; performing data enhancement processing on the second historical chicken head image to obtain the first historical chicken head image; wherein the data enhancement processing includes pose transformation and / or photometric adjustment; the pose transformation includes at least one of rotation transformation, translation transformation, and affine transformation; the photometric adjustment includes at least one of brightness adjustment, contrast adjustment, and color channel adjustment.

[0039] Optionally, the method further includes: acquiring a first historical chicken head image and corresponding historical chicken comb region mask, historical chicken eye region mask, and historical marker mask; constructing an initial segmentation model; using the first historical chicken head image as input features, and using the corresponding historical chicken comb region mask, historical chicken eye region mask, and historical marker mask as supervision labels, training the initial segmentation model to obtain the pre-trained instance segmentation model.

[0040] The second historical chicken head image was obtained by directly capturing images using an image acquisition device, such as a camera.

[0041] The historical rooster comb region mask, historical rooster eye region mask, and historical marker mask were obtained by manually annotating the second historical rooster head image.

[0042] This application does not limit the algorithm corresponding to the initial segmentation model. The initial segmentation model can be any model that can be trained to complete the segmentation of the rooster comb region, the rooster eye region, and the marker, such as a region-based convolutional neural network mask model (Mask R-CNN) or an attention-based mask segmentation model (Mask2Former).

[0043] Data augmentation is performed on the second historical chicken head image to obtain the first historical chicken head image. The augmented first historical chicken head image is then used to train the initial segmentation model. The resulting pre-trained instance segmentation model (hereinafter referred to as the instance segmentation model) has stronger generalization ability and robustness.

[0044] The instance segmentation model trained using the enhanced first historical chicken head image can accurately and stably segment the comb, eye, and calibration object regions from chicken head images taken under different orientations and lighting conditions. This results in the acquisition of comb region masks, eye region masks, and calibration object masks, which are prerequisites for ensuring the pose invariance and illumination robustness of color features in subsequent geometric measurements.

[0045] The pose transformation of the second historical chicken head image is performed to simulate different chicken head orientations and tilt states, thereby enhancing the adaptability of the instance segmentation model to pose changes.

[0046] The photometric adjustment of the second historical chicken head image involves artificially perturbing and adjusting the brightness, contrast, and color channels of the second historical chicken head image to simulate the changes in lighting under different shooting environments and improve the adaptability of the instance segmentation model to changes in lighting.

[0047] In some embodiments, after pixel-level segmentation of the chicken head image to be tested based on a pre-trained instance segmentation model to obtain a chicken comb region mask, connectivity analysis is performed on the chicken comb region mask to keep its edge contours continuous and complete; wherein, connectivity analysis includes: selecting the connected region with the largest area as the valid chicken comb region, and / or filling the holes in the chicken comb region mask.

[0048] Optionally, calculating the rooster comb pixel height and rooster comb pixel area based on the rooster comb region mask in the head pose coordinate system includes: acquiring each rooster comb pixel point of the rooster comb region mask; calculating a first projection path of each rooster comb pixel point along the rooster head height direction to the reference origin; taking the portion of each first projection path that falls within the rooster comb region mask as a second projection path; selecting the maximum value from each second projection path as the rooster comb pixel height; and determining the rooster comb pixel area based on the number of rooster comb pixels.

[0049] During the measurement of the rooster comb pixel height, only the length of the effective line segment coinciding with the rooster comb region mask in the measurement direction is counted to suppress interference from non-target areas on the rooster comb height measurement. The calculation of the rooster comb pixel height H is shown in formula (1): Formula (1); in, The height of the rooster's comb (in pixels) is the maximum value in the second projection path; L represents the first projection path. Represents the second projection path. Representing each pixel of the rooster's comb. This indicates a mask for the rooster's comb area. This is an indicator function.

[0050] During the measurement of the rooster comb pixel area, only the effective pixels belonging to the rooster comb region mask are counted. Methods such as connected component filtering or hole filling can be combined to avoid area errors caused by background noise or mask breakage.

[0051] Optionally, determining the rooster comb color feature value based on the rooster comb region mask includes: randomly sampling the rooster comb pixels to obtain a rooster comb sampling point set; filtering the values ​​of each rooster comb sampling point in each color channel based on a preset quantile threshold to remove outliers in the rooster comb sampling point set, obtaining a filtered rooster comb sampling point set; calculating the color statistics of the filtered rooster comb sampling point set in each color channel, and determining the color statistics as the rooster comb color feature value.

[0052] In the process of extracting color features from the rooster's comb, quantile filtering is used to clean the sampled pixels to suppress interference from abnormal lighting. This operation is performed separately on the three independent color channels: red, green, and blue. By setting a preset quantile threshold, for example, removing the highest and lowest 5% of extreme values, abnormal pixels in each channel can be identified and eliminated. These eliminated pixels typically correspond to overexposed bright areas caused by strong lighting, or underexposed dark areas caused by uneven lighting. After removing these outliers caused by uneven lighting, subsequent color statistical analysis will be based on pixels in the normally colored areas of the rooster's comb surface, thus ensuring that the final extracted color feature values ​​have higher stability and representativeness.

[0053] Calculating the color statistics of the filtered rooster comb sampling point set in each color channel involves statistically calculating the values ​​of all pixels in the point set within their respective red, green, and blue color channels. This statistical calculation can be done by calculating the arithmetic mean of all pixel values ​​in each color channel. After these calculations, three color statistics are obtained, representing the average color intensity of the rooster comb region in the red, green, and blue channels. These three color statistics constitute the rooster comb color feature values.

[0054] Optionally, the step of converting the rooster comb pixel height and the rooster comb pixel area into the actual rooster comb height and the actual rooster comb area based on the relationship between the calibration mask and the actual size of the calibration object includes: measuring the pixel size of the calibration object in the rooster head image to be tested based on the calibration mask; calculating a target conversion ratio based on the actual size and the pixel size of the calibration object; and converting the rooster comb pixel height into the actual rooster comb height and the rooster comb pixel area into the actual rooster comb area based on the target conversion ratio.

[0055] Each target conversion ratio corresponds to a chicken head image to be tested.

[0056] The target conversion ratio is the conversion ratio between the rooster comb pixel height and the actual rooster comb height corresponding to the current rooster head image to be tested, and the conversion ratio between the rooster comb pixel area and the actual rooster comb area corresponding to the current rooster head image to be tested.

[0057] In some embodiments, the measured height of the rooster's comb pixels is multiplied by a target conversion ratio to obtain the actual height of the rooster's comb in units of length. The area of ​​the rooster's comb pixels is multiplied by the square of the target conversion ratio to obtain the actual area of ​​the rooster's comb in units of area.

[0058] By converting the target ratio to obtain the actual height and area of ​​the rooster comb, the problem of inconsistent image scale caused by differences in shooting distance is solved. The actual height and area of ​​the rooster comb are transformed from pixel values ​​without clear scale into physical quantities that can be directly compared with real-world standards. This provides standardized data with practical application value for subsequent accurate recording, inter-individual comparisons, and breeding and health assessment.

[0059] Optionally, there are multiple calibration objects; the step of calculating the target conversion ratio based on the actual size and pixel size of the calibration objects includes: calculating multiple initial conversion ratios based on the actual size and pixel size of each calibration object; calculating robust statistical values ​​of the multiple initial conversion ratios to obtain the target conversion ratio; wherein the robust statistical values ​​include the median or the truncated mean.

[0060] When the robust statistical value is the median, the target conversion ratio s is calculated as shown in formula (2): Formula (2); Where s is the target conversion ratio. This represents taking the median value. Indicates the pixel size of the calibration object. Indicates the actual dimensions of the calibration object.

[0061] By setting multiple calibration objects and obtaining the target conversion ratio by taking robust statistical values ​​of the initial conversion ratio, the scale conversion deviation caused by the identification error of a single calibration object or local deformation can be suppressed, thereby improving the accuracy and robustness of the measurement method of this application.

[0062] This application does not limit the number of calibrators. In some embodiments, the number of calibrators may also be one.

[0063] The method proposed in this application can be applied to scenarios such as poultry breeding evaluation, chicken health status assessment, large-scale farming management, automated testing equipment, and scientific research data collection. Below, we will use chicken health status assessment as an example to explain one application scenario of the method proposed in this application.

[0064] In some embodiments, this application proposes a method for assessing the health status of chickens, the method comprising: obtaining the actual height, actual area, and color feature value of the comb of a target chicken; comparing and analyzing the actual height, actual area, and color feature value of the comb with a chicken health standard threshold to obtain the comparison and analysis result; and generating health status assessment information of the target chicken based on the comparison and analysis result.

[0065] The health standard threshold is a pre-established reference benchmark that defines the normal numerical range of a healthy rooster's comb in three dimensions: actual comb height, actual comb area, and comb color characteristic value. For example, it defines a reasonable range for height, typical values ​​for area, and normal color gamut. The measured data are compared one by one with the above normal numerical ranges to analyze whether the actual comb height, actual comb area, and comb color characteristic value are within the normal range, and the degree and direction of deviation, thus obtaining quantitative comparative analysis results.

[0066] The comparative analysis results are transformed into health conclusions that users can intuitively understand. For example, health conclusions can be graded as healthy, sub-healthy, and suspected abnormal.

[0067] Figure 2 A schematic diagram of a multi-feature measurement system for rooster combs based on image segmentation provided in this application embodiment is shown below. Figure 2 As shown, this application proposes a multi-feature measurement system for rooster comb based on image segmentation. The system 200 includes: an image acquisition module 210, an instance segmentation module 220, a pose coordinate system construction module 230, a feature calculation module 240, a scale conversion module 250, and a result output module 260. The image acquisition module 210 is used to acquire an image of the chicken head to be tested; the image of the chicken head to be tested includes the chicken head and the corresponding calibration object. The instance segmentation module 220 is used to perform pixel-level segmentation on the chicken head image to be tested based on a pre-trained instance segmentation model to obtain a chicken comb region mask, a chicken eye region mask, and a calibration object mask. The posture coordinate system construction module 230 is used to determine the reference origin of the chicken head based on the corn eye region mask; determine the coordinate axis direction based on the comb region mask and the corn eye region mask; the coordinate axis direction is used to describe the chicken head orientation; and construct a head posture coordinate system based on the reference origin and the coordinate axis direction. The feature calculation module 240 is used to calculate the height and area of ​​the rooster comb pixels based on the rooster comb region mask in the head posture coordinate system; and to determine the rooster comb color feature value based on the rooster comb region mask. The scale conversion module 250 is used to obtain the actual size of the calibration object; based on the relationship between the calibration object mask and the actual size of the calibration object, the rooster comb pixel height and the rooster comb pixel area are converted into the actual height and actual area of ​​the rooster comb, respectively. The result output module 260 is used to output multi-feature measurement results of the rooster comb based on the actual height of the rooster comb, the actual area of ​​the rooster comb, and the color feature value of the rooster comb.

[0068] It should be noted that the description of the system embodiments above is similar to the description of the method embodiments above, and has similar beneficial effects. For technical details not disclosed in the system embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0069] It should be noted that, in the embodiments of this application, if the above-mentioned image segmentation-based multi-feature measurement method for rooster combs is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.

[0070] Correspondingly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the steps in any of the image segmentation-based multi-feature measurement methods for rooster combs described in the above embodiments. Correspondingly, embodiments of this application also provide a computer program product, which, when executed by a processor of an electronic device, is used to implement the steps in any of the image segmentation-based multi-feature measurement methods for rooster combs described in the above embodiments.

[0071] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0072] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0073] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0074] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected to achieve the purpose of the embodiments of this application according to actual needs. In addition, each functional unit in the embodiments of this application may be fully integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the integrated unit may be implemented in hardware or in the form of hardware plus software functional units.

[0075] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause the device automatic test line to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0076] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined to obtain new method embodiments without conflict. The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined to obtain new method embodiments or device embodiments without conflict.

[0077] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for measuring multiple features of a rooster's comb based on image segmentation, characterized in that, The method includes: Acquire an image of the chicken head to be tested; the image of the chicken head to be tested includes the chicken head and the corresponding calibration object; The chicken head image to be tested is segmented at the pixel level based on a pre-trained instance segmentation model to obtain a chicken comb region mask, a chicken eye region mask, and a calibration object mask. Based on the corn eye region mask, the reference origin of the chicken head is determined; based on the comb region mask and the corn eye region mask, the coordinate axis direction is determined; the coordinate axis direction is used to describe the chicken head orientation; based on the reference origin and the coordinate axis direction, a head posture coordinate system is constructed. In the head pose coordinate system, the rooster comb pixel height and rooster comb pixel area are calculated based on the rooster comb region mask; the rooster comb color feature value is determined based on the rooster comb region mask. Obtain the actual size of the calibration object; based on the relationship between the calibration object mask and the actual size of the calibration object, convert the rooster comb pixel height and the rooster comb pixel area into the actual rooster comb height and the actual rooster comb area, respectively; Based on the actual height of the rooster comb, the actual area of ​​the rooster comb, and the color feature value of the rooster comb, output the multi-feature measurement results of the rooster comb.

2. The method according to claim 1, characterized in that, Determining the reference origin of the chicken head based on the mask of the chicken eye region includes: Obtain the coordinates of all pixels in the corn eye region mask to obtain the corn eye region pixel set; Based on the set of pixels in the corn region, calculate the geometric center of the corn; The geometric center is used as the reference origin of the chicken head.

3. The method according to claim 1, characterized in that, The determination of coordinate axis directions based on the rooster comb region mask and the rooster eye region mask includes: Obtain the pixel points corresponding to the rooster comb region mask and the rooster eye region mask respectively to obtain the rooster head region pixel point set; Principal component analysis is performed on the pixel set of the chicken head region to obtain a first principal axis and a second principal axis; the first principal axis corresponds to the direction along the line connecting the chicken beak and the back of the chicken's head, and the second principal axis represents the height direction of the chicken head that is orthogonal to the first principal axis; The direction of the coordinate axis is determined based on the first principal axis and the second principal axis.

4. The method according to claim 1, characterized in that, The method further includes: Obtain the first historical chicken head image and the corresponding historical chicken comb region mask, historical chicken eye region mask, and historical marker mask; Construct the initial segmentation model; Using the first historical chicken head image as input features, and the corresponding historical rooster comb region mask, historical chicken eye region mask, and historical marker mask as supervision labels, the initial segmentation model is trained to obtain the pre-trained instance segmentation model.

5. The method according to claim 4, characterized in that, The method further includes: Obtain the second historical chicken head image; The second historical chicken head image is subjected to data augmentation processing to obtain the first historical chicken head image; The data enhancement processing includes pose transformation and / or photometric adjustment; the pose transformation includes at least one of rotation transformation, translation transformation and affine transformation; the photometric adjustment includes at least one of brightness adjustment, contrast adjustment and color channel adjustment.

6. The method according to claim 3, characterized in that, The calculation of the rooster comb pixel height and rooster comb pixel area based on the rooster comb region mask in the head pose coordinate system includes: Obtain each rooster comb pixel of the rooster comb region mask; Calculate the first projection path of each of the rooster comb pixels along the height direction of the rooster's head to the reference origin; The portion of each first projection path that falls within the rooster comb region mask is taken as the second projection path; The maximum value is selected from each of the second projection paths as the height of the rooster comb pixel; The area of ​​the rooster comb pixels is determined based on the number of rooster comb pixels.

7. The method according to claim 6, characterized in that, The determination of comb color feature values ​​based on the comb region mask includes: Randomly sample the rooster comb pixels to obtain a rooster comb sampling point set; Based on a preset quantile threshold, the values ​​of each rooster comb sampling point in each color channel in the rooster comb sampling point set are filtered to remove outliers in the rooster comb sampling point set, resulting in a filtered rooster comb sampling point set. Calculate the color statistics of the filtered rooster comb sampling point set on each color channel, and determine the color statistics as the rooster comb color feature value.

8. The method according to claim 1, characterized in that, The step of converting the rooster comb pixel height and rooster comb pixel area into the actual rooster comb height and actual rooster comb area based on the relationship between the calibration mask and the actual size of the calibration object includes: Based on the calibration mask, the pixel size of the calibration object in the chicken head image to be tested is measured; The target conversion ratio is calculated based on the actual size and pixel size of the calibrated object; Based on the target conversion ratio, the height of the rooster comb pixels is converted into the actual height of the rooster comb, and the area of ​​the rooster comb pixels is converted into the actual area of ​​the rooster comb.

9. The method according to claim 8, characterized in that, The calibration objects are multiple; the calculation of the target conversion ratio based on the actual size and pixel size of the calibration objects includes: Based on the actual size and pixel size of each of the calibrators, multiple initial conversion ratios are calculated; Calculate robust statistical values ​​for multiple initial conversion ratios to obtain the target conversion ratio; wherein the robust statistical values ​​include the median or the truncated mean.

10. A multi-feature measurement system for rooster combs based on image segmentation, characterized in that, The system includes: an image acquisition module, an instance segmentation module, a pose coordinate system construction module, a feature calculation module, a scale conversion module, and a result output module; The image acquisition module is used to acquire an image of the chicken head to be tested; the image of the chicken head to be tested includes the chicken head and the corresponding calibration object; The instance segmentation module is used to perform pixel-level segmentation on the chicken head image to be tested based on a pre-trained instance segmentation model to obtain a chicken comb region mask, a chicken eye region mask, and a calibration object mask. The posture coordinate system construction module is used to determine the reference origin of the chicken head based on the corn eye region mask; determine the coordinate axis direction based on the comb region mask and the corn eye region mask; the coordinate axis direction is used to describe the chicken head orientation; and construct a head posture coordinate system based on the reference origin and the coordinate axis direction. The feature calculation module is used to calculate the rooster comb pixel height and rooster comb pixel area based on the rooster comb region mask in the head pose coordinate system; and to determine the rooster comb color feature value based on the rooster comb region mask. The scale conversion module is used to obtain the actual size of the calibration object; based on the relationship between the calibration object mask and the actual size of the calibration object, the rooster comb pixel height and the rooster comb pixel area are converted into the actual height and actual area of ​​the rooster comb, respectively. The result output module is used to output multi-feature measurement results of the rooster comb based on the actual height of the rooster comb, the actual area of ​​the rooster comb, and the color feature value of the rooster comb.