A target structure-guided perception and detection method for beef cattle
By constructing a target structure-guided perception and detection model for beef cattle, and explicitly extracting target contour information and boundary cues, the problems of decreased detection accuracy and insufficient adaptability in existing technologies are solved, and high-precision and robust detection is achieved in complex breeding environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NORTHWEST A & F UNIV
- Filing Date
- 2026-04-21
- Publication Date
- 2026-07-31
AI Technical Summary
Existing target detection methods for beef cattle suffer from problems such as decreased detection accuracy, insufficient boundary perception, and poor adaptability to complex conditions in intensive farming scenarios. In particular, they have deficiencies in feature representation, scenario adaptation, and model optimization, making it difficult to meet the requirements for detection accuracy and robustness in complex farming environments.
A target structure-guided perception and detection model for beef cattle was constructed, including a backbone network, a structure guidance module, and a feature interaction module. By utilizing the spatial decoupling focus classification loss function and the dynamic routing normalized overlap regression loss function, target contour information and boundary cues were explicitly extracted, enhancing the model's detection stability and localization accuracy under occlusion, crowding, and complex lighting conditions.
It effectively improves the accuracy and robustness of target detection in beef cattle, and can stably distinguish target boundaries from background structures in complex farming environments, thereby improving detection and positioning accuracy.
Smart Images

Figure CN122493354A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection technology, and in particular to a method for guided perception and detection of target structures in beef cattle. Background Technology
[0002] Target detection in beef cattle is a crucial foundation for smart farming tasks such as herd behavior analysis, health monitoring, precision feeding, individual identity association, and anomaly early warning. Especially in intensive beef cattle farming environments, the automatic detection of targets using video images provides essential support for subsequent multi-target tracking, behavior recognition, and farming management, thus possessing significant application value.
[0003] Currently, target detection methods for beef cattle mainly include those based on traditional manual features and classifiers, and those based on deep learning. Traditional methods typically rely on manually designed features such as edges, textures, shapes, or motion, combined with classifiers like Support Vector Machines (SVMs) and Adaboost to achieve target recognition. However, these methods are sensitive to scene changes and have limited generalization ability. In recent years, with the development of convolutional neural networks and Transformer detection frameworks, deep learning-based detection methods have made significant progress in target localization and classification. Related research mainly focuses on feature pyramid optimization, multi-scale feature interaction, cross-layer feature fusion, and detection head design, showing good performance in general target detection tasks. However, existing beef cattle target detection methods still suffer from problems such as decreased detection accuracy, insufficient boundary awareness, and poor adaptability to complex conditions in real intensive farming scenarios, making it difficult to meet the requirements for detection accuracy and robustness in complex farming environments. These problems are mainly reflected in the following aspects: (1) In terms of feature representation, most existing methods focus on deep semantic feature enhancement or hierarchical feature fusion. Although they can improve multi-scale representation capabilities to some extent, the utilization of target boundary information and structural cues is usually indirect, and there is a lack of explicit modeling of structural information. In scenarios where beef cattle are densely distributed, close to each other, or even locally adhered, if there is a lack of effective utilization of contour and boundary cues, it is easy to cause boundary confusion between adjacent individuals, which can lead to false detection, missed detection, or location deviation.
[0004] (2) In terms of scene adaptation, intensive farming environments are generally characterized by complex factors such as occlusion, crowding, background structural interference, and changes in lighting. Moreover, these visual degradation factors usually work together in a coupled manner in the detection process. On the one hand, perspective distortion significantly increases the scale difference of beef cattle targets in the same image, increasing the difficulty of multi-scale detection. On the other hand, occlusion and high-density distribution can lead to fragmented target outlines and adhesion of adjacent individual boundaries. At the same time, background information such as pen facilities, fence structures, ground textures, and feeding equipment can introduce a lot of interference, and uneven lighting can further weaken the visual contrast between the target and the background, making it difficult for the detection model to stably distinguish between the real target boundary and background structural noise.
[0005] (3) Regarding model optimization, the classification and regression processes of existing detection methods usually adopt relatively general optimization methods, which are difficult to adaptively adjust to problems such as uneven distribution of categories, large differences in sample difficulty, and heterogeneous positioning quality in complex aquaculture scenarios. For targets with severe occlusion, small scale, or difficult positioning, existing loss designs often fail to provide more targeted supervision, thus affecting the overall detection stability and positioning accuracy.
[0006] Therefore, it is necessary to improve one or more of the problems existing in the above-mentioned related technical solutions.
[0007] It should be noted that this section is intended to provide background or context for the technical solutions of this disclosure as set forth in the claims. The description herein does not constitute an admission that it is prior art simply because it is included in this section. Summary of the Invention
[0008] The purpose of this invention is to provide a target structure guided perception and detection method for beef cattle, thereby overcoming, to at least to some extent, one or more problems caused by the limitations and defects of related technologies.
[0009] This invention first provides a method for guided perception and detection of target structures in beef cattle, comprising: S1. Collect video frames of real beef cattle farming scenes, and annotate the bounding boxes of beef cattle targets in the video frame images to form a beef cattle target detection dataset. S2, Construct a target structure-guided perception and detection model for beef cattle. The detection model includes a backbone network, a structure guidance module, a feature interaction module, and a detection head. S3, the detection model is trained using the training set by utilizing the spatial decoupling focus classification loss function and the dynamic route normalized overlap regression loss function; S4 inputs the image to be detected into the trained detection model, outputs the location of the beef cattle target bounding box and the corresponding class probability, and realizes the detection of beef cattle targets.
[0010] In this invention, in step S1, representative image frames are extracted from the acquired video frames and manually labeled with bounding boxes; the ratio of the training set, validation set, and test set in the dataset is 8:1:1.
[0011] In this invention, in S2, the backbone network includes: a convolutional-pooling front-end structure and a multi-stage backbone transformation module. After the convolutional-pooling front-end structure processes the input image, it obtains a low-level feature map. After the multi-stage backbone transformation module processes the low-level feature map, it obtains a multi-level semantic representation.
[0012] In this invention, in S2, the structure guidance module includes a hierarchical structure feature generator and a structure guidance aggregation unit. The hierarchical structure feature generator extracts multi-scale boundary cues from the low-level feature map, and then the structure guidance aggregation unit performs spatial attention weighting and feature fusion on the multi-scale boundary cues and multi-level semantic representations to obtain multi-scale structure enhancement features.
[0013] In this invention, S2, the feature interaction module and the detection head include a high-efficiency hybrid encoder, an attention-based intra-scale feature interaction module, a cross-scale feature fusion module, and a decoding prediction unit.
[0014] In this invention, the data processing procedure between the feature interaction module and the detection head includes: First, input the multi-scale structural enhancement features into the efficient hybrid encoder to optimize the representation; Then, long-range semantic dependencies are modeled through an attention-based intra-scale feature interaction module, followed by bidirectional feature integration through a cross-scale feature fusion module. Then, structure-guided aggregation is performed again on the pyramid features to obtain enhanced multi-scale pyramid features; The decoding and prediction unit decodes and predicts the enhanced multi-scale pyramid features to obtain the bounding box location and corresponding class probability of the beef cattle target.
[0015] The present invention further provides a target structure guidance sensing and detection device for beef cattle, comprising: The data acquisition and preprocessing module acquires video frames of real beef cattle farming scenes, annotates the bounding boxes of beef cattle targets in the video frame images, and forms a beef cattle target detection dataset. The detection model construction module constructs a target structure-guided perception detection model for beef cattle. The detection model includes a backbone network, a structure guidance module, a feature interaction module, and a detection head. The training module uses the spatial decoupling focus classification loss function and the dynamic route normalized overlap regression loss function to train the detection model using the training set; The detection module takes the image to be detected as input to the trained detection model and outputs the location of the beef cattle target bounding box and the corresponding class probability, thereby realizing the detection of beef cattle targets.
[0016] In this invention, the backbone network includes a convolutional-pooling front-end structure and a multi-stage backbone transformation module. The convolutional-pooling front-end structure processes the input image to obtain a low-level feature map, and the multi-stage backbone transformation module processes the low-level feature map to obtain a multi-level semantic representation.
[0017] In this invention, the structure guidance module includes a hierarchical structure feature generator and a structure guidance aggregation unit. The hierarchical structure feature generator extracts multi-scale boundary cues from the low-level feature map. Then, the structure guidance aggregation unit performs spatial attention weighting and feature fusion on the multi-scale boundary cues and multi-level semantic representations to obtain multi-scale structure enhancement features.
[0018] In this invention, the feature interaction module and the detection head include a high-efficiency hybrid encoder, an attention-based intra-scale feature interaction module, a cross-scale feature fusion module, and a decoding prediction unit.
[0019] The technical solution provided by this invention may include the following beneficial effects: This invention discloses a structure-guided perception detection method for beef cattle targets. By setting a structure guidance module in the detection model, it achieves explicit extraction and step-by-step injection of target contour information and boundary cues, thereby enhancing the target contour modeling capability and suppressing background structural noise interference. To address the problems of uneven category distribution and significant differences in localization difficulty, spatial decoupling focus classification loss and dynamic route normalized overlap regression loss are designed to improve the detection stability and localization accuracy of the model under occlusion, congestion, and complex lighting conditions. This invention can effectively improve the accuracy and robustness of beef cattle target detection. Attached Figure Description
[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0021] Figure 1 This diagram illustrates a flowchart of a target structure-guided perception and detection method for beef cattle in an exemplary embodiment of this disclosure. Figure 2 This is a graph showing the relevant statistical results of the test set. Figure 3 This is a structural diagram of the Transformer model for structure-guided detection; Figure 4 It is a three-dimensional performance trade-off visualization under different compression levels; Figure 5(a) is an example of visual degradation under foggy weather conditions in the style transfer test set generated by SaMam; (b) is an example of diffuse lighting degradation under cloudy weather conditions in the style transfer test set generated by SaMam. Figure 6 (a) is a qualitative comparison of the detection results of the present method and other existing methods in an embodiment where targets are densely distributed and there is severe mutual occlusion; (b) is a qualitative comparison of the detection results of the present method and other existing methods in an embodiment where there is insufficient lighting; (c) is a qualitative comparison of the detection results of the present method and other existing methods in an embodiment where there is environmental interference and occlusion; (d) is a qualitative comparison of the detection results of the present method and other existing methods in an embodiment where there is obvious scale difference under partial occlusion conditions.
[0022] Figure 7 (a) is a Grad-CAM thermal visualization result of the present method and other existing methods in an embodiment under a scenario where targets are densely distributed and there is severe mutual occlusion; (b) is a Grad-CAM thermal visualization result of the present method and other existing methods in an embodiment under a scenario with insufficient lighting; (c) is a Grad-CAM thermal visualization result of the present method and other existing methods in an embodiment under an occlusion scenario with environmental interference; (d) is a Grad-CAM thermal visualization result of the present method and other existing methods in an embodiment under a scenario with obvious scale differences under partial occlusion conditions. Detailed Implementation
[0023] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0024] Furthermore, the accompanying drawings are merely illustrative diagrams of embodiments of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0025] This example implementation first provides a target structure-guided perception and detection method for beef cattle. Please refer to [reference needed]. Figure 1 This method may include: S1-S4, as follows: S1. Collect video frames of real beef cattle farming scenes, and annotate the bounding boxes of beef cattle targets in the video frame images to form a beef cattle target detection dataset. S2, Construct a target structure-guided perception and detection model for beef cattle. The detection model includes a backbone network, a structure guidance module, a feature interaction module, and a detection head. S3, the detection model is trained using the training set by utilizing the spatial decoupling focus classification loss function and the dynamic route normalized overlap regression loss function; S4 inputs the image to be detected into the trained detection model, outputs the location of the beef cattle target bounding box and the corresponding class probability, and realizes the detection of beef cattle targets.
[0026] In this embodiment, by setting a structure guidance module in the detection model, the explicit extraction and step-by-step injection of target contour information and boundary cues are realized, thereby enhancing the target contour modeling capability and suppressing background structural noise interference. To address the problems of uneven category distribution and large differences in localization difficulty, spatial decoupling focus classification loss and dynamic route normalized overlap regression loss are designed to improve the detection stability and localization accuracy of the model under occlusion, congestion and complex lighting conditions. This invention can effectively improve the accuracy and robustness of beef cattle target detection.
[0027] The specific process of each step in the above embodiments will be described below.
[0028] S1, Construct a beef cattle target detection dataset.
[0029] Monitoring videos of cattle pens under real-world farming conditions were collected, covering scenarios with dense target distribution, occlusion, low light, and complex background interference. To ensure stable coverage of the main activity areas of the cattle, two Hikvision DS-IPC-T12H-Ia monitoring cameras were used during the data collection process. The raw videos were stored in MP4 format with a resolution of 1920×1080 pixels and a frame rate of 24 fps. To support the training and evaluation of the cattle target detection model, representative image frames were extracted from the collected monitoring videos, and the cattle instances within them were manually labeled with bounding boxes, constructing a cattle target detection dataset. The dataset was divided into three parts: a training set (16960 images), a validation set (2120 images), and a test set (2120 images), representing 80%, 10%, and 10% of the total images, respectively. During the labeling process, bounding boxes were drawn for each cattle target in the selected frames to form the supervisory information required for subsequent detection tasks.
[0030] Considering the complex background structure and numerous interference factors in real-world livestock farming scenarios, this application employs a multi-class training approach during the detection model training phase to enhance the model's ability to distinguish between foreground targets and background interference. In the verification and testing tasks, only beef cattle are considered as target objects, while other categories are uniformly treated as background. This setting helps improve the discrimination stability of the detection model in complex monitoring environments. Statistical characteristics of the detection test set reveal that this dataset exhibits significant complex scene attributes. The instance quantity distribution indicates that multiple targets frequently appear simultaneously in a single frame, reflecting the dense distribution of targets in a group-raising environment. Occlusion ratio statistics further illustrate the presence of numerous overlapping target boxes in the images, indicating that inter-individual occlusion is common. The bounding box width and height distribution shows significant differences in target scale, consistent with the perspective effect under a fixed camera viewpoint. Relevant statistical results of the detection test set are as follows: Figure 2 As shown in the figure. Overall, the constructed target detection dataset can effectively cover the main detection challenges in complex aquaculture scenarios, providing a reliable data foundation for subsequent performance evaluation of detection models.
[0031] S2, Construct a target structure-guided perception and detection model for beef cattle.
[0032] To enhance the detection network's ability to perceive and utilize target structural cues, this invention constructs a target structure-guided perception and detection model for beef cattle. The detection model includes a backbone network, a structure guidance module, a feature interaction module, and a detection head. In constructing the beef cattle target structure-guided perception and detection model, a structure guidance module is set within the detection framework. Spatial details from early features are used as structural seeds to extract multi-scale boundary cues. Structural information is injected progressively during backbone feature construction and feature interaction, completing target contour information extraction, structural cue fusion and enhancement, and detection result output. This improves the model's ability to perceive target contours, separate neighboring individuals, and suppress interference from complex backgrounds.
[0033] like Figure 3 As shown, overall, given an input image, the backbone network first extracts low-level features through a convolutional-pooling front-end structure (Stem). The generated low-level feature map is then passed as input to subsequent backbone transformation modules operating at different stages. Let... This represents the Stem output with a step size of 4, where C, H, and W represent the channel dimension, height, and width, respectively. SG-DETR utilizes... As a structural seed, a hierarchical structure guidance mechanism is used to generate fine boundary cues. And structural information is injected step by step during the construction of the main features and the interaction of features.
[0034] (1) The backbone network includes: a convolution-pooling front-end structure and a multi-stage backbone transformation module. , and It is used to complete the layer-by-layer extraction of beef cattle targets from low-level texture information to high-level semantic information.
[0035] The backbone network first performs basic feature extraction on the input image: after the input image passes through the convolutional-pooling front-end structure Stem, low-level feature maps are obtained. Subsequently, the backbone network gradually constructs multi-level semantic representations through multiple stages of backbone transformation modules: among which, the first stage backbone transformation module With feature map As input, generate Initial semantic features of the hierarchy In the subsequent stages, the second stage backbone transformation module... and the third stage backbone transformation module The enhanced features from the previous stage are further encoded to gradually obtain higher-level semantic representations. and .
[0036] (2) The structure guidance module includes a Hierarchical Structural Feature Generator (HSFG) and a Structure-Guided Aggregation Unit (SGAU), which work together. The Hierarchical Structural Guidance (HSG) mechanism of the structure guidance module is the core of boundary modeling.
[0037] ①The main goal of HSFG is to extract stable and consistent boundary information from features in the early stages of the network. While these features contain rich spatial details, they are quite sensitive to changes in illumination. Therefore, HSFG achieves robust modeling of structural information by combining local contrast normalization with hybrid edge extraction.
[0038] Given input features First, the influence of lighting is mitigated through local normalization. (The window size is...) Define a local average pooling operator within the neighborhood. Then the local mean with standard deviation The calculation is as follows:
[0039] in, This is a numerically stable term. Normalized characteristics. get.
[0040] based on HSFG utilizes a hybrid filter bank to extract the structural response. Specifically, the first-order Sobel gradient is used to characterize orientation information, and the second-order Laplacian derivative is used to characterize intensity changes, expressed as:
[0041] in, This is the original edge map. and Represents the gradient operator. This represents the Laplacian operator. and These are learnable parameters used for adaptive balancing of edge components.
[0042] To cope with scale changes, the original edge map Features are projected onto the pyramid hierarchy using sequential pooling. A scale-aware attention mechanism recalibrates features across levels.
[0043] in, Indicates global average pooling. This represents feature concatenation. The final structural features are obtained through... Weighting is applied so that the model can adaptively focus on the most discriminative level under different beef cattle scale variations. They represent Hierarchical original edge feature map, This represents the attention weights perceived at the corresponding scale.
[0044] Direct fusion of structural and semantic features can easily introduce background noise, especially in scenes with occlusion or cluttered backgrounds.
[0045] ② Direct fusion of structural and semantic features can easily introduce background noise, especially in scenes with occlusion or cluttered backgrounds. To address this, SGAU employs a spatial attention mechanism to selectively inject boundary information.
[0046] For structural features With semantic features SGAU first projects them into a shared embedding space. To distinguish foreground boundaries from background textures, a dual-pooling strategy is used to generate a spatial attention map:
[0047] in, and These represent max pooling and average pooling operations by channel, respectively. (Larger) Convolutional kernels help capture a wider range of contextual consistency.
[0048] Finally, the aggregated features are modulated and refined to obtain:
[0049] The attention injection mechanism can explicitly enhance the contour information of beef cattle while suppressing irrelevant environmental edge responses, thereby significantly improving target localization performance in complex scenarios.
[0050] (3) The feature interaction module and the detection head include an efficient hybrid encoder, an attention-based intra-scale feature interaction module, a cross-scale feature fusion module, and a decoding prediction unit.
[0051] Following the backbone network, multi-scale structural enhancement features The data is fed into an efficient hybrid encoder to further optimize the multi-scale representation. This stage corresponds to the feature interaction process. First, high-level features... Intra-scale modeling is performed using an attention-based intra-scale feature interaction (AIFI) module to capture long-range semantic dependencies. Subsequently, a cross-scale feature fusion (CCFM) module integrates features from each layer via a bidirectional path. This mechanism combines semantically rich high-level features with structurally detailed low-level features through top-down and bottom-up information flows, constructing a robust feature pyramid that takes into account both spatial details and semantic context.
[0052] Before entering the decoder, SG-DETR performs structure-guided aggregation again on the pyramid features, resulting in... The hierarchical boundary augmentation representation is then fed into a Transformer decoder (decode prediction unit) with an auxiliary prediction head to generate the target bounding box and its class probability.
[0053] S3 uses Spatially Decoupled Focal Classification Loss (SD-FCL) and Dynamically Routed Normalized Overlap Regression (DRNOR) to train the detection model.
[0054] During the training phase, the network is further jointly supervised using the SD-FCL and DRNOR loss functions to explicitly constrain the model optimization process, enabling it to better adapt to degradation factors such as shading, crowding, and complex lighting in intensive farming environments. The SG-DETR framework optimizes the model by jointly minimizing the classification loss and bounding box regression loss. The overall training objective is formulated as follows:
[0055] in and These represent the classification loss and regression loss, respectively. This combined approach follows the standard detection paradigm while explicitly tuning and optimizing the process to suit intensive group farming scenarios.
[0056] The beef cattle target detection dataset exhibits significant class imbalance and spatial distribution discrepancies. Beef cattle instances appear frequently and occupy large image regions, while non-target classes appear infrequently and occupy only limited spatial regions. This imbalance is further amplified under conditions of overcrowding, background clutter, occlusion, and complex lighting, causing the dominant class to tend to suppress the gradients of rarer classes. To address this issue, this method proposes a Spatial Decoupled Focus Classification Loss (SD-FCL).
[0057] This method will Defined as the first The sample belongs to the first The original logits of each foreground category are calculated and then activated by the Sigmoid activation function. Mapping it to prediction probability, i.e., prediction probability It should be noted that this is an index. Specifically referring to foreground semantic categories, the background region is implicitly processed by suppressing responses from all foreground categories. To simultaneously incorporate category information and localization quality supervision, this method defines... Define a binary label for the category. Soft target score is used to reflect the accuracy of sample localization (such as the IoU between the predicted bounding box and the ground truth bounding box).
[0058] For negative samples, SD-FCL uses focus-based weighting:
[0059] in, and Control class imbalance and sample difficulty separately.
[0060] For positive samples, SD-FCL designed a spatial decoupling mechanism driven by category-level space occupancy. For category The average normalized box area in the training set is then the relative occupancy ratio. Defined as:
[0061] Based on this ratio The spatial decoupling gain is constructed as follows:
[0062] in This indicates the number of foreground categories used during detection training. Control the intensity of spatial compensation. This represents the intermediate category index used when finding the maximum or sum, and it is the same as... It's also a category number, but used as an auxiliary iteration variable in the formula. This normalization operation ensures the stability of the overall loss magnitude. The positive sample weighting term is defined as:
[0063] The final classification loss is calculated as follows:
[0064] in This represents the binary cross-entropy with logits. By decoupling the gradient of positive samples based on space occupancy statistics, SD-FCL enhances the learning of rare and small-area classes, which is particularly beneficial under cluttered backgrounds and uneven lighting conditions.
[0065] A concise explanation of SD-FCL symbols is as follows: Indicates the first The sample at the th Original output values for each category; Indicates the first The sample belongs to the first The predicted probabilities of each category; Indicates the first The sample at the th Binary category labels on each category; Indicates the first The sample at the th Soft target scores in each category; Indicates the first The sample at the th Negative sample weighting terms for each category; Indicates the first The sample at the th Weighted terms for positive samples in each category; Indicates the first The average normalized bounding box area of each category in the training set; Indicates the first The relative space occupancy of each category; Indicates the first Spatial decoupling gain corresponding to each category; This represents the category imbalance adjustment coefficient; This represents the sample difficulty adjustment coefficient; Indicates the spatial compensation intensity control coefficient; This represents the smallest positive number used to ensure numerical stability; This represents the total number of foreground categories used in the detection training; Represents the classification loss function; This represents the binary cross-entropy function with logits.
[0066] In group-grazing environments, bounding box regression faces varying degrees of localization difficulty. Severe occlusion and high-density crowding often lead to low overlap predictions, while close-range targets and densely distributed cattle require higher-precision geometric alignment. Simultaneously, scale variations introduce multiple localization difficulties within the same frame. To address this, this method proposes Dynamic Route Normalized Overlap Regression Loss (DRNOR), which adjusts the regression target based on the localization quality during training. Given a predicted bounding box... and its corresponding real bounding box First, define a normalized overlap term:
[0067] in and These represent the areas of the intersection and union, respectively. Parameters This method reshapes the gradient distribution in low-overlap regions, providing stable supervision for severely occluded targets and small far-field targets that frequently appear in dense cattle herd scenes. Previous IoU-based regression studies explored normalized overlap formulas and structure-aware alignment constraints to improve robustness and geometric consistency under challenging conditions. However, these methods typically employ a single, fixed target throughout training, failing to consider the heterogeneous localization difficulty between different overlap regions. To improve localization accuracy after obtaining sufficient overlap, this method further introduces a structure-aligned overlap term:
[0068] in, This represents a center offset penalty term with angular consistency. This represents a penalty for inconsistent width-to-height ratios. The formula follows a lightweight, structure-aware design approach, while being specifically tailored for dense and cluttered group farming scenarios. These two overlap terms are combined into a hybrid overlap metric:
[0069] in This is used to balance robustness and geometric accuracy. To further adapt the regression objective to different optimization stages, a dynamic routing strategy is applied:
[0070] in This is the routing threshold. This mechanism provides a stable gradient during the low-quality prediction phase, while gradually strengthening the structural alignment constraint as localization accuracy improves. The final bounding box regression loss is defined as:
[0071] This loss provides adaptive supervision under conditions of occlusion, high-density crowding, and scale variation, while ensuring accurate localization of dense, near targets.
[0072] A brief explanation of the DRNOR notation is as follows: Indicates the predicted bounding box; This represents the true bounding box corresponding to the predicted bounding box; This represents the normalized overlap term between the predicted bounding box and the ground truth bounding box; This represents the structural alignment overlap between the predicted bounding box and the ground truth bounding box. This represents the hybrid overlap index obtained by fusing the normalized overlap term and the structure-aligned overlap term. This indicates the overlapping metrics obtained through dynamic routing strategy selection. This represents the bounding box regression loss function; This represents the area of the intersection between the predicted bounding box and the actual bounding box; This shows the area of the union of the predicted bounding box and the actual bounding box. This represents the intersection-union ratio (IU) between the predicted bounding box and the ground truth bounding box. This represents the normalized center offset penalty term with angular consistency. This represents the penalty for inconsistency in width and height between the predicted bounding box and the ground truth bounding box. This represents the gradient distribution adjustment parameter in the normalized overlap term; This represents the fusion coefficient used to balance the normalized overlap term and the structural alignment overlap term; Indicates the dynamic routing threshold; express The weighting coefficients of the regression terms; Represents the distance between the predicted bounding box and the ground truth bounding box. distance.
[0073] Model training was conducted on an Ubuntu 20.04.6 LTS operating system, using Python 3.10.18 and the PyTorch 2.3.0 framework on a workstation. The hardware platform featured an 11th-generation Intel(R) Core(TM) i9-11900 processor (8 physical cores and 16 threads, base frequency 2.50GHz, maximum turbo frequency 5.20GHz) and 125GB of RAM. For computational acceleration, two NVIDIA GeForce RTX 3090 GPUs (24GB VRAM each) were used. Storage included a 931GB NVMe SSD for operating system and program execution, and four high-capacity SATA hard drives providing approximately 65TB of storage space for datasets and experimental outputs. During the training of the SG-DETR detection model, all input images were resized uniformly. Pixels were adjusted to fit the network input. The training process used a batch size of 4 and a total of 50 epochs. Model parameter optimization employed the AdamW optimizer, with an initial learning rate set to [value missing]. Meanwhile, the momentum factor is set to 0.9, and the weight decay factor is set to... To prevent overfitting, a combination of data augmentation strategies was introduced during training to enhance the model's generalization ability and robustness in complex scenarios. These strategies included blurring, median filtering, ToGray transformation, and contrast-limited adaptive histogram equalization (CLAHE).
[0074] S4, Beef cattle target detection.
[0075] Given a video frame depicting a real beef cattle farm, input a trained Structure-Guided Detection Transformer model and output the bounding box locations of the beef cattle and their corresponding probabilities. The evaluation metrics for the detection are precision, recall, and F1 score. as well as We also use the number of parameters, floating-point operations (GFLOPs), and frames per second (FPS) to evaluate model efficiency.
[0076] The following specific embodiments further illustrate the target structure guided perception and detection method for beef cattle of this application.
[0077] Experiment 1 Experiment 1 compares the proposed method (experimental example) with three state-of-the-art object detection methods: CNN-based Benchmarks (Faster R-CNN, RetinaNet, Libra R-CNN, Cascade R-CNN, Double-Head, ATSS, Dynamic R-CNN, GFL, TOOD, VarifocalNet, RTMDet), YOLOSeries (YOLOX-X, YOLOv8-X, YOLOv10-X, YOLO11-X, YOLO12-X), and Transformer-based Detectors (DETR, Deformable DETR, DAB-DETR, DINO, RT-DETR).
[0078] The performance comparison results of each group in Experiment 1 are shown in Table 1.
[0079] Table 1 Performance comparison of different target detection methods
[0080]
[0081] To ensure consistent experimental conditions, all methods were evaluated using a batch size of 4 during testing. In Table 1, "Params" represents the number of model parameters, and "GFLOPs" represents the number of floating-point operations (i.e., billions of floating-point operations) required for each forward inference iteration. For evaluation metrics, higher values for detection accuracy metrics such as AP indicate better performance, while lower values for error metrics such as IDS indicate better performance. For ease of comparison, the best results in Table 1 are indicated in bold, the second-best results in italics, and the third-best results are indicated by underline. These symbols will be consistent in subsequent experimental tables.
[0082] Overall, the method of this application (experimental example) demonstrates competitive detection performance among the compared methods. Regarding detection accuracy, the method of this application achieves a high average precision (AP). The embodiments of the present invention... and The accuracy rates reached 90.8% and 59.1% respectively. Compared with the DINO model, An increase of 1.0%; compared to RTMDet, an increase of 3.7% on the same metric. Higher. This indicates that the model possesses more accurate target localization capabilities. This performance improvement is primarily attributed to the effective preservation of target boundary details in complex scenes by the Hierarchical Structure Guided (HSG) mechanism. Simultaneously, the Dynamic Routing Normalized Overlap Regression (DRNOR) loss further enhances the accuracy of bounding box prediction.
[0083] In terms of efficiency, the method in this application maintains a low computational cost. The model has 21.9M parameters and a computational cost of 63.3 GFLOPs, which are lower than most ResNet-based detectors. For example, the GFLOPs of the method in this application are only about 23% of the computational cost of DINO. Regarding inference speed, the model runs at 132.6 FPS, which is sufficient for real-time applications. Although YOLOv10 runs faster, the method in this application... This is 3.9% higher than the previous method. These results demonstrate that the model achieves a good balance between accuracy and speed. RT-DETR has a similar hybrid architecture to the method in this application, but the method in this application... and The performance surpasses RT-DETR by 2.3% and 2.8%, respectively. This performance advantage validates the effectiveness of the Spatial Decoupled Focus Classification Loss (SD-FCL), which effectively addresses the class imbalance problem in the training data. Therefore, the method in this application provides a balanced solution for beef cattle monitoring tasks.
[0084] Experiment 2 Experiment 2 presents seven different methods to verify the effectiveness of the hierarchical structure guidance (HSG) mechanism, spatial decoupling focus classification loss function (SD-FCL), and dynamic route normalized overlap regression loss function (DRNOR) in the experimental examples of this invention.
[0085] In the comparative examples of Experiment 2, Method 1 uses HSG in step S2, SD-FCL and DRNOR in step S3, and trains the model using the standard Focal Loss and GIoU loss functions; all other steps are the same as in the experimental example. Method 2 removes HSG in step S2 and DRNOR in step S3, and trains the model using the standard GIoU loss function; all other steps are the same as in the experimental example. Method 3 removes HSG in step S2 and SD-FCL in step S3, and trains the model using the standard Focal Loss function; all other steps are the same as in the experimental example. Method 4 removes HSG in step S2, and all other steps are the same as in the experimental example. Method 5 removes SD-FCL and DRNOR in step S3 and uses the standard Focal Loss function. Method 6 removes DRNOR in step S3 and uses the standard GIoU loss function to train the model, with all other steps being the same as in the experimental example; Method 7 removes SD-FCL in step S3 and uses the standard focus loss function to train the model, with all other steps being the same as in the experimental example.
[0086] The comparison results of Experiment 2 are shown in Table 2.
[0087] Table 2. Target detection results for beef cattle using different methods
[0088] As shown in Table 2, Method 1 is constructed by removing HSG, SD-FCL, and DRNOR from the embodiments of this invention, and employs standard focal loss and GIoU loss. Method 1... and The accuracy rates were 88.5% and 56.3%, respectively. First, the effectiveness of a single module was verified. Introducing SD-FCL improved precision by 2.1%, confirming the module's ability to suppress negative background samples in cluttered scenes. Additionally, DRNOR was applied... The accuracy rate increased to 56.8%, indicating that dynamic regression routing can improve the localization accuracy of occluded targets. Introducing the HSG mechanism alone would further improve the accuracy. The accuracy was improved to 89.2%, demonstrating how this mechanism effectively incorporated structural cues to successfully separate adjacent cattle. Subsequent evaluation of inter-module synergy was conducted. Combining HSG with SD-FCL yielded a higher accuracy of 89.8%. However, in the absence of adaptive regression supervision, the model's recall remains limited. The complete embodiment of this invention achieves optimal performance. and The accuracy rates were 90.8% and 59.1%, respectively. Compared with Method 1, the F1-Score was improved by 2.2%. These experimental results demonstrate that the module proposed in this application exhibits significant complementary advantages in target detection tasks in intensive aquaculture environments.
[0089] Experiment 3 Experiment 3 presents the comparison results of the loss function proposed in this embodiment of the invention with the current mainstream objective function on the target detection task of beef cattle, so as to verify the advantages of the proposed SD-FCL classification loss and DRNOR regression loss in detection accuracy and localization performance in complex breeding scenarios.
[0090] The comparison results of Experiment 3 are shown in Table 3.
[0091] Table 3 Performance Comparison of Different Loss Functions
[0092] The evaluation work consists of two parts. The first part evaluates the classification loss under the condition of fixed GIoU regression loss. Traditional methods such as VFL and ATFL are difficult to deal with the spatial imbalance problem in beef cattle, and they have limitations in balancing the dominant large-scale foreground objects with the scarce background classes. Slide Loss improves the recall rate to 83.1% by emphasizing hard samples. However, the SD-FCL proposed in this method not only achieves a high recall rate of 90.8%, but also... The recall rate also reached 84.2%. This is attributed to the spatial decoupling mechanism effectively calibrating the gradients of the dominant and rare classes. The second part evaluates the bounding box regression loss under the condition of a fixed VFL classification head. Standard IoU-based loss functions such as CIoU and EIoU are used in... The improvement in DRNOR is limited because they impose constant constraints regardless of overlap quality. SIoU and Focaler-GIoU achieve competitive results by considering orientation or focusing mechanisms. Nevertheless, the DRNOR of the method in this application is... It still surpasses SioU by 1.7%. The dynamic routing strategy not only utilizes normalized overlap to ensure the stability of low-quality predictions, but also forces structural alignment of high-quality candidate boxes. This adaptive mechanism effectively promotes accurate localization in dense populations. Experimental results show that the loss function proposed in this invention has superior detection performance and robustness on the beef cattle target detection task.
[0093] Experiment 4 Experiment 4 presents a comparison of different pruning strategies under similar computational budgets to verify that the proposed method can effectively reduce computational complexity without causing serious accuracy degradation.
[0094] The comparison results of Experiment 4 are shown in Table 4.
[0095] Table 4 Comparison of different pruning strategies in terms of model complexity and detection performance.
[0096] Table 4 shows the actual speedup, calculated as the ratio of computational cost between the baseline model and the pruned model (GFLOPs to the GFLOPs of the pruned model), used to measure the actual computational speedup achieved by pruning. The performance drop represents the absolute performance difference relative to the baseline model in the AP@0.5:0.95 metric, quantifying the impact of different pruning strategies on detection accuracy. Compared to the baseline model, all pruned models reduced computational cost (GFLOPs) by approximately 50%. This indicates significant structural redundancy in the original models. Despite similar reductions in computational cost, different pruning criteria exhibited drastically different accuracy performance. The L1-norm pruning strategy resulted in the most severe performance degradation, with an AP decrease of 7.9%. This suggests that amplitude-based criteria may inadvertently remove parameters that remain important for feature representation. In contrast, sensitivity-aware methods better preserved model accuracy. Group-Hessian pruning achieved the highest AP of 56.0%, a decrease of only 3.1% from the baseline. Notably, the LAMP strategy achieved a competitive AP of 55.7% with significantly fewer parameters (7.3M) (other methods all had more than 10M parameters), demonstrating superior storage efficiency. Group-Taylor and Group-Norm strategies also showed moderate performance degradation. All pruning strategies achieved a consistent practical speedup of approximately 2x. Overall, these experimental results indicate that the high performance of the baseline model does not entirely depend on over-parameterization, but rather on a robust architectural design.
[0097] Experiment 5 Experiment 5, based on the comparison of different pruning strategies, further analyzed the trade-off between accuracy and efficiency under increasing compression.
[0098] LAMP was used as a representative structured pruning strategy, and random pruning was used as a naive benchmark for comparison. The theoretical speedup ranged from 1.5x to 4.0x. Figure 4This trade-off was visualized in 3D space, with the x-axis representing GFLOPs, the y-axis representing the number of parameters, and the z-axis representing AP@0.5:0.95. The theoretical speedup on the x-axis represents the target compression setting, and the labeled values represent the actual speedup. LAMP, as a representative structured pruning strategy, forms the upper bound of the accuracy-efficiency trade-off, while random pruning serves as a naive baseline to represent the lower bound. LAMP reduced the model's computational cost from 63.3 GFLOPs to 14.8 GFLOPs and the number of parameters from 21.9M to 5.8M. Under moderate compression, LAMP maintains detection accuracy well. When the theoretical speedup is 2.0x, It remains at 55.7%. It remained at 88.8%. In contrast, at similar compression levels, random pruning performed worse in terms of accuracy. At 2.0x speedup, its... It dropped to 49.4%. The accuracy dropped to 83.4%. This performance gap confirms the significant advantages of structured pruning. As compression levels increase further, the accuracy degradation becomes more pronounced. At a 4.0x speedup, LAMP's... The compression efficiency was 49.5%, while random pruning dropped sharply to 40.6%. These results reveal the practical theoretical upper limit of efficient compression. Overall, the model proposed in this application exhibits good compressibility, and its performance advantage does not rely on excessive parameterization.
[0099] Experiment 6 Experiment 6 evaluated the robustness of the models in complex visual environments by testing each detector on a visual degradation test set generated using the SaMam method. This method introduces controlled environmental degradation by altering the appearance attributes of the test images, thereby simulating detection scenarios under varying imaging conditions. It should be noted that these visual transformations are not intended to generate arbitrary or artistic styles, but rather to simulate real-world appearance changes commonly encountered in beef cattle farming environments.
[0100] Specifically, Experiment 6 designed two representative visual degradation scenarios. One was fog-like degradation, characterized by reduced image contrast and attenuation of detail information; the other was a degradation condition similar to a cloudy day, where the illumination was diffused, thereby weakening local contrast and reducing the sharpness of target boundaries. Figure 5 Examples of visual degradation test sets generated by SaMam are given, where (a) shows the visual degradation effect under fog-like weather conditions and (b) shows the diffuse light degradation effect under overcast weather conditions.
[0101] Table 5 presents the comparison results of detection performance under the aforementioned unfavorable visual conditions.
[0102] Table 5 Comparison of detection performance under different style migration test conditions
[0103] As can be seen, the embodiments of the present invention exhibit superior robustness compared to current mainstream detectors in both degradation scenarios. When significant visual degradation occurs in the image, the detection performance of YOLO11 decreases significantly, while the Transformer-based method shows better overall stability. Furthermore, the embodiments of the present invention still show a significant advantage over the strong baseline RT-DETR. In the hazy degradation scenario, the embodiments of the present invention achieve improvements in multiple metrics, with an F1-score improvement of 0.9 compared to RT-DETR. Improved by 1.8. Even in degraded scenarios like cloudy days, this embodiment of the invention maintains high positioning accuracy. and The above results represent improvements of 1.7 and 1.2 compared to the baseline, respectively. These results demonstrate that the proposed method can effectively mitigate the impact of environmental visual degradation on detection performance and learns more stable and invariant feature representations compared to existing methods.
[0104] Experiment 7 Experiment 7 verifies the robustness of the present invention's embodiments in complex livestock farming scenarios by visually comparing and analyzing the detection results of various complex scenarios with occlusion features. These complex scenarios include dense cattle herds, low-light conditions, environmental interference, and scale variations. The experiment compares YOLO11, RT-DETR, and the method of the present invention's embodiments. YOLO11 represents the current mainstream one-stage object detection method, while RT-DETR represents a Transformer-based object detection method; both can serve as representative baseline models for complex scene detection tasks.
[0105] Figure 6 The results are visually compared across various complex scenes with occlusion features. Figure 6 Each row corresponds to a typical challenge scenario, including dense cattle herds, low light conditions, environmental interference, and scale variations; each column presents the detection results of different detectors, including YOLO11, RT-DETR, and the SG-DETR method of this embodiment. Meanwhile, Figure 6 The paper visualizes the detection behavior and error patterns of different methods in complex environments using a labeling system of True Positive, False Positive, and False Negative. These two types of methods have been widely adopted in recent research and can therefore serve as representative baseline models for evaluating robustness in complex environments. Figure 6As shown in (a), in scenarios where targets are densely distributed and severely occluded, the baseline methods exhibit significant limitations. Due to the high overlap of target features, YOLO11 and RT-DETR are prone to false negatives and false negatives. In contrast, the SG-DETR method of this embodiment can accurately distinguish between different individual targets, demonstrating that the proposed method has a more effective feature decoupling capability in crowded environments. Figure 6 (b) shows the detection results under low light conditions. In dim environments, the visual features of beef cattle are significantly weakened, leading to a large number of missed detections by YOLO11 and RT-DETR. However, the SG-DETR method of this embodiment still maintains a high recall rate, indicating that the method still has strong feature extraction capabilities even when visual information is limited. Figure 6 (c) presents an occlusion scenario with environmental interference. This scenario includes a complex background and non-target objects, increasing visual confusion and reducing the separability between the foreground and background. In this case, the detection results of YOLO11 and RT-DETR are relatively unstable, easily responding to irrelevant areas and generating false detections, while also missing detections when the target part is occluded. In contrast, the SG-DETR method of this embodiment can maintain stable detection results, effectively suppress environmental interference and focus on the effective target area, exhibiting stronger robustness. Figure 6 (d) illustrates a scenario with significant scale differences under partial occlusion conditions. Due to the varying distances of the cattle, the target scale changes considerably, and some targets are occluded by obstacles. In this situation, comparison methods often struggle to detect smaller targets, especially when they are partially occluded. However, the SG-DETR method of this embodiment demonstrates excellent multi-scale adaptability, consistently detecting targets regardless of size differences or occlusion conditions.
[0106] Experiment 8 Experiment 8 further verifies the feature attention capability of the embodiments of the present invention in complex aquaculture scenarios by performing a heatmap visualization analysis of the spatial attention distribution of different detection models under occlusion conditions. The experiment selects four representative complex scenarios: dense cattle herds, low light conditions, environmental disturbances, and scale changes, and compares the method of the embodiments of the present invention with YOLO11 and RT-DETR.
[0107] like Figure 7As shown, this invention uses heatmap visualization to analyze the attention of different detection models to the cattle region in complex scenes with occlusion. Each row in the figure corresponds to a typical complex scene, including dense cattle herds, low light conditions, environmental interference, and scale variations. The first column is the original image, and the remaining columns show the visualization results of YOLO11, RT-DETR, and the Grad-CAM method of this invention. The heatmap is generated using the Grad-CAM method, where red areas indicate strong attentional responses from the model, and yellow areas indicate moderate responses. This visualization method can intuitively reflect the spatial attention distribution of the model within the detection area. Experiments compare and analyze the method of this invention with YOLO11 and RT-DETR, and visualize the results in four challenging scenarios. The results show that the attention distribution of YOLO11 and RT-DETR within the detection area is relatively dispersed, especially under conditions of crowded targets, low light, and environmental interference. These methods often only produce responses in local areas of the target, making it difficult to form a complete representation of the target features, especially when the target is occluded or small in scale. In contrast, the SG-DETR method of this invention exhibits a more compact and consistent activation pattern across various scenarios, and its attention distribution better covers the entire spatial range of the beef cattle instance. Overall, the heatmap results show that this method can learn more discriminative feature representations within the detection area and maintain a stable and coherent attention distribution under occlusion and scale changes. The above phenomena are consistent with... Figure 6 The results are consistent with the qualitative detection results, further verifying the robustness of the proposed method in complex environments.
[0108] This disclosure also provides a target structure guidance sensing and detection device for beef cattle, comprising: The data acquisition and preprocessing module acquires video frames of real beef cattle farming scenes, annotates the bounding boxes of beef cattle targets in the video frame images, and forms a beef cattle target detection dataset. The detection model construction module constructs a target structure-guided perception detection model for beef cattle. The detection model includes a backbone network, a structure guidance module, a feature interaction module, and a detection head. The training module uses the spatial decoupling focus classification loss function and the dynamic route normalized overlap regression loss function to train the detection model using the training set; The detection module takes the image to be detected as input to the trained detection model and outputs the location of the beef cattle target bounding box and the corresponding class probability, thereby realizing the detection of beef cattle targets.
[0109] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0110] In summary, in order to meet the needs of automatic target detection for beef cattle in intensive farming environments, this invention addresses the problems of existing target detection methods being susceptible to occlusion, crowded distribution, background structure interference, and changes in lighting, which lead to blurred target boundaries, difficulty in separating neighboring individuals, and insufficient positioning accuracy. Therefore, this invention constructs a beef cattle target structure-guided perception detection model.
[0111] First, a beef cattle target detection dataset was constructed, consisting of frame images extracted from real farm monitoring videos. The beef cattle targets in the images were manually labeled with bounding boxes, and the dataset was divided into training, validation, and test sets.
[0112] Then, a structure-guided detection Transformer model is constructed for beef cattle target detection. This model includes a backbone network, a hierarchical structure guidance mechanism, feature interaction, and a detection head. The backbone network consists of a convolutional-pooling front-end structure and a multi-stage backbone transformation module, used to extract low-level features and deep semantic features from the input image. The hierarchical structure guidance mechanism consists of a hierarchical structure feature generator and a structure-guided aggregation unit, used to extract multi-scale structural boundary cues from early features and inject structural information into the semantic stream step by step to enhance the model's ability to represent the contours of beef cattle targets and the boundaries of neighboring individuals. The feature interaction and detection head consists of an efficient hybrid encoder, an intra-scale feature interaction module, a cross-scale feature fusion module, and a Transformer decoder with an auxiliary prediction head, used to achieve multi-scale feature fusion and output the beef cattle target bounding box and class probability.
[0113] Finally, the model training employs a spatially decoupled focus classification loss function and a dynamic route normalized overlap regression loss function to jointly optimize the predicted category and predicted bounding box, thereby improving the model's target classification ability and localization accuracy under occlusion, crowding, and complex lighting conditions.
[0114] This invention can explicitly utilize the structural boundary information of beef cattle targets, progressively enhance the target contour representation during feature extraction and feature interaction, suppress noise interference from complex background structures, and improve the detection accuracy and robustness of the model in complex farming scenarios through joint optimization of classification and regression, providing more reliable target detection results for subsequent multi-target tracking and group behavior analysis.
[0115] It should be noted that although several modules of the system for executing actions are mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules for embodiment. Components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the present invention according to actual needs. Those skilled in the art can understand and implement this without any inventive effort.
[0116] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.
Claims
1. A method for guided perception and detection of target structures in beef cattle, characterized in that, include: S1. Collect video frames of real beef cattle farming scenes, and annotate the bounding boxes of beef cattle targets in the video frame images to form a beef cattle target detection dataset. S2, Construct a target structure-guided perception and detection model for beef cattle. The detection model includes a backbone network, a structure guidance module, a feature interaction module, and a detection head. S3, the detection model is trained using the training set by utilizing the spatial decoupling focus classification loss function and the dynamic route normalized overlap regression loss function; S4 inputs the image to be detected into the trained detection model, outputs the location of the beef cattle target bounding box and the corresponding class probability, and realizes the detection of beef cattle targets.
2. The method for guiding and sensing the target structure of beef cattle according to claim 1, characterized in that, In S1, representative image frames are extracted from the acquired video frames and manually labeled with bounding boxes; the ratio of training set, validation set and test set in the dataset is 8:1:
1.
3. The method for guiding and sensing the target structure of beef cattle according to claim 1, characterized in that, In S2, the backbone network includes a convolutional-pooling front-end structure and a multi-stage backbone transformation module. The convolutional-pooling front-end structure processes the input image to obtain a low-level feature map, and the multi-stage backbone transformation module processes the low-level feature map to obtain a multi-level semantic representation.
4. The target structure guided perception and detection method for beef cattle according to claim 3, characterized in that, In S2, the structure guidance module includes a hierarchical structure feature generator and a structure guidance aggregation unit. The hierarchical structure feature generator extracts multi-scale boundary cues from the low-level feature map. Then, the structure guidance aggregation unit performs spatial attention weighting and feature fusion on the multi-scale boundary cues and multi-level semantic representations to obtain multi-scale structure enhancement features.
5. The target structure guided perception and detection method for beef cattle according to claim 4, characterized in that, In S2, the feature interaction module and the detection head include an efficient hybrid encoder, an attention-based intra-scale feature interaction module, a cross-scale feature fusion module, and a decoding prediction unit.
6. The target structure guided perception and detection method for beef cattle according to claim 5, characterized in that, The data processing procedure between the feature interaction module and the detection head includes: First, input the multi-scale structural enhancement features into the efficient hybrid encoder to optimize the representation; Then, long-range semantic dependencies are modeled through an attention-based intra-scale feature interaction module, followed by bidirectional feature integration through a cross-scale feature fusion module. Then, structure-guided aggregation is performed again on the pyramid features to obtain enhanced multi-scale pyramid features; The decoding and prediction unit decodes and predicts the enhanced multi-scale pyramid features to obtain the bounding box location and corresponding class probability of the beef cattle target.
7. A target structure guidance and sensing detection device for beef cattle, characterized in that, include: The data acquisition and preprocessing module acquires video frames of real beef cattle farming scenes, annotates the bounding boxes of beef cattle targets in the video frame images, and forms a beef cattle target detection dataset. The detection model construction module constructs a target structure-guided perception detection model for beef cattle. The detection model includes a backbone network, a structure guidance module, a feature interaction module, and a detection head. The training module uses the spatial decoupling focus classification loss function and the dynamic route normalized overlap regression loss function to train the detection model using the training set; The detection module takes the image to be detected as input to the trained detection model and outputs the location of the beef cattle target bounding box and the corresponding class probability, thereby realizing the detection of beef cattle targets.
8. The target structure guidance and sensing detection device for beef cattle according to claim 7, characterized in that, The backbone network includes a convolutional-pooling front-end structure and a multi-stage backbone transformation module. The convolutional-pooling front-end structure processes the input image to obtain a low-level feature map, and the multi-stage backbone transformation module processes the low-level feature map to obtain a multi-level semantic representation.
9. The target structure guidance and sensing detection device for beef cattle according to claim 8, characterized in that, The structure guidance module includes a hierarchical structure feature generator and a structure guidance aggregation unit. The hierarchical structure feature generator extracts multi-scale boundary cues from the low-level feature map. Then, the structure guidance aggregation unit performs spatial attention weighting and feature fusion on the multi-scale boundary cues and multi-level semantic representations to obtain multi-scale structure enhancement features.
10. The target structure guidance and sensing detection device for beef cattle according to claim 9, characterized in that, The feature interaction module and detection head include an efficient hybrid encoder, an attention-based intra-scale feature interaction module, a cross-scale feature fusion module, and a decoding prediction unit.