A method for intelligently adjusting the spatial structure of a variable-structure pig farrowing bed

Through the edge computing platform and YOLO_v5 algorithm, the position and position can be adjusted to solve the problem of improper limits for temporary birth sows, the risk of piglet death is reduced, and the level of intelligence in piglets is improved.

CN117422853BActive Publication Date: 2025-08-22NANJING AGRICULTURAL UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311665091.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-06
Publication Date
2025-08-22
Estimated Expiration
2043-12-06

AI Technical Summary

Technical Problem

When adjusting the production bed for different structures, the prior art fails to effectively ensure that the temporary sows are in the center of the delivery bed, the main axis of the trunk is parallel to the position of the adjustable railing, and the head is facing the trunk, resulting in an increased risk of sows being pushed and piglet death.

Method used

The edge computing platform is used to combine the YOLO_v5 object detection algorithm to identify the sow's posture, trunk, head and feeding trough position in real time. The movement of the adjustable position bracket is controlled through the edge computing platform to ensure that the sow is limited in a suitable position.

Benefits of technology

It effectively avoids the thrust of the delivery sows, reduces the probability of newborn piglets being squeezed to death, and improves the practical application value of the delivery bed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117422853B_ABST
    Figure CN117422853B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for intelligently adjusting the spatial structure of a variable-structure pig delivery bed. The method utilizes the variable-structure delivery bed space in a non-restricted mode to increase pre-partum sow activity and health. When the sow is nearing delivery and its position is suitable for restriction, the position of the adjustable stalls is adjusted to restrict the sow, thereby reducing the probability of newborn piglets being crushed to death by postpartum sows. The method is implemented as follows: when a sow's delivery prediction algorithm issues a delivery warning, the YOLO_v5 target detection algorithm is used to identify the positions of the sow's trunk, head, tail, and trough. Based on the positional relationship characteristics of the sow's trunk, head, tail, and trough, it is determined whether the sow is in a position suitable for restriction. If the position is suitable, the adjustable stalls are automatically closed to restrict the sow.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent farming technology, specifically a method for intelligently adjusting the spatial structure of a variable-structure pig farrowing bed. This method combines computer vision, edge computing, and automatic control technologies. By detecting the position and posture characteristics of farrowing sows in real time, it automatically adjusts the position of adjustable stalls, achieving the goal of temporarily limiting the position of sows in the farrowing and postpartum stages of the variable-structure pig farrowing bed by time period. Background Art

[0002] In the field of pig farming, the health level of peripartum sows and the survival rate of piglets are one of the most important indicators. In Chinese invention patent CN2021106188847, a variable-structure pig delivery bed is disclosed, which uses machine vision technology to automatically analyze the changing characteristics of the pre-partum activity of expectant sows, and based on this, judges whether the expectant sow is close to giving birth. If it is judged that the expectant sow is close to giving birth, the position-adjustable fence is automatically controlled to move to limit the sow in labor. However, the technology disclosed in Chinese invention patent CN2021106188847 only determines the timing of adjusting the position of the adjustable fence based on whether the expectant sow is about to give birth, and ignores the real-time position and head orientation of the sow in labor. If the position of the adjustable fence is not adjusted when the sow in labor is in the center of the delivery bed, the main axis of the trunk is parallel to the adjustable fence, and the head is facing the trough, the sow in labor will be pushed by the adjustable fence, and the sow in labor will not be able to eat after being restricted. All these have greatly affected the practical application prospects of a variable-structure pig delivery bed disclosed in Chinese invention patent CN2021106188847.

[0003] With the rapid development of computer vision technology, especially the increasing application of target detection algorithms for automatically identifying the position and posture of farmed animals, computer vision technology has provided strong technical support for intelligent pig farming. At the same time, edge computing, a data processing technology that processes data near the data source, can be deployed directly in the breeding shed. This on-site deployment, combined with real-time computer vision analysis, greatly improves the speed and efficiency of breeding data processing and reduces data transmission and response delays. Applying edge computing technology to the real-time adjustment of the space in variable-structure pig farrowing beds allows the position of the adjustable pens to be adjusted while simultaneously ensuring that the farrowing sow is positioned in the center of the farrowing bed, with the main axis of the trunk parallel to the adjustable pens, and the head facing the trough. This enhances the practical application value of variable-structure pig farrowing beds and further promotes the development of intelligent pig farming. Summary of the Invention

[0004] The technical problem to be solved by the present invention is how to adjust the position of the adjustable fence to limit the sow about to give birth and its position is suitable for limiting, thereby reducing the probability of newborn piglets being crushed to death by the sow after giving birth.

[0005] Technical solution:

[0006] A method for intelligently adjusting the spatial structure of a variable-structure pig farrowing bed is based on a variable-structure pig farrowing bed. The variable-structure pig farrowing bed includes left-side and right-side adjustable stalls located on both sides of the farrowing bed, a camera for collecting images, and an edge computing platform for executing an algorithm for predicting the approaching birthing of expectant sows.

[0007] In the present invention, an edge computing platform is set up to connect to the camera to receive video data and execute the spatial structure intelligent adjustment algorithm, which includes the following steps:

[0008] Step S1: The variable structure pig uses the farrowing prediction algorithm to issue a farrowing warning to the sow on the farrowing bed, and the edge computing platform captures the current frame from the connected camera video stream;

[0009] Step S2: Use the object detection algorithm YOLO_v5 to identify the detection frames of the feeding trough and the sow's head in the frame, and extract the center point coordinates, width, and height of the detection frames of the feeding trough and the sow's head in the frame;

[0010] Step S3: Calculate the IOU value between the trough and the pig head detection frame. If the IOU value is greater than 0, go to step S4. If the IOU value is equal to 0, capture the next frame of the video stream and return to step S2.

[0011] Step S4: Determine whether the main axis of the torso of the farrowing sow is parallel to the position-adjustable stall frame. If so, go to step S5; otherwise, go to step S6;

[0012] Step S5: The edge computing platform detects the real-time positions of the left-side adjustable hurdle and the right-side adjustable hurdle, and executes steps S5-1 to S5-2;

[0013] Step S5-1: If only the left or right adjustable hurdle is in the limit position, the edge computing platform sends a limit instruction to the motion control DC motor driver board of the adjustable hurdle that is not in the limit position, driving the adjustable hurdle to move to the limit position, thus completing the delivery bed space adjustment task;

[0014] Step S5-2: If both the left and right adjustable hurdles are in the non-limited position, the edge computing platform simultaneously sends a limit instruction to the motion control DC motor driver boards of the left and right adjustable hurdles, and simultaneously drives the left and right adjustable hurdles to move to the limited position, thus completing the delivery bed space adjustment task;

[0015] Step S6: The edge computing platform detects the real-time positions of the left adjustable railing and the right adjustable railing, obtains the center point coordinates (TCx center , TCy center ) of the detection frame of the tail of the pregnant sow in labor, and executes steps S6-1 to S6-3;

[0016] Step S6-1: If both the left adjustable railing and the right adjustable railing are in non-limiting positions and TCx center < TTLx, where TTLx is the abscissa of the upper left corner of the detection frame of the feeding trough; the edge computing platform sends a limiting instruction to the motion control DC motor drive board of the right adjustable railing, drives the right adjustable railing to move to the limiting position, captures the next frame of the video stream, and returns to step S2;

[0017] Step S6-2: If both the left adjustable railing and the right adjustable railing are in non-limiting positions and TCx center > TBRx, where TBRx is the abscissa of the lower right corner of the detection frame of the feeding trough; the edge computing platform sends a limiting instruction to the motion control DC motor drive board of the left adjustable railing, drives the left adjustable railing to move to the limiting position, captures the next frame of the video stream, and returns to step S2;

[0018] Step S6-3: If either the left adjustable railing or the right adjustable railing is already in the limiting position, capture the next frame of the video stream and return to step S2.

[0019] Preferably, step S4 specifically includes:

[0020] Step S4-1: Extract the center point coordinates (SCx center , SCy center ) of the detection frame of the trunk of the pregnant sow in labor;

[0021] Step S4-2: Judge the size relationship between SCx in the center point coordinates of the detection frame of the trunk of the pregnant sow in labor center and the abscissa TTLx of the upper left corner of the detection frame of the feeding trough and the abscissa TBRx of the lower right corner of the detection frame of the feeding trough. If TTLx < SCx center < TBRx, the main axis of the trunk of the pregnant sow in labor is approximately parallel to the adjustable railing, and turn to step S5. If SCx center ≤ TTLx or SCx center≥TBRx, the main axis of the sow's trunk is not approximately parallel to the position-adjustable stall, and the process goes to step S6. The edge computing platform preferably embeds the model weights into detect.py of YOLO_v5, enabling it to process new frames captured by the camera in real time; adds a data interaction layer between detect.py and the sow's near-farming prediction algorithm and the spatial structure intelligent adjustment algorithm, and continuously transmits the detected sow posture, sow trunk position, sow head position, sow tail position, and trough position data to the sow's near-farming prediction algorithm and the spatial structure intelligent adjustment algorithm.

[0022] Beneficial effects of the present invention

[0023] This invention uses an edge computing platform to infer the YOLO_v5-based object detection algorithm to automatically identify the sow's posture, torso position, head and tail position, and feeding trough position. It then intelligently adjusts the position of the adjustable stall based on the identification results, ensuring that the stall is positioned when the sow's head is facing the feeding trough. This prevents the sow from being pushed when the adjustable stall is moved. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 This is a side view of a variable-structure pig farrowing bed in the prior art, viewed from the side near the camera.

[0025] Figure 2 This is a side view of the variable-structure pig farrowing bed of the prior art, viewed from the end away from the camera.

[0026] Figure 3 The present invention is a schematic diagram of the installation structure of the left electric push rod and the left position adjustable fence in the variable structure pig farrowing bed in the prior art.

[0027] Figure 4 The utility model is a schematic diagram of the connection structure of the pulley and the corresponding track of the left position adjustable hurdle in the prior art.

[0028] Figure 5 The present invention is a schematic diagram of an overall top view of a variable structure pig farrowing bed when the position-adjustable fence frame is located at the side fence position in the prior art.

[0029] Figure 6 The present invention is a schematic diagram of an overall top view of a variable structure pig farrowing bed in the prior art when the position-adjustable fence is located below the crossbeam.

[0030] Figure 7 This is a flow chart of the intelligent adjustment algorithm for the spatial structure of the variable-structure pig farrowing bed of the present invention.

[0031] Figure 8 This is the overall flow chart of the intelligent adjustment system of the present invention. DETAILED DESCRIPTION

[0032] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, the technical solutions of the present invention are described clearly and completely below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of the present invention.

[0033] Figure 1 、 Figure 2 This is a schematic diagram of the overall structure of the variable structure pig farrowing bed in the prior art, which mainly includes the main part of the sow farrowing bed and the automatic push rod system part. Figure 1 、 Figure 2 1 is the left position adjustable fence, 2 is the right position adjustable fence, 3 is the left electric push rod, 4 is the right electric push rod, 5 is the left side fence of the delivery bed, 6 is the right side fence of the delivery bed; 20 is the front door type component perpendicular to the delivery bed floor, 21 is the rear door type component perpendicular to the delivery bed floor, 23 is the left crossbeam parallel to the delivery bed floor, 22 is the right crossbeam parallel to the delivery bed floor; 24 is the electric push rod fixing plate; 25 is the edge computing platform; 26 is the camera; 12 is fixed on the upper right front of the right front baffle 8 Slide rails, 13 is the right front lower slide rail fixed on the right front baffle 8, 18 is the right rear upper slide rail fixed on the right rear baffle 10, 19 is the right rear lower slide rail fixed on the right rear baffle 10, 14 is the left front upper slide rail fixed on the left front baffle 9, 15 is the left front lower slide rail fixed on the left front baffle 9, 16 is the left rear upper slide rail fixed on the left rear baffle 11, 17 is the left rear lower slide rail fixed on the left rear baffle 11, right front upper slide rail 12, right front lower slide rail 13, left front upper slide rail 1 4. There are limit holes at both ends of the left front lower rail 15, the left rear upper rail 16, the left rear lower rail 17, the right rear upper rail 18, and the right rear lower rail 19. Both ends of the left position adjustable hurdle 1 are equipped with two sets of pulleys. The pulleys of the left position adjustable hurdle 1 can slide in the left front upper rail 14, the left front lower rail 15, the left rear upper rail 16, and the left rear lower rail 17; both ends of the right position adjustable hurdle 2 are equipped with two sets of pulleys. The pulleys of the right position adjustable hurdle 2 can slide in the right front upper rail 12 , the right front lower slide rail 13, the right rear upper slide rail 18, and the right rear lower slide rail 19; the electric push rod fixing plate 24 is fixed on the right crossbeam 22 and the left crossbeam 23, one end of the left electric push rod 3 is fixed on the fixing plate 24, and the other end is fixed to the left position adjustable fence 1, one end of the right electric push rod 4 is fixed on the fixing plate 24, and the other end is fixed to the right position adjustable fence 2, the edge computing platform 25 is installed on the front door-type component 20, and the piglet incubator 27 is located outside the sow movable fence area.

[0034] The connection between the left electric push rod 3 and the left position adjustable hurdle 1 is taken as an example to illustrate the connection method between the electric push rod and the position adjustable hurdle of the present invention. Figure 3 This is a schematic diagram of the installation and connection of the left electric push rod 3 and the left position adjustable hurdle 1. Preferably, one end of the left electric push rod 3 is fixed below the electric push rod fixing plate 24, and the other end is fixedly connected to the left position adjustable hurdle 1.

[0035] The left side position adjustable hurdle 1 is taken as an example to illustrate the specific movement mode of the position adjustable hurdle of the present invention during operation. Figure 4 As shown, the left position adjustable hurdle 1 is welded with a left front upper pulley block 28 and a left front lower pulley block 29 at one end close to the left front baffle 9, and the left rear upper pulley block 30 and the left rear lower pulley block 31 are welded at one end close to the left rear baffle 11. The left front upper pulley block 28 is placed in the left front upper slide rail 14, the left front lower pulley block 29 is placed in the left front lower slide rail 15, and the left rear upper pulley block 30 is placed in the left rear upper slide rail 16. Inside, the left rear lower pulley set 31 is placed in the left rear lower slide rail 17. When the left position adjustable hurdle 1 is subjected to the pulling force or pushing force of the left electric push rod 3, the left front upper pulley set 28, the left front lower pulley set 29, the left rear upper pulley set 30, and the left rear lower pulley set 31 roll in the left front upper slide rail 14, the left front lower slide rail 15, the left rear upper slide rail 16, and the left rear lower slide rail 17 respectively and drive the left position adjustable hurdle 1 to move smoothly.

[0036] When the sow is just transferred to the variable structure pig farrowing bed, the left position adjustable stall frame 1 and the right position adjustable stall frame 2 are parked next to the left stall 5 and the right stall 6 respectively. At this time, the overhead view of the farrowing bed structure is as follows: Figure 5 As shown, pre-partum sows have ample free space to move around. The camera 26 collects the behavioral video of the freely moving sows and transmits it to the edge computing platform 25 in real time. The edge computing platform 25 stores the received video in its memory.

[0037] The movement of the left position adjustable hurdle 1 and the right position adjustable hurdle 2 is achieved by controlling the extension and retraction of the electric push rods. The edge computing platform sends instructions to the controllers of the left electric push rod 3 and the right electric push rod 4 to control the left electric push rod 3 and the right electric push rod 4 to reduce the stroke, slide the left position adjustable hurdle 1 from the position next to the left hurdle 5 to under the left crossbeam 23, and slide the right position adjustable hurdle 2 from the position next to the right hurdle 6 to under the right crossbeam 22. After the left position adjustable hurdle 1 and the right position adjustable hurdle 2 reach the predetermined position, the left electric push rod 3 and the right electric push rod 4 stop working, automatically or manually The worker inserts the pin into the limiting holes on both sides of the four sets of pulleys on the left front upper rail 14, the left front lower rail 15, the left rear upper rail 16, and the left rear lower rail 17 close to the left side position adjustable hurdle 1 to fix the position of the left side position adjustable hurdle 1, and automatically or manually inserts the pin into the limiting holes on both sides of the four sets of pulleys on the right front upper rail 12, the right front lower rail 13, the right rear upper rail 18, and the right rear lower rail 19 on the right side position adjustable hurdle 2 to fix the position of the right side position adjustable hurdle 2.

[0038] The left side position adjustable fence 1 of the variable structure pig farrowing bed is located at the left crossbeam 23, and the right side position adjustable fence 2 is located below the right crossbeam 22. Figure 6 As shown, at this time, the left-side position-adjustable stall 1 and the right-side position-adjustable stall 2 confine the farrowing sow in a relatively narrow space, reducing the chance of the sow crushing the piglets after giving birth.

[0039] In the present invention, the embedded control terminal in the prior application is preferably replaced by an edge computing platform 25, which executes the sow's approaching delivery prediction algorithm in the prior application and the spatial structure intelligent adjustment algorithm proposed in the present invention.

[0040] The implementation steps of this application are:

[0041] Step 1: Create a dataset

[0042] When a sow is first placed in a variable-structure farrowing crate, adjustable pens are placed on either side of the crate, allowing the entire crate space to freely move around before farrowing. A camera mounted on the crate captures pre-partum sow behavior videos. Frame-by-frame images of the sow in four pre-partum postures (prone, standing, sitting, and lying on their side) are selected. The images are manually annotated with the sow's head, tail, feeding trough, and posture. During the annotation process, the annotated detection boxes accurately encompass the sow's torso. All video frames are size-normalized to produce a 640x640 image set.

[0043] Step 2: Improve the model network structure

[0044] First, in the common.py file of YOLO_v5, define a module named repconv and provide a definition for the repconv module in the yolo.py file. Then, replace all C3 modules in the yolov5n.yaml file with the repconv module defined in common.py and yolo.py.

[0045] Step 3: Train model weights

[0046] First, define the dataset path, the class names to be identified, and the number of classes in the configuration file required for training. Then, use the improved network structure for training. After training, verify the model to ensure it accurately identifies the location of the trough, the sow's head, torso, tail, and posture.

[0047] Step 4: Early warning of sow farrowing

[0048] Based on the recognition results of YOLO_v5, the key pre-partum features consisting of the activity level, posture ratio, and posture transition frequency of the expectant sow are calculated, and then input into the dynamic linear model to construct a prediction algorithm for the sow's approaching delivery, thereby realizing early warning of sow delivery.

[0049] Step 5: Intelligent adjustment of the space of variable-structure pig farrowing beds

[0050] When the sow farrowing prediction algorithm issues a farrowing warning, the variable structure pig farrowing bed space structure intelligent adjustment algorithm proposed by the present invention starts to work. The algorithm flow is as follows: Figure 7 The specific steps are as follows:

[0051] Step S1: The variable structure pig uses the farrowing prediction algorithm to issue a farrowing warning to the sow on the farrowing bed, and the edge computing platform captures the current frame from the connected camera video stream;

[0052] Step S2: Use the object detection algorithm YOLO_v5 to identify the detection frames of the feeding trough and the sow's head in the frame, and extract the center point coordinates, width, and height of the detection frames of the feeding trough and the sow's head in the frame;

[0053] Step S3: Calculate the IOU value between the trough and the pig head detection frame. If the IOU value is greater than 0, go to step S4. If the IOU value is equal to 0, capture the next frame of the video stream and return to step S2.

[0054] Step S4: Determine whether the main axis of the torso of the farrowing sow is parallel to the position-adjustable stall frame. If so, go to step S5; otherwise, go to step S6;

[0055] Step S5: The edge computing platform detects the real-time positions of the left-side adjustable hurdle and the right-side adjustable hurdle, and executes steps S5-1 to S5-2;

[0056] Step S5-1: If only the left or right adjustable hurdle is in the limit position, the edge computing platform sends a limit instruction to the motion control DC motor driver board of the adjustable hurdle that is not in the limit position, driving the adjustable hurdle to move to the limit position, thus completing the delivery bed space adjustment task;

[0057] Step S5-2: If both the left and right adjustable hurdles are in the non-limited position, the edge computing platform simultaneously sends a limit instruction to the motion control DC motor driver boards of the left and right adjustable hurdles, and simultaneously drives the left and right adjustable hurdles to move to the limited position, thus completing the delivery bed space adjustment task;

[0058] Step S6: The edge computing platform detects the real-time positions of the left and right adjustable stalls, and obtains the center point coordinates of the farrowing sow tail detection frame (TCx center ,TCy center ), execute steps S6-1 to S6-3;

[0059] Step S6-1: If the left position adjustable hurdle and the right position adjustable hurdle are both in the non-limited position and TCx center <TTLx, where TTLx is the horizontal coordinate of the upper left corner of the trough detection frame; the edge computing platform sends a limit command to the DC motor driver board for the right adjustable hurdle motion control, driving the right adjustable hurdle to move to the limit position, capturing the next frame of the video stream, and returning to step S2;

[0060] Step S6-2: If the left position adjustable hurdle and the right position adjustable hurdle are both in the non-limited position and TCx center >TBRx, where TBRx is the horizontal coordinate of the lower right corner of the trough detection frame; the edge computing platform sends a limit command to the left position adjustable fence motion control DC motor driver board, drives the left position adjustable fence to move to the limit position, captures the next frame of the video stream, and returns to step S2;

[0061] Step S6-3: If the left position adjustable hurdle or the right position adjustable hurdle is already at the limit position, capture the next frame of the video stream and return to step S2.

[0062] Step S4 specifically includes:

[0063] Step S4-1: Extract the center point coordinates of the sow's torso detection frame (SCx center , SCy center );

[0064] Step S4-2: Determine SCx in the center coordinates of the sow's torso detection frame center The relationship between the upper left corner horizontal coordinate TTLx of the trough detection frame and the lower right corner horizontal coordinate TBRx of the trough detection frame, if TTLx<SCx center <TBRx, then the main axis of the farrowing sow's trunk is approximately parallel to the position-adjustable stall, go to step S5, if SCx center ≤TTLx or SCx center ≥TBRx, the main axis of the torso of the farrowing sow is not approximately parallel to the position-adjustable stall, and the process goes to step S6.

[0065] Step 6: Integrate the code

[0066] Figure 8 The overall flow chart of the intelligent adjustment system is shown below. Within the intelligent adjustment system, the three modules—the target detection algorithm, the sow near-farming prediction algorithm, and the spatial structure intelligent adjustment algorithm—must work smoothly together. First, the optimized model weights are embedded into the detect.py function of YOLO_v5, enabling it to process new frames captured by the camera in real time. To ensure smooth integration between the subsequent sow near-farming prediction algorithm and the spatial structure intelligent adjustment algorithm, a data exchange layer is designed between detect.py and these two algorithms. This layer continuously transmits detected data on sow posture, trunk position, head position, tail position, and trough position to the sow near-farming prediction algorithm and the spatial structure intelligent adjustment algorithm. When data flows to the sow near-farming prediction algorithm, the algorithm analyzes the detection results and issues a farrowing warning if it determines that the sow is about to farrow. Once the farrowing prediction algorithm issues a farrowing warning, data from the data exchange layer begins to flow to the spatial structure intelligent adjustment algorithm. The spatial structure intelligent adjustment algorithm adjusts the position of the adjustable stall based on the detection results to ensure the optimal farrowing position for the sow.

[0067] Step 8: Edge Deployment

[0068] To ensure efficient model and algorithm execution on edge devices, the Jetson Xavier NX was selected as the edge computing platform. First, the latest version of JetPack, which includes all core components required by the Jetson platform, was installed on the Jetson Xavier NX. Next, the PyTorch deep learning framework was configured on the platform based on the model requirements, and TensorRT was used for model acceleration optimization. To ensure the smooth operation of detect.py and related algorithms, the required Python libraries were installed according to the requirements.txt file in YOLO_v5, and the CUDA toolchain was configured to fully utilize the GPU acceleration capabilities of the Jetson Xavier NX. Furthermore, the camera was compatible with the Jetson Xavier NX device and the driver was sufficient to ensure proper operation of the camera on the Jetson Xavier NX. Regular system maintenance was performed, clearing unnecessary logs and files to maintain system stability.

[0069] The specific embodiments described herein are merely illustrative of the spirit of the present invention. Persons skilled in the art may make various modifications, additions, or substitutions to the described specific embodiments without departing from the spirit of the present invention or exceeding the scope of the appended claims.

Claims

1. A method for intelligently adjusting the spatial structure of a variable-structure pig farrowing bed, based on a variable-structure pig farrowing bed, the variable-structure pig farrowing bed comprising: The invention provides a device comprising a left-side adjustable stall and a right-side adjustable stall located on both sides of the delivery bed, a camera for collecting images, and an edge computing platform for executing an algorithm for predicting the impending delivery of a sow. The edge computing platform is characterized in that the edge computing platform is connected to the camera to receive video data and executes the algorithm for predicting the impending delivery of a sow. When it is predicted that the sow is about to deliver, an intelligent adjustment algorithm for the spatial structure of the delivery bed is executed. The intelligent adjustment algorithm for the spatial structure of the delivery bed includes the following steps: Step S1: The variable structure pig uses the farrowing prediction algorithm to issue a farrowing warning to the sow on the farrowing bed, and the edge computing platform captures the current frame from the connected camera video stream; Step S2: Use the object detection algorithm YOLO_v5 to identify the detection frames of the feeding trough and the sow's head in the frame, and extract the center point coordinates, width, and height of the detection frames of the feeding trough and the sow's head in the frame; Step S3: Calculate the IOU value between the trough and the farrowing sow head detection frame. If the IOU value is greater than 0, go to step S4. If the IOU value is equal to 0, capture the next frame of the video stream and return to step S2. Step S4: Determine whether the main axis of the torso of the farrowing sow is parallel to the position-adjustable stall. If yes, go to step S5; otherwise, go to step S6. Step S4 specifically includes: Step S4-1: Extract the center point coordinates of the sow's torso detection frame (SCx center , SCy center ); Step S4-2: Determine the size relationship between the SCx in the center point coordinates of the detection frame of the pregnant sow's trunk center and the abscissa TTLx of the upper left corner of the feeding trough detection frame and the abscissa TBRx of the lower right corner of the feeding trough detection frame. If TTLx < SCx center < TBRx, the main axis of the pregnant sow's trunk is approximately parallel to the position-adjustable rack, and proceed to step S5. If SCx center ≤ TTLx or SCx center ≥ TBRx, the main axis of the pregnant sow's trunk is not approximately parallel to the position-adjustable rack, and proceed to step S6; Step S5: The edge computing platform detects the real-time positions of the left-side adjustable hurdle and the right-side adjustable hurdle, and executes steps S5-1 to S5-2; Step S5-1: If only the left or right adjustable hurdle is in the limit position, the edge computing platform sends a limit instruction to the motion control DC motor driver board of the adjustable hurdle that is not in the limit position, driving the adjustable hurdle to move to the limit position, thus completing the delivery bed space adjustment task; Step S5-2: If both the left and right adjustable hurdles are in the non-limited position, the edge computing platform simultaneously sends a limit instruction to the motion control DC motor driver boards of the left and right adjustable hurdles, and simultaneously drives the left and right adjustable hurdles to move to the limited position, thus completing the delivery bed space adjustment task; Step S6: The edge computing platform detects the real-time positions of the left and right adjustable stalls, and obtains the center point coordinates of the farrowing sow tail detection frame (TCx center ,TCy center ), execute steps S6-1 to S6-3; Step S6-1: If both the left position-adjustable railing and the right position-adjustable railing are in non-limiting positions and TCx center <TTLx, where TTLx is the abscissa of the upper left corner of the feeding trough detection frame; the edge computing platform sends a limiting instruction to the DC motor drive board for controlling the movement of the right position-adjustable railing, driving the right position-adjustable railing to move to the limiting position, capturing the next frame of the video stream, and returning to Step S2; Step S6-2: If the left position adjustable hurdle and the right position adjustable hurdle are both in the non-limited position and TCx center >TBRx, where TBRx is the horizontal coordinate of the lower right corner of the trough detection frame; the edge computing platform sends a limit command to the left position adjustable fence motion control DC motor driver board, drives the left position adjustable fence to move to the limit position, captures the next frame of the video stream, and returns to step S2; Step S6-3: If the left position adjustable hurdle or the right position adjustable hurdle is already at the limit position, capture the next frame of the video stream and return to step S2.

2. The method according to claim 1, characterized in that The edge computing platform executes the sow's near-farming prediction algorithm and the spatial structure intelligent adjustment algorithm. Specifically, the model weights are embedded into YOLO_v5's detect.py, enabling it to process new frames captured by the camera in real time. A data interaction layer is added between detect.py and the sow's near-farming prediction algorithm and the spatial structure intelligent adjustment algorithm to continuously transmit the detected sow posture, sow torso position, sow head position, sow tail position and trough position data to the sow's near-farming prediction algorithm and the spatial structure intelligent adjustment algorithm.

Citation Information

Patent Citations

  • Variable-structure intelligent obstetric table for sows

    CN113317215A

  • Farm feed monitoring method and device, electronic equipment and storage medium

    CN114724067A

  • Animal feature detection equipment and method based on visual identification

    CN116019027A