A computer vision-based method and system for monitoring egg laying in a multi-tiered cage layer hen area

CN117351430BActive Publication Date: 2026-10-16ZHEJIANG UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311435584.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-30
Publication Date
2026-10-16
Estimated Expiration
2043-10-30

AI Technical Summary

Technical Problem

该方法通过计算机视觉技术对鸡蛋速度进行测算,对监控系统的要求较高,而且针对于大型养鸡场,需要布置多个监控系统,对鸡笼定位的情况不够直观而且搭建系统费时费力

Benefits of technology

本发明提供的监测模型通过跟踪算法与蛋鸡区位的外在特征(笼柱)相结合,对蛋鸡区位进行定位编号计数,不需要任何外在的辅助标签,实施简单几乎不需要人工成本,对实时产蛋监测更加直观高效,设备维护起来非常简单,同时针对现有场景重新设计了跟踪算法,更换蛋鸡区位专用目标检测模块以及加入第二次的IOU匹配,对多层多列蛋鸡区位的编号定位和对应编号蛋鸡的产蛋计数的精度和速度有更大程度的提高,此外仅需两个工业摄像头俯视的方法对多层多列笼养鸡笼进行实时监测,前后期投入设备更少,监测速度更快且效率更高。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117351430B_ABST
    Figure CN117351430B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on computer vision's layering formula cage raising hen area location egg production monitoring method, comprising: step 1, by the video data of two layers of hen area location of acquisition inspection equipment;Step 2, the video data obtained is labeled, and video image set and label constitute dataset;Step 3, construct the monitoring algorithm based on improved DeepSort framework, the monitoring algorithm includes target detection module, track matching module, track generation module and positioning counting module;Step 4, training monitoring algorithm using dataset, to obtain monitoring model;Step 5, the video data of the egg-laying hen area to be counted is obtained, and input into monitoring model to obtain the egg production of corresponding hen area location.The application also provides a kind of layering formula cage raising hen area location egg production monitoring system.The method provided by the application is designed for multiple layers of multiple columns of layering formula cage raising hen area location, so that egg production monitoring is more intuitive and accurate, and monitoring efficiency is higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of animal husbandry technology, and in particular relates to a method and system for monitoring the location and egg production of layered cage-raised laying hens based on computer vision. Background Technology

[0002] The development of deep learning has provided strong support for computer vision technology, significantly improving the accuracy and stability of computer vision-based monitoring methods. In particular, the widespread application of deep learning technology has provided more accurate and efficient methods for tasks such as image processing and object detection, helping to reduce manual costs and monitoring errors. In recent years, some scholars have applied computer vision technology to monitoring egg production in caged laying hens. Zhao Chunjiang et al. used QR code tags and an improved YOLO algorithm for single-layer cage location and counting, but this method has certain limitations. On the one hand, during the rearing process, QR code tags are easily damaged or torn by chicken feces, food scraps, and other foreign objects, making them unscannable. On the other hand, the content inside the QR code is fixed and cannot be modified; if the cage information is changed, it must be remade, requiring significant manual labor costs for pre- and post-rear maintenance. This method can only be applied to single layers, resulting in low detection efficiency.

[0003] Patent document CN114842470A discloses an egg counting method and positioning system in a stacked cage rearing mode. The method includes: an egg target tracking and counting module: counting eggs based on a multi-category egg target monitoring model and a multi-target tracking DeepSort algorithm, distinguishing different categories of eggs for separate counting; and a speed display positioning and display recognition module: designing and training a speed display semantic segmentation model based on the UNet algorithm and a speed display target classification model based on the CNN algorithm using a convolutional monitoring algorithm. They introduced appearance features to improve the accuracy of tracking and recognition during the multi-target tracking process for egg recognition. This method requires high-quality egg video data, necessitates a speed sensor for every two conveyor belts, and is cumbersome to install equipment in multi-layer, multi-column chicken cages, with the on-site positioning of the chicken cages not being intuitive. In farming scenarios, it involves significant initial investment and troublesome daily maintenance.

[0004] Patent document CN116091473A discloses a method and system for precise monitoring of egg production performance in a multi-channel, location-based system for laying hen houses. This method includes multiple cages arranged side-by-side, with each layer of cages corresponding to a conveyor belt. After a hen places an order, the eggs slide down the inclined surface at the bottom of the cage onto the conveyor belt. Once the conveyor belt is activated, it transports the eggs forward to an egg collector. The monitoring system detects the eggs at the egg channel openings on a video screen to monitor the egg position and quantity. This method uses computer vision technology to calculate the egg speed, placing high demands on the monitoring system. Furthermore, for large-scale chicken farms, multiple monitoring systems need to be deployed, the cage positioning is not intuitive enough, and system setup is time-consuming and labor-intensive. Summary of the Invention

[0005] The main objective of this invention is to provide a computer vision-based method and system for monitoring egg production in multi-layered caged laying hens. This method is designed for multi-layered and multi-column caged laying hen locations, making the monitoring of egg production in each cage more intuitive, accurate, and efficient. It requires less monitoring equipment and does not use any external auxiliary tags, making subsequent maintenance very simple. At the same time, it can also ensure highly efficient unmanned monitoring.

[0006] To achieve the first objective of this invention, a computer vision-based method for monitoring egg production in stacked cage-raised laying hens by location is provided, comprising: Step 1: Obtain video data of the two-layer laying hen area using inspection equipment, which includes two monocular cameras with the same top-view angle but different heights. Step 2: Extract images frame by frame from the acquired video data to construct a video image set, and label the video image set with cage posts and eggs in the images. Combine the video image set and the labels to form a dataset. Step 3: Construct a monitoring algorithm based on the improved Deepsort framework. The monitoring algorithm includes a target detection module, a trajectory matching module, a trajectory generation module, and a location counting module. The target detection module is used to calibrate the cage column numbers in the input video data and identify the input video data to generate detection information in each frame of the image. The detection information includes the detection boxes obtained by identification or the prediction boxes obtained by prediction. The detection boxes include the trajectory matching the eggs, the corresponding shape features, and the trajectory motion parameters. The trajectory matching module performs multi-round IOU matching based on the detection boxes of the current frame and the prediction boxes obtained by prediction in the previous frame, and performs cost matrix analysis based on the matching results to output the corresponding linear matching relationship. The trajectory generation module performs cascade matching based on the linear matching relationship between the detection boxes and all prediction boxes, and combines the shape features, trajectory motion parameters, and trajectory of the detection boxes to generate the trajectory image of the eggs. The location counting module locates each laying hen location based on the cage column number and generates the number of eggs laid in the corresponding egg location based on the trajectory image of the eggs. Step 4: Train the monitoring algorithm using the dataset to obtain a monitoring model for monitoring egg production in different laying hen locations; Step 5: Obtain video data of the laying hen locations to be counted and input it into the monitoring model to obtain the egg production of the corresponding laying hen locations.

[0007] This invention requires only two industrial cameras to perform real-time monitoring of multi-layer, multi-column caged chickens from above. Simultaneously, the target tracking part of the model is updated according to the hardware selection. By replacing the dedicated target detection module for laying hen locations and adding a second IOU matching, the accuracy and speed of numbering and locating multi-layer, multi-column laying hen locations and counting the egg production of corresponding numbered laying hens are greatly improved.

[0008] Specifically, before deploying the inspection equipment, the two monocular cameras need to be calibrated and distortion-corrected to ensure the accuracy of egg production monitoring in different tiers of laying hens.

[0009] Specifically, the expression for the calibration distortion correction process is as follows: ; In the formula, As a scale factor, Let be the distance from the optical center to the image plane of the laying hen's location. and These are the x and y coordinates of the laying hen's location in the pixel coordinate system. and For the normalized focal length of the laying hen region on the x and y axes, The rotation matrix obtained from camera calibration, and Using the world coordinate system, Coordinates for correcting locational distortion in laying hens. Radial distortion, For tangential distortion, Let be the radius of curvature. The coordinates are those of the laying hen after location distortion.

[0010] Specifically, the process of constructing the video image set is as follows: The VideoCapture function is used to extract a preset number of frames from the acquired video data to obtain an initial image set. The initial image set was cleaned and augmented to obtain a set of video images containing the locations of laying hens.

[0011] The data cleaning process includes data deduplication, data filtering, and data repair.

[0012] The data augmentation includes HSV data enhancement, Brightness data enhancement, and Mixup data enhancement.

[0013] Specifically, the monitoring algorithm also includes a global attention module, which is used to perform multi-dimensional attention mechanism operations on each frame of the input video data and multiply the features under different dimensions in turn to obtain feature-enhanced video data and input it into the target detection module. The introduction of global attention mechanism operations can better capture the dependencies between channels and spatial dimensions in the feature maps of cage columns and eggs, thereby significantly improving the performance of the model.

[0014] Specifically, the object detection module also introduces a Ghost module, which is used to reduce the number of model parameters. By using grouped convolution and linear operations, more feature maps are generated with fewer parameters, which greatly reduces the complexity of the model, reduces the number of network parameters, and improves the model's computing speed.

[0015] Specifically, the trajectory matching module uses the Hungarian algorithm to solve the cost matrix to obtain the corresponding linear matching relationship. The linear matching relationship includes trajectory mismatch, detection box not matched, and detection box and prediction box successfully matched. If the matching result is a trajectory mismatch or no detection box is matched, repeat the IOU matching until the termination condition is met.

[0016] Specifically, in the case of trajectory mismatch, trajectories with more than 50 consecutive mismatched frames are directly deleted.

[0017] Specifically, for cases where no detection box is matched, these unmatched detection boxes are initialized as new trajectories.

[0018] Specifically, the positioning and counting module generates the upper layer laying hen location region of interest (LROI1) and the lower layer laying hen location region of interest (LROI2) based on the coordinates of the upper and lower cage columns, and assigns them real-time numbers. Then, it counts the eggs in the LROI1 and LROI2 regions. After the video ends, it calculates the egg count values ​​of all frames in each LROI1 and LROI2 region to obtain the final laying hen location egg production observation results.

[0019] Specifically, during training, the WIoU loss function is used to train the target detector of the monitoring algorithm in order to update the parameters of the target detector.

[0020] Specifically, the expression for the loss function is as follows: ; ; In the formula, and Indicates the width and height of the prediction box. and This represents the actual width and height of the bounding box. and This represents the width and length of the smallest rectangle formed by the combination of the predicted bounding box and the ground truth bounding box. (Superscript) Since the representative does not participate in the calculation, it effectively eliminates factors that hinder convergence. The penalty for WIoU will amplify the loss of ordinary quality anchor frames. Representing outlier, it is used to assign a gradient weight gain to high-quality anchor boxes. For gradient gain, and For hyperparameters, This represents the IOU loss.

[0021] To achieve the second objective of this invention, a stacked cage-raised layer hen location egg production monitoring system is provided, which is implemented by the above-mentioned stacked cage-raised layer hen location egg production monitoring method, including a chicken farm management unit, an egg production monitoring unit, and a system management unit. The chicken farm management unit includes chicken farm environmental monitoring, chicken farm feeding management, and chicken farm personnel management; The egg production monitoring unit includes cage monitoring, egg production monitoring, and abnormal alarms; The system management unit includes a system settings section for coordinating chicken farm management units and egg production monitoring units, a system user management section for managing accounts, and an overall data management section for storing daily monitoring results.

[0022] Compared with the prior art, the beneficial effects of the present invention are as follows: The monitoring model provided by this invention combines a tracking algorithm with the external features (cage posts) of the laying hen locations to locate, number, and count the laying hen locations. It does not require any external auxiliary tags, is simple to implement with almost no labor costs, and provides more intuitive and efficient real-time egg production monitoring. The equipment is also very easy to maintain. At the same time, the tracking algorithm has been redesigned for existing scenarios, replacing the dedicated target detection module for laying hen locations and adding a second IOU matching, which greatly improves the accuracy and speed of numbering and locating laying hen locations in multiple layers and columns and counting the egg production of corresponding numbered hens. In addition, it only requires two industrial cameras to monitor multiple layers and columns of caged chickens in real time, requiring less equipment investment in the early and later stages, and providing faster and more efficient monitoring. Attached Figure Description

[0023] Figure 1 A flowchart illustrating a computer vision-based method for monitoring egg production in tiered cage-raised laying hens. Figure 2 This is a schematic diagram of the inspection equipment provided in this embodiment; Figure 3 This is a schematic diagram of the monitoring algorithm provided in this embodiment; Figure 4 This is a flowchart illustrating the positioning counting process provided in this embodiment; Figure 5 This is a schematic diagram of the egg production monitoring system for laying hens provided in this embodiment; Figure 6 This is a bar chart of the monitoring data for test number 1 provided by the monitoring module in this embodiment; Figure 7 This is a bar chart showing the data of the misdetected chicken cage for test number 1 provided by the monitoring module in this embodiment; Figure 8 This is a bar chart of the monitoring data for test number 2 provided by the monitoring module in this embodiment; Figure 9 This is a bar chart showing the data of the misdetected chicken cage for test number 2 provided by the monitoring module in this embodiment; Figure 10 This is a bar chart of the monitoring data for test number 3 provided by the monitoring module in this embodiment; Figure 11 This is a bar chart showing the data of the misdetected chicken cage for test number 3 provided by the monitoring module in this embodiment; Figure 12 This is a bar chart of the monitoring data for test number 4 provided by the monitoring module in this embodiment; Figure 13 The bar chart shows the data of the misdetected chicken cage for test number 4 provided by the monitoring module in this embodiment. Detailed Implementation

[0024] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art without inventiveness are within the protection scope of the present invention.

[0025] like Figure 1 As shown, the egg production monitoring method for laying hens in this embodiment includes: like Figure 2 As shown, the stacked cage-raising area for laying hens includes multiple layers and rows of laying hen cages 2, each characterized by two cage posts 1, and the eggs laid by the hens rolling through a certain slope of the rolling angle 3 to a metal bottom mesh platform 4 below the laying hen cage.

[0026] Step 1: Place two X001 monocular industrial cameras 5 on the second and fourth layers of laying hen cages, respectively, on the camera bracket 6, which is 0.58m away from the laying hen cages. Use a 45-degree angle to view the non-overlapping laying hen areas from above, and construct an inspection device with a Raspberry Pi 7 and an inspection robot 8. Then, calibrate and correct the distortion of the two monocular industrial cameras to ensure the accuracy of egg production monitoring in different layers of laying hens.

[0027] In this embodiment, the calculation formula for calibrating and correcting distortion of the two monocular industrial cameras is as follows: ; In the formula, As a scale factor, Let be the distance from the optical center to the image plane of the laying hen's location. and These are the x and y coordinates of the laying hen's location in the pixel coordinate system. and For the normalized focal length of the laying hen region on the x and y axes, The rotation matrix obtained from camera calibration, and Using the world coordinate system, Coordinates for correcting locational distortion in laying hens. Radial distortion, For tangential distortion, Let be the radius of curvature. The coordinates are those of the laying hen after location distortion.

[0028] Step 2: Using the inspection equipment constructed in Step 1, acquire video data of the two layers of laying hens at a speed of 0.3 m / s along a specified path, process the frames to obtain image information with features, and perform data preprocessing to compile a recognition dataset suitable for the YOLO model and a tracking dataset suitable for the DeepSort model. The dataset categories include cage posts and eggs.

[0029] In this embodiment, the specific steps include: Step 2.1: Collect video of the layered laying hen locations at different heights, and use the VideoCapture function to extract 754 images by cropping the video into 8-frame segments. Step 2.2: Perform data cleaning on the dataset extracted in Step 2.1, including data deduplication, data filtering, and data repair, to obtain 743 images of the location of laying hens. Step 2.3: In order to improve the generalization ability of the model, the 743 location images of laying hens in Step 2.2 were expanded using HSV data augmentation, Brightness data augmentation and Mixup data augmentation to obtain a dataset containing 2229 image data. Step 2.4: Use LabelImg for manual annotation to generate a txt file with the feature coordinate information of the cage posts and eggs. Integrate the image with the corresponding annotated txt file to form a cage post and egg recognition dataset. Then, based on the manually annotated dataset, extract the cage post and egg regions and save them as cage post and egg tracking datasets according to categories. Step 2.5: Divide the cage column and egg recognition dataset into training, validation, and test sets in an 8:1:1 ratio. During the training phase, the model calculates the loss function by comparing the predicted target boxes with the actual candidate boxes, thereby optimizing the weights. During the validation phase, the model's performance is evaluated in real time to avoid overfitting, and hyperparameters are adjusted to further optimize the model's performance. Finally, during the testing phase, the test dataset is used to verify the robustness of the trained model and its performance in different scenarios. Step 2.6: Divide the cage post and egg tracking dataset into a training set and a test set in a 9:1 ratio; the model learns the target tracking patterns and features by analyzing the data in the training set, and gradually improves its performance through repeated training and optimization to better capture the motion, appearance and behavior features of the target object; the model uses the test set to determine whether the model can successfully track the target object in actual process.

[0030] Step 3: Construct a monitoring algorithm based on the improved DeepSort framework. The monitoring algorithm includes a target detection module, a trajectory matching module, a trajectory generation module, and a location counting module. The target detection module is used to calibrate the cage column numbers in the input video data and identify the input video data to generate detection information in each frame of the image. The detection information includes the detected bounding boxes or the predicted bounding boxes. The detected bounding boxes include the trajectory matching the egg, the corresponding shape features, and the trajectory motion parameters. The predicted bounding boxes are obtained by using Kalman filtering to predict unmatched trajectories. The trajectory matching module performs two IOU matchings based on the detected bounding boxes of the current frame and the predicted bounding boxes of the previous frame, and performs cost matrix analysis based on the matching results to output the corresponding linear matching relationship. The trajectory generation module performs cascade matching based on the linear matching relationship between the detected bounding boxes and all predicted bounding boxes, combined with the shape features, trajectory motion parameters, and trajectory of the detected bounding boxes, to generate the trajectory image of the egg. The location counting module locates each laying hen's location based on the cage column number and generates the number of eggs laid in the corresponding egg location based on the trajectory image of the egg.

[0031] In this embodiment, the structure of the monitoring algorithm is as follows: Figure 3 As shown: First, the improved YOLO algorithm's dedicated target detection module for laying hen locations replaces the ordinary 2D convolutions (Conv) of several CBS, C3_x, and C3_1_F modules in the backbone and neck layers of the YOLO algorithm with lightweight convolutions (Ghostconv) to obtain GhostCBS, ChostC3_x, and GhostC3_1f modules, significantly reducing the computational cost of the network model. Then, the backbone layer incorporates the GAM global attention mechanism to enhance the perception of features of cage pillars and eggs in space and channels, and uses the WIOUv3 loss function for target detection. Second, a second IOU matching is added to the DeepSort algorithm to reduce the problem of target loss during tracking, enabling more accurate multi-target tracking.

[0032] The algorithm flow of the improved YOLO algorithm's dedicated target detection module for laying hen locations is as follows: Input a laying hen location image with 3 channels and dimensions of 640×640. The image is processed by a CBS module with a stride of 2 and a 6×6 convolutional kernel to obtain a 32×320×320 feature map. Then, a GhostCBS module with a stride of 2 and a 3×3 convolutional kernel obtains a 64×160×160 feature map. This is followed by a GhostC3_1 module to obtain another 64×160×160 feature map. Finally, a GhostCBS module with a stride of 2 and a 3×3 convolutional kernel obtains a 128×80×80 feature map. This is then processed by a GH... The OSTC3_2 module produces a 128×80×80 feature map. After passing through GhostCBS with a stride of 2 and a 3×3 convolution kernel, a 256×40×40 feature map is obtained. After passing through the GHOSTC3_3 module, a 256×40×40 feature map is obtained. After passing through GhostCBS with a stride of 2 and a 3×3 convolution kernel, a 512×20×20 feature map is obtained. After passing through the GhostC3_1 module, a 512×20×20 feature map is obtained. Finally, after passing through the GAM global attention module and the SPPF spatial pyramid pooling module, a 512×20×20 feature map is obtained.The GhostCBS module with a 1×1 convolutional kernel and a stride of 1 yields a 256×20×20 feature map. The Upsample module then produces a 256×40×40 feature map. This 256×40×40 feature map is concatenated with the 256×40×40 feature map obtained from the backbone layer using the Concat module, resulting in a 512×40×40 feature map. This 256×40×40 feature map is then passed through the GhostC3_1f module. Finally, the GhostCBS module with a 1×1 convolutional kernel and a stride of 1 produces a 128×40×40 feature map. The Upsample module then... The upsampling module obtains a 128×80×80 feature map. This is then concatenated with the 128×80×80 feature map obtained from the backbone layer using the Concat module to obtain a 256×80×80 feature map. This 256×80×80 feature map is then obtained through the GhostC3_1f module, resulting in another 128×80×80 feature map. Finally, a GhostCBS module with a 3×3 convolution kernel and a stride of 2 obtains a 128×40×40 feature map. This 128×40×40 feature map is then concatenated with the 128×40×40 feature map obtained from the backbone layer using the Concat module, resulting in a 128×40×40 feature map. This 156×80×80 feature map is then obtained through the GhostC3_1f module. The 3_1f module yields a 256×40×40 feature map. This is followed by a 3×3 GhostCBS module with a stride of 2 to obtain a 256×20×20 feature map. This is then concatenated with the 256×40×40 feature map obtained from the backbone layer using the Concat module to obtain a 512×20×20 feature map. This 512×20×20 feature map is then obtained through the GhostC3_1f module. Finally, the 128×80×80, 256×40×40, and 512×20×20 feature maps obtained from the neck are processed by a GhostCBS module with 256 output channels. After converting the stConv feature maps to 256×80×80, 256×40×40, and 256×20×20 and feeding them into the head layer, the bounding box regression loss is calculated for each pixel in the feature maps using the WIOUv3 loss function with preset prior boxes. This yields a multidimensional array containing information such as object category, category confidence, bounding box coordinates, width, and height. Redundant information in the array is filtered using confidence and IOU thresholds to remove invalid content. Non-maximum suppression is then applied to eliminate redundant predicted boxes, thus obtaining the detection information for the cage posts and eggs.

[0033] The GhostConv convolution algorithm in the GhostC3, GhostC3_x, and GhostC3_1f modules works as follows: input feature 1 is convolved with a 1×1 convolution to obtain feature 2; feature 2 is then linearly transformed by a 5×5 convolution to obtain feature 3; finally, feature 2 and input feature 1 are merged to output feature 4. The addition of the GhostConv module generates more feature maps with fewer parameters by using grouped convolution and linear operations, which greatly reduces the complexity of the model, reduces the number of network parameters, and improves the model's computation speed.

[0034] The algorithm of the GAM global attention module is as follows: Image feature 1, with input channel C and dimensions W×H, is transformed into a W×H×C feature map to obtain feature 2. This feature map is then transformed into a C×W×H feature map through a two-layer multilayer perceptron to obtain feature 3. A sigmoid function is applied to the output feature map, which is then multiplied bit-by-bit with the input feature map to obtain feature 4. Feature 4 is then convolved with a 7×7 kernel to obtain feature 5 (C / r), where the r parameter determines the compression ratio of the channel and spatial branches. This is followed by another 7×7 convolution to obtain feature 6 (C×W×H). Finally, the output feature map is multiplied bit-by-bit with feature 4 using a sigmoid function to obtain feature 7. Through these steps, the GAM global attention module can better capture the dependencies between channel and spatial dimensions in the feature maps of the cage pillars and eggs, thus significantly improving the model's performance.

[0035] Step 4: Use the dataset to train the monitoring algorithm to obtain a monitoring model for monitoring the egg production of laying hens in different locations.

[0036] The loss function expression used in this embodiment is as follows: ; ; In the formula, and Indicates the width and height of the prediction box. and This represents the actual width and height of the bounding box. and This represents the width and length of the smallest rectangle formed by the combination of the predicted bounding box and the ground truth bounding box. (Superscript) Since the representative does not participate in the calculation, it effectively eliminates factors that hinder convergence. The penalty for WIoU will amplify the loss of ordinary quality anchor frames. Representing outlier, it is used to assign a gradient weight gain to high-quality anchor boxes. For gradient gain, and For hyperparameters, This represents the IOU loss.

[0037] The training hyperparameters for the object detection module are as follows: training device is RTX3080; input image size is 640×640; batch size is 8; Adam optimizer is used for model gradient optimization; early stopping mechanism is set to 150 rounds; initial learning rate is 0.01; momentum factor is 0.937; optimizer weight decay is 0.001; and training times are 300 rounds.

[0038] The training hyperparameters of the monitoring model are as follows: minimum confidence threshold is 0.2; maximum IOU matching threshold is 0.7; the number of frames the trajectory is maintained during the initialization phase is 3; and the maximum number of consecutive frames that can be lost is 50.

[0039] In addition, Table 1 shows the performance comparison results of the monitoring model in this embodiment with other models.

[0040] ; Step 5: Obtain video data of the laying hen locations to be counted and input it into the monitoring model to obtain the location number and egg production of the corresponding laying hen locations.

[0041] In this embodiment, as Figure 4 The positioning and counting process is as follows: Step 5.1: Acquire video frames from the chicken farm. The monitoring model tracks the cage posts and eggs on the upper and lower levels and performs conditional judgments for LROI generation. If more than two cage post features are tracked on the upper and lower levels, proceed to step 5.2; otherwise, proceed directly to step 5.3. Step 5.2: Obtain the tracking numbers of the two cage posts in the upper layer of the laying hen area in the current frame. And the tracking numbers of the two cage posts in the lower layer laying hen area. The mean of the top left and top right x and y coordinates , The region of interest (LROI1) for the upper layer of laying hens and the region of interest (LROI2) for the lower layer of laying hens are plotted using the following formula: ; ;in , , , To generate the x and y coordinate ranges for LROI1 and LROI2, For maximum and minimum value functions, This is a summation function.

[0042] also, The calculation formula is: ;in This represents the actual height of the laying hen area. Focal length This refers to the actual distance between the camera and the laying hen area. The angle of the camera from the lower layer of laying hens. The actual size occupied by a single pixel.

[0043] Step 5.3: Then, the cage pillar features of the generated LROI1 and LROI2 are judged. If no new cage pillar number is detected, the current frame... Tracking number of the last cage pillar List of cage pillar tracking numbers existing in the previous frame If the result is not specified, the LROI number is not updated; otherwise, the generated LROI1 and LROI2 numbers are incremented for the current frame. The nth LROI1 and LROI2 numbers of the upper and lower layers The calculation formula is: ;in, For the first Frame number Tracking number of each cage column, For the first List of tracking numbers assigned to frame cage pillars. For the first layer A list of cage position numbers for frames. For the second layer The cage location number list of the frame is used to calculate the number of eggs in LROI1 and LROI2 respectively. Frame number Number of eggs in LROI1 and LROI2 The formula is: ;in, Indicates the first Frame numbering LROI region, It represents the total number of eggs detected in the current frame image. , For the first Frame number The coordinates of the center point of each egg and It is an indicator function, representing and exist within the area.

[0044] Step 5.4: To better estimate the number of eggs in each laying hen location and minimize the impact of frames with large variations on the predicted value, after the video ends, for each... The weighted average of the egg counts across all frames within the region is used to calculate the predicted egg production for each numbered hen location.

[0045] like Figure 5As shown, this embodiment provides a stacked cage-raised layer hen location egg production monitoring system, implemented using the stacked cage-raised layer hen location egg production monitoring method provided in the above example. It includes a chicken farm management unit, an egg production monitoring unit, and a system management unit. The chicken farm management unit includes chicken farm environmental monitoring, chicken farm feeding management, and chicken farm personnel management. The egg production monitoring unit includes cage monitoring, egg production monitoring, and abnormal alarms. The system management unit includes a system settings section for coordinating the chicken farm management unit and the egg production monitoring unit, a system user management section for managing accounts, and an overall data management section for storing daily monitoring results.

[0046] The layered cage-raised layer hen location egg production monitoring system in this embodiment adopts the Spring Boot architecture, with the front end implemented based on the Vue framework and the database using MySQL. JPA is a specification used to persist entity objects to a relational database. The system architecture consists of a View layer, a Controller layer, a Service layer, and a Dao layer. The View layer is used for data visualization of egg production at each layer hen location and interaction with farm management personnel. The Controller layer is responsible for receiving requests from farm management personnel, the Service layer processes requests from farm management personnel, and the Dao layer... This is the data access layer, responsible for interacting with the database and writing the monitoring model into the edge computing device of the inspection equipment. It acquires video footage of the stacked caged laying hen areas via the X001 monocular industrial camera and transmits it to a Raspberry Pi through the CSI interface for real-time egg production statistics. The system then sends the results to a MySQL database. Farm managers use the intelligent laying hen location egg production monitoring system to monitor and analyze the egg production results of each laying hen location in real time, enabling them to develop more scientific and effective farm management strategies, remove abnormal laying hens, and improve egg production and quality.

[0047] To verify the robustness of the invention in real-world scenarios, field experiments were conducted in commercial farms, testing was carried out on caged laying hen environments with different times and light intensities. Table 2 shows the overall real-time monitoring results of the monitoring model of the invention on the location and egg production of layered caged laying hens during the breeding process.

[0048] ; like Figure 6 and Figure 7 The chart shows the data on egg production in test area 1 and the data on misdetected cages. The horizontal axis of the bar chart represents different cage numbers, and the vertical axis represents the corresponding number of eggs. 505 cages were tested and 505 cages were actually tested. 0 cages were missed, and 6 cages had misdetected egg production.

[0049] like Figure 8 and Figure 9 As shown, the bar charts are the location-based egg production data and the bar charts for misdetected chicken cages in the second sampled video. The horizontal axis of the bar charts represents different chicken cage numbers, and the vertical axis represents the corresponding number of eggs. 544 chicken cages were detected, 544 chicken cages were actually measured, 0 chicken cages were missed, and 4 chicken cages were misdetected for egg production. like Figure 10 and Figure 11 The image shows a bar chart of location-based egg production data and a bar chart of misdetected cage data from the third sampled video. The horizontal axis of the bar chart represents different cage numbers, and the vertical axis represents the corresponding number of eggs. 524 cages were detected, and 525 cages were actually measured. One cage was missed, and seven cages had misdetected egg production.

[0050] like Figure 12 and Figure 13 The image shows a bar chart of location-based egg production data and a bar chart of misdetected cage data for the fourth sampled video segment. The horizontal axis of the bar chart represents different cage numbers, and the vertical axis represents the corresponding number of eggs. 577 cages were detected, and 578 cages were actually measured. One cage was missed, and four cages had misdetected egg production.

[0051] The monitoring results of this invention under the specified typical "124" production mode show very high accuracy, with a hen location counting accuracy of 99% and a hen location positioning accuracy of 99.9%. This indicates that the method proposed in this invention can maintain a high level of monitoring quality in practical applications.

Claims

1. A method for monitoring egg production in stacked cage-raised laying hens based on computer vision, characterized in that, include: Step 1: Obtain video data of the two-layer laying hen area using inspection equipment, which includes two monocular cameras with the same top-view angle but different heights. Step 2: Extract images frame by frame from the acquired video data to construct a video image set, and label the video image set with cage posts and eggs in the images. Combine the video image set and the labels to form a dataset. Step 3: Construct a monitoring algorithm based on the improved DeepSort framework. The monitoring algorithm includes a target detection module, a trajectory matching module, a trajectory generation module, and a location counting module. The target detection module is used to calibrate the cage column numbers in the input video data and identify the input video data to generate detection information in each frame of the image. The detection information includes the detected bounding boxes or the predicted bounding boxes. The detected bounding boxes include the trajectory matching the egg, the corresponding shape features, and the trajectory motion parameters. The predicted bounding boxes are obtained by using Kalman filtering to predict unmatched trajectories. The trajectory matching module performs two rounds of IOU matching based on the detected bounding boxes of the current frame and the predicted bounding boxes of the previous frame, and performs cost matrix analysis based on the matching results to output the corresponding linear matching relationship. The trajectory generation module performs cascade matching based on the linear matching relationship between the detected bounding boxes and all predicted bounding boxes, and combines the shape features, trajectory motion parameters, and trajectory of the detected bounding boxes to generate the trajectory image of the egg. The location counting module locates each laying hen location based on the cage column number and generates the number of eggs laid in the corresponding egg location based on the trajectory image of the egg. The positioning and counting module generates the upper layer laying hen location region of interest (LROI1) and the lower layer laying hen location region of interest (LROI2) based on the coordinates of the upper cage column and assigns them real-time numbers. Then, it counts the eggs in the LROI1 and LROI2 regions. After the video ends, it calculates the weighted average of the egg count values ​​of all frames in each LROI1 and LROI2 region to obtain the final laying hen location egg production observation results. Step 4: Train the monitoring algorithm using the dataset to obtain a monitoring model for monitoring egg production in different laying hen locations; Step 5: Obtain video data of the laying hen locations to be counted and input it into the monitoring model to obtain the location number and egg production of the corresponding laying hen locations.

2. The method for monitoring egg production in stacked cage-raised laying hens based on computer vision according to claim 1, characterized in that, Before deploying the inspection equipment, the two monocular cameras need to be calibrated and distortion-corrected.

3. The method for monitoring egg production in stacked cage-raised hens based on computer vision according to claim 2, characterized in that, The expression for the calibration distortion correction process is as follows: ; In the formula, As a scale factor, Let be the distance from the optical center to the image plane of the laying hen's location. and These are the x and y coordinates of the laying hen's location in the pixel coordinate system. and For the normalized focal length of the laying hen region on the x and y axes, The rotation matrix obtained from camera calibration, and Using the world coordinate system, Coordinates for correcting locational distortion in laying hens. Radial distortion, For tangential distortion, Let be the radius of curvature. The coordinates are those of the laying hen after location distortion.

4. The method for monitoring egg production in stacked cage-raised hens based on computer vision according to claim 1, characterized in that, The process of constructing the video image set is as follows: The VideoCapture function is used to extract a preset number of frames from the acquired video data to obtain an initial image set. The initial image set was cleaned and augmented to obtain a set of video images containing the locations of laying hens.

5. The method for monitoring egg production in stacked cage-raised laying hens based on computer vision according to claim 1, characterized in that, The target detection module of the monitoring algorithm introduces a global attention module, which performs multi-dimensional attention mechanism operations on each frame of the input video data and multiplies the features in different dimensions bit by bit to obtain feature-enhanced image data output.

6. The method for monitoring egg production in stacked cage-raised hens based on computer vision according to claim 1, characterized in that, The trajectory matching module uses the Hungarian algorithm to solve the cost matrix to obtain the corresponding linear matching relationship. The linear matching relationship includes trajectory mismatch, detection box not matched, and detection box and prediction box successfully matched. If the matching result is a trajectory mismatch or no detection box is matched, repeat the IOU matching until the termination condition is met.

7. The method for monitoring egg production in stacked cage-raised laying hens based on computer vision according to claim 1, characterized in that, The target detector of the monitoring algorithm is trained using the WIOU loss function to update the parameters of the monitoring algorithm.

8. The method for monitoring egg production in stacked cage-raised hens based on computer vision according to claim 7, characterized in that, The expression for the WIOU loss function is as follows: ; ; In the formula, and Indicates the width and height of the prediction box. and This represents the actual width and height of the bounding box. and This represents the width and length of the smallest rectangle formed by the combination of the predicted bounding box and the ground truth bounding box. (Superscript) Since the representative does not participate in the calculation, it effectively eliminates factors that hinder convergence. The penalty for WIoU will amplify the loss of ordinary quality anchor frames. Representing outlier, it is used to assign a gradient weight gain to high-quality anchor boxes. For gradient gain, and For hyperparameters, This represents the IOU loss.

9. A stacked cage-raised layer hen location egg production monitoring system, characterized in that, The method for monitoring the location of laying hens in a stacked cage system as described in any one of claims 1 to 8 includes a chicken farm management unit, an egg production monitoring unit, and a system management unit. The chicken farm management unit includes chicken farm environmental monitoring, chicken farm feeding management, and chicken farm personnel management; The egg production monitoring unit includes cage monitoring, egg production monitoring, and abnormal alarms; The system management unit includes a system settings section for coordinating chicken farm management units and egg production monitoring units, a system user management section for managing accounts, and an overall data management section for storing daily monitoring results.

Citation Information

Patent Citations

  • Egg counting and positioning system in stacked cage culture mode

    CN114842470A

  • Multi-channel location fine egg laying performance monitoring method and system for laying hen house

    CN116091473A

  • Livestock image output device, learning device, livestock identification device, livestock image output system, livestock image output method, and program

    JP2022175105A