CN114120441A - Method and device for checking pig turning group, electronic equipment and storage medium - Google Patents

Method and device for checking pig turning group, electronic equipment and storage medium Download PDF

Info

Publication number
CN114120441A
CN114120441A CN202111328914.7A CN202111328914A CN114120441A CN 114120441 A CN114120441 A CN 114120441A CN 202111328914 A CN202111328914 A CN 202111328914A CN 114120441 A CN114120441 A CN 114120441A
Authority
CN
China
Prior art keywords
pig
pigs
target
preset
group
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111328914.7A
Other languages
Chinese (zh)
Inventor
刘旭
陈静
杨帆
柯妮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan New Hope Animal Nutrition Technology Co ltd
Shandong New Hope Liuhe Group Co Ltd
New Hope Liuhe Co Ltd
Original Assignee
Sichuan New Hope Animal Nutrition Technology Co ltd
Shandong New Hope Liuhe Group Co Ltd
New Hope Liuhe Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan New Hope Animal Nutrition Technology Co ltd, Shandong New Hope Liuhe Group Co Ltd, New Hope Liuhe Co Ltd filed Critical Sichuan New Hope Animal Nutrition Technology Co ltd
Priority to CN202111328914.7A priority Critical patent/CN114120441A/en
Publication of CN114120441A publication Critical patent/CN114120441A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/20Analysis of motion
    • G06T7/246Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30181Earth observation
    • G06T2207/30188Vegetation; Agriculture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30241Trajectory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30242Counting objects in image

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a pig turning group checking method, a pig turning group checking device, electronic equipment and a storage medium, wherein a video picture when a pig turning group is carried out in a turning group channel is obtained, a plurality of marking lines are preset in the video picture, and target detection and target tracking are carried out on a plurality of frames of pig images based on a preset target detection and tracking model, so that the pig motion track of each pig is obtained, and automatic identification of pig behaviors is realized based on an artificial intelligent model; and then the position relation between the pig motion track of each pig and the marking lines is determined, and when the position relation is that the pig motion track is intersected with the marking lines, the number of the pigs is changed, so that the intelligent checking of the number of the pigs when the pigs are switched to the group is realized, manual intervention is not needed, the human resources are reduced, the checking procedure is reduced, and the checking efficiency and the checking accuracy are improved.

Description

Method and device for checking pig turning group, electronic equipment and storage medium
Technical Field
The application relates to the technical field of animal breeding, in particular to a pig turning stock checking method and device, electronic equipment and a storage medium.
Background
The 'pig herd conversion' refers to a process of transferring a pig herd from one region to another region, and is an important link in the production process of a pig farm, and comprises pig/fattening pig sales conversion, weaned pig conversion, eliminated pig conversion and the like. In the group transfer process, the number of pigs needs to be checked to serve as important basic data for final enterprise asset management and operation management.
At present, the pig turning and counting are realized in a manual mode, and in the turning process, workers stand at two ends of a turning channel to count the number of pigs. As the processes of pig driving, counting, quantity rechecking, side station supervision and the like all require manpower, when a large-scale pig farm (such as a ten-thousand-level pig farm) is carried out to change the group, a plurality of people are required to participate, and manpower resources and time are extremely wasted. And the counting is carried out in a manual mode, so that the risk of inaccurate counting or false report exists.
Disclosure of Invention
The application provides a pig turning group checking method, a pig turning group checking device, electronic equipment and a storage medium, and aims to solve the technical problem that the checking efficiency is low in the existing pig turning group checking mode.
In order to solve the above technical problem, an embodiment of the present application provides a pig turning stock checking method, including:
acquiring a video picture when a pig changes into a group in a group changing channel, wherein the video picture comprises a plurality of frames of pig images, and a plurality of marking lines are preset in the video picture;
performing target detection and target tracking on multiple frames of pig images based on a preset target detection and tracking model to obtain the pig motion track of each pig;
determining the position relation between the pig motion track of each pig and the marking line;
if the position relationship is that the motion track of the pig is intersected with a plurality of marking lines, the number of the pigs is changed.
In the embodiment, the automatic identification of the pig behaviors is realized based on an artificial intelligence model by acquiring a video picture when the pig is switched to the group through a group switching channel, presetting a plurality of marking lines on the video picture, and carrying out target detection and target tracking on a plurality of frames of pig images based on a preset target detection and tracking model to obtain the pig motion track of each pig; and then the position relation between the pig motion track of each pig and the marking lines is determined, and when the position relation is that the pig motion track is intersected with the marking lines, the number of the pigs is changed, so that the intelligent checking of the number of the pigs when the pigs are switched to the group is realized, manual intervention is not needed, the human resources are reduced, the checking procedure is reduced, and the checking efficiency and the checking accuracy are improved.
In one embodiment, the target detection and tracking model includes yolov5 network and Deepsort network, and based on a preset target detection and tracking model, performs target detection and target tracking on multiple frames of pig images to obtain a pig motion trajectory of each pig, including:
detecting bounding box information of a target pig in a plurality of frames of pig images based on a yolov5 network, wherein the bounding box information comprises bounding box directions;
based on a Deepsort network, performing feature extraction on an image area corresponding to the bounding box information to obtain image features;
determining a first motion track of the target pig based on the image characteristics;
and combining the first motion tracks of the target pigs in the multi-frame pig images to obtain the motion tracks of the target pigs.
In the embodiment, the directionality of the bounding box of the target pig in the multi-frame pig image is detected based on the yolov5 network, the pig motion track of the target pig is identified based on the image area corresponding to the bounding box with the directionality, and the identification accuracy of the pig motion track can be improved.
In one embodiment, determining the first motion trajectory of the target pig based on the first image feature comprises:
acquiring a second motion track of the target pig in the previous frame of pig image;
predicting the predicted position of the target pig in the current frame pig image based on the second motion track, and extracting a second image feature of an image area corresponding to the predicted position;
calculating a loss value between the first image feature and the second image feature;
determining a first motion trail of the target pig based on the loss value and the predicted position
In the embodiment, the predicted position of the current frame of pig image is predicted through the second motion track of the previous frame of pig image, and the first motion track of the target pig in the current frame of pig image is determined by comparing the first image feature of the current frame of pig image with the second image feature of the image region corresponding to the predicted position.
In one embodiment, 2 marking lines are preset in the video frame, and if the position relationship is that the pig motion track intersects with a plurality of marking lines, the number of pigs is changed, including:
if the position relation is that the motion tracks of the pigs sequentially intersect with 2 marking lines according to a first preset sequence, adding 1 to the number of the pigs;
if the position relation is that the motion tracks of the pigs are sequentially intersected with the 2 marking lines according to a second preset sequence, the number of the pigs is reduced by 1, and the first preset sequence is opposite to the second preset sequence.
In the embodiment, 2 marking lines are arranged, the sequence of the motion track of the pig intersected with the 2 marking lines is detected, so that whether the pig advances or retreats is determined, 1 is correspondingly added or subtracted from the number of the pigs, the intelligent counting of the pigs when the pigs are switched to a group is realized, and the counting efficiency and accuracy are improved.
In one embodiment, the turning passage is provided with a one-way door, and the one-way door is used for controlling the pigs to pass through the turning passage in one way and is used as one of a plurality of marking lines.
This embodiment is through setting up one-way door as one in the marking line to when guaranteeing that pig one-way motion, realize the pig and count, improve the accuracy that the pig was checked.
In one embodiment, the turning passage is provided with a one-way limiting fence, and the one-way limiting fence is used for controlling the passing width of the pigs when the pigs pass through the turning passage only.
This embodiment is through setting up one-way spacing bar control and changeing crowd's passageway and only pass through one pig at every turn, and is one-way to reduce the algorithm identification process because the intensive and identification error that leads to of pig, thereby improved the pig accuracy of checing.
Further, before the herd transferring channel carries out the herd transferring of the pigs, the method also comprises the following steps:
acquiring the average pig age of a swinery to be transferred;
determining the average body width corresponding to the average pig age based on a preset mapping relation table of the pig age and the body width;
based on the average body width, a width adjusting instruction is sent to the unidirectional limiting fence and used for adjusting the width of the unidirectional limiting fence, and the width of the unidirectional limiting fence meets the condition that a single pig passes through the unidirectional limiting fence in one direction each time.
In the embodiment, the average body width of the swinery is determined through the average pig age of the swinery to be transferred, and the width of the one-way limit fence is adjusted according to the average body width, so that only one pig passes through the channel in one way at each time, and the checking accuracy is further improved.
In a second aspect, an embodiment of the present application provides a pig turning group checking device, including:
the acquisition module is used for acquiring video pictures when the pigs are switched to the group in the group switching channel, the video pictures comprise multi-frame pig images, and a plurality of marking lines are preset in the video pictures;
the detection module is used for carrying out target detection and target tracking on the multi-frame pig images based on a preset target detection and tracking model to obtain the pig motion track of each pig;
the determining module is used for determining the position relation between the pig motion track of each pig and the marking line;
and the changing module is used for changing the number of the pigs if the position relationship is that the motion tracks of the pigs are intersected with the plurality of marking lines.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to make the electronic device execute the pig herd-only inventory method according to the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the method for checking the herd-only pig inventory according to the first aspect is implemented.
Please refer to the relevant description of the first aspect for the beneficial effects of the second aspect to the fourth aspect, which are not described herein again.
Drawings
Fig. 1 is a schematic flow chart of a pig herd turning inventory method provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of an image annotation provided in an embodiment of the present application;
fig. 3 is a schematic view of a pig enclosure provided in an embodiment of the present application;
FIG. 4 is a schematic illustration of a marking line provided in an embodiment of the present application;
fig. 5 is a schematic view of a unidirectional spacer provided in an embodiment of the present application;
fig. 6 is a schematic structural diagram of a pig turning group checking device provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
As related to the background art, the current pig herd turning inventory is realized in a manual mode, and in the herd turning process, workers stand at two ends of a herd turning channel to count the number of pigs. As the processes of pig driving, counting, quantity rechecking, side station supervision and the like all require manpower, when a large-scale pig farm (such as a ten-thousand-level pig farm) is carried out to change the group, a plurality of people are required to participate, and manpower resources and time are extremely wasted. And the counting is carried out in a manual mode, so that the risk of inaccurate counting or false report exists.
Therefore, the embodiment of the application provides a pig turning group checking method, a pig turning group checking device, an electronic device and a storage medium, wherein a video picture of a pig turning group in a turning group channel is obtained, a plurality of marking lines are preset in the video picture, and target detection and target tracking are carried out on a plurality of frames of pig images based on a preset target detection and tracking model to obtain a pig motion track of each pig, so that automatic identification of pig behaviors is realized based on an artificial intelligence model; and then, the position relation between the motion track of each pig and the marking lines is determined, and when the position relation is that the motion track of each pig is intersected with the marking lines, the number of pigs is changed, so that the intelligent counting of the number of pigs when the pigs are switched into a group is realized, manual intervention is not needed, the human resources are reduced, the counting procedure is reduced, and the counting efficiency and the counting accuracy are improved.
Referring to fig. 1, a flowchart for implementing a pig group turning inventory method according to an embodiment of the present application is shown. The swinery turning and checking method described in the embodiment of the present application can be applied to electronic devices, where the electronic devices are provided with a camera or are in communication connection with an external camera, and the electronic devices include but are not limited to smart phones, tablet computers, desktop computers, supercomputers, personal digital assistants and other computer devices. The method for checking the pigs only rotating the herd comprises the following steps of S101 to S104:
step S101, obtaining a video picture when a pig changes into a group in a group changing channel, wherein the video picture comprises a plurality of frames of pig images, and a plurality of marking lines are preset in the video picture.
In this step, the herd transfer channel is the connecting channel when pigs are transferred from one region to another. And installing a camera or an external camera on the electronic equipment right above the group transferring channel, and collecting a video picture of the group transferring channel through the camera or the external camera. The video pictures are extracted into multiple frames of pig images, and the sequence of the acquisition time of each frame of pig image is marked, so that target tracking of pigs is facilitated by adopting time-coherent images subsequently.
The marking lines are line segments preset at fixed positions of the video pictures, namely a plurality of marking lines are arranged at the positions of the same size of each frame of pig image. The marking line is used as a reference line of the motion trail of the pig, and the marking line can be used as a counting boundary of the electronic equipment, so that the pig can be intelligently checked. For example, pigs were considered to have a count of +1 only at the left end of the line and pigs were considered to have a count of-1 only at the right end of the line.
And S102, performing target detection and target tracking on multiple frames of the pig images based on a preset target detection and tracking model to obtain the pig motion track of each pig.
In this step, the target detection and tracking model includes a target detection network and a target tracking network, the target detection network is used for detecting a target in the image, and the target tracking network is used for tracking the detected target. For example, the target detection network is yolov5 network, and the target tracking network is a Deepsort network. Optionally, multiple frames of pig images are input into the target detection and tracking model, and for each pig, one pig motion track is output and is represented by a track ID.
Optionally, video data when the pigs are switched to the herd only in the herd switching channel is collected, video frames in the video data are extracted, and the video frames are stored as images. As shown in the schematic diagram of the labeled image shown in fig. 2, the minimum circumscribed rectangle with the direction is used as a bounding box to label only the pigs in the image, a training set is constructed based on the labeled image, and the images in the training set are subjected to augmentation operations, such as flipping transformation, random trimming, translation transformation, size transformation, noise disturbance, rotation transformation, and the like. And inputting the training set after the amplification operation into a preset model for training until a convergence condition is preset, and obtaining the target detection and tracking model. The preset convergence condition may be that the number of model iterations reaches a preset number, or that a loss function of the model is smaller than a preset value. It should be noted that the target detection and tracking model may be trained on the electronic device, or the model file may be migrated to the electronic device after training on other electronic devices is completed.
Step S103, determining the position relation between the pig motion track of each pig and the marking line.
In this step, the positional relationship includes intersection and disjointness. Note that the mark line intersects with the turning group channel, and preferably, the mark line is perpendicular to the turning group channel. That is, if the pig passes through the herd transfer channel only, the motion trajectory of the pig inevitably intersects with all the plurality of marking lines, and if the pig does not pass through the herd transfer channel, the motion trajectory of the pig does not intersect with at least one of the plurality of marking lines.
And step S104, if the position relation is that the motion trail of the pigs is intersected with the plurality of marking lines, changing the number of the pigs.
In the step, the motion track of the pig is intersected with a plurality of marking lines, which means that the pig exits from the group transferring channel or returns to the group transferring channel, so that the number of pigs is changed. Because the pigs may pass through the herd turning channel from the positive direction and then return to the herd turning channel from the negative direction in the herd turning process, the number of the pigs passing through the herd turning channel can be accumulated to 1, and the number of the pigs returning to the herd turning channel can be reduced by 1.
In an embodiment, on the basis of the embodiment shown in fig. 1, the step S102 specifically includes:
detecting bounding box information of a target pig in a plurality of frames of the pig images based on the yolov5 network, wherein the bounding box information comprises bounding box directions;
based on the Deepsort network, performing feature extraction on the image area corresponding to the bounding box information to obtain image features;
determining a first motion track of the target pig based on the image features;
and combining the first motion tracks of the target pigs in the multiple frames of the pig images to obtain the pig motion tracks of the target pigs.
In this example, the schematic view of the pig enclosure box is shown in fig. 3. The direction information of the surrounding frame is added in the labeling process, so that the model learns the direction characteristics of the surrounding frame during training, the direction information of the frame can be predicted, the pig motion track of the target pig is identified based on the image area corresponding to the directional surrounding frame, and the identification accuracy of the pig motion track can be improved. Optionally, the bounding box information further includes a bounding box type, a bounding box size, a bounding box confidence, and the like.
Optionally, a second motion track of the target pig in the last frame of the pig image is obtained; predicting the predicted position of the target pig in the current frame pig image based on the second motion track, and extracting a second image feature of an image area corresponding to the predicted position; calculating a loss value between the first image feature and the second image feature; determining a first motion trajectory of the target pig based on the loss value and the predicted position.
Illustratively, the box (bounding box), the confidence (bounding box confidence) and the class (bounding box type) detected by yolov5 network are screened, and the bounding box with the bounding box size box _ area smaller than the preset size min _ area or the bounding box confidence smaller than the preset confidence min _ confidence is deleted. And deleting other bounding boxes of the same target through an NMS (non-maximum suppression method) so as to reserve a bounding box corresponding to each target and eliminate the condition that a plurality of bounding boxes exist in one target.
The method comprises the steps that a Deepsort network detects a corresponding area of a bounding box in an original pig image, cuts the area and then puts the cut area into a convolutional neural network for feature extraction, and then obtains a first image feature. And predicting the tracking target of the current frame through a Kalman filter by using the tracker (motion trail) of the last frame of pig image of the video.
And calculating cosine distances between first features of all the surrounding frames detected by the current frame and second features predicted by the Kalman filter to form a loss matrix. And according to the loss matrix, matching by using a Hungarian algorithm, and combining the motion track of the current frame with the track of the matched previous frame. If the previous frame corresponding to the current frame has no motion track, a motion track is newly established by the current frame. Optionally, if no motion track matching the current frame is detected for more than a preset number of frames (for example, 70 frames), then no matching is performed subsequently.
In one embodiment, 2 of the marking lines are preset in the video picture. On the basis of the embodiment shown in fig. 1, the step S104 specifically includes:
if the position relation is that the motion trail of the pig is sequentially intersected with 2 marking lines according to a first preset sequence, adding 1 to the number of the pigs;
and if the position relation is that the motion track of the pig is sequentially intersected with 2 marking lines according to a second preset sequence, the number of the pigs is reduced by 1, and the first preset sequence is opposite to the second preset sequence.
In this embodiment, 2 marking lines are arranged, and the sequence of the intersection of the track and the marking lines is detected to determine the movement direction of the pigs, so that the situation that the pigs move back to cause repeated counting is avoided, and the accuracy of checking the pigs is improved. Optionally, the track and two lines successively intersect to calculate a valid count, and only collide with one line and do not calculate valid data.
Illustratively, the schematic of the marked lines shown in FIG. 4. When the pig passes through the trajectory from the left line L to the right line R, counting +1 when the pig indicates the advancing direction; when the pig passes from the right line R to the left line L, the backward direction is counted as-1.
Optionally, the turning passage is provided with a one-way door for controlling the pigs to pass through the turning passage in one way and serve as one of the plurality of marking lines. The one-way door can only enable the pig to move forward but not move backward, so that the situation of repeated counting caused by the fact that the pig only moves back is avoided. Preferably, the one-way gate is provided as the most upper one of the several marked lines, i.e. as the right line R in fig. 4, in order to further improve the accuracy of the counting judgment.
Optionally, a schematic view of a one-way retaining rail as shown in fig. 5. The turning channel is provided with a one-way limiting fence, and the one-way limiting fence is used for controlling the passing width of the pigs when only passing through the turning channel. Wherein railing G can adjust according to the actual width of changeing crowd's passageway, and one-way spacing fence H can adjust through the width according to the size of pig. It will be appreciated that more or fewer one-way retaining rails H may be provided on the balustrade G as shown in figure 5.
Optionally, the one-way fence is used as one of the several marking lines, such as the right line R in fig. 4. Only one pig passes through the group channel by setting the one-way limiting fence, and the pig passes through the group channel in one way, so that the identification error caused by the intensive pigs in the algorithm identification process is reduced, and the checking accuracy of the pigs is improved.
In an embodiment, on the basis of the embodiment shown in fig. 1, before the herd transferring channel performs herd transferring of pigs, the method further includes:
acquiring the average pig age of a swinery to be transferred;
determining the average body width corresponding to the average pig age based on a preset mapping relation table of the pig age and the body width;
and sending a width adjusting instruction to the unidirectional limiting fence based on the average body width, wherein the width adjusting instruction is used for adjusting the width of the unidirectional limiting fence, and the width of the unidirectional limiting fence meets the condition that a single pig passes through the unidirectional limiting fence in a unidirectional way every time.
In this embodiment, before the group is transferred, an operator inputs the age of the pigs to be transferred into the group at an equipment controller (electronic equipment), determines the body width of the pigs corresponding to the age of the pigs according to a mapping relation table, and controls the one-way limiting bar to adjust the width according to the body width, so that the pigs just pass through one-way limiting when being transferred into the group, and the inventory accuracy is further improved.
In order to execute the method for checking the pigs by only turning the pigs, which corresponds to the embodiment of the method, corresponding functions and technical effects are realized. Referring to fig. 6, fig. 6 is a block diagram illustrating a pig turning group checking device according to an embodiment of the present application. For convenience of explanation, only the parts related to the present embodiment are shown, and the swine herd turning and inventory device provided in the embodiments of the present application includes:
the acquisition module 601 is configured to acquire a video picture when a pig changes from a group to a group in a group changing channel, where the video picture includes multiple frames of pig images, and the video picture is preset with multiple marking lines;
the detection module 602 is configured to perform target detection and target tracking on multiple frames of the pig images based on a preset target detection and tracking model to obtain a pig motion track of each pig;
a determining module 603, configured to determine a position relationship between the pig motion trajectory of each pig and the marking line;
and a changing module 604, configured to change the number of pigs if the position relationship is that the motion trajectory of the pig intersects with the plurality of marking lines.
In one embodiment, the target detection and tracking model includes yolov5 network and Deepsort network, and the detection module 602 includes:
the detecting unit is used for detecting bounding box information of a target pig in the pig image of the current frame based on the yolov5 network, wherein the bounding box information comprises a bounding box type, a bounding box size and a bounding box direction;
the extraction unit is used for extracting the features of the image area corresponding to the bounding box information based on the Deepsort network to obtain first image features;
the determining unit is used for determining a first motion track of the target pig in the current frame pig image based on the first image feature;
and the merging unit is used for merging the first motion tracks of the target pigs in the multiple frames of the pig images to obtain the pig motion tracks of the target pigs.
Optionally, the determining unit includes:
the acquisition subunit is used for acquiring a second motion track of the target pig in the previous frame of the pig image;
the prediction subunit is configured to predict, based on the second motion trajectory, a predicted position of the target pig in the current frame pig image, and extract a second image feature of an image area corresponding to the predicted position;
a calculation subunit configured to calculate a loss value between the first image feature and the second image feature;
and the determining subunit is used for determining a first motion track of the target pig based on the loss value and the predicted position.
In an embodiment, the video frame has 2 preset mark lines, and the changing module 604 includes:
the increasing unit is used for adding 1 to the number of the pigs if the position relation is that the motion tracks of the pigs sequentially intersect with 2 marking lines according to a first preset sequence;
and the reduction unit is used for reducing the number of the pigs by 1 if the position relation is that the motion tracks of the pigs are sequentially intersected with the 2 marking lines according to a second preset sequence, wherein the first preset sequence is opposite to the second preset sequence.
Optionally, the turning passage is provided with a one-way door for controlling the pigs to pass through the turning passage in one way and serve as one of the plurality of marking lines.
Optionally, the turning channel is provided with a one-way limiting fence, and the one-way limiting fence is used for controlling the passing width of the pigs when the pigs pass through the turning channel.
In an embodiment, the pig herd-only inventory device further includes:
the second acquisition module is used for acquiring the average pig age of the swinery to be transferred;
the second determination module is used for determining the average body width corresponding to the average pig age based on a preset pig age and body width mapping relation table;
and the sending module is used for sending a width adjusting instruction to the unidirectional limiting fence based on the average body width, wherein the width adjusting instruction is used for adjusting the width of the unidirectional limiting fence, and the width of the unidirectional limiting fence meets the condition that a single pig passes through the unidirectional limiting fence in one direction at each time.
The pig turning group checking device can implement the pig turning group checking method of the method embodiment. The alternatives in the above-described method embodiments are also applicable to this embodiment and will not be described in detail here. The rest of the embodiments of the present application may refer to the contents of the above method embodiments, and in this embodiment, details are not described again.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 7, the electronic apparatus 7 of this embodiment includes: at least one processor 70 (only one shown in fig. 7), a memory 71, and a computer program 72 stored in the memory 71 and executable on the at least one processor 70, the processor 70 implementing the steps of any of the method embodiments described above when executing the computer program 72.
The electronic device 7 may be a computing device such as a smart phone, a tablet computer, a desktop computer, and a cloud server. The electronic device may include, but is not limited to, a processor 70, a memory 71. Those skilled in the art will appreciate that fig. 7 is merely an example of the electronic device 7, and does not constitute a limitation of the electronic device 7, and may include more or less components than those shown, or combine some of the components, or different components, such as an input-output device, a network access device, etc.
The Processor 70 may be a Central Processing Unit (CPU), and the Processor 70 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 71 may in some embodiments be an internal storage unit of the electronic device 7, such as a hard disk or a memory of the electronic device 7. The memory 71 may also be an external storage device of the electronic device 7 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the electronic device 7. The memory 71 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer program. The memory 71 may also be used to temporarily store data that has been output or is to be output.
In addition, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in any of the method embodiments described above.
The embodiments of the present application provide a computer program product, which when running on an electronic device, enables the electronic device to implement the steps in the above method embodiments when executed.
In several embodiments provided herein, it will be understood that each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a terminal device to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are further detailed to explain the objects, technical solutions and advantages of the present application, and it should be understood that the above-mentioned embodiments are only examples of the present application and are not intended to limit the scope of the present application. It should be understood that any modifications, equivalents, improvements and the like, which come within the spirit and principle of the present application, may occur to those skilled in the art and are intended to be included within the scope of the present application.

Claims (10)

1. A pig turning group checking method is characterized by comprising the following steps:
acquiring a video picture when a pig is switched to a group in a group switching channel, wherein the video picture comprises a plurality of frames of pig images, and a plurality of marking lines are preset in the video picture;
performing target detection and target tracking on the multiple frames of the pig images based on a preset target detection and tracking model to obtain the pig motion track of each pig;
determining the position relation between the pig motion track of each pig and the marking line;
and if the position relation is that the motion track of the pig intersects with the plurality of marking lines, changing the number of the pigs.
2. The method for pig turning group inventory of claim 1, wherein the target detection and tracking model comprises yolov5 network and Deepsort network, and the method for performing target detection and target tracking on multiple frames of the pig images based on the preset target detection and tracking model to obtain the pig motion trajectory of each pig comprises:
for each frame of the pig image, detecting bounding box information of a target pig in the current frame of the pig image based on the yolov5 network, wherein the bounding box information comprises a bounding box category, a bounding box size and a bounding box direction;
based on the Deepsort network, performing feature extraction on the image area corresponding to the bounding box information to obtain a first image feature;
determining a first motion track of the target pig in the current frame pig image based on the first image feature;
and combining the first motion tracks of the target pigs in the multiple frames of the pig images to obtain the pig motion tracks of the target pigs.
3. The pig herd-only inventory method of claim 2, wherein the determining a first motion trajectory of the target pig based on the first image feature comprises:
acquiring a second motion track of the target pig in the previous frame of the pig image;
predicting the predicted position of the target pig in the current frame pig image based on the second motion track, and extracting a second image feature of an image area corresponding to the predicted position;
calculating a loss value between the first image feature and the second image feature;
determining a first motion trajectory of the target pig based on the loss value and the predicted position.
4. The method according to claim 1, wherein 2 marking lines are preset in the video frame, and if the position relationship is that the pig motion trajectory intersects with all of the marking lines, the changing the number of pigs comprises:
if the position relation is that the motion trail of the pig is sequentially intersected with 2 marking lines according to a first preset sequence, adding 1 to the number of the pigs;
and if the position relation is that the motion track of the pig is sequentially intersected with 2 marking lines according to a second preset sequence, the number of the pigs is reduced by 1, and the first preset sequence is opposite to the second preset sequence.
5. The method as claimed in claim 1, wherein the herd turning passage is provided with a one-way gate for controlling the pigs to pass through the herd turning passage in one direction and as one of the plurality of marking lines.
6. The method for checking the rotating group of pigs according to claim 1, wherein the rotating group channel is provided with a one-way limiting fence, and the one-way limiting fence is used for controlling the passing width of the pigs when the pigs pass through the rotating group channel.
7. The method of claim 6, further comprising, prior to the herd transfer lane for herd transfer, the steps of:
acquiring the average pig age of a swinery to be transferred;
determining the average body width corresponding to the average pig age based on a preset mapping relation table of the pig age and the body width;
and sending a width adjusting instruction to the unidirectional limiting fence based on the average body width, wherein the width adjusting instruction is used for adjusting the width of the unidirectional limiting fence, and the width of the unidirectional limiting fence meets the condition that a single pig passes through the unidirectional limiting fence in a unidirectional way every time.
8. A pig only changes crowd and checks device which characterized in that includes:
the acquisition module is used for acquiring a video picture when a pig changes from a group to a group in a group switching channel, wherein the video picture comprises a plurality of frames of pig images, and a plurality of marking lines are preset in the video picture;
the detection module is used for carrying out target detection and target tracking on a plurality of frames of the pig images based on a preset target detection and tracking model to obtain the pig motion track of each pig;
the determining module is used for determining the position relation between the pig motion track of each pig and the marking line;
and the changing module is used for changing the number of the pigs if the position relation is that the motion tracks of the pigs are intersected with the plurality of the marking lines.
9. An electronic device, comprising a memory for storing a computer program and a processor for executing the computer program to cause the electronic device to perform the swine herd turning inventory method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that it stores a computer program which, when executed by a processor, implements the swine rotational only herd inventory method according to any one of claims 1 to 7.
CN202111328914.7A 2021-11-10 2021-11-10 Method and device for checking pig turning group, electronic equipment and storage medium Pending CN114120441A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111328914.7A CN114120441A (en) 2021-11-10 2021-11-10 Method and device for checking pig turning group, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111328914.7A CN114120441A (en) 2021-11-10 2021-11-10 Method and device for checking pig turning group, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114120441A true CN114120441A (en) 2022-03-01

Family

ID=80378240

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111328914.7A Pending CN114120441A (en) 2021-11-10 2021-11-10 Method and device for checking pig turning group, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114120441A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640807A (en) * 2022-03-15 2022-06-17 京东科技信息技术有限公司 Video-based object counting method and device, electronic equipment and storage medium
CN116193363A (en) * 2023-05-04 2023-05-30 广东省农业科学院动物科学研究所 Dynamic tracking processing method and system for live pig transfer

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640807A (en) * 2022-03-15 2022-06-17 京东科技信息技术有限公司 Video-based object counting method and device, electronic equipment and storage medium
CN114640807B (en) * 2022-03-15 2024-01-16 京东科技信息技术有限公司 Video-based object statistics method, device, electronic equipment and storage medium
CN116193363A (en) * 2023-05-04 2023-05-30 广东省农业科学院动物科学研究所 Dynamic tracking processing method and system for live pig transfer
CN116193363B (en) * 2023-05-04 2023-06-27 广东省农业科学院动物科学研究所 Dynamic tracking processing method and system for live pig transfer

Similar Documents

Publication Publication Date Title
CN114120441A (en) Method and device for checking pig turning group, electronic equipment and storage medium
CN112257502A (en) Pedestrian identification and tracking method and device for surveillance video and storage medium
US20220375106A1 (en) Multi-target tracking method, device and computer-readable storage medium
US20210170580A1 (en) Action imitation method and robot and computer readable medium using the same
CN110796135B (en) Target positioning method and device, computer equipment and computer storage medium
WO2021104124A1 (en) Method, apparatus and system for determining confinement pen information, and storage medium
CN107786848A (en) The method, apparatus of moving object detection and action recognition, terminal and storage medium
CN113011403B (en) Gesture recognition method, system, medium and device
Zheng et al. YOLO-BYTE: An efficient multi-object tracking algorithm for automatic monitoring of dairy cows
CN111695462A (en) Face recognition method, face recognition device, storage medium and server
CN109447022B (en) Lens type identification method and device
CN113781526A (en) Domestic animal count identification system
Gan et al. Spatiotemporal graph convolutional network for automated detection and analysis of social behaviours among pre-weaning piglets
CN110599520B (en) Open field experiment data analysis method, system and terminal equipment
JP2017076394A (en) Moving object counter and method
CN114255424A (en) Method and device for determining object behaviors, storage medium and electronic device
CN111405197B (en) Video clipping method, image processing method and device
CN113628165A (en) Livestock rotating fence checking method, device and storage medium
CN112465869A (en) Track association method and device, electronic equipment and storage medium
CN115588194A (en) Image data labeling method, device, equipment and medium based on weak supervised learning
CN111598005A (en) Dynamic capture data processing method and device, electronic equipment and computer storage medium
CN114119648A (en) Pig counting method for fixed channel
CN110991235B (en) State monitoring method and device, electronic equipment and storage medium
CN115035157B (en) AGV motion control method, device and medium based on visual tracking
CN114005011B (en) Method, system, equipment and medium for determining in-loop state of live stock

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination