A high-density broiler chicken spatial activity and drinking behavior quantification method and system based on visual identification and target detection

CN122967309APending Publication Date: 2026-10-23SICHUAN AGRI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0006]本发明的目的在于克服现有技术的缺点,提供一种基于视觉标识与目标检测的高密度平养肉鸡空间活动及饮采行为量化方法及系统,采用全群检测框与抽样视觉标识相结合的双尺度策略,对于全群肉鸡,利用所有肉鸡检测框计算空间活动热图、检测框占据热图、最近邻距离和资源区拥挤指数;对于佩戴视觉编码标识的抽样肉鸡,通过多目标跟踪与视觉编码重绑定机制保持身份连续性,并进一步输出饮水和采食事件级结果,能够解决现有技术中存在的以下技术问题:(1)高密度平养场景中无法稳定长期追踪每一只肉鸡;(2)仅依赖多目标跟踪轨迹标识容易因遮挡和检测框波动造成 ID 断裂;(3)单帧行为识别缺少事件开始、持续、结束和置信度输出;(4)饮水、采食行为缺少设施空间语义约束;(5)不同饲养密度下群体空间活动和资源利用缺少统一量化指标

Benefits of technology

1)行为与设施联合检测:本发明在同一目标检测框架中同时识别肉鸡基础姿态和养殖设施目标,使饮水和采食行为判定能够同时考虑姿态类别和设施空间关系,降低仅凭单帧姿态或单一位置关系造成的误判;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122967309A_ABST
    Figure CN122967309A_ABST
Patent Text Reader

Abstract

The application provides a high-density flat broiler chicken space activity and drinking / sampling behavior quantification method and system based on visual identification and target detection, comprising: acquiring video images and sampling individual information of different feeding density flat breeding fields, carrying out broiler posture and breeding facility joint detection, calculating whole group space activity characteristics based on all broiler detection boxes, carrying out individual tracking, identity binding and rebinding based on sampling visual identification, constructing a drinking / sampling event state machine based on posture categories, facility space relationships and time windows, carrying out quality control and confidence calculation on drinking / sampling behavior events, and outputting space activity, resource utilization and management suggestions under different feeding densities; the application can realize whole group space activity quantification and sampling individual drinking / sampling event statistics, reduce behavior statistics fragmentation caused by multi-target tracking ID breakage, and improve the fine level of broiler feeding density evaluation, resource configuration optimization and behavior management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of intelligent livestock and poultry farming, computer vision, animal behavior recognition, target detection, multi-target tracking, and stocking density assessment. Specifically, it relates to a method and system for quantifying the spatial activity and drinking behavior of high-density free-range broilers based on visual identification and target detection. Background Technology

[0002] Floor-raising of broilers is a common method of broiler production. With the expansion of farming scale and the increasing demands for production efficiency, the number of broilers per unit area is constantly increasing. Different stocking densities affect broiler spatial activity, feeding and drinking behavior, crowding in resource areas, and group aggregation. Excessively high stocking densities can lead to limited activity space, intensified competition for resource points, obstructed drinking and feeding, decreased exercise, and increased stress risk. Therefore, accurately quantifying the spatial activity of broiler flocks and individual drinking and drinking behaviors under different stocking densities is of great significance for optimizing stocking density, improving animal welfare, and enhancing farming management.

[0003] Currently, broiler behavior monitoring mainly relies on manual observation, single-frame image classification, target detection, or multi-target tracking methods. Manual observation is time-consuming and highly subjective, making it difficult to conduct long-term continuous statistics. Single-frame image classification or target detection methods can usually only determine the broiler's posture in a single frame and cannot accurately obtain event-level information such as the start, duration, and end of behavior. Although multi-target tracking methods can generate short-term trajectories, in high-density floor-rearing scenarios, due to the similar appearance of broilers, frequent occlusion, target intersections, and fluctuations in detection boxes, trajectory label jumps, trajectory breaks, or identity confusion are prone to occur, resulting in the splitting of behavior statistics for the same broiler.

[0004] Furthermore, drinking and feeding behaviors exhibit a clear facility dependence. Drinking behavior typically occurs near water pipes or nozzles, while feeding behavior usually occurs near feed troughs. If behavior is determined solely based on broiler posture categories, non-resource interaction postures can easily be misclassified as drinking or feeding. Conversely, if behavior is determined solely based on whether broilers are near the facility, brief passages, obstructed contact, or overcrowding in resource areas can easily be misclassified as valid behavioral events.

[0005] Therefore, there is a need for a method and system for quantifying the behavior of high-density floor-raised broilers that can simultaneously identify the basic posture of broilers and the goals of the breeding facility, take into account the spatial activities of the entire flock and the behavioral events of sampled individuals, and maintain the continuity of the identity of sampled individuals through visual coding. Summary of the Invention

[0006] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for quantifying the spatial activity and drinking behavior of high-density floor-raised broilers based on visual identification and target detection. It adopts a dual-scale strategy that combines whole-flock detection frames with sampled visual identification frames. For the whole flock of broilers, spatial activity heatmaps, detection frame occupancy heatmaps, nearest neighbor distances, and resource area crowding indices are calculated using all broiler detection frames. For sampled broilers wearing visual coding identification frames, identity continuity is maintained through multi-target tracking and visual coding rebinding mechanism, and drinking and feeding event-level results are further output. This invention can solve the following technical problems existing in the prior art: (1) It is impossible to stably track each broiler in a high-density floor-raised setting for a long time; (2) Relying solely on multi-target tracking trajectory identification frames is prone to ID breakage due to occlusion and detection frame fluctuations; (3) Single-frame behavior recognition lacks output of event start, duration, end, and confidence; (4) Drinking and feeding behaviors lack facility spatial semantic constraints; (5) There is a lack of unified quantitative indicators for group spatial activity and resource utilization under different stocking densities.

[0007] To achieve the above technical effects, the following technical solution is adopted: A quantitative method for spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual labels and target detection includes the following steps: S100: Obtain video images and sampled individual information from floor-raised pens with different stocking densities; Acquire video images of floor-raised broiler pens with different stocking densities, and record the pen number, pen area, number of broilers, stocking density per unit area, video acquisition time, video frame rate, video resolution, camera installation parameters, region of interest, and identification information of sampled broilers wearing backpack visual coding tags. S200. Joint detection of broiler posture and breeding facilities based on target detection model; Frame-by-frame target detection is performed on the video images to obtain the target bounding boxes of the basic posture of broilers and the target bounding boxes of the breeding facilities; the target bounding boxes of the basic posture of broilers include at least the normal posture, feeding posture and drinking posture, and the target bounding boxes of the breeding facilities include at least the feed trough, the water pipe and the water nozzle. S300: Calculate the spatial activity characteristics of the entire flock based on all broiler detection frames; The spatial activity features of the entire flock are calculated based on the target bounding boxes of all broiler chickens' basic poses. The spatial activity features of the entire flock include the center point heatmap, the detection box occupancy heatmap, the number of resource area visits, the nearest neighbor distance, and the resource point congestion index. S400: Individual tracking, identity binding, and rebinding based on sampled visual identifiers; The trajectories of broiler chickens are generated based on a multi-target tracking algorithm, and the trajectory identifiers are bound to the visual coding identifiers of the sampled broiler chickens. When the original trajectory does not appear within a preset time, the same visual coding identifier is allowed to be rebound to a new trajectory identifier, and the behavioral statistics before and after rebinding are attributed to the same sampled broiler chicken. S500: Construct a state machine for drinking / feeding events based on attitude categories, facility spatial relationships, and time windows; Based on the broiler's basic posture target box, the breeding facility target box and the time window, an event state machine for drinking behavior and feeding behavior is constructed, and the frame-level detection results are converted into behavioral events with candidate start, confirmed start, in progress, brief interruption, end and uncertain states. S600, Perform quality control and confidence calculation on drinking / feeding behavior events; The behavioral events are post-processed, including recording excessively short events, merging adjacent short-interval events, marking excessively long events, marking low-confidence events, and calculating event confidence. The results output the candidate start time, confirmed start time, end time, duration, number of occurrences, positive sample ratio, pure intent ratio, resource distance, number of neighboring individuals, event confidence, and quality label of the behavioral events. S700 provides suggestions on spatial activities, resource utilization, and management under different stocking densities; Based on the spatial activity characteristics of the entire flock under different stocking densities and sampled broiler behavioral events, we calculate the broiler space utilization index, resource utilization index, resource point crowding index and behavioral adaptability score, and generate stocking density optimization suggestions. Furthermore, in step S200, the target detection model simultaneously identifies broiler basic posture targets and aquaculture facility targets within the same detection framework; Furthermore, in step S300, for the (i)th botnet detection box in frame (t), the calculation formula is: ; Where t represents the video frame number, indicating the t-th frame image, used to describe time series calculations such as detection, heatmap, resource access, and proximity distance; i represents the botnet target number, indicating the i-th botnet target in the t-th frame. This represents the target detection box for the i-th botnet in frame t. The formula for calculating the center point is: ; in, Let be the center point of the botnet detection box, and let be the coordinates of the center point of the i-th botnet detection box in the t-th frame. The formula for calculating the center point heatmap is: ; in, The total number of spatial grid cells represents the total number of grid cells used in the calculation of spatial heat maps or spatial utilization indices. The heatmap value of the center point of the (k)th spatial grid is... Let (k) be the k-th spatial grid, representing the k-th grid cell after dividing the chicken coop image plane into spatial grids. This is an indicator function that takes the value 1 if the condition within the parentheses is true, and 0 otherwise. The formula for calculating the area occupied by the detection box in the heatmap is: ; in, Representing the bounding box, this indicates that the heatmap is calculated based on the area covered by the bounding box. The heatmap value occupied by the detection box of the (k)th spatial grid is given. The area represents the region of the detection box, grid, or the intersection of the two; when uncalibrated, it is the pixel area, and after calibration, it can be converted to the actual area. The number of accesses to the resource area is calculated as follows: for the target frame of the aquaculture facility. According to the preset expansion distance The resource access area is expanded to obtain the resource access area, and the calculation formula is as follows: ; The formula for calculating the number of resource area accesses in frame (t) is: ; Wherein, (r) represents the resource type, which includes at least one of feed trough, drinking pipe, and drinking spout. The location of the resource is indicated by the resource detection frame. This represents the outer distance of the resource region, and the threshold for the outer distance of the access region for resource type r. This represents the number of botnets in the current frame, and represents the number of botnet targets detected and included in the statistics in frame t. Furthermore, Indicates the resource access region, representing the location of the resource. According to the distance of the resource area expansion The expanded access determination area; The nearest neighbor distance is calculated using the following formula: ; The average nearest neighbor distance for frame t is: ; in, Let be the number of broiler chickens detected in frame (t). in, It represents the nearest neighbor distance of the i-th botnet in frame t, and represents the minimum distance from the center point of this botnet to the center points of other botnets; The average nearest neighbor distance in frame t represents the average of the nearest neighbor distances of all chickens participating in the statistics in frame t. This represents the number of botnets in the current frame, and represents the number of botnet targets detected and participating in the nearest neighbor distance statistics in frame t. The resource point congestion index is calculated using the following formula: ; in, Let be the congestion index of resource type (r) in frame (t), representing the degree of broiler chicken aggregation in the resource area corresponding to a unit resource point. This refers to the number of broiler chickens within the resource area. The resource point count represents the number of botnet targets located within the resource type r access area in frame t. To prevent extremely small positive values ​​where the denominator is zero, a correction term is used to prevent the denominator from being zero; Furthermore, in step S400, the visual encoding identifier is a two-dimensional visual encoding identifier, which includes ArUco identifier, AprilTag identifier, QR code, color encoding identifier or other visual encoding identifiers that can uniquely represent an individual's identity. The identity binding process includes: identifying visual coding identifiers within the trajectory target box or its extended area; and establishing a correspondence between the current trajectory identifier and the visual coding identifier when the identified visual coding identifier belongs to a preset sampled broiler identity set. The identity rebinding process includes: when the same visual coding identifier has been bound to an old trajectory identifier, and the old trajectory identifier has not been observed again within a preset timeout period, the visual coding identifier is migrated and bound to a new trajectory identifier, and the behavior statistics results corresponding to the old trajectory identifier and the new trajectory identifier are attributed to the same visual coding identifier; Furthermore, in step S500, for the (i)th target box of the (t)th frame... With resource target box The resource proximity relationship is defined as follows: ; in, This represents the shortest distance between two bounding boxes. The proximity threshold corresponding to resource type (r); Let represent the ith target bounding box of the botnet in frame t, and represent the botnet detection bounding box output by the target detection model; The resource target box of resource type r in frame t represents the detection box of trough, water pipe or water spout identified by the target detection model. When the resource type is a water tap or water pipe, the effective proximity frame ratio for drinking water is: ; The frame rate for the pure intention of drinking water is: ; When the following conditions are met: When the target broiler chicken enters the positive water sample state, it is determined that W is the length of the time window. To approach the proportional threshold, The threshold for the number of frames in the pure intention of drinking water; This indicates the proximity relationship between resources, representing whether the i-th botnet in frame t satisfies the proximity condition with the resource type below it. This indicates the proximity threshold for resources, representing the proximity determination distance for the resource type below. When the resource type is a feed trough, the effective proximity frame ratio for feeding is: ; The frame rate for pure feeding intent is: ; When the following conditions are met: When the target broiler chicken enters a positive feeding state, it is determined that the chicken has entered the positive sample intake state; wherein, To ensure that the feeding rate is close to the threshold, The threshold for the number of frames for the pure intention of feeding. It is a summation index variable, representing the time points traversed frame by frame or moment by moment within a time window; Furthermore, in step S500, the event state machine includes none, candidate, begin, ongoing, gap, end, and uncertain states; when the number of consecutive positive sample frames reaches the event start confirmation threshold, the state changes from candidate to begin; when the event continuously meets the positive sample condition, it enters the ongoing state; when the event briefly fails to meet the positive sample condition during its execution and does not exceed the end interval threshold, it enters the gap state; when the duration of failing to meet the positive sample condition exceeds the end interval threshold, it enters the end state; when the event duration exceeds the maximum duration threshold or the event confidence is lower than a preset threshold, it is marked as uncertain. Among them, none indicates no event state, meaning no candidate behavioral event has been formed; candidate indicates candidate event state, meaning preliminary behavioral evidence has appeared but has not yet met the confirmation conditions; begin indicates event start confirmation state, meaning the candidate event has met the start confirmation threshold; ongoing indicates event continuous state, meaning the behavioral event is continuously occurring; gap indicates brief interruption state, meaning behavioral evidence is temporarily missing but has not yet met the termination conditions; end indicates event end state, meaning the lack of behavioral evidence has reached the end interval threshold; uncertain indicates uncertain event state, meaning the event has insufficient confidence, abnormal duration, or unstable boundaries. Furthermore, in step S600, the proportion of positive samples for the event is: ; The proportion of purely intentional events is: ; in, This represents the number of frames that satisfy the positive sample condition during the event. This represents the number of frames during the event period that satisfy the corresponding pose intention conditions. The total number of event evidence frames; The event resource proximity score is: ; The event duration score is: ; in, This represents the average distance from the target to the corresponding resource point during the event. The distance normalization threshold, For the duration of the event, The minimum effective event duration; Event confidence is calculated using the following formula: ; in, This indicates the proportion of positive samples for an event, representing the ratio of the number of frames that meet the positive sample criteria during the event to the total number of event evidence frames. This represents the proportion of pure intent of an event, which is the ratio of the number of frames that meet the corresponding pose intent conditions during the event to the total number of event evidence frames. The event resource proximity score represents the degree of proximity calculated from the average distance from the target to the corresponding resource point during the event. The event duration score represents the stability level calculated from the relationship between the event duration and the minimum effective event duration. The event confidence score represents the credibility of a behavioral event by combining the proportion of positive samples, the proportion of pure intent, resource proximity score, and duration score. Let be the weighting coefficients, and satisfy: ; Furthermore, in step S600, when the duration of a behavior event is less than the minimum event duration threshold, the behavior event is recorded as a rejection event and is not counted in the number of valid behavior events; when the time interval between two adjacent events of the same behavior type in the same sampled broiler is less than a preset merging threshold, the two adjacent events are merged into one behavior event; when the duration of a behavior event is greater than the maximum duration threshold, the behavior event is marked as an excessively long uncertain event. Furthermore, in step S700, the space utilization index is calculated using the following formula: ; in, The space utilization index represents a comprehensive evaluation of the uniformity of broiler chicken distribution, spatial coverage, and inter-individual distance within the chicken house. Spatial heatmap uniformity represents the degree of evenness in the distribution of active heatmaps across different spatial grids. Spatial coverage rate represents the proportion of spatial grids covered by broiler activity within a statistical period. The score is normalized to the nearest neighbor distance. These are the weighting coefficients; The uniformity of the spatial heatmap is calculated using the following formula: ; in: ; Where K is the number of spatial grids, The percentage of activity in the k-th spatial grid; The resource utilization index is calculated using the following formula: ; in, As a resource utilization index, The score is based on the access score to the trough area. Scoring is given for visits to the drinking fountain area. To score the stability of feeding events, Score the stability of drinking water incidents; Behavioral adaptability scores are calculated using the following formula: ; in, The behavioral adaptation score represents the behavioral adaptation status as jointly reflected by the normalized crowding index and the stability of drinking and feeding events. The normalized congestion index represents the normalized congestion level of a resource area. Scoring for stability of drinking water and feeding events. These are the weighting coefficients; This invention also provides a quantification system for implementing the above-mentioned quantification method for spatial activity and drinking behavior of high-density free-range broilers based on sampling visual identification and target detection, comprising: The video acquisition module is used to acquire video images and basic information of floor-raised pens with different stocking densities; The target detection module is used to identify targets in the basic posture of broilers and targets in the breeding facilities; The whole-group spatial activity calculation module is used to calculate the center point heatmap, the detection box occupancy heatmap, the number of resource area visits, the nearest neighbor distance, and the resource point congestion index; The visual coding recognition module is used to identify the backpack-type visual coding labels of sampled broiler chickens; The multi-target tracking module is used for online tracking of live broiler chickens and generating trajectory markers; The identity binding and rebinding module is used to bind trajectory identifiers with visual encoding identifiers and perform identity migration after the trajectory is broken; The behavioral event determination module is used to construct a state machine for drinking and feeding behavior events based on broiler posture categories, facility spatial relationships, and time windows. The event post-processing module is used to record events that are too short, merge short-interval events, mark events that are too long, mark low-confidence events, and calculate the event confidence. The indicator evaluation module is used to calculate the space utilization index, resource utilization index, resource point congestion index, and behavioral adaptability score. The management suggestion output module is used to output suggestions for optimizing stocking density, resource allocation, and abnormal behavior alerts.

[0008] The beneficial effects of this invention are as follows: 1) Joint detection of behavior and facilities: This invention simultaneously identifies the basic posture of broilers and the target of breeding facilities in the same target detection framework, so that the judgment of drinking and feeding behavior can simultaneously consider the posture category and the spatial relationship of facilities, reducing the misjudgment caused by relying solely on a single frame posture or a single positional relationship. 2) Dual-scale quantification of the whole flock and sampled individuals: This invention does not require long-term tracking of every broiler chicken in a high-density scene. Instead, it uses the whole flock detection frame to perform spatial heat map and resource congestion analysis, and uses sampled individuals wearing visual coding tags to perform drinking and feeding event statistics, taking into account both the spatial distribution of the whole flock and the quantification of individual behavior. 3) Reduce statistical fragmentation caused by trajectory breakage: This invention binds multi-target tracking trajectory identifiers with visual coding identifiers and allows the same visual coding identifier to migrate to a new trajectory after trajectory breakage, so that the behavioral statistics of the same sampled broiler chicken in different trajectory segments can be attributed to the same identity. 4) Converting frame-level detection results into event-level behavior output: This invention uses time windows and event state machines to convert drinking and eating behaviors into event-level outputs with candidate_start, confirmed_start, end, duration, count, positive_ratio, pure_intent_ratio, resource_distance, neighbor_count, event_confidence, and quality_flag; 5) Supports evaluation of space utilization and resource allocation under different stocking densities: This invention can compare the space utilization index, resource utilization index, resource point crowding index and behavioral adaptability score under different density pens, providing a quantitative basis for determining reasonable stocking density and optimizing the layout of feed troughs and drinking water facilities. Attached Figure Description

[0009] Figure 1 This is a flowchart illustrating a method for quantifying the spatial activity and drinking behavior of high-density free-range broilers based on visual identification and target detection, as described in an embodiment of the present invention. Figure 2 This is a block diagram of the overall architecture of a high-density free-range broiler spatial activity and drinking behavior quantification system based on visual identification and target detection in an embodiment of the present invention. Figure 3 This is a diagram illustrating the joint detection of behavior and facilities in an embodiment of the present invention; Figure 4 This is a flowchart illustrating the binding and rebinding process between sampling visual coding identifiers and trajectory identifiers in an embodiment of the present invention. Figure 5 This is a schematic diagram of the drinking / feeding event state machine in an embodiment of the present invention; Figure 6 This is a schematic diagram of the spatial activity heatmap and resource point crowding index output at a certain moment under the feeding density in an embodiment of the present invention. Detailed Implementation

[0010] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0011] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0012] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments of the present invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, and / or combinations thereof.

[0013] In the following examples, unless otherwise specified, all reagents and consumables were purchased from conventional reagent manufacturers in the art; unless otherwise specified, the experimental methods and techniques used are conventional methods and techniques in the art.

[0014] The technical solutions provided by the present invention will be described below with reference to the embodiments. The scope of protection of the present invention is not limited by the following embodiments.

[0015] Please see Figure 1 This invention provides a technical solution: a method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on visual identification and target detection, the workflow of which is shown in the figure below. Figure 1 As shown, it includes the following steps: S100: Obtain video images and sampled individual information from floor-raised pens with different stocking densities; Acquire video images of floor-raised broiler pens with different stocking densities, and record the pen number, pen area, number of broilers, stocking density per unit area, video acquisition time, video frame rate, video resolution, camera installation parameters, region of interest, and identification information of sampled broilers wearing backpack visual coding tags. S200. Joint detection of broiler posture and breeding facilities based on target detection model; Frame-by-frame target detection is performed on the video images to obtain the target bounding boxes of the basic posture of broilers and the target bounding boxes of the breeding facilities; the target bounding boxes of the basic posture of broilers include at least the normal posture, feeding posture and drinking posture, and the target bounding boxes of the breeding facilities include at least the feed trough, the water pipe and the water nozzle. S300: Calculate the spatial activity characteristics of the entire flock based on all broiler detection frames; The spatial activity features of the entire flock are calculated based on the target bounding boxes of all broiler chickens' basic poses. The spatial activity features of the entire flock include the center point heatmap, the detection box occupancy heatmap, the number of resource area visits, the nearest neighbor distance, and the resource point congestion index. S400: Individual tracking, identity binding, and rebinding based on sampled visual identifiers; The trajectories of broiler chickens are generated based on a multi-target tracking algorithm, and the trajectory identifiers are bound to the visual coding identifiers of the sampled broiler chickens. When the original trajectory does not appear within a preset time, the same visual coding identifier is allowed to be rebound to a new trajectory identifier, and the behavioral statistics before and after rebinding are attributed to the same sampled broiler chicken. S500: Construct a state machine for drinking / feeding events based on attitude categories, facility spatial relationships, and time windows; Based on the broiler's basic posture target box, the breeding facility target box and the time window, an event state machine for drinking behavior and feeding behavior is constructed, and the frame-level detection results are converted into behavioral events with candidate start, confirmed start, in progress, brief interruption, end and uncertain states. S600, Perform quality control and confidence calculation on drinking / feeding behavior events; The behavioral events are post-processed, including recording excessively short events, merging adjacent short-interval events, marking excessively long events, marking low-confidence events, and calculating event confidence. The results output the candidate start time, confirmed start time, end time, duration, number of occurrences, positive sample ratio, pure intent ratio, resource distance, number of neighboring individuals, event confidence, and quality label of the behavioral events. S700 provides suggestions on spatial activities, resource utilization, and management under different stocking densities; Based on the spatial activity characteristics of the entire flock under different stocking densities and sampled broiler behavioral events, we calculate the broiler space utilization index, resource utilization index, resource point crowding index and behavioral adaptability score, and generate stocking density optimization suggestions. Furthermore, in step S200, the target detection model simultaneously identifies broiler basic posture targets and aquaculture facility targets within the same detection framework; Furthermore, in step S300, for the (i)th botnet detection box in frame (t), the calculation formula is: ; Where t represents the video frame number, indicating the t-th frame image, used to describe time series calculations such as detection, heatmap, resource access, and proximity distance; i represents the botnet target number, indicating the i-th botnet target in the t-th frame. This represents the target detection box for the i-th botnet in frame t. The formula for calculating the center point is: ; in, Let be the center point of the botnet detection box, and let be the coordinates of the center point of the i-th botnet detection box in the t-th frame. The formula for calculating the center point heatmap is: ; in, The total number of spatial grid cells represents the total number of grid cells used in the calculation of spatial heat maps or spatial utilization indices. The heatmap value of the center point of the (k)th spatial grid is... Let (k) be the k-th spatial grid, representing the k-th grid cell after dividing the chicken coop image plane into spatial grids. This is an indicator function that takes the value 1 if the condition within the parentheses is true, and 0 otherwise. The formula for calculating the area occupied by the detection box in the heatmap is: ; in, Representing the bounding box, this indicates that the heatmap is calculated based on the area covered by the bounding box. The heatmap value occupied by the detection box of the (k)th spatial grid is given. The area represents the region of the detection box, grid, or the intersection of the two; when uncalibrated, it is the pixel area, and after calibration, it can be converted to the actual area. The number of accesses to the resource area is calculated as follows: for the target frame of the aquaculture facility. According to the preset expansion distance The resource access area is expanded to obtain the resource access area, and the calculation formula is as follows: ; The formula for calculating the number of resource area accesses in frame (t) is: ; Wherein, (r) represents the resource type, which includes at least one of feed trough, drinking pipe, and drinking spout. The location of the resource is indicated by the resource detection frame. This represents the outer distance of the resource region, and the threshold for the outer distance of the access region for resource type r. This represents the number of botnets in the current frame, and represents the number of botnet targets detected and included in the statistics in frame t. Furthermore, Indicates the resource access region, representing the location of the resource. According to the distance of the resource area expansion The expanded access determination area; The nearest neighbor distance is calculated using the following formula: ; The average nearest neighbor distance for frame t is: ; in, Let be the number of broiler chickens detected in frame (t). in, It represents the nearest neighbor distance of the i-th botnet in frame t, and represents the minimum distance from the center point of this botnet to the center points of other botnets; The average nearest neighbor distance in frame t represents the average of the nearest neighbor distances of all chickens participating in the statistics in frame t. This represents the number of botnets in the current frame, and represents the number of botnet targets detected and participating in the nearest neighbor distance statistics in frame t. The resource point congestion index is calculated using the following formula: ; in, Let be the congestion index of resource type (r) in frame (t), representing the degree of broiler chicken aggregation in the resource area corresponding to a unit resource point. This refers to the number of broiler chickens within the resource area. The resource point count represents the number of botnet targets located within the resource type r access area in frame t. To prevent extremely small positive values ​​where the denominator is zero, a correction term is used to prevent the denominator from being zero; Furthermore, in step S400, the visual encoding identifier is a two-dimensional visual encoding identifier, which includes ArUco identifier, AprilTag identifier, QR code, color encoding identifier or other visual encoding identifiers that can uniquely represent an individual's identity. The identity binding process includes: identifying visual coding identifiers within the trajectory target box or its extended area; and establishing a correspondence between the current trajectory identifier and the visual coding identifier when the identified visual coding identifier belongs to a preset sampled broiler identity set. The identity rebinding process includes: when the same visual coding identifier has been bound to an old trajectory identifier, and the old trajectory identifier has not been observed again within a preset timeout period, the visual coding identifier is migrated and bound to a new trajectory identifier, and the behavior statistics results corresponding to the old trajectory identifier and the new trajectory identifier are attributed to the same visual coding identifier; Furthermore, in step S500, for the (i)th target box of the (t)th frame... With resource target box The resource proximity relationship is defined as follows: ; in, This represents the shortest distance between two bounding boxes. The proximity threshold corresponding to resource type (r); Let represent the ith target bounding box of the botnet in frame t, and represent the botnet detection bounding box output by the target detection model; The resource target box of resource type r in frame t represents the detection box of trough, water pipe or water spout identified by the target detection model. When the resource type is a water tap or water pipe, the effective proximity frame ratio for drinking water is: ; The frame rate for the pure intention of drinking water is: ; When the following conditions are met: When the target broiler chicken enters the positive water sample state, it is determined that W is the length of the time window. To approach the proportional threshold, The threshold for the number of frames in the pure intention of drinking water; This indicates the proximity relationship between resources, representing whether the i-th botnet in frame t satisfies the proximity condition with the resource type below it. This indicates the proximity threshold for resources, representing the proximity determination distance for the resource type below. When the resource type is a feed trough, the effective proximity frame ratio for feeding is: ; The frame rate for pure feeding intent is: ; When the following conditions are met: When the target broiler chicken enters a positive feeding state, it is determined that the chicken has entered the positive sample intake state; wherein, To ensure that the feeding rate is close to the threshold, The threshold for the number of frames for the pure intention of feeding. It is a summation index variable, representing the time points traversed frame by frame or moment by moment within a time window; Furthermore, in step S500, the event state machine includes none, candidate, begin, ongoing, gap, end, and uncertain states; when the number of consecutive positive sample frames reaches the event start confirmation threshold, the state changes from candidate to begin; when the event continuously meets the positive sample condition, it enters the ongoing state; when the event briefly fails to meet the positive sample condition during its execution and does not exceed the end interval threshold, it enters the gap state; when the duration of failing to meet the positive sample condition exceeds the end interval threshold, it enters the end state; when the event duration exceeds the maximum duration threshold or the event confidence is lower than a preset threshold, it is marked as uncertain. Among them, none indicates no event state, meaning no candidate behavioral event has been formed; candidate indicates candidate event state, meaning preliminary behavioral evidence has appeared but has not yet met the confirmation conditions; begin indicates event start confirmation state, meaning the candidate event has met the start confirmation threshold; ongoing indicates event continuous state, meaning the behavioral event is continuously occurring; gap indicates brief interruption state, meaning behavioral evidence is temporarily missing but has not yet met the termination conditions; end indicates event end state, meaning the lack of behavioral evidence has reached the end interval threshold; uncertain indicates uncertain event state, meaning the event has insufficient confidence, abnormal duration, or unstable boundaries. Furthermore, in step S600, the proportion of positive samples for the event is: ; The proportion of purely intentional events is: ; in, This represents the number of frames that satisfy the positive sample condition during the event. This represents the number of frames during the event period that satisfy the corresponding pose intention conditions. The total number of event evidence frames; The event resource proximity score is: ; The event duration score is: ; in, This represents the average distance from the target to the corresponding resource point during the event. The distance normalization threshold, For the duration of the event, The minimum effective event duration; Event confidence is calculated using the following formula: ; in, This indicates the proportion of positive samples for an event, representing the ratio of the number of frames that meet the positive sample criteria during the event to the total number of event evidence frames. This represents the proportion of pure intent of an event, which is the ratio of the number of frames that meet the corresponding pose intent conditions during the event to the total number of event evidence frames. The event resource proximity score represents the degree of proximity calculated from the average distance from the target to the corresponding resource point during the event. The event duration score represents the stability level calculated from the relationship between the event duration and the minimum effective event duration. The event confidence score represents the credibility of a behavioral event by combining the proportion of positive samples, the proportion of pure intent, resource proximity score, and duration score. Let be the weighting coefficients, and satisfy: ; Furthermore, in step S600, when the duration of a behavior event is less than the minimum event duration threshold, the behavior event is recorded as a rejection event and is not counted in the number of valid behavior events; when the time interval between two adjacent events of the same behavior type in the same sampled broiler is less than a preset merging threshold, the two adjacent events are merged into one behavior event; when the duration of a behavior event is greater than the maximum duration threshold, the behavior event is marked as an excessively long uncertain event. Furthermore, in step S700, the space utilization index is calculated using the following formula: ; in, The space utilization index represents a comprehensive evaluation of the uniformity of broiler chicken distribution, spatial coverage, and inter-individual distance within the chicken house. Spatial heatmap uniformity represents the degree of evenness in the distribution of active heatmaps across different spatial grids. Spatial coverage rate represents the proportion of spatial grids covered by broiler activity within a statistical period. The score is normalized to the nearest neighbor distance. These are the weighting coefficients; The uniformity of the spatial heatmap is calculated using the following formula: ; in: ; Where K is the number of spatial grids, The percentage of activity in the k-th spatial grid; The resource utilization index is calculated using the following formula: ; in, As a resource utilization index, The score is based on the access score to the trough area. Scoring is given for visits to the drinking fountain area. To score the stability of feeding events, Score the stability of drinking water incidents; Behavioral adaptability scores are calculated using the following formula: ; in, The behavioral adaptation score represents the behavioral adaptation status as jointly reflected by the normalized crowding index and the stability of drinking and feeding events. The normalized congestion index represents the normalized congestion level of a resource area. Scoring for stability of drinking water and feeding events. These are the weighting coefficients; On the other hand, this invention provides a high-density floor-raised broiler spatial activity and drinking behavior quantification system based on visual identification and target detection. See the overall architecture diagram below. Figure 2 The system includes: The video acquisition module is used to acquire video images and basic information of floor-raised pens with different stocking densities; The target detection module is used to identify targets in the basic posture of broilers and targets in the breeding facilities; The whole-group spatial activity calculation module is used to calculate the center point heatmap, the detection box occupancy heatmap, the number of resource area visits, the nearest neighbor distance, and the resource point congestion index; The visual coding recognition module is used to identify the backpack-type visual coding labels of sampled broiler chickens; The multi-target tracking module is used for online tracking of live broiler chickens and generating trajectory markers; The identity binding and rebinding module is used to bind trajectory identifiers with visual encoding identifiers and perform identity migration after the trajectory is broken; The behavioral event determination module is used to construct a state machine for drinking and feeding behavior events based on broiler posture categories, facility spatial relationships, and time windows. The event post-processing module is used to record events that are too short, merge short-interval events, mark events that are too long, mark low-confidence events, and calculate the event confidence. The indicator evaluation module is used to calculate the space utilization index, resource utilization index, resource point congestion index, and behavioral adaptability score. The management suggestion output module is used to output suggestions for optimizing stocking density, resource allocation, and abnormal behavior alerts.

[0016] Example 1: Video Acquisition and Basic Information Gathering Cameras are installed above or diagonally above the broiler pens to capture video of pens with different stocking densities. The different stocking densities can include 15, 25, 35, and 45 birds per pen, or other density gradients can be set according to actual breeding conditions.

[0017] During data collection, record the field number, field area, number of broilers, stocking density per unit area, video collection time, video frame rate, video resolution, camera installation height, camera angle, and coordinates of the region of interest.

[0018] For each column, a sample of broiler chickens is selected from the flock and fitted with a backpack-mounted visual coding tag. The visual coding tag can be an ArUco tag, an AprilTag tag, a QR code, or other two-dimensional visual coding tag that can uniquely identify an individual.

[0019] Example 2: Joint Detection of Behavior and Facilities See Figure 3 , Figure 3 This is a joint detection map of behavior and facilities in an embodiment of the present invention; frame-by-frame target detection is performed on the video image, and the category, confidence score, and bounding box coordinates of each target are output. The detection categories include at least normal posture, eat pose, drink pose, feeder, water pipe, and water nipple; Among them, normal, eat_pose, and drink_pose are the basic posture categories of live broiler chickens, used for multi-target tracking, behavior determination, and spatial activity statistics; feeder, water_pipe, and water_nipple are the breeding facility categories, used to construct feeding resource areas, drinking resource areas, and facility spatial constraints. For fixed facilities such as drinking faucets, multiple frames of water_nipple detection boxes can be accumulated and clustered to form static drinking faucet anchor points; for troughs, the trough area can be dynamically updated based on the detection results of the current frame or historical frames; for drinking pipes, a strip-shaped area of ​​the drinking pipe can be generated based on the water_pipe detection box.

[0020] Example 3: Calculation of Spatial Activity Characteristics of the Entire Population For the i-th botnet detection box in frame (t):

[0021] Where t represents the video frame number, indicating the t-th frame image, used to describe time series calculations such as detection, heatmap, resource access, and proximity distance; i represents the botnet target number, indicating the i-th botnet target in the t-th frame. This represents the target detection box for the i-th botnet in frame t. Its center point is:

[0022] in, Let be the center point of the botnet detection box, and let be the coordinates of the center point of the i-th botnet detection box in the t-th frame. Divide the column image into (K) spatial grids. The heatmap of the center point is as follows:

[0023] in, The total number of spatial grid cells represents the total number of grid cells used in the calculation of spatial heat maps or spatial utilization indices. The heatmap value of the center point of the (k)th spatial grid is... Let (k) be the k-th spatial grid, representing the k-th grid cell after dividing the chicken coop image plane into spatial grids. This is an indicator function that takes the value 1 if the condition within the parentheses is true, and 0 otherwise. The heatmap showing the area occupied by the detection bounding box is as follows:

[0024] in, Representing the bounding box, this indicates that the heatmap is calculated based on the area covered by the bounding box. The heatmap value occupied by the detection box of the (k)th spatial grid is given. The area represents the region of the detection box, grid, or the intersection of the two; when uncalibrated, it is the pixel area, and after calibration, it can be converted to the actual area. Target framework for aquaculture facilities According to the preset expansion distance Expanding this area yields the resource access zone:

[0025] The number of resource area accesses in frame (t) is:

[0026] Wherein, (r) represents the resource type, which includes at least one of feed trough, drinking pipe, and drinking spout. The location of the resource is indicated by the resource detection frame. This represents the outer distance of the resource region, and the threshold for the outer distance of the access region for resource type r. This represents the number of botnets in the current frame, and represents the number of botnet targets detected and included in the statistics in frame t. Furthermore, Indicates the resource access region, representing the location of the resource. According to the distance of the resource area expansion The expanded access determination area; The nearest neighbor distance of the i-th broiler center point is:

[0027] The average nearest neighbor distance for frame (t) is:

[0028] in, Let be the number of broiler chickens detected in frame (t). It represents the nearest neighbor distance of the i-th botnet in frame t, and represents the minimum distance from the center point of this botnet to the center points of other botnets; The average nearest neighbor distance in frame t represents the average of the nearest neighbor distances of all chickens participating in the statistics in frame t. This represents the number of botnets in the current frame, and represents the number of botnet targets detected and participating in the nearest neighbor distance statistics in frame t. The resource point congestion index is:

[0029] in, Let be the congestion index of resource type (r) in frame (t), representing the degree of broiler chicken aggregation in the resource area corresponding to a unit resource point. This refers to the number of broiler chickens within the resource area. The resource point count represents the number of botnet targets located within the resource type r access area in frame t. A correction term is used to prevent extremely small positive values ​​where the denominator is zero.

[0030] Using the above indicators, the system obtains spatial activity distribution, body-occupied area, resource area access intensity, inter-individual distance, and resource point crowding under different stocking densities.

[0031] Example 4: Individual Sampling Tracking, Identity Binding and Rebinding See Figure 4 , Figure 4 This is a flowchart illustrating the binding and rebinding process between sampling visual coding identifiers and trajectory identifiers in this embodiment of the invention; the live broiler detection box is input into a multi-target tracking algorithm to generate trajectory identifiers. The multi-target tracking algorithm can be ByteTrack, OC-SORT, DeepSORT, or other tracking-by-detection algorithms.

[0032] For each trajectory target, a visually coded identifier is identified within its target bounding box or extended target bounding box. When the identified visually coded identifier belongs to a pre-defined sampled broiler chicken set, a binding relationship is established between the current trajectory identifier and that visually coded identifier.

[0033] When the same visual code identifier has been bound to an old trajectory identifier, and the old trajectory identifier is not observed again within a preset timeout period, the old trajectory is deemed invalid; if the same visual code identifier is identified again in the new trajectory target, the visual code identifier is allowed to migrate and bind to the new trajectory identifier.

[0034] For example, track_id=12 in the... Frame bound to visual encoding ID=5; when track_id=12 breaks and does not reappear for a preset time, if track_id=31 is in the [frame name missing]... If the frame is identified again as visual encoding ID=5, then track_id=31 will be re-bound to visual encoding ID=5, and the behavior statistics of track_id=12 and track_id=31 will be attributed to the same sampled botnet identity.

[0035] Example 5: Drinking Water Event State Machine Determination For each tracked target, a behavior record is generated frame by frame, including frame number, time, target bounding box coordinates, center point, area, aspect ratio, posture category, whether it is close to a drinking fountain, whether it is close to a feed trough, resource distance, and number of neighboring individuals.

[0036] For drinking behavior, the proximity relationship between the target box in frame (t) and the drinking spout or pipe resource is defined as follows:

[0037] in, This represents the shortest distance between two bounding boxes. The proximity threshold corresponding to resource type (r); Let represent the ith target bounding box of the botnet in frame t, and represent the botnet detection bounding box output by the target detection model; The resource target box of resource type r in frame t represents the detection box of trough, water pipe or water spout identified by the target detection model. Within the most recent (W) frame window, the proportion of effective proximity frames for drinking water is:

[0038] The frame rate for the pure intention of drinking water is:

[0039] When the following conditions are met: When the target is determined to meet the positive drinking water sample condition in the current frame, W is the length of the time window. To approach the proportional threshold, The threshold for the number of frames in the pure intention of drinking water; This indicates the proximity relationship between resources, representing whether the i-th botnet in frame t satisfies the proximity condition with the resource type below it. This indicates the proximity threshold for resources, representing the proximity determination distance for the resource type below.

[0040] The system further manages drinking water events through an event state machine; see details below. Figure 5The initial state is none; when the positive sample condition for drinking water begins to be met, it enters the candidate state; when the number of consecutive positive sample frames reaches the event start confirmation threshold, it enters the begin state and records confirmed_start; when the positive sample condition is continuously met, it enters the ongoing state; when the positive sample condition is not met for a short period of time but does not exceed the end interval threshold, it enters the gap state; when the time when the positive sample condition is not met exceeds the end interval threshold, it enters the end state and resets to none; when the event duration exceeds the maximum duration threshold or the confidence is too low, it is marked as an uncertain state.

[0041] Example 6: State Machine Determination of Feeding Events For feeding behavior, the proximity relationship between the target box in frame (t) and the feed trough resource is defined as follows:

[0042] Within the most recent (W) frame window, the proportion of effective proximity frames for feeding is:

[0043] The frame rate for pure feeding intent is:

[0044] When the following conditions are met: When the target is determined to meet the positive sample feeding condition in the current frame, it is then determined that the target meets the positive sample feeding condition in the current frame; where, To ensure that the feeding rate is close to the threshold, The threshold for the number of frames for the pure intention of feeding. It is a summation index variable, representing the time point traversed frame by frame or moment by moment within a time window; the feeding behavior is also managed through the none, candidate, begin, ongoing, gap, end, and uncertain states.

[0045] Example 7: Post-event processing and event confidence calculation The system performs post-processing for existing drinking water and feeding events.

[0046] If the event duration is less than the minimum event duration threshold, it is recorded as a rejected event and is not counted in the valid event count. If the interval between two adjacent events of the same type on the same sampled broiler is less than the merging threshold, the two events are merged into one event. If the event duration exceeds the maximum duration threshold, it is marked as uncertain_long; if the event confidence is lower than the preset threshold, it is marked as uncertain_low_confidence.

[0047] The proportion of positive samples for the event is:

[0048] The proportion of purely intentional events is:

[0049] in, This represents the number of frames that satisfy the positive sample condition during the event. This represents the number of frames during the event period that satisfy the corresponding pose intention conditions. The total number of event evidence frames; The event resource proximity score is:

[0050] The event duration score is:

[0051] in, This represents the average distance from the target to the corresponding resource point during the event. The distance normalization threshold, For the duration of the event, The minimum effective event duration; The confidence level of the event is:

[0052] in, This indicates the proportion of positive samples for an event, representing the ratio of the number of frames that meet the positive sample criteria during the event to the total number of event evidence frames. This represents the proportion of pure intent of an event, which is the ratio of the number of frames that meet the corresponding pose intent conditions during the event to the total number of event evidence frames. The event resource proximity score represents the degree of proximity calculated from the average distance from the target to the corresponding resource point during the event. The event duration score represents the stability level calculated from the relationship between the event duration and the minimum effective event duration. The event confidence score represents the credibility of a behavioral event obtained by combining the proportion of positive samples, the proportion of pure intent, the resource proximity score, and the duration score. Let be the weighting coefficients, and satisfy: .

[0053] Event output fields include identity_type, identity_id, action, candidate_start, confirmed_start, end, duration, positive_ratio, pure_intent_ratio, mean_resource_distance, min_resource_distance, neighbor_count_mean, event_confidence and quality_flag; in, Indicates the identity type, representing the source of the individual chicken's identity in the event, such as an identity confirmed by a visual identifier or an identity represented solely by a tracking trajectory number; This represents the identity number, which is the individual ID corresponding to the identity type. Indicates the behavior category, representing the type of behavioral event such as eating or drinking; Indicates the candidate start time, representing the time or frame number when behavioral evidence first enters the candidate state; Indicates the confirmation start time, representing the time or frame number at which a candidate event is confirmed after meeting the confirmation conditions; Indicates the end time, representing the time or frame number when the behavioral event ended; Indicates duration, representing the length of time an event lasts from start to finish; Indicates quantity or count, representing the number of events, the number of targets, the number of resource accesses, or the number of statistical frames; The percentage of positive evidence represents the proportion of positive frames that meet the behavioral criteria during the event period. Indicates the proportion of pure intent, representing the percentage of frames during the event that clearly show the intent to eat or drink. This indicates the resource distance, representing the distance from the target botnet to the corresponding resource in the current frame; This represents the average resource distance, indicating the average distance between the target botnet and the corresponding resource during the event period; This represents the minimum resource distance, indicating the minimum distance between the target botnet and its corresponding resource during the event period. This indicates the number of neighboring individuals, representing the number of other chickens within a certain distance range around the target chicken in the current frame; Indicates the average number of neighboring individuals, representing the average number of neighboring broilers around the target broiler during the event period; Indicates the confidence level of an event, representing the degree of credibility of the behavioral event; This indicates a quality marker, representing the quality status of events such as normal events, low-confidence uncertain events, excessively long uncertain events, or combined events.

[0054] Example 8: Evaluation of Space Utilization, Resource Utilization, and Stocking Density For different stocking densities, the system calculates evaluation indicators based on the spatial activity characteristics of the entire herd and the behavioral events of sampled individuals. The space utilization index is:

[0055] in, The space utilization index represents a comprehensive evaluation of the uniformity of broiler chicken distribution, spatial coverage, and inter-individual distance within the chicken house. Spatial heatmap uniformity represents the degree of evenness in the distribution of active heatmaps across different spatial grids. Spatial coverage rate represents the proportion of spatial grids covered by broiler activity within a statistical period. The score is normalized to the nearest neighbor distance. These are the weighting coefficients; Spatial heatmap uniformity is:

[0056] in:

[0057] Where K is the number of spatial grids, The percentage of activity in the k-th spatial grid; The resource utilization index is:

[0058] in, As a resource utilization index, The score is based on the access score to the trough area. Scoring is given for visits to the drinking fountain area. To score the stability of feeding events, Score the stability of drinking water incidents; Behavioral adaptability score:

[0059] in, The behavioral adaptation score represents the behavioral adaptation status as jointly reflected by the normalized crowding index and the stability of drinking and feeding events. The normalized congestion index represents the normalized congestion level of a resource area. Scoring for stability of drinking water and feeding events. These are the weighting coefficients; When a certain stocking density exhibits increased crowding index at resource points, decreased average nearest neighbor distance, increased fragmentation of drinking or feeding events, decreased individual activity, or uneven space utilization, the system generates stocking density optimization suggestions. These suggestions include reducing the number of animals per unit area, increasing the number of water nozzles, adjusting the location of water pipes, increasing feed trough length, optimizing pen layout, or adjusting feeding and watering management strategies. Figure 6 This is a schematic diagram of the spatial activity heatmap and resource point crowding index output at a certain moment under the feeding density in an embodiment of the present invention.

[0060] System Implementation Examples A system for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection includes: The video acquisition module is used to acquire videos of pens with different stocking densities and record the pen density, acquisition time, frame rate, resolution, and region of interest. The target detection module is used to identify normal, eat_pose, drink_pose, feeder, water_pipe, and water_nipple. The whole-group spatial activity calculation module is used to generate center point heatmaps, detection box occupancy heatmaps, resource area access counts, nearest neighbor distances, and resource point congestion indices; The visual coding recognition module is used to identify the backpack-type visual coding labels of sampled broiler chickens; The multi-target tracking module is used for online tracking of live broiler chickens and generating trajectory markers; The identity binding and rebinding module is used to bind trajectory identifiers with visual encoding identifiers and perform identity migration after the trajectory is broken; The behavior event determination module is used to generate drinking / feeding events based on posture category, facility spatial relationship, and time window; The event post-processing module is used to record excessively short events, merge short-interval events, mark abnormal events, and calculate event confidence. The indicator evaluation module is used to calculate the space utilization index, resource utilization index, resource point congestion index, and behavioral adaptability score. The management suggestion output module is used to output suggestions for optimizing stocking density, resource allocation, and abnormal behavior alerts; The data export module is used to export individual summary tables, trajectory tables, event tables, rejection event tables, swarm detection tables, and frame-level region statistics tables. The visualization module is used to display or save video images with detection boxes, trajectory markers, visual coding markers, event stages, and statistical information.

[0061] Optional implementation of backpack-type visual coding and labeling components In one embodiment, the backpack-type visual coding tagging component worn by the sampled broilers includes a flexible fitting base, a visual coding tagging layer, a transparent protective layer, a fixing component, and anti-pecking edges.

[0062] The flexible bonding base is used to fit the feather area on the back of the broiler; the visual coding mark layer is set on the upper surface of the flexible bonding base for identification by a camera device above or diagonally above; the transparent protective layer covers the visual coding mark layer for waterproofing, stain resistance, and abrasion resistance; the fixing components include flexible straps, harnesses, adhesive layers, or clamps; the anti-pecking edge is a rounded corner structure, an edge-wrapping structure, or a flexible transition structure to reduce the probability of chickens pecking and the mark falling off.

[0063] The visual coding identification layer can use ArUco identifiers, AprilTag identifiers, QR codes, color coding patterns, or other two-dimensional visual coding identifiers that can uniquely identify an individual.

[0064] Therefore, those skilled in the art will recognize that although embodiments of the present invention have been shown and described in detail herein, many other variations or modifications conforming to the principles of the present invention can be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the invention. Therefore, the scope of the present invention should be understood and recognized as covering all such other variations or modifications.

Claims

1. A quantitative method for spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identifiers and target detection, characterized in that, Includes the following steps: S100: Obtain video images and sampled individual information from floor-raised pens with different stocking densities; Acquire video images of floor-raised broiler pens with different stocking densities, and record the pen number, pen area, number of broilers, stocking density per unit area, video acquisition time, video frame rate, video resolution, camera installation parameters, region of interest, and identification information of sampled broilers wearing backpack visual coding tags. S200. Joint detection of broiler posture and breeding facilities based on target detection model; Frame-by-frame target detection is performed on the video images to obtain the target bounding boxes of the basic posture of broilers and the target bounding boxes of the breeding facilities; the target bounding boxes of the basic posture of broilers include at least the normal posture, feeding posture and drinking posture, and the target bounding boxes of the breeding facilities include at least the feed trough, the water pipe and the water nozzle. S300: Calculate the spatial activity characteristics of the entire flock based on all broiler detection frames; The spatial activity features of the entire flock are calculated based on the target bounding boxes of all broiler chickens' basic poses. The spatial activity features of the entire flock include the center point heatmap, the detection box occupancy heatmap, the number of resource area visits, the nearest neighbor distance, and the resource point congestion index. S400: Individual tracking, identity binding, and rebinding based on sampled visual identifiers; Chicken trajectories are generated based on a multi-target tracking algorithm, and the trajectory identifiers are bound to the visual coding identifiers of sampled chickens. When the original trajectory does not appear within a preset time, the same visual coding identifier is allowed to be rebound to a new trajectory identifier, and the behavioral statistics before and after rebinding are attributed to the same sampled botnet identity. S500: Construct a state machine for drinking / feeding events based on attitude categories, facility spatial relationships, and time windows; Based on the broiler's basic posture target box, the breeding facility target box and the time window, an event state machine for drinking behavior and feeding behavior is constructed, and the frame-level detection results are converted into behavioral events with candidate start, confirmed start, in progress, brief interruption, end and uncertain states. S600, Perform quality control and confidence calculation on drinking / feeding behavior events; The behavioral events are post-processed, including recording excessively short events, merging adjacent short-interval events, marking excessively long events, marking low-confidence events, and calculating event confidence. The results output the candidate start time, confirmed start time, end time, duration, number of occurrences, positive sample ratio, pure intent ratio, resource distance, number of neighboring individuals, event confidence, and quality label of the behavioral events. S700 provides suggestions on spatial activities, resource utilization, and management under different stocking densities; Based on the spatial activity characteristics of the entire flock under different stocking densities and sampled broiler behavioral events, we calculate the broiler space utilization index, resource utilization index, resource point crowding index, and behavioral adaptability score, and generate stocking density optimization suggestions.

2. The method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection according to claim 1, characterized in that, In step S200, the target detection model simultaneously identifies broiler basic posture targets and aquaculture facility targets within the same detection framework.

3. The method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection according to claim 1, characterized in that, In step S300, for the (i)th botnet detection box in frame (t), the calculation formula is: ; Where t represents the video frame number, indicating the t-th frame image, used to describe time series calculations such as detection, heatmap, resource access, and proximity distance; i represents the botnet target number, indicating the i-th botnet target in the t-th frame. This represents the target detection box for the i-th botnet in frame t. The formula for calculating the center point is: ; in, Let be the center point of the botnet detection box, and let be the coordinates of the center point of the i-th botnet detection box in the t-th frame. The formula for calculating the center point heatmap is: ; in, The total number of spatial grid cells represents the total number of grid cells used in the calculation of spatial heat maps or spatial utilization indices. The heatmap value of the center point of the (k)th spatial grid is... Let (k) be the k-th spatial grid, representing the k-th grid cell after dividing the chicken coop image plane into spatial grids. This is an indicator function that takes the value 1 if the condition within the parentheses is true, and 0 otherwise. The formula for calculating the area occupied by the detection box in the heatmap is: ; in, Representing the bounding box, this indicates that the heatmap is calculated based on the area covered by the bounding box. The heatmap value occupied by the detection box of the (k)th spatial grid is given. The area represents the region of the detection box, grid, or the intersection of the two; when uncalibrated, it is the pixel area, and after calibration, it can be converted to the actual area. The number of accesses to the resource area is calculated as follows: for the target frame of the aquaculture facility. According to the preset expansion distance The resource access area is expanded to obtain the resource access area, and the calculation formula is as follows: ; The formula for calculating the number of resource area accesses in frame (t) is: ; Wherein, (r) represents the resource type, which includes at least one of feed trough, drinking pipe, and drinking spout. The location of the resource is indicated by the resource detection frame. This represents the outer distance of the resource region, and the threshold for the outer distance of the access region for resource type r. This represents the number of botnets in the current frame, and represents the number of botnet targets detected and included in the statistics in frame t. Furthermore, Indicates the resource access region, representing the location of the resource. According to the distance of the resource area expansion The expanded access determination area; The nearest neighbor distance is calculated using the following formula: ; The average nearest neighbor distance for frame t is: ; in, Let be the number of broiler chickens detected in frame (t). It represents the nearest neighbor distance of the i-th botnet in frame t, and represents the minimum distance from the center point of this botnet to the center points of other botnets; The average nearest neighbor distance in frame t represents the average of the nearest neighbor distances of all chickens participating in the statistics in frame t. This represents the number of botnets in the current frame, and represents the number of botnet targets detected and participating in the nearest neighbor distance statistics in frame t. The resource point congestion index is calculated using the following formula: ; in, Let be the congestion index of resource type (r) in frame (t), representing the degree of broiler chicken aggregation in the resource area corresponding to a unit resource point. This refers to the number of broiler chickens within the resource area. The resource point count represents the number of botnet targets located within the resource type r access area in frame t. A correction term is used to prevent extremely small positive values ​​where the denominator is zero.

4. The method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection according to claim 1, characterized in that, In step S400, the visual encoding identifier is a two-dimensional visual encoding identifier, which includes ArUco identifier, AprilTag identifier, QR code, color encoding identifier or other visual encoding identifiers that can uniquely represent an individual's identity. The identity binding process includes: identifying visual coding identifiers within the trajectory target box or its extended area; and establishing a correspondence between the current trajectory identifier and the visual coding identifier when the identified visual coding identifier belongs to a preset sampled broiler identity set. The identity rebinding process includes: when the same visual coding identifier has been bound to an old trajectory identifier, and the old trajectory identifier has not been observed again within a preset timeout period, the visual coding identifier is migrated and bound to a new trajectory identifier, and the behavior statistics results corresponding to the old trajectory identifier and the new trajectory identifier are attributed to the same visual coding identifier.

5. The method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection according to claim 1, characterized in that, In step S500, for the (i)th target box of the (t)th frame... With resource target box The resource proximity relationship is defined as follows: ; in, This represents the shortest distance between two bounding boxes. The proximity threshold corresponding to resource type (r); Let represent the ith target bounding box of the botnet in frame t, and represent the botnet detection bounding box output by the target detection model; The resource target box of resource type r in frame t represents the detection box of trough, water pipe or water spout identified by the target detection model. When the resource type is a water tap or water pipe, the effective proximity frame ratio for drinking water is: ; The frame rate for the pure intention of drinking water is: ; When the following conditions are met: When the target broiler chickens enter the positive water sample state, it is determined that W is the length of the time window. To approach the proportional threshold, The threshold for the number of frames in the pure intention of drinking water; This indicates the proximity relationship between resources, representing whether the i-th botnet in frame t satisfies the proximity condition with the resource type below it. This indicates the proximity threshold for resources, representing the proximity determination distance for the resource type below. When the resource type is a feed trough, the effective proximity frame ratio for feeding is: ; The frame rate for pure feeding intent is: ; When the following conditions are met: When the target broiler chicken enters a positive feeding state, it is determined that the chicken has entered the positive sample intake state; wherein, To ensure that feeding is close to the proportion threshold, The threshold for the number of frames for the pure intention of eating. It is a summation index variable, representing the time points traversed frame by frame or moment by moment within a time window.

6. The method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection according to claim 1, characterized in that, In step S500, the event state machine includes none, candidate, begin, ongoing, gap, end, and uncertain states. When the number of consecutive positive sample frames reaches the event start confirmation threshold, the state changes from candidate to begin. When the event continuously meets the positive sample condition, it enters the ongoing state. When the event briefly fails to meet the positive sample condition during its execution and does not exceed the end interval threshold, it enters the gap state. When the duration of the failure to meet the positive sample condition exceeds the end interval threshold, it enters the end state. When the event duration exceeds the maximum duration threshold or the event confidence is lower than a preset threshold, it is marked as uncertain. Among them, none indicates no event state, meaning no candidate behavioral event has been formed at present; candidate indicates candidate event state, meaning preliminary behavioral evidence has appeared but has not yet met the confirmation conditions; begin indicates event start confirmation state, meaning the candidate event has met the start confirmation threshold; ongoing indicates event continuous state, meaning the behavioral event is continuously occurring; gap indicates brief interruption state, meaning behavioral evidence is temporarily missing but has not yet met the termination conditions; end indicates event end state, meaning the lack of behavioral evidence has reached the termination interval threshold; uncertain indicates uncertain event state, meaning the event has insufficient confidence, abnormal duration, or unstable boundaries.

7. The method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection according to claim 1, characterized in that, In step S600, the proportion of positive samples for an event is: ; The proportion of purely intentional events is: ; in, This represents the number of frames that satisfy the positive sample condition during the event. This represents the number of frames during the event period that satisfy the corresponding pose intention conditions. The total number of event evidence frames; The event resource proximity score is: ; Event duration score: ; in, This represents the average distance from the target to the corresponding resource point during the event. The distance normalization threshold, For the duration of the event, The minimum effective event duration; Event confidence is calculated using the following formula: ; in, This indicates the proportion of positive samples for an event, representing the ratio of the number of frames that meet the positive sample criteria during the event to the total number of event evidence frames. This represents the proportion of pure intent of an event, which is the ratio of the number of frames that meet the corresponding pose intent conditions during the event to the total number of event evidence frames. The event resource proximity score represents the degree of proximity calculated from the average distance from the target to the corresponding resource point during the event. The event duration score represents the stability level calculated from the relationship between the event duration and the minimum effective event duration. The event confidence score represents the credibility of a behavioral event by combining the proportion of positive samples, the proportion of pure intent, resource proximity score, and duration score. Let be the weighting coefficients, and satisfy: .

8. The method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection according to claim 1, characterized in that, In step S600, when the duration of a behavior event is less than the minimum event duration threshold, the behavior event is recorded as a rejection event and is not counted in the number of valid behavior events; when the time interval between two adjacent events of the same behavior type of the same sampled broiler is less than the preset merging threshold, the two adjacent events are merged into one behavior event. When the duration of a behavioral event exceeds the maximum duration threshold, the behavioral event is marked as an excessively long uncertain event.

9. The method for quantifying the spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection according to claim 1, characterized in that, In step S700, the space utilization index is calculated using the following formula: ; in, The space utilization index represents a comprehensive evaluation of the uniformity of broiler chicken distribution, spatial coverage, and inter-individual distance within the chicken house. Spatial heatmap uniformity represents the degree of evenness in the distribution of active heatmaps across different spatial grids. Spatial coverage rate represents the proportion of spatial grids covered by broiler activity within a statistical period. The score is normalized to the nearest neighbor distance. These are the weighting coefficients; The uniformity of the spatial heatmap is calculated using the following formula: ; in: ; Where K is the number of spatial grids, The percentage of activity in the k-th spatial grid; The resource utilization index is calculated using the following formula: ; in, As a resource utilization index, The score is based on the access score to the trough area. Scoring is given for visits to the drinking fountain area. To score the stability of feeding events, Score the stability of drinking water incidents; Behavioral adaptability scores are calculated using the following formula: ; in, The behavioral adaptation score represents the behavioral adaptation status as jointly reflected by the normalized crowding index and the stability of drinking and feeding events. The normalized congestion index represents the normalized congestion level of a resource area. Scoring for stability of drinking water and feeding events. These are the weighting coefficients.

10. A quantitative system for implementing the quantitative method for spatial activity and drinking behavior of high-density free-range broiler chickens based on sampling visual identification and target detection as described in claims 1-9, characterized in that, The system includes: The video acquisition module is used to acquire video images and basic information of floor-raised pens with different stocking densities; The target detection module is used to identify targets in the basic posture of broilers and targets in the breeding facilities; The whole-group spatial activity calculation module is used to calculate the center point heatmap, the detection box occupancy heatmap, the number of resource area visits, the nearest neighbor distance, and the resource point congestion index; The visual coding recognition module is used to identify the backpack-type visual coding labels of sampled broiler chickens; The multi-target tracking module is used for online tracking of live broiler chickens and generating trajectory markers; The identity binding and rebinding module is used to bind trajectory identifiers with visual encoding identifiers and perform identity migration after the trajectory is broken; The behavioral event determination module is used to construct a state machine for drinking and feeding behavior events based on broiler posture categories, facility spatial relationships, and time windows. The event post-processing module is used to record events that are too short, merge short-interval events, mark events that are too long, mark low-confidence events, and calculate the event confidence. The indicator evaluation module is used to calculate the space utilization index, resource utilization index, resource point congestion index, and behavioral adaptability score. The management suggestion output module is used to output suggestions for optimizing stocking density, resource allocation, and abnormal behavior alerts.