A chicken health state recognition method based on multi-level semantic label driving

CN123016471APending Publication Date: 2026-10-30YANGZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611064188.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-17
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0005]本发明的目的是提供一种基于多层级语义标签驱动的鸡只健康状态识别方法,解决现有技术中早期禽病症状微弱且局部、不同图像类型下部分症状属性字段不可观测、少数异常类别识别困难以及诊断结果缺乏细粒度证据支撑的问题

Benefits of technology

[0069]与现有技术相比,本发明的有益效果在于:首先,通过构建包含总体健康状态、核心异常类别和细粒度症状属性的多层级禽类视觉健康诊断数据集,并结合面向不同图像类型的可观测性掩码监督机制,避免不可观测属性字段参与损失计算;其次,构建基于共享视觉主干网络的多层级视觉健康诊断模型,使第一层级、第二层级和第三层级在共享视觉特征基础上实现并行建模;再次,在优选实施方式中,第二层级采用SPA损失函数以改善少数异常类别样本与多数正常样本之间的不均衡问题,第三层级采用CSSFE注意力模块以强化细粒度症状属性识别中的局部空间特征表达能力;最后,本发明能够输出总体健康状态、核心异常类别、细粒度症状属性及对应的可视化视觉证据,从而增强模型诊断结果的可信度和实用价值。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123016471A_ABST
    Figure CN123016471A_ABST
Patent Text Reader

Abstract

The application discloses a chicken health state recognition method based on multi-level semantic label driving in the technical field of computer vision, comprising the following steps: S1, collecting poultry images in actual breeding environment, covering multiple perspectives, illumination and posture; S2, constructing a data set through cleaning, pretreatment, multi-level labeling and mask generation, and the label contains health state, core abnormality and symptom attribute; S3, taking a pre-trained Swin Transformer visual model as a base model, containing health state discrimination, core abnormality multi-label identification and fine-grained symptom attribute identification branches; S4, the core abnormality multi-label identification uses SPA loss, and through negative class clipping, asymmetric weight and dynamic focusing, the minority abnormality is enhanced, and the easy-to-distinguish one is inhibited; S5, the fine-grained symptom attribute identification introduces CSSFE, and uses classification head weight and prediction probability to construct expected class activation map and aggregate weighted spatial token features. Weak symptoms can be recognized early, and the performance and interpretability of minority abnormality recognition are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for recognizing the health status of chickens based on multi-level semantic tags in the field of computer vision technology. Background Technology

[0002] In modern poultry farming systems, accurate identification of individual health status, behavioral abnormalities, and early disease characteristics is a crucial prerequisite for achieving intelligent inspection, disease early warning, and refined management. Currently, machine vision technology is becoming increasingly mature and is being applied to fields such as smart farming. As a result, traditional poultry farming models are undergoing an evolution from mechanized and automated production to information-based and intelligent production. Poultry visual health diagnosis, as a core sensory entry point, can provide important evidence for early disease detection, abnormal behavior identification, and health status assessment.

[0003] With breakthroughs in computing power, deep learning has developed rapidly. In recent years, research and application of deep learning in poultry health identification has become an important direction. Existing methods typically use convolutional neural networks, visual Transformers, or combinations thereof to directly output health or abnormality judgments, or output several disease categories, from input images. However, for early symptoms of poultry diseases, they often only manifest as subtle changes in comb color, localized abnormal posture, decreased mental state, lethargy, and other weak and localized visual features, which existing methods struggle to fully exploit.

[0004] Furthermore, most current models can only provide an overall diagnostic conclusion, failing to provide the fine-grained symptom evidence and corresponding visual regions that led to this conclusion, resulting in a lack of interpretability in the diagnostic results. Meanwhile, poultry images exhibit significant differences in image type during actual acquisition, with some fine-grained symptom attribute fields remaining unobservable across different image types. If these are uniformly supervised, noisy labels can easily be introduced, affecting model training performance. Moreover, core anomaly categories typically belong to minority classes, and existing loss functions struggle to balance positive class enhancement and negative class suppression, leading to insufficient performance in identifying minority anomaly categories. Summary of the Invention

[0005] The purpose of this invention is to provide a chicken health status recognition method based on multi-level semantic tags, which solves the problems in the prior art where early poultry disease symptoms are weak and localized, some symptom attribute fields are unobservable under different image types, a few abnormal categories are difficult to identify, and diagnostic results lack fine-grained evidence support.

[0006] To achieve the above objectives, this invention provides a method for identifying the health status of chickens based on multi-level semantic tags, comprising the following steps:

[0007] S1. Collect image data of individual poultry in actual breeding environments;

[0008] S2. Perform data cleaning, image preprocessing, multi-level labeling, observability mask generation, and dataset partitioning on the collected images to construct a poultry visual health diagnosis dataset. The multi-level labeling includes the first-level overall health status label, the second-level core abnormality category label, and the third-level fine-grained symptom attribute label.

[0009] S3. Construct a multi-level visual health diagnosis model based on a shared visual backbone network. The multi-level visual health diagnosis model includes a first-level overall health status discrimination branch, a second-level core abnormality multi-label recognition branch, and a third-level fine-grained symptom attribute recognition branch.

[0010] S4. For the second-level core anomaly multi-label recognition task, the SPA loss function is adopted as the loss construction method. Through negative class pruning, asymmetric weight adjustment of positive and negative samples and dynamic focus adjustment, the learning ability of a few anomaly class samples is enhanced, and the dominant role of easily classified negative samples in the loss function is suppressed.

[0011] S5. For the third-level fine-grained symptom attribute recognition task, the CSSFE attention module is introduced as a semantically guided feature enhancement unit. The expected class activation map is constructed using the third-level classification head weight and prediction probability. The spatial token features output by the shared visual backbone network are weighted and aggregated to obtain the enhanced third-level fine-grained symptom attribute recognition result.

[0012] S6. Train and test the multi-level visual health diagnosis model on the poultry visual health diagnosis dataset, and output the overall health status, core abnormality categories, fine-grained symptom attributes, and corresponding visual evidence.

[0013] As a further improvement to the present invention, S1 is specifically described below.

[0014] S1.1 Prepare image acquisition equipment and complete the acquisition of individual poultry images in the actual breeding environment. The image acquisition equipment includes one or more of the following: fixed camera, mobile camera, or handheld acquisition terminal.

[0015] S1.2. Collect images of individual poultry according to the preset shooting requirements. During the collection process, cover one or more of the following perspectives: frontal view, side view, head close-up view, and full-body view. Set the camera height, shooting distance, and shooting angle according to the size of the individual poultry and the breeding environment so that the collected images can clearly present visual areas such as the comb, head, feathers, body posture, and mental state, while covering different lighting environments and different individual postures.

[0016] As a further improvement to the present invention, S2 is specifically described below.

[0017] S2.1 Filter the original image data and remove one or more of the following: blurry samples, severely occluded samples, samples with missing targets, and duplicate samples;

[0018] S2.2. Perform size unification, normalization, and format conversion on the screened images to form standardized image data;

[0019] S2.3. Perform multi-level labeling on the standardized images. The multi-level labels include the first level of overall health status label, the second level of core abnormality category label, and the third level of fine-grained symptom attribute label.

[0020] The third-level fine-grained symptom attribute tags include five attribute fields: comb color, comb shape, feather condition, posture and movement, and posture and expression. The second-level core abnormality categories include at least comb abnormalities and lethargy.

[0021] S2.4. Based on the image type corresponding to the current input image, generate observability masks for each attribute field in the third-level fine-grained symptom attributes. When the image type is a full-body photo, the comb color, comb shape, feather condition, posture and expression are all observable fields. When the image type is a head close-up, the comb color and comb shape are observable fields, while the feather condition, posture and expression are unobservable fields. For observable fields, assign the corresponding mask value of 1; for unobservable fields, assign the corresponding mask value of 0.

[0022] S2.5. Based on the image data after cleaning, preprocessing, multi-level labeling, and observability mask generation, construct a poultry visual health diagnosis dataset and divide the poultry visual health diagnosis dataset into a training set, a validation set, and a test set.

[0023] As a further improvement to the present invention, the specific content of S3 is as follows.

[0024] S3.1. Using the pre-trained Swin Transformer visual model as the base model, task adaptation and output improvement are performed on its hierarchical window self-attention feature extraction structure to form a shared visual backbone network, which is used to perform unified feature extraction on the input image and output spatial token features and pooling features. Among them, spatial token features are used to represent the local visual information of different spatial regions in the image, and pooling features are used to represent the global semantic information of the input image.

[0025] S 3.2. Based on the output of the shared visual backbone network, a multi-level parallel diagnostic structure is constructed. The multi-level parallel diagnostic structure includes a first-level overall health status discrimination branch, a second-level core abnormality multi-label recognition branch, and a third-level fine-grained symptom attribute recognition branch. The first-level overall health status discrimination branch is used to output the overall health status discrimination result, the second-level core abnormality multi-label recognition branch is used to output the core abnormality category recognition result, and the third-level fine-grained symptom attribute recognition branch is used to output the classification result of multiple fine-grained symptom attribute fields.

[0026] The third-level fine-grained symptom attribute recognition branch consists of multiple parallel attribute classification heads. Each fine-grained symptom attribute field corresponds to an independent attribute classification head, enabling different fine-grained symptom attributes to be modeled separately based on shared visual features.

[0027] As a further improvement to the present invention, S4 is specifically described below.

[0028] S4.1, Suppose that there are a total of [number] in the second level. There are 1 core anomaly categories, among which... This represents the total number of core anomaly categories at the second level. The core anomaly category index is represented as... ,and For the first Each of the core anomaly categories has a network output logit denoted as . The real label is recorded as ,in, , This indicates that the core exception category exists. This indicates that the core exception category does not exist; then the first... Predicted probabilities for each core anomaly category Represented as: ;

[0029] in, This represents the Sigmoid activation function. Indicates the first The predicted probability that each core anomaly category is positive;

[0030] S4.2, Definition of the first Positive class probability of each core anomaly category With negative class probability They are respectively:

[0031] ;

[0032] in, Indicates the first The predicted probability of each core anomaly being positive. Indicates the first The predicted probability of each core anomaly being negative;

[0033] Introducing negative class clipping parameters In this case, the negative class probability is corrected to obtain the corrected negative class probability. :

[0034] ;

[0035] in, This represents the negative class pruning parameter, used to shift the negative class probability upwards to reduce the dominant effect of easily classified negative samples on the loss function; This represents the corrected negative class probability;

[0036] S4.3 To achieve asymmetric adjustment of positive and negative samples, define the weight parameters for the positive class separately. Negative class weight parameters Positive class focusing parameters and negative class focusing parameters ;in, Used to adjust the weight of positive samples in the loss. Used to adjust the weights of negative class samples in the loss. Used to enhance the learning strength of difficult positive samples. Used to suppress the impact of easily classified negative samples on the loss;

[0037] Correspondingly, construct the first The basic log loss term for each core anomaly category is:

[0038] ;

[0039] ;

[0040] in, Indicates greater than A very small constant is used to avoid numerical overflow or undefined cases in logarithmic operations; Indicates the first The positive class basic log loss term corresponding to each core anomaly category; Indicates the first The negative basic log loss term corresponding to each core anomaly category;

[0041] S4.4, Definition of the first The sample difficulty adjustment terms for each core anomaly category are as follows:

[0042] ;

[0043] ;

[0044] ;

[0045] in, Indicates combining real labels The probability of the selected target; when hour, ;when hour, ; Indicates the first Dynamic focusing parameters corresponding to each core anomaly category; when hour, ;when hour, ; Indicates the first The sample difficulty adjustment factor corresponding to each core anomaly category is used to asymmetricly scale the loss according to the sample classification difficulty.

[0046] Then the first The SPA loss for each core anomaly category is:

[0047] ;

[0048] in, Indicates the first The SPA loss value corresponding to each core anomaly category;

[0049] If there are missing or invalid tags in the second level, a mask item is introduced. The second-level total loss is obtained by normalizing the data according to the valid labels. :

[0050] ;

[0051] in, Indicates the first The label validity mask corresponding to each core anomaly category; when the... When a tag is valid, When the first When a label is missing or invalid ; This represents the total SPA loss for the second-level core anomaly multi-label recognition task.

[0052] As a further improvement to the present invention, the specific content of S5 is as follows.

[0053] S5.1. Let the spatial token feature of the shared visual backbone network output be represented as:

[0054] ;

[0055] in, Represents the number of tokens in the space. Representing the feature dimension, for the third level... The classification head weight matrix for each fine-grained symptom attribute field is represented as follows: ;

[0056] in, Indicates the first The number of categories in each fine-grained symptom attribute field;

[0057] Let the base prediction logits for this attribute field be... Then its predicted probability distribution is expressed as:

[0058] ;

[0059] in, This is a probability temperature parameter.

[0060] Construct a semantic expectation weight vector based on the classifier head weight and the predicted probability:

[0061] ;

[0062] S5.2. Construct a class activation map based on spatial token features and the classification head weight matrix, and obtain attention weights through temperature scaling and normalization; then, sum the attention weights corresponding to each category according to the predicted probability to obtain the first... The expected attention weights corresponding to each fine-grained symptom attribute field;

[0063] S5.3 After normalizing the expected attention weights, the spatial token features are weighted and aggregated to obtain enhanced fine-grained attribute features. Then, the classification result of the attribute field is recalculated based on the enhanced fine-grained attribute features, and weighted and fused with the basic classification result according to the fusion coefficient to obtain the final third-level output result.

[0064] As a further improvement to the present invention, the specific details of S6 are as follows.

[0065] S6.1 Construct a model training and inference runtime environment. The hardware environment uses computer equipment with high computing performance to provide the computing resources required for image processing, model training and inference calculations. The software environment uses the PyTorch deep learning framework to realize the network construction, parameter training and performance testing of the chicken health status recognition model.

[0066] S6.2. Train the multi-level visual health diagnosis model using the training set and validation set, and save the optimal model parameters.

[0067] S6.3 Load the trained model weights, use the test set to evaluate the performance of the chicken health status recognition model, and after the evaluation, use the model weights for inference applications on the chicken images to be recognized, and output the recognition results of overall health status, core abnormality categories and fine-grained symptom attributes.

[0068] S6.4 Generate corresponding visual heatmaps, abnormality category prompts, and fine-grained symptom attribute evidence based on the model output results.

[0069] Compared with existing technologies, the beneficial effects of this invention are as follows: First, by constructing a multi-level avian visual health diagnosis dataset containing overall health status, core abnormality categories, and fine-grained symptom attributes, and combining it with an observability mask supervision mechanism for different image types, unobservable attribute fields are avoided from participating in loss calculations. Second, a multi-level visual health diagnosis model based on a shared visual backbone network is constructed, enabling the first, second, and third levels to achieve parallel modeling based on shared visual features. Third, in a preferred embodiment, the second level uses the SPA loss function to improve the imbalance problem between a few abnormal category samples and a majority of normal samples, and the third level uses a CSSFE attention module to enhance the local spatial feature expression capability in fine-grained symptom attribute recognition. Finally, this invention can output overall health status, core abnormality categories, fine-grained symptom attributes, and corresponding visual evidence, thereby enhancing the credibility and practical value of the model's diagnostic results. Attached Figure Description

[0070] Figure 1 This is a flowchart of the overall method of the present invention.

[0071] Figure 2 This is a structural diagram of the multi-level visual health diagnosis model in this invention.

[0072] Figure 3 This is a diagram illustrating the symptom evidence enhancement mechanism in this invention.

[0073] Figure 4 This is the diagnostic output and visual evidence diagram in this invention.

[0074] Figure 5 This is a diagram showing the output structure of healthy and unhealthy samples in this invention. Detailed Implementation

[0075] The present invention will be further described below with reference to the accompanying drawings:

[0076] like Figure 1-3 The method for identifying the health status of chickens based on multi-level semantic tags, as shown, includes the following steps:

[0077] S1. Collect image data of individual poultry in actual breeding environments;

[0078] S1.1 Prepare image acquisition equipment and complete the acquisition of individual poultry images in the actual breeding environment. The image acquisition equipment includes one or more of the following: fixed camera, mobile camera, or handheld acquisition terminal.

[0079] S1.2. Collect images of individual poultry according to the preset shooting requirements. During the collection process, cover one or more of the following perspectives: frontal view, side view, head close-up view, and full-body view. Set the camera height, shooting distance, and shooting angle according to the size of the individual poultry and the breeding environment so that the collected images can clearly present visual areas such as the comb, head, feathers, body posture, and mental state, while covering different lighting environments and different individual postures.

[0080] S2. Perform data cleaning, image preprocessing, multi-level labeling, observability mask generation, and dataset partitioning on the collected images to construct a poultry visual health diagnosis dataset. The multi-level labeling includes the first-level overall health status label, the second-level core abnormality category label, and the third-level fine-grained symptom attribute label.

[0081] S2.1 Filter the original image data and remove one or more of the following: blurry samples, severely occluded samples, samples with missing targets, and duplicate samples;

[0082] S2.2. Perform size unification, normalization, and format conversion on the screened images to form standardized image data;

[0083] S2.3. Perform multi-level labeling on the standardized images. The multi-level labels include the first level of overall health status label, the second level of core abnormality category label, and the third level of fine-grained symptom attribute label.

[0084] The third-level fine-grained symptom attribute tags include five attribute fields: comb color, comb shape, feather condition, posture and movement, and posture and expression. The second-level core abnormality categories include at least comb abnormalities and lethargy.

[0085] S2.4. Based on the image type corresponding to the current input image, generate observability masks for each attribute field in the third-level fine-grained symptom attributes. When the image type is a full-body photo, the comb color, comb shape, feather condition, posture and expression are all observable fields. When the image type is a head close-up, the comb color and comb shape are observable fields, while the feather condition, posture and expression are unobservable fields. For observable fields, assign the corresponding mask value of 1; for unobservable fields, assign the corresponding mask value of 0.

[0086] S2.5. Based on the image data after cleaning, preprocessing, multi-level labeling, and observability mask generation, construct a poultry visual health diagnosis dataset and divide the poultry visual health diagnosis dataset into a training set, a validation set, and a test set.

[0087] S3. Construct a multi-level visual health diagnosis model based on a shared visual backbone network. The multi-level visual health diagnosis model includes a first-level overall health status discrimination branch, a second-level core abnormality multi-label recognition branch, and a third-level fine-grained symptom attribute recognition branch.

[0088] S3.1. Using the pre-trained Swin Transformer visual model as the base model, task adaptation and output improvement are performed on its hierarchical window self-attention feature extraction structure to form a shared visual backbone network, which is used to perform unified feature extraction on the input image and output spatial token features and pooling features. Among them, spatial token features are used to represent the local visual information of different spatial regions in the image, and pooling features are used to represent the global semantic information of the input image.

[0089] S 3.2. Based on the output of the shared visual backbone network, a multi-level parallel diagnostic structure is constructed. The multi-level parallel diagnostic structure includes a first-level overall health status discrimination branch, a second-level core abnormality multi-label recognition branch, and a third-level fine-grained symptom attribute recognition branch. The first-level overall health status discrimination branch is used to output the overall health status discrimination result, the second-level core abnormality multi-label recognition branch is used to output the core abnormality category recognition result, and the third-level fine-grained symptom attribute recognition branch is used to output the classification result of multiple fine-grained symptom attribute fields.

[0090] The third-level fine-grained symptom attribute recognition branch consists of multiple parallel attribute classification heads. Each fine-grained symptom attribute field corresponds to an independent attribute classification head, enabling different fine-grained symptom attributes to be modeled separately based on shared visual features.

[0091] S4. For the second-level core anomaly multi-label recognition task, the SPA loss function is adopted as the loss construction method. Through negative class pruning, asymmetric weight adjustment of positive and negative samples and dynamic focus adjustment, the learning ability of a few anomaly class samples is enhanced, and the dominant role of easily classified negative samples in the loss function is suppressed.

[0092] S4.1, Suppose that there are a total of [number] in the second level. There are 1 core anomaly categories, among which... This represents the total number of core anomaly categories at the second level. The core anomaly category index is represented as... ,and For the first Each of the core anomaly categories has a network output logit denoted as . The real label is recorded as ,in, , This indicates that the core exception category exists. This indicates that the core exception category does not exist; then the first... Predicted probabilities for each core anomaly category Represented as: ;

[0093] in, This represents the Sigmoid activation function. Indicates the first The predicted probability that each core anomaly category is positive;

[0094] S4.2, Definition of the first Positive class probability of each core anomaly category With negative class probability They are respectively:

[0095] ;

[0096] in, Indicates the first The predicted probability of each core anomaly being positive. Indicates the first The predicted probability of each core anomaly being negative;

[0097] Introducing negative class clipping parameters In this case, the negative class probability is corrected to obtain the corrected negative class probability. :

[0098] ;

[0099] in, This represents the negative class pruning parameter, used to shift the negative class probability upwards to reduce the dominant effect of easily classified negative samples on the loss function; This represents the corrected negative class probability;

[0100] S4.3 To achieve asymmetric adjustment of positive and negative samples, define the weight parameters for the positive class separately. Negative class weight parameters Positive class focusing parameters and negative class focusing parameters ;in, Used to adjust the weight of positive samples in the loss. Used to adjust the weights of negative class samples in the loss. Used to enhance the learning strength of difficult positive samples. Used to suppress the impact of easily classified negative samples on the loss;

[0101] Correspondingly, construct the first The basic log loss term for each core anomaly category is:

[0102] ;

[0103] ;

[0104] in, Indicates greater than A very small constant is used to avoid numerical overflow or undefined cases in logarithmic operations; Indicates the first The positive class basic log loss term corresponding to each core anomaly category; Indicates the first The negative basic log loss term corresponding to each core anomaly category;

[0105] S4.4, Definition of the first The sample difficulty adjustment terms for each core anomaly category are as follows:

[0106] ;

[0107] ;

[0108] ;

[0109] in, Indicates combining real labels The probability of the selected target; when hour, ;when hour, ; Indicates the first Dynamic focusing parameters corresponding to each core anomaly category; when hour, ;when hour, ; Indicates the first The sample difficulty adjustment factor corresponding to each core anomaly category is used to asymmetricly scale the loss according to the sample classification difficulty.

[0110] Then the first The SPA loss for each core anomaly category is:

[0111] ;

[0112] in, Indicates the first The SPA loss value corresponding to each core anomaly category;

[0113] If there are missing or invalid tags in the second level, a mask item is introduced. The second-level total loss is obtained by normalizing the data according to the valid labels. :

[0114] ;

[0115] in, Indicates the first The label validity mask corresponding to each core anomaly category; when the... When a tag is valid, When the first When a label is missing or invalid ; This represents the total SPA loss for the second-level core anomaly multi-label recognition task.

[0116] S5. For the third-level fine-grained symptom attribute recognition task, the CSSFE attention module is introduced as a semantically guided feature enhancement unit. The expected class activation map is constructed using the third-level classification head weight and prediction probability. The spatial token features output by the shared visual backbone network are weighted and aggregated to obtain the enhanced third-level fine-grained symptom attribute recognition result.

[0117] S5.1. Let the spatial token feature of the shared visual backbone network output be represented as:

[0118] ;

[0119] in, Represents the number of tokens in the space. Representing the feature dimension, for the third level... The classification head weight matrix for each fine-grained symptom attribute field is represented as follows: ;

[0120] in, Indicates the first The number of categories in each fine-grained symptom attribute field;

[0121] Let the base prediction logits for this attribute field be... Then its predicted probability distribution is expressed as:

[0122] ;

[0123] in, This is a probability temperature parameter.

[0124] Construct a semantic expectation weight vector based on the classifier head weight and the predicted probability:

[0125] ;

[0126] S5.2. Construct a class activation map based on spatial token features and the classification head weight matrix, and obtain attention weights through temperature scaling and normalization; then, sum the attention weights corresponding to each category according to the predicted probability to obtain the first... The expected attention weights corresponding to each fine-grained symptom attribute field;

[0127] S5.3 After normalizing the expected attention weights, the spatial token features are weighted and aggregated to obtain enhanced fine-grained attribute features. Then, the classification result of the attribute field is recalculated based on the enhanced fine-grained attribute features, and weighted and fused with the basic classification result according to the fusion coefficient to obtain the final third-level output result.

[0128] S6. Train and test the multi-level visual health diagnosis model on the poultry visual health diagnosis dataset, and output the overall health status, core abnormality categories, fine-grained symptom attributes, and corresponding visual evidence.

[0129] S6.1 Construct a model training and inference runtime environment. The hardware environment uses computer equipment with high computing performance to provide the computing resources required for image processing, model training and inference calculations. The software environment uses the PyTorch deep learning framework to realize the network construction, parameter training and performance testing of the chicken health status recognition model.

[0130] S6.2. Train the multi-level visual health diagnosis model using the training set and validation set, and save the optimal model parameters.

[0131] S6.3 Load the trained model weights, use the test set to evaluate the performance of the chicken health status recognition model, and after the evaluation, use the model weights for inference applications on the chicken images to be recognized, and output the recognition results of overall health status, core abnormality categories and fine-grained symptom attributes.

[0132] S6.4 Generate corresponding visual heatmaps, abnormality category prompts, and fine-grained symptom attribute evidence based on the model output results.

[0133] The multi-level visual diagnostic method proposed in this invention can simultaneously output overall health status, core abnormality categories, and fine-grained symptom attributes, and generate visual heatmaps corresponding to the fine-grained symptoms, forming interpretable visual evidence results. For example... Figure 1As shown, the present invention generally includes image acquisition, data cleaning and multi-level annotation, construction of multi-level visual health diagnosis model, training optimization and feature enhancement, and output of diagnosis results and visual evidence.

[0134] like Figure 2 As shown, the multi-level visual health diagnosis model constructed in this invention adopts a shared visual backbone network, on which a first-level overall health status discrimination branch, a second-level core abnormality multi-label recognition branch, and a third-level fine-grained symptom attribute recognition branch are set up, thereby forming a multi-level semantic collaborative diagnosis structure.

[0135] like Figure 3 As shown, in the symptom evidence enhancement mechanism, the expected class activation map is first constructed using the third-level class head weights and predicted probabilities. Then, based on the expected class activation map, the spatial tokens in the shared visual features are weighted and aggregated to obtain the enhanced fine-grained feature expression.

[0136] like Figure 4 As shown, the present invention can ultimately output overall health status, core abnormality categories and fine-grained symptom attributes, and generate visual heatmaps corresponding to the fine-grained symptoms, forming interpretable visual evidence results.

[0137] like Figure 5 As shown, this invention uses actual collected images of chicken heads as input, and selects healthy and unhealthy samples to illustrate the recognition process. The system first preprocesses the original images, performing size unification and center cropping to obtain standardized images suitable for model input. Then, it automatically extracts image features through a shared visual backbone network and outputs L3 fine-grained symptom attributes, L2 core abnormality categories, and L1 overall health status under image-level supervision. Specifically, the L3 layer identifies observable symptom attributes such as comb color and comb shape; the L2 layer further determines the presence of core abnormalities such as comb abnormalities and lethargy; and the L1 layer outputs the final healthy or unhealthy judgment. The comb region bounding boxes in the attached figures are only used to illustrate key visual cues and to explain the correspondence between the model's recognition results and image representations; they do not indicate that comb region bounding boxes or segmentation masks were used as strong supervision signals during training. As seen in the healthy examples, the model outputs a rosy comb color and an upright comb shape. Further analysis shows that there are no abnormalities in the comb or lethargy, and the rooster is ultimately identified as healthy. As seen in the unhealthy examples, the model outputs a pale comb color and a crooked comb shape. Further analysis shows that there are abnormalities in the comb, and the rooster is ultimately identified as unhealthy.

[0138] This invention can automatically learn visual representations related to health status from a single chicken image without the need for strong local region annotation, and form a structured recognition result of "fine-grained symptom attributes - core abnormality category - overall health status", thereby improving the interpretability and practical application value of chicken health recognition.

[0139] This invention is not limited to the above embodiments. Based on the technical solutions disclosed herein, those skilled in the art can make some substitutions and modifications to some of the technical features without creative effort, and all such substitutions and modifications are within the protection scope of this invention.

Claims

1. A method for identifying the health status of chickens based on multi-level semantic tags, characterized in that: Includes the following steps, S1. Collect image data of individual poultry in actual breeding environments; S2. Perform data cleaning, image preprocessing, multi-level labeling, observability mask generation, and dataset partitioning on the collected images to construct a poultry visual health diagnosis dataset. The multi-level labeling includes the first-level overall health status label, the second-level core abnormality category label, and the third-level fine-grained symptom attribute label. S3. Construct a multi-level visual health diagnosis model based on a shared visual backbone network. The multi-level visual health diagnosis model includes a first-level overall health status discrimination branch, a second-level core abnormality multi-label recognition branch, and a third-level fine-grained symptom attribute recognition branch. S4. For the second-level core anomaly multi-label recognition task, the SPA loss function is adopted as the loss construction method. Through negative class pruning, asymmetric weight adjustment of positive and negative samples and dynamic focus adjustment, the learning ability of a few anomaly class samples is enhanced, and the dominant role of easily classified negative samples in the loss function is suppressed. S5. For the third-level fine-grained symptom attribute recognition task, the CSSFE attention module is introduced as a semantically guided feature enhancement unit. The expected class activation map is constructed using the third-level classification head weight and prediction probability. The spatial token features output by the shared visual backbone network are weighted and aggregated to obtain the enhanced third-level fine-grained symptom attribute recognition result. S6. Train and test the multi-level visual health diagnosis model on the poultry visual health diagnosis dataset, and output the overall health status, core abnormality categories, fine-grained symptom attributes, and corresponding visual evidence.

2. The method for identifying the health status of chickens based on multi-level semantic tags according to claim 1, characterized in that: The specific content of S1 is as follows: S1.1 Prepare image acquisition equipment and complete the acquisition of individual poultry images in the actual breeding environment. The image acquisition equipment includes one or more of the following: fixed camera, mobile camera, or handheld acquisition terminal. S1.

2. Collect images of individual poultry according to the preset shooting requirements. During the collection process, cover one or more of the following perspectives: frontal view, side view, head close-up view, and full-body view. Set the camera height, shooting distance, and shooting angle according to the size of the individual poultry and the breeding environment so that the collected images can clearly present visual areas such as the comb, head, feathers, body posture, and mental state, while covering different lighting environments and different individual postures.

3. The method for identifying the health status of chickens based on multi-level semantic tags according to claim 2, characterized in that: The specific details of S2 are as follows. S2.1 Filter the original image data and remove one or more of the following: blurry samples, severely occluded samples, samples with missing targets, and duplicate samples; S2.

2. Perform size unification, normalization, and format conversion on the screened images to form standardized image data; S2.

3. Perform multi-level labeling on the standardized images. The multi-level labels include the first level of overall health status label, the second level of core abnormality category label, and the third level of fine-grained symptom attribute label. The third-level fine-grained symptom attribute tags include five attribute fields: comb color, comb shape, feather condition, posture and movement, and posture and expression. The second-level core abnormality categories include at least comb abnormalities and lethargy. S2.

4. Based on the image type corresponding to the current input image, generate observability masks for each attribute field in the third-level fine-grained symptom attributes. When the image type is a full-body photo, the comb color, comb shape, feather condition, posture and expression are all observable fields. When the image type is a head close-up, the comb color and comb shape are observable fields, while the feather condition, posture and expression are unobservable fields. For observable fields, assign the corresponding mask value of 1; for unobservable fields, assign the corresponding mask value of 0. S2.

5. Based on the image data after cleaning, preprocessing, multi-level labeling, and observability mask generation, construct a poultry visual health diagnosis dataset and divide the poultry visual health diagnosis dataset into a training set, a validation set, and a test set.

4. The method for identifying the health status of chickens based on multi-level semantic tags according to claim 3, characterized in that: The specific details of S3 are as follows. S3.

1. Using the pre-trained Swin Transformer visual model as the base model, task adaptation and output improvement are performed on its hierarchical window self-attention feature extraction structure to form a shared visual backbone network, which is used to perform unified feature extraction on the input image and output spatial token features and pooling features. Among them, spatial token features are used to represent the local visual information of different spatial regions in the image, and pooling features are used to represent the global semantic information of the input image. S 3.

2. Based on the output of the shared visual backbone network, a multi-level parallel diagnostic structure is constructed. The multi-level parallel diagnostic structure includes a first-level overall health status discrimination branch, a second-level core abnormality multi-label recognition branch, and a third-level fine-grained symptom attribute recognition branch. The first-level overall health status discrimination branch is used to output the overall health status discrimination result, the second-level core abnormality multi-label recognition branch is used to output the core abnormality category recognition result, and the third-level fine-grained symptom attribute recognition branch is used to output the classification result of multiple fine-grained symptom attribute fields. The third-level fine-grained symptom attribute recognition branch consists of multiple parallel attribute classification heads. Each fine-grained symptom attribute field corresponds to an independent attribute classification head, enabling different fine-grained symptom attributes to be modeled separately based on shared visual features.

5. The method for identifying the health status of chickens based on multi-level semantic tags according to claim 4, characterized in that: The specific details of S4 are as follows. S4.1, Suppose that there are a total of [number] in the second level. There are 1 core anomaly categories, among which... This represents the total number of core anomaly categories at the second level. The core anomaly category index is represented as... ,and For the first Each of the core anomaly categories has a network output logit denoted as . The real label is recorded as ,in, , This indicates that the core exception category exists. This indicates that the core exception category does not exist; then the first... Predicted probabilities for each core anomaly category Represented as: ; in, This represents the Sigmoid activation function. Indicates the first The predicted probability that each core anomaly category is positive; S4.2, Definition of the first Positive class probability of each core anomaly category With negative class probability They are respectively: ; in, Indicates the first The predicted probability of each core anomaly being positive. Indicates the first The predicted probability of each core anomaly being negative; Introducing negative class clipping parameters In this case, the negative class probability is corrected to obtain the corrected negative class probability. : ; in, This represents the negative class pruning parameter, used to shift the negative class probability upwards to reduce the dominant effect of easily classified negative samples on the loss function; This represents the corrected negative class probability; S4.3 To achieve asymmetric adjustment of positive and negative samples, define the weight parameters for the positive class separately. Negative class weight parameters Positive class focusing parameters and negative class focusing parameters ;in, Used to adjust the weight of positive samples in the loss. Used to adjust the weights of negative class samples in the loss. Used to enhance the learning strength of difficult positive samples. Used to suppress the impact of easily classified negative samples on the loss; Correspondingly, construct the first The basic log loss term for each core anomaly category is: ; ; in, Indicates greater than A very small constant is used to avoid numerical overflow or undefined cases in logarithmic operations; Indicates the first The positive class basic log loss term corresponding to each core anomaly category; Indicates the first The negative basic log loss term corresponding to each core anomaly category; S4.4, Definition of the first The sample difficulty adjustment terms for each core anomaly category are as follows: ; ; ; in, Indicates combining real labels The probability of the selected target; when hour, ;when hour, ; Indicates the first Dynamic focusing parameters corresponding to each core anomaly category; when hour, ;when hour, ; Indicates the first The sample difficulty adjustment factor corresponding to each core anomaly category is used to asymmetricly scale the loss according to the sample classification difficulty. Then the first The SPA loss for each core anomaly category is: ; in, Indicates the first The SPA loss value corresponding to each core anomaly category; If there are missing or invalid tags in the second level, a mask item is introduced. The second-level total loss is obtained by normalizing the data according to the valid labels. : ; in, Indicates the first The label validity mask corresponding to each core anomaly category; when the... When a tag is valid, When the first When a label is missing or invalid ; This represents the total SPA loss for the second-level core anomaly multi-label recognition task.

6. The method for identifying chicken health status based on multi-level semantic tags according to claim 5, characterized in that: The specific details of S5 are as follows. S5.

1. Let the spatial token feature of the shared visual backbone network output be represented as: ; in, Represents the number of tokens in the space. Representing the feature dimension, for the third level... The classification head weight matrix for each fine-grained symptom attribute field is represented as follows: ; in, Indicates the first The number of categories in each fine-grained symptom attribute field; Let the base prediction logits for this attribute field be... Then its predicted probability distribution is expressed as: ; in, This is a probabilistic temperature parameter; Construct a semantic expectation weight vector based on the classifier head weight and the predicted probability: ; S5.

2. Construct a class activation map based on spatial token features and the classification head weight matrix, and obtain attention weights through temperature scaling and normalization; then, sum the attention weights corresponding to each category according to the predicted probability to obtain the first... The expected attention weights corresponding to each fine-grained symptom attribute field; S5.3 After normalizing the expected attention weights, the spatial token features are weighted and aggregated to obtain enhanced fine-grained attribute features. Then, the classification result of the attribute field is recalculated based on the enhanced fine-grained attribute features, and weighted and fused with the basic classification result according to the fusion coefficient to obtain the final third-level output result.

7. The method for identifying the health status of chickens based on multi-level semantic tags according to claim 6, characterized in that: The specific details of S6 are as follows. S6.1 Construct a model training and inference runtime environment. The hardware environment uses computer equipment with high computing performance to provide the computing resources required for image processing, model training, and inference calculations. The software environment uses the PyTorch deep learning framework to implement network construction, parameter training, and performance testing of the chicken health status recognition model. S6.

2. Train the multi-level visual health diagnosis model using the training set and validation set, and save the optimal model parameters. S6.3 Load the trained model weights, use the test set to evaluate the performance of the chicken health status recognition model, and after the evaluation, use the model weights for inference applications on the chicken images to be recognized, and output the recognition results of overall health status, core abnormality categories and fine-grained symptom attributes. S6.4 Generate corresponding visual heatmaps, abnormality category prompts, and fine-grained symptom attribute evidence based on the model output results.