Automatic detection and analysis method and system for piglet squeezing event of sow

Through video data processing and deep learning network, the pose and fatal areas of sows and piglets are identified, and the occlusion problem in the detection of sow squeezed piglets is solved, and accurate detection and automatic analysis of the number of squeezed piglets is realized.

CN119229530AActive Publication Date: 2024-12-31SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411288008.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2024-12-31
Estimated Expiration
2044-09-13

AI Technical Summary

Technical Problem

The prior art is difficult to accurately detect the number of sows squeezed piglets, especially when the sows lie on their side, which makes it difficult to timely monitor the specific number of compressed piglets.

Method used

By obtaining video data of the living of breastfeeding sows and piglets, identifying the piglet mask profile, sow posture and key points in the video frame, filtering out the side lying state, determining the fatal area, and tracking based on the deep learning network to calculate the IOU Values ​​are used to determine whether the piglet is in the fatal area, thereby automatically detecting the squeeze event.

Benefits of technology

Accurate detection of sow squeezed piglet incidents is achieved, the occlusion problem is solved, and the number of squeezed piglets can be detected efficiently and accurately, providing a new method for automatic evaluation and automatic detection of sow fetality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119229530A_ABST
    Figure CN119229530A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic detection and analysis method for an event that a sow squeezes a piglet. The method comprises the following steps: acquiring video data of common life of the lactating sow and the piglet as an initial data set; performing identification based on the initial data set to obtain piglet mask contours, sow postures, sow mask contours and key points of all video frames; screening the initial data set based on sow postures to obtain a basic data set; obtaining different fatal areas based on the basic data set and the corresponding sow mask contours and key points; determining a final fatal area based on the fatal area; tracking the piglet in the final fatal area based on the basic data set and the piglet mask contour to obtain a tracking result; and obtaining the number of the squeezed piglets based on the tracking result. The deadly area of the sows extruding the piglets can be accurately positioned, and the number of the sows extruding the piglets can be detected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and more particularly to an automatic detection and analysis method and system for an event in which a sow squeezes a piglet. Background Art

[0002] At present, according to extensive research, sow crushing is the main cause of piglet mortality, especially in the early stage before weaning. There are many risks of piglet compression, and suffocation and physical injuries caused by sow crushing are the direct causes of piglet death. Although manual monitoring can prevent crushing incidents to a certain extent, this method is neither efficient nor economical in modern large-scale farming models.

[0003] Although intelligent devices based on computer vision have begun to be applied to the smart farming industry, they are mainly focused on simple analysis of pig behavior. For the detection and prediction of complex interactive behaviors such as piglet compression when sows lie on their sides, the existing technology is still in the exploratory stage and lacks in-depth research. The piglet compression event when sows lie on their sides is a complex interactive behavior between sows and piglets, and its detection needs to fully consider the interactive relationship between piglets and sows.

[0004] When the sow's back squeezes piglets when she lies on her side, due to the sow's large body, her back often forms a visual obstruction, making it difficult to monitor the specific number of piglets under pressure in a timely and accurate manner.

[0005] Therefore, how to accurately locate the fatal area where the sow squeezes the piglets and then detect the number of piglets squeezed by the sow is a problem that technicians in this field urgently need to solve. Summary of the invention

[0006] In view of this, the present invention provides an automatic detection and analysis method and system for sow squeezing piglets events, which can accurately locate the fatal area where the sow squeezes the piglets and then detect the number of piglets squeezed by the sow.

[0007] In order to achieve the above object, the present invention adopts the following technical solution:

[0008] An automatic detection and analysis method for a sow squeezing piglet event, comprising:

[0009] Obtain video data of lactating sows and piglets living together as the initial data set;

[0010] Based on the initial data set, the piglet mask contour, sow posture, sow mask contour and key points of all video frames are identified;

[0011] Filter the initial data set based on the sow posture to obtain a basic data set;

[0012] Obtain different fatal areas based on the basic data set and the corresponding sow mask contour and key points;

[0013] determining a final lethal area based on the lethal area;

[0014] Tracking the piglet in the final lethal area based on the basic data set and the piglet mask outline to obtain a tracking result;

[0015] The number of squeezed piglets was obtained based on the tracking results.

[0016] Preferably, obtaining the piglet mask contour, sow posture, sow mask contour and key points of all video frames specifically includes:

[0017] Build a deep learning network and perform pre-training to obtain a trained deep learning network;

[0018] Processing is performed based on the initial data set to obtain a plurality of video frame images;

[0019] The video frame image is input into the trained deep learning network to obtain the piglet mask contour, the sow posture, the sow mask contour and the key points.

[0020] Preferably, obtaining the basic data set specifically includes:

[0021] The sow postures include: side-lying and non-side-lying;

[0022] A video frame image F of the sow lying on its side is obtained by screening based on the initial data set;

[0023] The N frames of video images before the video frame image F are selected as the basic data set.

[0024] Preferably, the key points include: the intersection T of the sow's tail and the sow's body and the key point E at the base of the ear.

[0025] Preferably, the different lethal areas include: an arc-shaped lethal area and a back-shaped lethal area;

[0026] The method for determining the arc-shaped fatal area is as follows:

[0027] Get the midpoint M of the line connecting the intersection point T and the key point E at the base of the ear;

[0028] The line passing through the midpoint M and perpendicular to ET intersects with the back and abdomen of the sow mask contour respectively, and obtains a back intersection point V and an abdomen intersection point U correspondingly;

[0029] After the back intersection point V is offset by a distance b along the direction from V to M, a measurement point P is obtained;

[0030] The arc obtained by connecting the three points E, P and T intersects with the sow mask contour to obtain an intersection point R;

[0031] The arc-shaped fatal area is formed by sequentially connecting the intersection point R, the ear base key point E, the measuring point P, the intersection point T, the abdomen intersection point U and the intersection point R.

[0032] Preferably, the method for determining the back-shaped fatal area is:

[0033] After the abdominal intersection point U is offset by a distance k along the UV direction, a node O is obtained;

[0034] Draw a straight line parallel to the ET line through the node O within the sow mask outline;

[0035] The straight line divides the sow mask outline into an upper region and a lower region;

[0036] The upper area is used as the back-shaped fatal area.

[0037] Preferably, determining the final lethal area specifically includes:

[0038] Obtaining a camera position C, and obtaining a vector CV based on connecting the camera position C with the back intersection point V;

[0039] A vector MT is obtained by connecting the midpoint M and the intersection point T;

[0040] Based on the vector MT, the vector MT is first rotated around the midpoint M toward the outside of the sow body until the angle swept when it is in the same direction as the vector CV is used as the evaluation angle;

[0041] Determine whether the evaluation angle within the sow mask outline is greater than 180°. If so, determine that the sow's back is visible, and use the back-shaped lethal area as the final lethal area. Otherwise, determine that the sow's back is not visible, and use the arc-shaped lethal area as the final lethal area.

[0042] Preferably, obtaining the number of squeezed piglets based on the tracking results specifically includes:

[0043] Based on the basic data set, the IOU values ​​of the piglet mask contour and the final fatal area in all video frame images are calculated to obtain multiple IOU values;

[0044] Determine whether the IOU value gradually decreases to 0, and if so, determine that the piglet is not in the final lethal area;

[0045] Otherwise, it is determined that the piglets are located in the final lethal area, and the number of piglets is accumulated into the set of squeezed piglets as the tracking result;

[0046] Determine whether the tracking result is ≥ 1, if so, determine that piglet squeezing has occurred, and use the tracking result as the number of squeezing piglets;

[0047] Otherwise, it is determined that piglet squeezing did not occur.

[0048] Preferably, after determining that piglet squeezing has occurred, the method further comprises:

[0049] Determine whether the piglets in the final fatal area are visible, and if not, take the number of squeezed piglets as the number of invisible squeezed piglets and add them into the invisible set;

[0050] If yes, then determine whether the back contour line of the final fatal area passes through the piglet mask contour, and if yes, determine it as a visible squeezed piglet and accumulate the number to obtain a visible set;

[0051] Otherwise, the piglets that are overlapped but not squeezed are determined and the number is accumulated to obtain the filtered set.

[0052] An automatic detection and analysis system for sow squeezing piglets, comprising: a data acquisition module, a data processing module, a fatal area determination module and a result output module;

[0053] The data acquisition module is used to acquire video data of lactating sows and piglets living together as an initial data set;

[0054] The data processing module is used to identify the piglet mask contour, sow posture, sow mask contour and key points of all video frames based on the initial data set; filter the initial data set based on the sow posture to obtain a basic data set;

[0055] The fatal area determination module is used to obtain different fatal areas based on the basic data set and the corresponding sow mask contour and the key points; and determine the final fatal area based on the fatal areas;

[0056] The result output module is used to track the piglets in the final lethal area based on the basic data set and the piglet mask contour to obtain tracking results; and obtain the number of squeezed piglets based on the tracking results.

[0057] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses an automatic detection and analysis method and system for sow squeezing piglets, which has the following beneficial effects:

[0058] 1. The present invention accurately determines the fatal area where the sow squeezes the piglets when lying on its side based on the method of adaptive fatal area positioning, solves the occlusion problem during the event of the sow squeezing the piglets on its back, and can accurately detect the number of squeezed piglets.

[0059] 2. The present invention realizes efficient automatic analysis of the behavior of side-lying sows squeezing piglets, provides a technical reference for automatic evaluation of sow maternal characteristics, and provides a new method for automatic detection and analysis of sow squeezing piglet behavior. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0061] Figure 1 A flow chart of an automatic detection and analysis method for sow squeezing piglets provided by the present invention.

[0062] Figure 2 A cross-sectional view of a side-lying sow provided by the present invention.

[0063] Figure 3 A schematic diagram of key points and fatal areas of a side-lying sow provided by the present invention.

[0064] Figure 4 A visual graph of the regression relationship between the key points b, d and h provided by the present invention.

[0065] Figure 5 This is a flow chart of the method for determining the final fatal area provided by the present invention.

[0066] Figure 6 This is a flow chart of the method for tracking the number of squeezed piglets provided by the present invention.

[0067] Figure 7 A schematic diagram of the structure of an automatic detection and analysis system for sow squeezing piglets provided by the present invention. DETAILED DESCRIPTION

[0068] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0069] Example 1

[0070] like Figure 1 As shown, the embodiment of the present invention discloses an automatic detection and analysis method of a sow squeezing a piglet event, comprising:

[0071] Obtain video data of lactating sows and piglets living together as the initial data set;

[0072] Based on the initial data set, the piglet mask contour, sow posture, sow mask contour and key points of all video frames are identified;

[0073] The initial data set is screened based on the sow's posture to obtain a basic data set;

[0074] Different fatal areas are obtained based on the basic data set and the corresponding sow mask contours and key points;

[0075] Determining a final lethal zone based on the lethal zone;

[0076] Track the piglet in the final lethal area based on the basic data set and the piglet mask outline to obtain the tracking result;

[0077] The number of crushed piglets was obtained based on the tracking results.

[0078] Example 2

[0079] The embodiment of the present invention discloses an automatic detection and analysis method of a sow squeezing a piglet event, comprising:

[0080] Get the video data of lactating sows and piglets living together as the initial data set:

[0081] Preferably, this embodiment is implemented by a high-definition video acquisition system and a data storage system built in a pig farm, and the recorded video data is sorted to form an initial data set.

[0082] Preferably, the high-definition video acquisition system of this embodiment adopts: Dahua camera, model: DH-IPC-HFW3441E-SA.

[0083] Based on the initial data set, the piglet mask contours, sow postures, sow mask contours and key points of all video frames are identified:

[0084] Preferably, obtaining the piglet mask contour, sow posture, sow mask contour and key points of all video frames specifically includes:

[0085] Build a deep learning network and perform pre-training to obtain a trained deep learning network;

[0086] Processing is performed based on the initial data set to obtain multiple video frame images;

[0087] The video frame image is input into the trained deep learning network to obtain the piglet mask contour, sow posture, sow mask contour and key points.

[0088] Preferably, the deep learning network pre-training process is:

[0089] Obtain video data of lactating sows and piglets living together;

[0090] The video data was edited into 238 video clips of several minutes in length;

[0091] Use the open source Labelme software to perform amodal instance segmentation and annotation on the video clips to obtain annotated datasets;

[0092] The labeled data set is divided into a training set and a test set in a ratio of 7:3;

[0093] The training set is used to train the deep learning network, and the test set is used to verify the effect of the deep learning network. At the same time, 4 long video clips are obtained in the test set to test the detection effect of the deep learning network, and finally a trained deep learning network is obtained.

[0094] Preferably, in this embodiment, the acquired video data involves 61 Danish genetics sows, which are free to move and are raised individually with their piglets in farrowing pens; each pen is approximately 2.5 meters by 2.8 meters, with 70% of the ground being concrete and 30% being plastic slats; an overhead camera (DH-IPC-HFW3441E-SA, Dahua camera) is fixed at one corner of each pen, with a height of 2 meters and a shooting angle of 70°; the video data is recorded at a frame rate of 30 frames per second and a resolution of 1920×1080 pixels.

[0095] The initial data set was filtered based on the sow posture to obtain the basic data set:

[0096] Preferably, obtaining the basic data set specifically includes:

[0097] Sow postures include: side-lying and non-side-lying;

[0098] Based on the initial data set, a video frame image F of a sow lying on its side is obtained;

[0099] The N frames of video images before the video frame image F are selected as the basic data set.

[0100] Different fatal areas are obtained based on the basic data set and the corresponding sow mask contours and key points:

[0101] Preferably, Figure 2-Figure 3 As shown, the key points include: the intersection T of the sow's tail and the sow's body and the key point E at the base of the ear.

[0102] Preferably, the contact edge point P' of the sow with the ground can be projected to the visible side of the sow (point P) along the camera viewing angle. Since the height and shooting angle of the camera are fixed in all pig pens, an approximate evaluation can be made through the regression equation of the sow's body shape and the distance between the camera and the sow.

[0103] Preferably, the different lethal areas include: an arc-shaped lethal area and a back-shaped lethal area;

[0104] The arc-shaped lethal area is determined as follows:

[0105] Get the midpoint M of the line connecting the intersection point T and the key point E at the base of the ear;

[0106] The line passing through the midpoint M and perpendicular to ET intersects with the back and abdomen of the sow mask contour respectively, and the back intersection point V and the abdomen intersection point U are obtained accordingly;

[0107] The measuring point P is obtained after the back intersection point V is offset by a distance b in the direction from V to M;

[0108] The arc obtained by connecting the three points E, P, and T intersects with the sow mask contour to obtain the intersection point R;

[0109] An arc-shaped fatal area is formed by connecting the intersection point R, the key point E at the base of the ear, the measuring point P, the intersection point T, the abdominal intersection point U and the intersection point R in sequence.

[0110] Preferably, the length of the line connecting the back intersection point V and the abdomen intersection point U is h. Based on the camera position C, the length of the line connecting the back intersection point V is d. The regression relationship between b, d and h is:

[0111] b=(855100-7255d+26710h+4.966×d 2 +0.665dh-15.160h 2 )×10 -5 ;

[0112] The visual representation of the regression relationship between b, d and h is as follows Figure 4 shown.

[0113] Preferably, the method for determining the back-shaped fatal area is:

[0114] The node O is obtained after the intersection point U of the abdomen is offset by a distance k along the UV direction;

[0115] Draw a straight line parallel to the ET line through node O within the sow mask outline;

[0116] The straight line divides the sow mask outline into upper and lower regions;

[0117] Use the upper area as the back-shaped fatal area.

[0118] Preferably, the value of k in this embodiment is: 0.25h.

[0119] Preferably, based on dividing the sow mask contour into two upper and lower regions, the piglets whose lower region, ie, the suckling region, overlaps with the lethal region can be filtered.

[0120] Determine the final lethal area based on the lethal area:

[0121] Preferably, Figure 5 As shown, determine the final lethal area, including:

[0122] Get the camera position C, and obtain the vector CV based on the connection between the camera position C and the back intersection point V;

[0123] Vector MT is obtained by connecting the midpoint M and the intersection point T;

[0124] Based on the vector MT, first rotate around the midpoint M outside the sow's body until the angle swept when it is in the same direction as the vector CV is used as the evaluation angle;

[0125] Determine whether the evaluation angle within the sow mask outline is greater than 180°. If so, the sow's back is determined to be visible, and the back-shaped lethal area is used as the final lethal area. Otherwise, the sow's back is determined to be invisible, and the arc-shaped lethal area is used as the final lethal area.

[0126] The piglets are tracked in the final lethal area based on the basic data set and the piglet mask outline to obtain the tracking result.

[0127] The number of crushed piglets based on the tracking results:

[0128] Preferably, Figure 6 As shown in the figure, the number of crushed piglets was obtained based on the tracking results, including:

[0129] Based on the basic data set, the IOU values ​​of the piglet mask outline and the final fatal area in all video frame images are calculated to obtain multiple IOU values;

[0130] Determine whether the IOU value gradually decreases to 0. If so, it is determined that the piglet is not in the final lethal area;

[0131] Otherwise, the piglets are determined to be in the final lethal area, and the number of piglets is accumulated to the set of squeezed piglets as the tracking result;

[0132] Determine whether the tracking result is ≥ 1. If so, it is determined that piglet squeezing has occurred, and the tracking result is used as the number of squeezing piglets;

[0133] Otherwise, it is determined that piglet squeezing did not occur.

[0134] Preferably, after determining that piglet squeezing has occurred, the method further comprises:

[0135] Determine whether the piglets in the final fatal area are visible. If not, treat the number of squeezed piglets as the number of invisible squeezed piglets and add them to the invisible set;

[0136] If yes, then determine whether the back contour line of the final fatal area passes through the piglet mask contour. If yes, then determine it as a visible squeezed piglet and accumulate the number to obtain a visible set;

[0137] Otherwise, the piglets that are overlapped but not squeezed are determined and the number is accumulated to obtain the filtered set.

[0138] Preferably, after it is determined that piglet squeezing has occurred, the piglets in the final fatal area are not visible, which proves that all squeezed piglets are not visible. At this time, the number of squeezed piglets Q is equal to the number of invisible squeezed piglets Q z .

[0139] Preferably, after determining that piglet squeezing has occurred, if the piglets in the final fatal area are visible, it is further determined whether the back contour line of the final fatal area passes through the piglet mask contour. If so, the number of visible squeezing piglets Q is accumulated. v Otherwise, it is determined as overlapping but not squeezed piglets and the cumulative number Q n , based on the number of crushed piglets Q, the number of visible crushed piglets Q v and the cumulative number of piglets that overlap but are not squeezed Q n Get the number of invisible squeezed piglets Q z =QQ v -Q n .

[0140] Example 3

[0141] The method of the present invention was tested:

[0142] Evaluation of segmentation performance of deep learning networks for instance segmentation of sows and piglets:

[0143] When performing instance segmentation on sows, the intersection over union (IoU) between the predicted mask and the ground truth mask of the sow is used to evaluate the segmentation performance. The IoU calculation expression is as follows:

[0144]

[0145] Among them, TP a Indicates the number of correct detections, FP a Indicates the number of false positives, FN a Indicates the number of missed detections;

[0146] The test results show that the segmentation IoU of piglets and sows are 0.871 and 0.951 respectively, which fully reflects the accuracy of sow and piglet instance segmentation.

[0147] Keypoint detection performance evaluation:

[0148] The precision P kand recall R k Used to evaluate keypoint detection performance. A keypoint is considered correctly detected if the Euclidean distance between a detected keypoint and the corresponding ground truth keypoint is less than 10% d.

[0149] Precision k The calculation expression is as follows:

[0150]

[0151] Recall R k The calculation expression is as follows:

[0152]

[0153] The test results show that the precision and recall of key point detection are 97.8% and 96.5% respectively, which fully reflects the accuracy of the adaptive lethal area positioning method in detecting sow key points.

[0154] Assessment of the accuracy of tracking of piglets in the lethal zone:

[0155] Multi-object tracking methods MOT, MOTA score and IDF when tracking piglets in the lethal zone 1 Scores are the two most important indicators in the field of MOT (multi-object tracking).

[0156]

[0157] Among them, MOTA represents the number of discrete errors of the tracker, FP represents the number of false positives, FN represents the number of missed positives, IDS represents the number of times the ID of one piglet is incorrectly assigned to another piglet, and GT represents the true value.

[0158]

[0159] Among them, IDF 1 The score is the ratio of the number of correctly identified detections to the average of the actual number of ground detections and the calculated number of detections; IDTP not only means that the ratio area of ​​the intersection of the detection box and the actual ground box is greater than the threshold r, but also means that the piglet ID is the same as the initial piglet ID; IDFP means that the overlap requirement may be met, but the piglet IDs are not the same; IDFN means that the detection failed.

[0160] IDF 1 The score is the ratio of the number of correctly identified detections to the average of the number of ground-truth detections and the number of calculated detections. IDTP not only means that the ratio area of ​​the intersection of the detection box and the ground-truth box is greater than the threshold r, but also means that the piglet ID is the same as the initial piglet ID.

[0161] The test results show the tracking of piglets in the lethal area, with a MOTA of 0.946 and an IDF of 1 The value was 0.950, which fully reflects the accuracy of tracking piglets in the lethal area.

[0162] Squeeze event detection performance evaluation:

[0163] For the detection of piglet squeezing events, precision, recall and F 1 score is used to evaluate the squeeze event detection performance:

[0164]

[0165]

[0166]

[0167] Among them, TP c represents the number of correctly detected piglet crushing events, FP c represents the number of falsely detected piglet crush events, FN c represents the number of missed piglet crushing events, R C Represents the recall rate, P C Indicates the precision.

[0168] The temporal and spatial intersection-over-union (TIoU) is introduced to evaluate the accuracy of detecting piglet squeezing events in long videos:

[0169]

[0170] Among them, CE det Indicates a detected squeeze event, CE gt Indicates actual events on the ground.

[0171] The piglet squeezing events in the short video clips in the dataset were tested, and the classification results are shown in Table 1:

[0172] Table 1 Classification results of piglet crushing events in short video clips

[0173]

[0174] Among them, CE is a squeeze event, and NCE is a non-squeeze event. The test results show that the recall rate is 0.919, the precision rate is 0.895, and the F 1 The score is 0.906.

[0175] The piglet squeezing event in the long video clip was tested, and the results of the squeezing event are shown in Table 2:

[0176] Table 2 Classification results of piglet crushing events in long video clips

[0177]

[0178] The test results show that the average TIoU reaches 0.968. The duration of the real and detected squeezing events is 9346 seconds and 9331 seconds respectively. The total number of real and detected squeezing events is 14 and 14 respectively. The total number of real and detected squeezing piglets is 9 and 10 respectively. The test results show that the automatic detection and analysis method of sow squeezing piglet events has high accuracy.

[0179] Example 4

[0180] like Figure 7 As shown, an automatic detection and analysis system for sow squeezing piglets event includes: a data acquisition module, a data processing module, a fatal area determination module and a result output module;

[0181] A data acquisition module, used to acquire video data of lactating sows and piglets living together as an initial data set;

[0182] The data processing module is used to identify the piglet mask contour, sow posture, sow mask contour and key points of all video frames based on the initial data set; the initial data set is screened based on the sow posture to obtain the basic data set;

[0183] A fatal area determination module is used to obtain different fatal areas based on the basic data set and the corresponding sow mask contour and key points; and determine the final fatal area based on the fatal area;

[0184] The result output module is used to track the piglets in the final fatal area based on the basic data set and the piglet mask contour to obtain the tracking result; and the number of squeezed piglets is obtained based on the tracking result.

[0185] Preferably, each module of the automatic detection and analysis system for sow squeezing piglets event in this embodiment corresponds to the method described in Example 2.

[0186] Example 5

[0187] Based on the same inventive concept, the present invention also provides a computer device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0188] Memory, used to store computer programs;

[0189] The processor, when used to execute the program stored in the memory, can implement an automatic detection and analysis method for an event of sow squeezing piglets as in Example 1 or 2.

[0190] The electronic device may include: a processor, a communications interface, a memory, and a communications bus, wherein the processor, the communications interface, and the memory communicate with each other via the communications bus. The processor may call logic instructions in the memory to execute an automatic detection and analysis method for a sow squeezing a piglet event in Embodiment 1 or 2.

[0191] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0192] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses an automatic detection and analysis method and system for sow squeezing piglets, which has the following beneficial effects:

[0193] 1. The present invention accurately determines the fatal area where the sow squeezes the piglets when lying on its side based on the method of adaptive fatal area positioning, solves the occlusion problem during the event of the sow squeezing the piglets on its back, and can accurately detect the number of squeezed piglets.

[0194] 2. The present invention realizes efficient automatic analysis of the behavior of side-lying sows squeezing piglets, provides a technical reference for automatic evaluation of sow maternal characteristics, and provides a new method for automatic detection and analysis of sow squeezing piglet behavior.

[0195] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0196] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for automatically detecting and analyzing sow squeezing piglets, characterized in that: include: Obtain video data of lactating sows and piglets living together as the initial data set; Based on the initial data set, the piglet mask contour, sow posture, sow mask contour and key points of all video frames are identified; Filter the initial data set based on the sow posture to obtain a basic data set; Obtain different fatal areas based on the basic data set and the corresponding sow mask contour and key points; determining a final lethal area based on the lethal area; Tracking the piglet in the final lethal area based on the basic data set and the piglet mask outline to obtain a tracking result; The number of squeezed piglets was obtained based on the tracking results.

2. The automatic detection and analysis method of a sow squeezing piglet event according to claim 1 is characterized in that: Obtain the piglet mask contour, sow posture, sow mask contour and key points of all video frames, including: Build a deep learning network and perform pre-training to obtain a trained deep learning network; Processing is performed based on the initial data set to obtain a plurality of video frame images; The video frame image is input into the trained deep learning network to obtain the piglet mask contour, the sow posture, the sow mask contour and the key points.

3. The automatic detection and analysis method of a sow squeezing piglet event according to claim 2 is characterized in that: The basic data set includes: The sow postures include: side-lying and non-side-lying; A video frame image F of the sow lying on its side is obtained by screening based on the initial data set; The N frames of video images before the video frame image F are selected as the basic data set.

4. The automatic detection and analysis method of a sow squeezing piglet event according to claim 1 is characterized in that: The key points include: the intersection T of the sow's tail and the sow's body and the key point E at the base of the ear.

5. The automatic detection and analysis method of sow squeezing piglet event according to claim 4 is characterized in that: The different lethal areas include: an arc-shaped lethal area and a back-shaped lethal area; The method for determining the arc-shaped fatal area is as follows: Get the midpoint M of the line connecting the intersection point T and the key point E at the base of the ear; The line passing through the midpoint M and perpendicular to ET intersects with the back and abdomen of the sow mask contour respectively, and obtains a back intersection point V and an abdomen intersection point U correspondingly; After the back intersection point V is offset by a distance b along the direction from V to M, a measurement point P is obtained; The arc obtained by connecting the three points E, P and T intersects with the sow mask contour to obtain an intersection point R; The arc-shaped fatal area is formed by sequentially connecting the intersection point R, the ear base key point E, the measuring point P, the intersection point T, the abdomen intersection point U and the intersection point R.

6. The automatic detection and analysis method of sow squeezing piglet event according to claim 5 is characterized in that: The method for determining the back-shaped fatal area is as follows: After the abdominal intersection point U is offset by a distance k along the UV direction, a node O is obtained; Draw a straight line parallel to the ET line through the node O within the sow mask outline; The straight line divides the sow mask outline into an upper region and a lower region; The upper area is used as the back-shaped fatal area.

7. The automatic detection and analysis method of sow squeezing piglet event according to claim 5 is characterized in that: Determine the final lethal zone, including: Obtaining a camera position C, and obtaining a vector CV based on connecting the camera position C with the back intersection point V; A vector MT is obtained by connecting the midpoint M and the intersection point T; Based on the vector MT, the vector MT is first rotated around the midpoint M toward the outside of the sow body until the angle swept when it is in the same direction as the vector CV is used as the evaluation angle; Determine whether the evaluation angle within the sow mask outline is greater than 180°. If so, determine that the sow's back is visible, and use the back-shaped lethal area as the final lethal area. Otherwise, determine that the sow's back is not visible, and use the arc-shaped lethal area as the final lethal area.

8. The automatic detection and analysis method of sow squeezing piglet event according to claim 3 is characterized in that: The number of squeezed piglets is obtained based on the tracking results, specifically including: Based on the basic data set, the IOU values ​​of the piglet mask contour and the final fatal area in all video frame images are calculated to obtain multiple IOU values; Determine whether the IOU value gradually decreases to 0, and if so, determine that the piglet is not in the final lethal area; Otherwise, it is determined that the piglets are located in the final lethal area, and the number of piglets is accumulated into the set of squeezed piglets as the tracking result; Determine whether the tracking result is ≥ 1, if so, determine that piglet squeezing has occurred, and use the tracking result as the number of squeezing piglets; Otherwise, it is determined that piglet squeezing did not occur.

9. The automatic detection and analysis method of sow squeezing piglet event according to claim 8, characterized in that: After determining that piglet crush has occurred, it also includes: Determine whether the piglets in the final fatal area are visible, and if not, take the number of squeezed piglets as the number of invisible squeezed piglets and add them into the invisible set; If yes, then determine whether the back contour line of the final fatal area passes through the piglet mask contour, and if yes, determine it as a visible squeezed piglet and accumulate the number to obtain a visible set; Otherwise, the piglets that are overlapped but not squeezed are determined and the number is accumulated to obtain the filtered set.

10. An automatic detection and analysis system for sow squeezing piglets, applied to the automatic detection and analysis method for sow squeezing piglets as claimed in any one of claims 1 to 9, characterized in that: include: Data acquisition module, data processing module, fatal area determination module and result output module; The data acquisition module is used to acquire video data of lactating sows and piglets living together as an initial data set; The data processing module is used to identify the piglet mask contour, sow posture, sow mask contour and key points of all video frames based on the initial data set; Filter the initial data set based on the sow posture to obtain a basic data set; The fatal area determination module is used to obtain different fatal areas based on the basic data set and the corresponding sow mask contour and the key points; determining a final lethal area based on the lethal area; The result output module is used to track the piglets in the final lethal area based on the basic data set and the piglet mask contour to obtain a tracking result; The number of squeezed piglets was obtained based on the tracking results.

Citation Information

Patent Citations

  • Method and device for monitoring piglet compression

    CN110598643A

  • Convolutional network identification method for sow lactation behaviors

    CN110598658A

  • Method for predicting piglet squeezing event of sow, readable medium and electronic equipment

    CN118378738A

  • METHOD FOR COUNTING SUCKlING PIGLETS BASED ON SELF-ATTENTION SPATIOTEMPORAL FEATURE FUSION

    US20230147130A1