A method and system for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house
Through the combination of multi-category egg segmentation model and egg tracking model, combined with marker strip identification and conveyor belt dynamic and static detection methods, accurate weight measurement and cage tracing of eggs on the egg conveyor belt are achieved, solving the problems of insufficient egg weight measurement accuracy and difficulty in cage-level egg laying performance in the existing technology, and improving breeding efficiency and production efficiency.
Patent Information
- Application Number
- CN202411768921.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-12-04
AI Technical Summary
The prior art is difficult to accurately obtain the egg profile and long and short axis size under complex conditions, resulting in insufficient egg weight measurement accuracy and inability to achieve accurate statistics of egg laying performance at the cage level.
Multi-category egg segmentation model and egg tracking model are used to identify, classify and track eggs on the egg conveyor belt in real time, and combine marker strip identification and conveyor belt dynamic and static detection methods to achieve accurate weight measurement and cage tracing of eggs.
It improves the accuracy of egg weight measurement, realizes cage-level egg laying performance data analysis, helps breeders to timely discover and deal with abnormal cages, and improves breeding efficiency and production efficiency.
Smart Images

Figure CN119229356B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the intersecting field of machine vision systems, digital image processing technology, deep learning technology, wireless network communication technology and poultry precision breeding technology, and in particular relates to a method and system for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house. Background Art
[0002] The advantage of stacked cage farming is that it can standardize the breeding process, conduct large-scale centralized management of laying hens, and improve space utilization and production efficiency. However, due to the characteristics of high-density breeding, the risk of disease transmission and spread in the house is aggravated, and higher requirements are placed on the refined management of the breeding process. The egg-laying performance of laying hens is closely related to their health status. When the environment in the chicken house is poor, the feed is nutritious, the laying hens are sick or stressed, the egg-laying performance of laying hens will be negatively affected, such as decreased egg production rate, reduced egg weight, deterioration of eggshell quality and egg quality, and even suspension of production. Therefore, it is of great significance to achieve accurate statistics of egg-laying performance at the cage level, including accurate egg weight measurement, accurate egg counting, and accurate egg tracing, at low cost. The accurate statistical method and system of egg-laying performance at the cage level can provide clues for the cage positions of low-yielding, sick, and dead laying hens in the process of refined breeding, and improve breeding efficiency and production benefits.
[0003] Patent document CN116883921A discloses an egg weight detection and grading method based on deep learning, which attempts to identify eggs in each layer of a stacked cage, obtains the egg outline after image processing, measures the egg's major and minor axes, and finally establishes an egg weight inversion model to grade the eggs. The traditional image processing methods used in this method, such as opening operation, graying, Gaussian filtering, and image binarization, have strict requirements on imaging conditions. In the case of uneven lighting, complex background, overlapping eggs, variable egg shapes and sizes, and changes in the projection area (i.e., changes in the major and minor axis dimensions) caused by dirt or damage on the egg surface, it is difficult to accurately obtain the egg outline and major and minor axis dimensions, and therefore cannot meet the high-precision requirements for egg weight measurement. Similarly, patent document CN111134047A discloses a method and system for monitoring the egg-laying performance of caged laying hens. This method is also unable to accurately obtain the outline and major and minor axis dimensions of the eggs under the above-mentioned complex conditions, resulting in insufficient weight measurement accuracy; and because this method does not have a tracking module, when the eggs roll back in the picture, that is, pass through the center of the picture multiple times, it will cause the eggs to be counted repeatedly.
[0004] Patent document CN114842470A discloses an egg counting and positioning system in a stacked cage mode, including an egg tracking and counting module and a speed display positioning and indication recognition module, thereby realizing multi-category egg counting and positioning. On the one hand, this method cannot obtain important egg-laying performance data such as egg weight; on the other hand, the egg positioning method requires each egg conveyor belt to be equipped with a high-precision speed sensor and speed display, the positioning process is complicated, the hardware cost is high, and the installation and maintenance are difficult, which is difficult to meet the actual production needs of the farm. Summary of the invention
[0005] In order to solve the problems and needs in the background technology, the purpose of the present invention is to provide a method and system for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house, which has the characteristics of high precision, low cost and easy maintenance, and can achieve the following functions:
[0006] (1) Real-time acquisition and transmission of high-quality egg video data;
[0007] (2) Multi-target instance segmentation and multi-target real-time tracking;
[0008] (3) Accurately count, weigh and trace eggs of multiple categories;
[0009] (4) Analyze the health status of laying hens based on the egg-laying performance data at the cage level, assist farmers in checking cages with abnormal egg-laying conditions, and promptly identify and handle weak, sick, and dead chickens.
[0010] The technical solution adopted by the present invention is:
[0011] 1. A method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house
[0012] Step 1: Mark the egg conveyor belt with a marking strip according to the total length of the chicken cage; and install the data acquisition module above the egg conveyor belt;
[0013] Step 2: Use the data acquisition module to shoot the egg conveyor belt, the eggs on the conveyor belt, and the marking strips to obtain a conveyor belt-egg video, and then obtain a conveyor belt-egg image sequence;
[0014] Step 3: After using the multi-category egg segmentation model to identify the marker bar and the eggs in each frame of the conveyor belt-egg image sequence, the corresponding marker bar recognition result and egg detection information are obtained; according to the marker bar recognition result and egg detection information of each frame, the eggs and marker bars are tracked respectively, the corresponding tracking results are obtained, and the situation of them passing through the preset counting line is recorded;
[0015] Step 4: Based on the egg detection information, the egg weight inversion model is used to invert the weight of each egg to obtain the weight of each egg;
[0016] Step 5: According to the conveyor belt-egg image sequence, use the conveyor belt static and dynamic detection method to calculate the actual running time of the egg conveyor belt; then, in combination with the time when the marking strip and the eggs pass the counting line and the obtained IDs of each egg through tracking, calculate the cage number of each egg and the egg production situation of each cage, and complete the accurate weighing and cage tracing of the eggs.
[0017] In the said Step 1, the egg conveyor belt is divided into several segments by the marking strip, and there are several consecutive conveyor belts with the same length, satisfying S = L / n * k + s1, where 0 < s1 < L / n, S is the total length of the egg conveyor belt, L is the total length of a single-layer chicken cage, n is the equal division number of the total length of the chicken cage, k is the number of segments of the consecutive conveyor belts with the same length, and s1 is the remaining length after equal division of the egg conveyor belt.
[0018] In the said Step 2, after frame extraction and preprocessing of the conveyor belt-egg video, a conveyor belt-egg image sequence is obtained.
[0019] In the said Step 3, according to the recognition results of the marking strip in each frame and the egg detection information, track and record the passing time of the eggs and the marking strip, specifically:
[0020] According to the egg detection information, use the egg tracking model to continuously track the eggs in each frame image and assign a unique ID to each egg. When the center coordinates of an egg pass the preset counting line in the image frame, the egg count increases, and record the egg ID and passing time when the center coordinates of the egg pass the counting line; when the recognition result of the marking strip is that there is a marking strip, track and record the time when each marking strip passes the counting line.
[0021] In the said Step 4, fit the egg segmentation mask in each egg detection information into an egg-shaped curve, extract the x value of the center coordinate and the y value of the center coordinate in the current field of view of the egg-shaped curve and each curve parameter, and record them as egg-shaped curve information. Use the egg-shaped curve information as an independent variable and input it into the egg weight accurate inversion model, and the model outputs the weight of the egg.
[0022] In the said Step 5, according to the conveyor belt-egg image sequence, use the conveyor belt static and dynamic detection method to calculate the actual running time of the egg conveyor belt, specifically:
[0023] If no eggs are detected in the current frame image, judge the static and dynamic state of the conveyor belt according to the similarity between the front and back frame images; if eggs are detected in the current frame image, judge the static and dynamic state of the conveyor belt according to whether the eggs with the same ID are displaced between the front and back frames. The displacement of the eggs is the Euclidean distance between the center coordinates of the eggs with the same ID in the front and back frames, and then statistically calculate the actual running time of the egg conveyor belt.
[0024] 2. A precise egg weighing and cage tracing system for stacked cage laying hens
[0025] A data acquisition module is used to shoot the egg conveyor belt and the marking strips and eggs on the conveyor belt, obtain the conveyor belt-egg video and send it to the data transmission and receiving module;
[0026] The data acquisition module is installed above the egg conveyor belt at one end of the chicken cage close to the central egg collector. The data acquisition module includes a machine vision housing, a color camera and a fill light. The color camera is installed in the middle of the top of the machine housing, and the fill light is used to provide the best shooting lighting environment;
[0027] The data transmission and receiving module is used to transmit the conveyor belt-egg video to the data processing module. After the data processing module completes the video processing, the processing result is transmitted back to the data transmission and receiving module and communicates with the terminal;
[0028] The data processing module is used to perform image processing on the received conveyor belt-egg video, obtain the processing result and return the processing result to the data transmission and receiving module.
[0029] The data processing module comprises:
[0030] A preprocessing unit, used for performing frame extraction and preprocessing on the conveyor belt-egg video to obtain a conveyor belt-egg image sequence;
[0031] A multi-category instance segmentation unit is used to input the conveyor belt-egg image sequence into the multi-category egg segmentation model, segment the eggs and the marking strips on the conveyor belt, and obtain the marking strip recognition result and the egg detection information;
[0032] A multi-target real-time tracking unit, used for receiving the bounding box coordinates and the egg segmentation mask in the egg detection information of the egg, assigning a unique ID number to each egg using the egg tracking model, and tracking the eggs in real time, obtaining the position coordinates and the egg segmentation mask of each egg in different video frames, and tracking the marker strip in real time and recording the passing time when the marker strip passes through the counting line;
[0033] The egg precision weighing unit is used to fit an egg-shaped curve based on the egg segmentation mask of each egg, extract the center coordinate x value and the center coordinate y value of the egg-shaped curve in the current field of view and various curve parameters and record them as egg-shaped curve information, use the egg-shaped curve information as an independent variable and input it into the egg weight precision inversion model, and the model outputs the weight of the egg;
[0034] The egg precision counting unit is used to count the eggs based on the tracking results of each egg and adopt the line collision strategy; specifically, when the center coordinates of the egg pass through the counting line, the number of eggs increases accordingly, and the egg ID and the passing time when the center coordinates of the egg pass through the counting line are recorded. When eggs with the same ID pass through the counting line repeatedly, they are not counted repeatedly;
[0035] The conveyor belt static detection unit is used to determine the static and dynamic state of the conveyor belt based on the marking strip recognition result, egg detection information and target tracking result. If no egg is detected in the current frame image, the static and dynamic state of the conveyor belt is determined according to the similarity between the previous and next frame images. If an egg is detected in the current frame image, the static and dynamic state of the conveyor belt is determined according to whether the egg with the same ID is displaced in the previous and next frames. The displacement of the egg is the Euclidean distance between the center coordinates of the egg with the same ID in the previous and next frames, thereby calculating the actual running time of the egg conveyor belt.
[0036] The egg precision cage tracing unit is used to calculate the cage number of each egg and the egg-laying situation of each cage by combining the actual running time of the egg conveyor belt and the time when the eggs and the marking strip pass the counting line;
[0037] The data storage and transmission unit is used to store the processing results and transmit the processing results through the data transmission and receiving module.
[0038] 3. A storage medium
[0039] The medium stores a computer program, and when the computer program is executed by the processor, the steps of the method for accurately measuring the weight of eggs and tracing the cages in a stacked cage laying hen house are implemented.
[0040] IV. A COMPUTER PROGRAM PRODUCT
[0041] The product includes a computer program / instruction, which, when executed by a processor, implements the steps of a method for accurately measuring the weight of eggs laid in a stacked cage laying hen house and tracing the cages.
[0042] The beneficial effects of the present invention are as follows:
[0043] 1) The present invention applies egg-shaped curve fitting to the precise weighing task of eggs in a stacked cage mode for the first time, thereby improving the accuracy of egg weighing.
[0044] 2) The present invention does not require modification of existing laying hen cages, and based on the marking strip recognition and conveyor belt static detection method, the accuracy of egg cage tracing is improved; the conveyor belt can be started and stopped at any time, and there is no need to return the conveyor belt to its original position, which improves the practicability of the present invention in actual applications.
[0045] 3) The present invention can obtain egg-laying performance data at the cage level, which is helpful for early warning and timely discovery of abnormal cage positions, and is of great significance for refined management of breeding.
[0046] 4) The hardware system formed by the present invention has the characteristics of simple structure, low cost and easy installation and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A flow chart of a method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house provided in an embodiment of the present invention.
[0048] Figure 2 A schematic diagram of a data acquisition system provided by an embodiment of the present invention.
[0049] Figure 3 A schematic diagram of a method for accurately tracing eggs to cages provided in an embodiment of the present invention.
[0050] Figure 4 A schematic diagram of the ByteTrack multi-target tracking method provided in an embodiment of the present invention.
[0051] Figure 5 A flow chart of an accurate egg weighing and cage tracing system for a stacked cage laying hen house provided in an embodiment of the present invention.
[0052] In the figure: 1 is the machine vision shell; 2 is the USB camera; 3 is the USB fill light; 4 is the egg. DETAILED DESCRIPTION
[0053] The present invention will be further described below in conjunction with embodiments, but the protection scope of the present invention is not limited thereto:
[0054] like Figure 1 and Figure 4 As shown, the present invention provides a method for accurately measuring the weight of eggs and tracing the cages in a stacked cage laying hen house, comprising the following steps:
[0055] Step 1: Mark the egg conveyor belt with a marking strip according to the total length of the chicken cage; install a data acquisition module above the egg conveyor belt near the central egg collector at one end of the chicken cage, and the distance between the data acquisition module and the starting point of the chicken cage is s2; manually fix the marking strip on the egg conveyor belt at standard intervals, and the color and shape of the marking strip are not affected by the working time of the conveyor belt. Figure 3As shown, the egg conveyor belt is divided into 5 sections by the marking strips and there are 4 continuous sections of the conveyor belt with the same length, satisfying S=L / 2*4+s1, where the total length of the egg conveyor belt is S=105m, the total length of the single-layer chicken cage is L=50.4m, and the remaining length of the egg conveyor belt after being divided equally is s1=4.2m. That is, each time the chicken house conveys eggs, the conveyor belt runs at least 50.4m, which ensures that at least 2 marking strips appear in the captured video.
[0056] Step 2: Use the data acquisition module to shoot the egg conveyor belt, the eggs on the conveyor belt, and the marking strips to obtain a conveyor belt-egg video, and then perform frame extraction and preprocessing on the conveyor belt-egg video to obtain a conveyor belt-egg image sequence;
[0057] Step 3: After using the multi-category egg segmentation model to identify the marker bar and the eggs in each frame of the conveyor belt-egg image sequence, the corresponding marker bar recognition result and egg detection information are obtained. The egg detection information includes the egg classification information, egg segmentation mask, and polygon coordinates; according to the marker bar recognition result and egg detection information of each frame, the eggs and marker bars are tracked respectively, the corresponding tracking results are obtained, and the situation of their passing through the preset counting line is recorded;
[0058] According to the identification results of the marker strips in each frame and the egg detection information, the eggs and marker strips are tracked and the passing time is recorded, specifically:
[0059] According to the egg detection information, the egg tracking model is used to continuously track the eggs in each frame and assign a unique ID to each egg. If the center coordinates of an egg pass through the preset counting line in the image screen, the number of eggs increases, and the egg ID and the passing time when the center coordinates of the egg pass through the counting line are recorded; if the marking bar recognition result is that there is a marking bar, the time when each marking bar passes the counting line is tracked and recorded. Among them, the preset counting line in the image screen is perpendicular to the movement direction of the conveyor belt.
[0060] The multi-category egg segmentation model is specifically the YOLOv8n-S model, which includes an efficient backbone network Backbone for extracting image features, a neck network Neck for further processing the feature maps extracted from the Backbone to fuse feature information of different scales, and a head network Head for target segmentation and classification. The YOLOv8n-S model is obtained by optimizing the YOLOv8n model. The optimization method is as follows: For the Backbone part, a more efficient convolution operation is adopted, that is, the standard convolution is replaced by the depthwise separable convolution, which can maintain high performance while reducing the amount of calculation; and the CBAM (Convolutional Block Attention Module) attention module that combines the spatial and channel attention mechanisms is introduced to adaptively enhance important feature channels and suppress unimportant feature channels, thereby improving the model's learning ability for key features; for the Neck part, a lightweight cross-scale feature fusion module CCFM (Cross-Scale Feature Fusion Module) is used to replace the original Neck part to promote information exchange between feature maps of different levels, so that high-level semantic information can be transmitted to the low-level while maintaining the detailed features of the low-level, that is, enhancing the feature fusion ability of the model. In addition, in order to further speed up the inference speed of the model, the YOLOv8n-S model is used as the teacher model, and the Contrastive Representation Distillation method is used to train a student model YOLOv8n-S with comparable segmentation accuracy but faster running speed.
[0061] The egg tracking model is the ByteTrack method, which uses the bounding box of the target to achieve continuous tracking of the target in the video sequence. It is characterized by high precision, real-time performance, and easy integration. It can achieve fast tracking processing while maintaining high tracking accuracy. Compared with the complex tracking methods such as DeepSORT, ByteTrack does not require additional training sets, has a simpler principle and runs faster, and can meet the tracking accuracy requirements. The specific tracking steps are as follows: Figure 4 As shown in the figure, first find the target in each frame of the video according to the above instance segmentation model, use Kalman filtering to predict the possible position of the target in the next frame, match the detection result of the current frame with the predicted position and connect them into a continuous trajectory, then perform dynamic matching of the target, give priority to matching high-confidence targets, and then process low-confidence targets, finally update the status of the matched trajectory to create a new trajectory, and end the trajectory that has not been matched for a long time.
[0062] Construct a high-quality multi-category instance segmentation dataset. Obtain video data from the ends of the egg conveyor belts on each layer in a stacked cage laying hen house, extract the video by frames, and perform image preprocessing on the extracted frame images to produce a high-quality multi-target instance segmentation dataset, which contains two major target categories: eggs and markers. The dataset is semi-automatically annotated using the SegmentAnything model, which can greatly reduce the cost of manual annotation and save annotation time while ensuring annotation accuracy; the annotation results are saved in YOLOv8 format, that is, a txt format annotation text is generated for each image, including the category of each target in the image, the coordinates of the target detection box, and the segmentation mask; the annotation results are cleaned, checked, and corrected, such as removing or correcting inconsistent / wrong annotation information.
[0063] The target categories in the dataset include eggs (normal eggs, cracked eggs, soft-shell eggs, blood-spotted eggs, and dirty eggs) and markers. Since only normal eggs can be sold directly, the other types of eggs are defective eggs, which are closely related to the health of laying hens. Therefore, only the identified normal eggs are sent to the weight inversion model in step 4, and the counting and tracing of defective eggs are not affected. The training set: validation set: test set in the dataset = 6:2:2, which are used for model training, validation, and testing respectively. After using this dataset to train and validate the YOLOv8n-S model, a multi-category egg segmentation model was obtained.
[0064] The following evaluation parameters are used to evaluate model performance during model training, verification and testing: precision, recall, accuracy and mean average precision (mAP), which respectively satisfy Precision = TP / (TP+FP), Accuracy = TP+TN / (TP+TN+FP+FN), and mAP = (1 / C)∑ c=1 C AP c , where TP is True Positive, the number of instances correctly predicted as positive, that is, the actual positive class and correctly predicted as positive by the model; TN is True Negative, the number of instances correctly predicted as negative, that is, the actual negative class and correctly predicted as negative by the model; FP is False Positive, the number of instances incorrectly predicted as positive, that is, the actual negative class, but incorrectly predicted as positive by the model; FN is False Negative, the number of instances incorrectly predicted as negative, that is, the actual positive class, but incorrectly predicted as negative by the model; C is the total number of categories, AP c It is the average precision of the cth category. The specific calculation result of AP is the area under the Precision-Recall curve of each category.
[0065] Step 4: According to the egg detection information, first screen the eggs according to the egg categories in the egg detection information to obtain normal eggs, and then use the egg weight inversion model to invert the weight of each normal egg to obtain the weight of each egg; specifically, for each egg, fit the egg segmentation mask in each egg detection information into an egg-shaped curve (i.e., an oval curve), extract the center coordinate x value and the center coordinate y value of the egg-shaped curve in the current field of view and each curve parameter and record them as egg-shaped curve information (including the angle θ between the long axis of the egg and the horizontal direction, the long axis length H, the short axis length W, the circumference C, the area A and other parameters), use the egg-shaped curve information as an independent variable and input it into the egg weight precise inversion model, and the model outputs the weight of the egg.
[0066] The formula for the egg-shaped curve equation is as follows:
[0067] y=±B / 2((L 2 -4x 2 ) / (L 2 +8wx+4x 2 )) 0.5
[0068] Among them, x and y are the coordinate points of the egg-shaped curve, B is the maximum width of the egg, L is the length of the egg, and w is the distance between the two vertical axes of the maximum width and half the length of the egg.
[0069] The accurate inversion model of egg weight is a neural network regression model Neural Network Regression. Before training, the independent variables need to be checked for multicollinearity, the independent variables with strong collinearity are eliminated, and the independent variables are normalized to accelerate the convergence speed of the neural network regression model. During training, the egg-shaped curve information is used as the independent variable, and the true value of the egg weight is used as the dependent variable. After training the neural network regression model Neural Network Regression, the accurate inversion model of egg weight is obtained. Specifically, a distortion-free low-power USB color camera is used to obtain the video screen of the egg along the running direction of the conveyor belt, and the screen is frame-divided and extracted to obtain multiple images. The above images are input into the multi-category egg segmentation model and the egg tracking model, and the coordinate position and segmentation mask of the egg with the same ID number in the image can be obtained. The segmentation mask of the egg with the same ID number in the above different images is input into the egg weight inversion model, and multiple weight values g of the same egg can be obtained. Considering that the conveyor belt may shake slightly during operation and the egg has the smallest deformation when it is located in the middle area of the image, the average of the egg weight inversion results when the same egg is located in the middle 1 / 2 area of the image is taken as the final weight value g of the egg.
[0070] Step 5: Based on the conveyor belt-egg image sequence, the actual running time of the egg conveyor belt is calculated using the conveyor belt static detection method; then, combined with the time when the marking bar and the egg pass the counting line and the tracked egg center coordinates pass the counting line, the egg ID of each egg is calculated to obtain the chicken cage number of each egg and the egg laying situation of each chicken cage. The egg laying situation includes the number of eggs, egg type, and egg weight, and the accurate weight measurement and cage tracing of eggs are completed.
[0071] In step 5, considering that the egg conveyor belt usually pauses multiple times during its actual operation, in order to accurately trace the eggs back to the cage, it is necessary to analyze the static and dynamic state of the conveyor belt in the video to calculate the actual running time of the conveyor belt. Based on the conveyor belt-egg image sequence, the actual running time of the egg conveyor belt is calculated using the static and dynamic detection method of the conveyor belt, specifically:
[0072] If no eggs are detected in the current frame image, the dynamic and static state of the conveyor belt is determined by comparing the similarity between the previous and next frame images with the preset similarity threshold; if eggs are detected in the current frame image, the dynamic and static state of the conveyor belt is determined by whether the eggs with the same ID are displaced in the previous and next frames. The displacement of the eggs is the Euclidean distance between the center coordinates (x1, y1) and (x2, y2) of the eggs with the same ID in the previous and next frames. If there is displacement, the conveyor belt is in operation, and the actual operation time of the egg conveyor belt is counted. Among them, the similarity between images uses the structural similarity index SSIM, which takes into account information in three aspects: brightness, contrast, and structure, to avoid errors in the static and static detection of the conveyor belt caused by sudden changes in illumination or sudden distortion of the image, which in turn affects the subsequent egg tracing results.
[0073] When a marking bar is identified in the image, the marking bar is tracked and the time t2 when its center coordinate passes through the preset counting line is recorded, and the actual running time T of the conveyor belt is calculated based on the statistics. 动 , satisfying T 动 =T 总 -T 静 , combined with the time t1 when the center coordinates of each egg pass through the above preset counting line, high-precision cage tracing of each egg can be achieved.
[0074] Specific steps for high-precision egg tracing are:
[0075] It is known that the total length of a single-layer chicken cage is L, the total number of chicken cages is N, the length of a single chicken cage is z, the distance between the two marking bars is L / 2, and the distance between the camera and the starting position of the first chicken cage is s2; through the unique ID number and weight g of each egg, the total number of eggs on the conveyor belt, the time t1 and t2 for each egg and marking bar to pass the counting line, and the actual running time T of the conveyor belt 动 .
[0076] Calculate the time difference between two markers passing the counting line, t=t2-t2', where t2 and t2' are the time between two consecutive markers passing the counting line. When three markers appear on the screen, two time differences can be calculated, and their average is taken as the final result, that is, the time for the conveyor belt to run L / 2 distance is t, and the time for the conveyor belt to run a single chicken cage length is t z =2t / N, and the running time t from the camera to the starting position of the chicken cage can be further obtained s =s2×t / z, where z is the length of a single chicken cage. Therefore, the total time required for the conveyor belt to run from the camera to the end of the last chicken cage should be T =N×t z +t s .
[0077] Considering that the egg conveyor belt at the breeding site cannot be guaranteed to run exactly for the above T time during actual operation, and usually T 动 >T, so take T 动 The first period of time T in the egg cage is used for egg cage tracing, then the cage tracing result of each egg i (i.e. cage position number Cage i ) is Cage i =ceil( (Tt s ) / t i ), where ceil() is a round-up operation, t i is the time when egg i passes the counting line. Based on the above, the type, quantity and weight information of eggs produced by each chicken cage can be obtained, providing effective information for timely detection of abnormal chicken cages.
[0078] like Figure 5 As shown, the present invention proposes a precise egg weighing and cage tracing system for a stacked cage laying hen house. The facilities used in the stacked cage laying hen house include special cages for laying hens, a traveling automatic feeding device, an automatic water supply pipeline, an automatic egg collection system and a manure cleaning system. The automatic egg system includes an egg conveyor belt and a central egg collector. The eggs laid by the laying hens in each cage first roll onto the egg conveyor belt, and then the eggs are transported to the central egg collector along the conveyor belt. Usually, the egg conveyor belt runs once a day at a fixed time. Specifically including:
[0079] A data acquisition module is used to shoot the egg conveyor belt and the marking strips and eggs 4 on the conveyor belt, obtain the conveyor belt-egg video and send it to the data transmission and receiving module;
[0080] The data acquisition module is installed on the side of the egg conveyor belt at one end of the chicken cage (i.e., close to the central egg collector) to obtain color video data when the egg conveyor belt is running. Figure 2As shown, the data acquisition module includes a machine vision housing 1, a USB color camera 2 and a USB fill light 3. The color camera is installed in the middle of the top of the machine housing, and the fill light is used to provide the best shooting lighting environment. Reflective material is attached to the inside of the machine vision housing to ensure the image clarity and accurate capture of details, and improve the imaging effect of the camera. The color camera uses a USB low-power color camera without distortion or with distortion correction function. The USB fill light can adjust the color temperature and light intensity to meet the needs of different scenes.
[0081] This module can be installed on each egg conveyor belt or on designated conveyor belts according to the actual needs of the laying hen house. If several conveyor belts are designated for installation, in order to obtain the egg-laying information of all cages in the entire chicken house, the module can be installed on multiple conveyor belts in succession in combination with the time planning of egg collection in the chicken house.
[0082] The data transmission and receiving module is used to wirelessly transmit the conveyor belt-egg video to the data processing module. After the data processing module completes the video processing, the processing result is transmitted back to the data transmission and receiving module and communicates with the terminal. The processing result includes a visualized video of multi-target segmentation and tracking of the source video, and information such as the category, quantity and weight of eggs produced in each cage in the laying hen house. During the wireless transmission process, the source video can be losslessly compressed to reduce the amount of data, improve transmission efficiency and save bandwidth.
[0083] The data processing module is used to perform image processing according to the received conveyor belt-egg video or image data, obtain the processing result and return the processing result to the data transmission and receiving module.
[0084] The terminal includes PC and mobile terminals. Users can register and log in to their accounts to remotely view the egg conveyor operation video and the historical egg-laying information of each laying hen cage. Both the PC and mobile terminals have data analysis functions, which can draw various types of charts based on the historical egg-laying information of each laying hen cage to intuitively display the egg-laying fluctuations. The egg-laying information of each laying hen cage can be automatically compared horizontally and vertically, that is, the egg-laying conditions of different cages on the same day and the egg-laying conditions of the same cage over time can be compared. When an abnormal cage is found, an alarm message will be pushed to the user in a timely manner.
[0085] The data processing module includes:
[0086] A preprocessing unit, used for performing frame extraction and preprocessing on the conveyor belt-egg video to obtain a conveyor belt-egg image sequence;
[0087] A multi-category instance segmentation unit is used to input the conveyor belt-egg image sequence into a multi-category egg segmentation model, segment the eggs (normal eggs, cracked eggs, soft-shell eggs, blood-spotted eggs, and dirty eggs) and the marking strips on the conveyor belt, and obtain the marking strip recognition results and egg detection information;
[0088] A multi-target real-time tracking unit is used to receive the bounding box coordinates and the egg segmentation mask in the egg detection information of the egg, assign a unique ID number to each egg using the egg tracking model, and track the eggs in real time, obtain the position coordinates and the egg segmentation mask of each egg in different video frames (i.e., different moments), and track the marker strip in real time and record the passing time when the marker strip passes through the counting line;
[0089] The egg precise weighing unit is used to fit an egg-shaped curve (i.e., an oval curve) based on the egg segmentation mask of each egg, extract the center coordinate x value and the center coordinate y value of the egg-shaped curve in the current field of view and various curve parameters and record them as egg-shaped curve information (including the angle θ between the major axis and the horizontal direction, the major axis length H, the minor axis length W, the circumference C, the area A and other parameters), use the egg-shaped curve information as an independent variable and input it into the egg weight precise inversion model, and the model outputs the weight of the egg; the egg weight precise inversion model takes the average weight calculated in the video frame when the same egg is located in the middle 1 / 2 area of the image as the weight of the egg.
[0090] The egg precision counting unit is used to count the eggs based on the tracking results of each egg and adopt the line collision strategy; specifically, when the center coordinates of the egg pass through the counting line located at the center of the image screen and perpendicular to the running direction of the egg, the number of eggs increases accordingly, and the egg ID and the passing time when the center coordinates of the egg pass through the counting line are recorded. When eggs with the same ID pass through the counting line repeatedly, they are not counted repeatedly;
[0091] The conveyor belt static and static detection unit is used to determine the static and dynamic state of the conveyor belt based on the marking strip recognition result, egg detection information and target tracking result. If no egg is detected in the current frame image, the static and dynamic state of the conveyor belt is determined by comparing the similarity SSIM between the previous and next frame images with a preset similarity threshold; if an egg is detected in the current frame image, the static and dynamic state of the conveyor belt is determined based on whether the egg with the same ID is displaced in the previous and next frames. The displacement of the egg is the Euclidean distance between the center coordinates (x1, y1) and (x2, y2) of the egg with the same ID in the previous and next frames. If there is displacement, the conveyor belt is in operation, and the actual operation time of the egg conveyor belt is calculated.
[0092] The egg precision cage tracing unit is used to accurately trace the detected eggs to cages and calculate the cage number of each egg and the egg-laying situation of each cage based on the actual running time of the egg conveyor belt, the time when the eggs and the marking strips pass the counting line, the total length of the cages, the total number of cages, the length of a single cage, the distance between the two marking strips, the distance between the camera and the starting position of the first cage, and other parameters;
[0093] The data storage and transmission unit is used to store the processing results of the above video, including segmentation and tracking videos, egg laying category, quantity and weight information of each cage, and the processing results can be transmitted and received through the data transmission and receiving module for users to view.
[0094] Finally, it should be noted that the above embodiments and explanations are only used to illustrate the technical solution of the present invention rather than to limit it. Those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope disclosed in the technical solution of the present invention, which should be included in the scope of protection of the claims of the present invention.
Claims
1. A method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house, characterized in that: It includes the following steps: Step 1: Mark the egg conveyor belt according to the total length of the chicken coop using a marking strip; And install a data acquisition module above the egg conveyor belt; Step 2: Use the data acquisition module to photograph the egg conveyor belt, the eggs and the marking strip on the conveyor belt to obtain a conveyor belt-egg video, and then obtain a conveyor belt-egg image sequence; Step 3: After using the multi-class egg segmentation model to identify the marking strip, identify and classify the eggs in each frame of the conveyor belt-egg image sequence, the corresponding marking strip recognition result and egg detection information are obtained; According to the marking strip recognition results and egg detection information of each frame, track the eggs and the marking strip respectively, obtain the corresponding tracking results and record the situation of their passing through the pre-designed counting line; Step 4: According to the egg detection information, use the egg weight inversion model to invert the weight of each egg respectively to obtain the weight of each egg; Step 5: According to the conveyor belt-egg image sequence, use the conveyor belt static and dynamic detection method to calculate the actual running time of the egg conveyor belt; then combine the time when the marking strip and the egg pass through the counting line and the ID of each egg obtained by tracking to calculate the chicken coop number of each egg and the egg production situation of each chicken coop, and complete the accurate weighing and tracing of the chicken coop of the eggs; In the said Step 4, the egg segmentation mask in each egg detection information is fitted into an egg-shaped curve, the x value of the central coordinate and the y value of the central coordinate in the current field of view of the egg-shaped curve and each curve parameter are extracted and recorded as egg-shaped curve information, and the egg-shaped curve information is used as an independent variable and input into the egg weight accurate inversion model, and the model outputs the weight of the egg; The formula of the egg-shaped curve equation is as follows: y=±B / 2((L 2 -4x 2 ) / (L 2 +8wx+4x 2 )) 0.5 Where x, y are the coordinate points of the egg-shaped curve, B is the maximum width of the egg, L is the length of the egg, and w is the distance between the two vertical axes of the maximum width of the egg and half of the length.
2. The method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house according to claim 1, characterized in that: In the said Step 1, the egg conveyor belt is divided into several segments by the marking strip and there are several consecutive conveyor belts with the same length, satisfying S = L / n * k + s1, 0 < s1 < L / n, where S is the total length of the egg conveyor belt, L is the total length of a single-layer chicken coop, n is the equal division number of the total length of the chicken coop, k is the number of segments of the consecutive conveyor belts with the same length, and s1 is the remaining length after equal division of the egg conveyor belt.
3. The method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house according to claim 1, characterized in that: In the said Step 2, after frame extraction and preprocessing of the conveyor belt-egg video, a conveyor belt-egg image sequence is obtained.
4. The method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house according to claim 1, characterized in that: In the said Step 3, according to the marking strip recognition results and egg detection information of each frame, track the eggs and the marking strip and record the passing time, specifically: According to the egg detection information, use the egg tracking model to continuously track the eggs in each frame of the image and assign a unique ID to each egg. If the central coordinate of an egg passes through the pre-set counting line in the image frame, the egg count increases, and record the egg ID and passing time when the central coordinate of the egg passes through the counting line; if the marking strip recognition result is that there is a marking strip, then track and record the time when each marking strip passes through the counting line.
5. The method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house according to claim 1, characterized in that: In step 5, the actual running time of the egg conveyor belt is calculated according to the conveyor belt-egg image sequence using the conveyor belt static detection method, specifically: If no egg is detected in the current frame image, the dynamic state of the conveyor belt is judged based on the similarity between the previous and next frame images; if an egg is detected in the current frame image, the dynamic state of the conveyor belt is judged based on whether the egg with the same ID is displaced in the previous and next frames. The displacement of the egg is the Euclidean distance between the center coordinates of the egg with the same ID in the previous and next frames, and the actual running time of the egg conveyor belt is then counted.
6. A stacked cage laying hen house egg laying accurate weight measurement and cage tracing system, characterized in that: include: A data acquisition module is used to shoot the egg conveyor belt and the marking strips and eggs on the conveyor belt, obtain the conveyor belt-egg video and send it to the data transmission and receiving module; The data acquisition module is installed above the egg conveyor belt at one end of the chicken cage close to the central egg collector. The data acquisition module includes a machine vision housing, a color camera and a fill light. The color camera is installed in the middle of the top of the machine housing, and the fill light is used to provide the best shooting lighting environment; The data transmission and receiving module is used to transmit the conveyor belt-egg video to the data processing module. After the data processing module completes the video processing, the processing result is transmitted back to the data transmission and receiving module and communicates with the terminal; A data processing module is used to perform image processing on the received conveyor belt-egg video, obtain the processing result and return the processing result to the data transmission and receiving module; The data processing module includes an egg precision weighing unit, which is used to fit an egg-shaped curve based on the egg segmentation mask of each egg, extract the center coordinate x value and the center coordinate y value of the egg-shaped curve in the current field of view and various curve parameters and record them as egg-shaped curve information, use the egg-shaped curve information as an independent variable and input it into the egg weight precision inversion model, and the model outputs the weight of the egg; The formula for the egg-shaped curve equation is as follows: y=±B / 2((L 2 -4x 2 ) / (L 2 +8wx+4x 2 )) 0.5 Among them, x and y are the coordinate points of the egg-shaped curve, B is the maximum width of the egg, L is the length of the egg, and w is the distance between the two vertical axes of the maximum width and half the length of the egg.
7. The stacked cage laying hen house egg laying accurate weight measurement and cage tracing system according to claim 6, characterized in that: The data processing module also includes: A preprocessing unit, used for performing frame extraction and preprocessing on the conveyor belt-egg video to obtain a conveyor belt-egg image sequence; A multi-category instance segmentation unit is used to input the conveyor belt-egg image sequence into the multi-category egg segmentation model, segment the eggs and the marking strips on the conveyor belt, and obtain the marking strip recognition result and the egg detection information; A multi-target real-time tracking unit, used for receiving the bounding box coordinates and the egg segmentation mask in the egg detection information of the egg, assigning a unique ID number to each egg using the egg tracking model, and tracking the eggs in real time, obtaining the position coordinates and the egg segmentation mask of each egg in different video frames, and tracking the marker strip in real time and recording the passing time when the marker strip passes through the counting line; The egg precision counting unit is used to count the eggs based on the tracking results of each egg and adopt the line collision strategy; specifically, when the center coordinates of the egg pass through the counting line, the number of eggs increases accordingly, and the egg ID and the passing time when the center coordinates of the egg pass through the counting line are recorded. When eggs with the same ID pass through the counting line repeatedly, they are not counted repeatedly; The conveyor belt static detection unit is used to determine the static and dynamic state of the conveyor belt based on the marking strip recognition result, egg detection information and target tracking result. If no egg is detected in the current frame image, the static and dynamic state of the conveyor belt is determined according to the similarity between the previous and next frame images; if an egg is detected in the current frame image, the static and dynamic state of the conveyor belt is determined according to whether the egg with the same ID is displaced in the previous and next frames, and the displacement of the egg is the Euclidean distance between the center coordinates of the egg with the same ID in the previous and next frames, thereby calculating the actual running time of the egg conveyor belt; The egg precision cage tracing unit is used to calculate the cage number of each egg and the egg-laying situation of each cage by combining the actual running time of the egg conveyor belt and the time when the eggs and the marking strip pass the counting line; The data storage and transmission unit is used to store the processing results and transmit the processing results through the data transmission and receiving module.
8. A storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the steps of the method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house as described in any one of claims 1 to 5 are implemented.
9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of a method for accurately measuring the weight and tracing the eggs in a stacked cage laying hen house as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and system for monitoring egg laying performance of laying hen zone of cage-rearing laying hens
CN111134047A
Egg counting and positioning system in stacked cage culture mode
CN114842470A
Egg weight detecting and grading method and system based on deep learning
CN116883921A
Multi-channel location fine egg laying performance monitoring method and system for laying hen house
CN116091473A
Hen egg distribution measuring device, egg-collecting hen house feeding management system, and hen egg distribution measuring method
JP2024054082A