Virtual electronic ear tag adding model training method, ear tag adding method and device

By adding a model to virtual electronic ear tags, and automatically adding virtual identification IDs to live animals using image sensors and computer vision technology, solving the problem of interruption of traditional electronic ear tags communication and improving the success rate and security of feeding data entry.

CN118365847BActive Publication Date: 2024-11-26张宇琦 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311179086.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-13
Publication Date
2024-11-26
Estimated Expiration
2043-09-13

AI Technical Summary

Technical Problem

During the breeding of live animals, the communication between traditional radio frequency identification electronic earmarks and the Internet of Things settings is easily interrupted due to the mutual obstruction between live animals, resulting in the failure of feeding data entry.

Method used

Using virtual electronic ear tags to add models, collect top view of live animals through image sensors, use convolutional networks and Re-ID models for object detection and similar identification, and automatically add virtual identification IDs to live animals, avoiding the use of physical electronic ear tags. .

Benefits of technology

It improves the success rate of live animal feeding data entry, saves feeding costs, ensures the safety of breeders and the health of live animal, and avoids data entry failure caused by falling ear tags or emergency responses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118365847B_ABST
    Figure CN118365847B_ABST
Patent Text Reader

Abstract

The present invention provides a virtual electronic ear tag adding model training method, ear tag adding method and device, including: obtaining a first training sample set; obtaining an initial convolutional network, using the first training sample set to train the initial neural network and update model parameters to obtain a target detection model; obtaining a second training sample set; obtaining an initial Re-ID model, using the second training sample set to train the part of the initial Re-ID model that performs feature extraction and update model parameters to obtain a target Re-ID model; constructing a virtual electronic ear tag adding model, the virtual electronic ear tag adding model includes a target detection model, an image segmentation model and a target Re-ID model that are sequentially set. Obtain at least one target top view; input the target top view into the virtual electronic ear tag adding model to add an identification ID to the target live animal object in the target top view as a virtual electronic ear tag. The present invention can improve the success rate of live animal breeding data entry and ensure the safety of live animal objects and breeders.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image data processing, and in particular to a virtual electronic ear tag adding model training method, an ear tag adding method and a device. Background Art

[0002] Livestock breeding is one of the main components of agriculture. In order to facilitate the management and recording of the livestock breeding process, it is necessary to record the livestock breeding data, including feeding data, entry and exit data, and weighing data. However, for the same type of livestock, it is difficult to distinguish each individual manually. Based on this, it is necessary to add ear tags to each livestock for differentiation.

[0003] The traditional ear tag adding method includes: manually inserting an electronic ear tag with a radio frequency identification (RFID) into the ear of a live animal, and setting up an active Internet of Things device to establish a communication connection with the radio frequency identification electronic ear tag to achieve data sensing and entry.

[0004] However, in actual application scenarios, adding physical ear tags will cause live animals to have emergency reactions, and due to mutual obstruction between live animals, there is a possibility of communication interruption between the wireless radio frequency identification electronic ear tags and the Internet of Things settings, resulting in the failure of entering the feeding data of live animals. Summary of the invention

[0005] In view of this, the embodiments of the present invention provide a virtual electronic ear tag adding model training method, ear tag adding method and device to eliminate or improve one or more defects existing in the prior art, and solve the problem of failure in entering the feeding data of live animals due to interruption of communication between the wireless radio frequency identification electronic ear tags and the Internet of Things settings due to mutual occlusion between the live animals.

[0006] One aspect of the present invention provides a virtual electronic ear tag adding model training method, the method comprising the following steps:

[0007] Acquire a first training sample set, the first training sample set includes a plurality of first-category samples, each of the first-category samples includes a first-category top view for a preset barn block, the first-category top view includes one or more live animal objects, and a real position frame of each live animal object is added to the first-category top view as a label; the real position frame is used to indicate the relative position of each live animal object in the first-category top view;

[0008] An initial convolutional network is obtained, wherein the initial convolutional network takes the first type of top view as input and outputs a predicted position frame of the live animal object, a loss is constructed based on the deviation between the predicted position frame and the true position frame, and the initial neural network is trained using the first training sample set and the model parameters are updated to obtain a target detection model;

[0009] A second training sample set is obtained, wherein the second training sample set includes a plurality of second-category samples, each of which includes a second-category top view of a single live animal object, and a corresponding identification ID is added to each second-category top view as a label; the second-category samples are divided into multiple categories according to a set number of live animal objects, and the second-category samples in each category are generated for the same live animal object, and their identification IDs are consistent;

[0010] An initial Re-ID model is obtained, which takes two second-category top views as input and outputs an identification result of whether they belong to the same category; wherein the part of the initial Re-ID model that performs feature extraction takes the second-category top view as input and outputs intermediate image features; a downstream subtask is established, which includes performing an ID classification task with the image features of a single second-category top view as input, and performing a same category identification task with the image features of two second-category top views as input; a loss function is constructed by minimizing the deviation of the ID classification task, the deviation of the same category identification task, maximizing the difference between image feature classes, and / or minimizing the difference within image feature classes, and a second training sample set is used to train the part of the initial Re-ID model that performs feature extraction and update the model parameters to obtain a target Re-ID model;

[0011] A virtual electronic ear tag adding model is constructed, which includes a target detection model, an image segmentation model and a target Re-ID model which are set in sequence. The target detection model obtains and inputs a plurality of consecutive target overhead views of the target livestock shed block, and outputs a target position frame of a plurality of target live animal objects in each target overhead view. The image segmentation model cuts out a target overhead sub-image of each target live animal object according to the target position frame in each target overhead view. The target Re-ID model performs similar recognition on the target live animal objects between each target overhead view, and marks the target live animal objects of the same category in each target overhead view with the same identification ID.

[0012] Optionally, the target Re-ID model performs similar identification on the target live animal objects between the target top views, and marks the target live animal objects of the same category in the target top views with the same ID, including:

[0013] The target top-view sub-images corresponding to each target top-view are input into the target Re-ID model, so that the Re-ID model extracts the image features corresponding to each target top-view sub-image, performs top-view classification processing on the target top-view sub-images, and matches the target top-view sub-images belonging to the same target live animal object between each target top-view, and classifies the target top-view sub-images corresponding to the same target live animal object in different target top-views into the same category;

[0014] An identification ID is added to the target overhead sub-image in each target overhead view according to the classification result, and different identification IDs are marked for different categories.

[0015] Optionally, for the target top-view sub-images corresponding to each continuously input target top-view, the Re-ID model classifies and matches the target top-view sub-images corresponding to two consecutive target top-views in each batch in chronological order and adds an identification ID, so that the latter target top-view processed in the earlier batch is the same as the previous target top-view processed in the later batch.

[0016] Optionally, after obtaining the second training sample set, the method further includes:

[0017] The second type of top view is subjected to image enhancement processing, and the image enhancement processing includes flipping and rotating processing, scaling and cropping processing, translation and transformation processing, color and brightness adjustment processing, noise addition processing, color change and filter processing or mixed enhancement processing.

[0018] Optionally, the target position frame includes corner coordinates, and the corner coordinates include upper left corner coordinates and lower right corner coordinates;

[0019] or,

[0020] Corner coordinates include upper left corner coordinates, upper right corner coordinates and lower right corner coordinates;

[0021] or,

[0022] Corner coordinates include upper left corner coordinates, lower right corner coordinates, and lower left corner coordinates.

[0023] Another aspect of the present invention provides a method for adding a virtual electronic ear tag, the method comprising the following steps:

[0024] Acquire at least one target bird's-eye view, where the target bird's-eye view refers to a bird's-eye view image of one or more target live animals in a preset livestock shed block acquired by an image sensor;

[0025] The target top view is input into the virtual electronic ear tag adding model to add an identification ID to the target live animal object in the target top view as a virtual electronic ear tag. The virtual electronic ear tag adding model is obtained based on the virtual electronic ear tag adding model training method mentioned in any of the above embodiments.

[0026] Optionally, obtaining target live animal image data includes:

[0027] Acquire overhead image data acquired by at least two image sensors;

[0028] Performing frame extraction processing on the overhead view image data respectively to obtain the overhead view image corresponding to each image sensor;

[0029] The overhead images are stitched together using a preset stitching algorithm to obtain target live animal image data.

[0030] Optionally, the number of overhead images corresponding to each image sensor is at least two, and the overhead images are spliced ​​using a preset splicing algorithm to obtain target live animal image data, including:

[0031] The overhead images are grouped according to the acquisition time of the overhead image data acquired by the image sensor; the overhead images in each overhead image group are spliced ​​to form an overhead image covering a preset barn block;

[0032] The overhead images in each overhead image group are stitched together using a preset stitching algorithm to obtain target live animal image data.

[0033] Another aspect of the present invention provides a device for adding a virtual electronic ear tag, the device comprising: a processor and a memory, characterized in that computer instructions are stored in the memory, and the processor is used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the electronic device implements the above-mentioned virtual electronic ear tag adding model training method and virtual electronic ear tag adding method steps.

[0034] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the program is executed by a processor, the steps of the above-mentioned virtual electronic ear tag adding model training method and virtual electronic ear tag adding method are implemented.

[0035] The beneficial effects of the present invention are at least:

[0036] The virtual electronic ear tag adding method, model training method and device of the present invention collect a target top view of a live animal object through an image sensor, input the target top view into a virtual electronic ear tag adding model to add an identification ID as a virtual electronic ear tag, and do not need to set a physical electronic ear tag of wireless radio frequency identification on the ear of the live animal object, thereby avoiding the possibility of communication interruption between the wireless radio frequency identification electronic ear tag and the Internet of Things setting, and improving the success rate of live animal breeding data entry; at the same time, when the number of live animal objects is large, there is no need to set a wireless radio frequency identification electronic ear tag, which can save the breeding cost of the live animal objects.

[0037] Furthermore, the use of virtual electronic ear tags can prevent the ear tags from falling off due to activities or fights of live animals, thereby avoiding the failure of feeding data entry of live animals and improving the success rate of feeding data entry.

[0038] Furthermore, the use of virtual electronic ear tags avoids the need to manually set ear tags on live animals, which can ensure the safety of breeders and reduce the difficulty of raising live animals. At the same time, it also avoids the occurrence of emergency and maladaptive reactions in live animals during the process of manually setting ear tags, thereby slowing down the weight gain of live animals and improving the safety and health of live animals during the breeding process.

[0039] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.

[0040] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:

[0042] Figure 1 A flowchart of a method for training a virtual electronic ear tag adding model provided by an embodiment of the present invention;

[0043] Figure 2 A schematic diagram of a top view of a preset barn block provided in one embodiment of the present invention;

[0044] Figure 3 A flowchart of a method for adding a virtual electronic ear tag provided by another embodiment of the present invention;

[0045] Figure 4 A schematic diagram of a preset barn block provided for another embodiment of the present invention;

[0046] Figure 5 A block diagram of a virtual electronic ear tag adding model training device provided by another embodiment of the present invention;

[0047] Figure 6 A block diagram of a device for adding a virtual electronic ear tag provided by another embodiment of the present invention;

[0048] Figure 7A block diagram of an electronic device provided according to another embodiment of the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0050] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.

[0051] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0052] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.

[0053] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0054] The following is a detailed introduction to the virtual electronic ear tag adding model training method provided in this application.

[0055] like Figure 1 As shown, the embodiment of the present application provides a virtual electronic ear tag adding model training method, the implementation of the method can rely on a computer program, the computer program can be run on a computer device such as a smart phone, a tablet computer, a personal computer, or on a server, this embodiment does not limit the operating subject of the method, the method includes at least the following steps S101 to S105:

[0056] Step S101, obtaining a first training sample set.

[0057] In this embodiment, the first training sample set includes a plurality of first-class samples, each of which includes a first-class overhead view of a preset livestock shed block, the first-class overhead view includes one or more live animal objects, and the real position frame of each live animal object is added as a label in the first-class overhead view. The real position frame is used to indicate the relative position of each live animal object in the first-class overhead view.

[0058] In this embodiment, the live animal object may be a mammal such as a pig, a cow or a sheep, or may be a poultry such as a chicken, a duck or a goose. In actual implementation, the live animal object may also be a fish such as a carp or a crucian carp. This embodiment does not limit the type of the live animal object.

[0059] like Figure 2 The schematic diagram of the preset barn block is shown, taking the preset barn block containing three live animal objects as an example, including live animal A, live animal B and live animal C, and each live animal object is added with a real position box as a label.

[0060] The real position frame refers to a detection frame used to indicate the position and size of the live animal object in the first type of top view.

[0061] In one example, the real position box is a minimum rectangular box that completely contains the pixel points of the live animal object in the first type of top view.

[0062] like Figure 2 As shown, taking the top view outlines of the live animals A, B and C in the first type of top view as an ellipse as an example, the real position frame, that is, the labels added by the live animals A, B and C, is the minimum rectangular frame containing all the pixel points of the live animals A, B and C.

[0063] In another example, the real position box is a special-shaped box that completely contains the pixel points of the living animal in the first type of top view, wherein the contour edge of the special-shaped box is aligned with the contour edge of the living animal object.

[0064] For example, in the first type of top view, if the top view of the live animal object is circular, the label added to the live animal object is a circular real position frame; if the top view of the live animal object is prismatic, the label added to the live animal object is a prismatic real position frame.

[0065] In this embodiment, the first type of bird's-eye view may be acquired by an image sensor disposed in a preset barn block, or may be acquired from a network. This embodiment does not limit the method for acquiring the first type of bird's-eye view.

[0066] The image sensor refers to a sensor with an image acquisition function, including but not limited to a surveillance camera, a network camera, and an infrared sensor. This embodiment does not limit the type of the image sensor.

[0067] Step S102, obtaining an initial convolutional network.

[0068] In this embodiment, the initial convolutional network takes the first type of top view as input and outputs a predicted position frame of the live animal object, constructs a loss based on the deviation between the predicted position frame and the true position frame, and uses the first training sample set to train the initial neural network and update the model parameters to obtain a target detection model.

[0069] Among them, the initial convolutional network can be LeNet-5 neural networks (LeNet-5 Convolutional Neural Networks), AlexNet Convolutional Neural Network (AlexNet), densely connected convolutional networks (DenseNet), and this embodiment does not limit the type of the initial convolutional network.

[0070] Step S103: obtaining a second training sample set.

[0071] In this embodiment, the second training sample set includes multiple second-category samples, each of which includes a second-category overhead view of a single live animal object, and a corresponding identification ID is added to each second-category overhead view as a label; the second-category samples are divided into multiple categories according to a set number of live animal objects, and the second-category samples in each category are generated for the same live animal object, and their identification IDs are consistent.

[0072] For example: taking the second training sample set including multiple second-category top views corresponding to live animal object E and multiple second-category top views corresponding to live animal object F as an example, for the multiple second-category top views corresponding to live animal object E, the identification ID corresponding to live animal object E is added as a label; correspondingly, for the multiple second-category top views corresponding to live animal object F, the identification ID corresponding to live animal object F is added.

[0073] In this embodiment, the identification ID is used to uniquely indicate the live animal object, and different live animal objects correspond to different identification IDs. The identification ID is used to search or update the feeding data such as the entry and exit time, weighing, feeding, exercise, etc. corresponding to the live animal object in the server database and perform further operations. The allocation method of the identification ID is determined according to the type of the live animal object and the ear tag marking habits of the breeding farm. It can be numbers, letters, or a combination of numbers and letters. This embodiment does not limit the implementation method of the identification ID.

[0074] In addition, the identification ID of each live animal object may be a manually marked identification ID, or an identification ID generated by an ID generator. The ID generator includes but is not limited to a self-incrementing ID generator, a database sequence, or a distributed ID generator. This embodiment does not limit the generation method of the identification ID and the type of the ID generator.

[0075] In this embodiment, the second type of overhead view can be cropped from the first type of overhead view according to the real position frame, or it can be obtained by photographing through an image collector, or it can be acquired from the network. This embodiment does not limit the method of acquiring the second type of overhead view.

[0076] Optionally, in order to increase the diversity of the second training sample set and improve the generalization ability of the trained model, before using the second training sample set to train the model, it is also necessary to perform image enhancement processing on the second type of top view in the second training sample set.

[0077] Specifically, after obtaining the second training sample set, the method further includes: performing image enhancement processing on the second type of top view.

[0078] Among them, the image enhancement processing includes flipping and rotating processing, scaling and cropping processing, translation and transformation processing, color and brightness adjustment processing, noise adding processing, color changing and filter processing or mixed enhancement processing.

[0079] Step S104, obtaining an initial Re-ID model. The Re-ID (Person Re-Identification, Re-ID) model is a computer vision model used to track and match the identity of a target object between multiple surveillance cameras. Its goal is to identify and compare the identity of the same target object between different surveillance cameras.

[0080] In this embodiment, the initial Re-ID model takes two second-category top views as input and outputs a recognition result of whether they belong to the same category.

[0081] Among them, the part of the initial Re-ID model that performs feature extraction takes the second-category overhead view as input and outputs intermediate image features; establishes downstream subtasks, which include performing ID classification tasks with the image features of a single second-category overhead view as input, and performing similar recognition tasks with the image features of two second-category overhead views as input; constructs a loss function by minimizing the ID classification task deviation, the similar recognition task deviation, maximizing the difference between image feature classes and / or minimizing the difference within image feature classes, and uses the second training sample set to train the part of the initial Re-ID model that performs feature extraction and update the model parameters to obtain the target Re-ID model.

[0082] When the downstream subtask includes performing an ID classification task with a single second-category top view image feature as input, a loss function is constructed to minimize the ID classification task deviation. In this case, the loss function includes a first loss function.

[0083] In the case where the downstream subtask includes performing the same type of recognition task with the image features of the two second type top views as input, the construction of the loss function includes constructing the loss function by the same type of recognition task deviation, maximizing the difference between image feature classes, and / or minimizing the difference within image feature classes. In this case, the loss function includes the second loss function and / or the third loss function.

[0084] Among them, the first loss function can be an identity loss function (Identity Loss), such as L1 paradigm loss function (L1 Loss), L2 paradigm loss function (L2 Loss), etc.; the second loss function can be a verification loss function (Verification Loss), such as contrastive loss function (Contrastive Loss), Sigmoid cross entropy loss function (Sigmoid Cross Entropy Loss), etc.; the third loss function can be a triplet loss function (TripletLoss), such as Euclidean distance loss function (Euclidean Distance Loss), fractional loss function (MarginRanking Loss), etc.

[0085] In actual implementation, the first loss function, the second loss function and the third loss function can be selected or adjusted according to actual needs. This embodiment does not limit the implementation method of the first loss function, the second loss function and the third loss function.

[0086] Step S105, constructing a virtual electronic ear tag adding model.

[0087] In this embodiment, the virtual electronic ear tag adding model includes a target detection model, an image segmentation model and a target Re-ID model which are set in sequence.

[0088] Among them, the target detection model obtains and inputs multiple consecutive target bird's-eye views of the target livestock shed block, and outputs the target position boxes of multiple target live animal objects in each target bird's-eye view.

[0089] In the case where the true position frame is the smallest rectangular frame that completely contains the pixel points of the live animal object in the first type of top view, the label added to each live animal also includes the corner coordinates of the target position frame, and accordingly, the target position frame output by the target detection model also includes the corner coordinates. The corner coordinates include the upper left corner coordinates and the lower right corner coordinates; or, the corner coordinates include the upper left corner coordinates, the upper right corner coordinates and the lower right corner coordinates; or, the corner coordinates include the upper left corner coordinates, the lower right corner coordinates and the lower left corner coordinates.

[0090] In this embodiment, the target detection model is connected to the image segmentation model. The image segmentation model is used to, when receiving the target overhead view output by the target detection model, cut out the target live animal object in the target overhead view into a target overhead sub-image according to the target position box in the target overhead view, and each target overhead sub-image contains a target live animal object.

[0091] Specifically, after the target detection model obtains and inputs multiple consecutive target overhead views of the target livestock shed block and outputs the target position frames of multiple target live animal objects in each target overhead view, the image segmentation model cuts out the target overhead sub-image of each target live animal object from each target overhead view according to the target position frame therein.

[0092] At the same time, the image segmentation model is also connected to the target Re-ID model. After the image segmentation model cuts out the target overhead sub-image, the target overhead sub-image is input into the target Re-ID model. The target Re-ID model identifies the target live animal objects of the same category between each target overhead view and marks the target live animal objects of the same category in each target overhead view with the same identification ID.

[0093] Specifically, the target Re-ID model performs similar identification on the target live animal objects between the target top views, and marks the target live animal objects of the same category in the target top views with the same ID, which at least includes steps S11 to S12:

[0094] Step S11, input the target top view sub-images corresponding to each target top view into the target Re-ID model, so that the Re-ID model extracts the image features corresponding to each target top view sub-image, performs top view classification processing on the target top view sub-images, and matches the target top view sub-images belonging to the same target live animal object between the target top views, and classifies the target top view sub-images corresponding to the same target live animal object in different target top views into the same category.

[0095] Step S12: adding identification IDs to the target top-view sub-images in each target top-view image according to the classification results, wherein different categories are marked with different identification IDs.

[0096] Specifically, an identification ID is added to the target overhead view sub-image in each target overhead view according to the classification results, including: for the target overhead view sub-images corresponding to each continuously input target overhead view, the Re-ID model classifies and matches the target overhead view sub-images corresponding to two consecutive target overhead views in each batch in chronological order and adds an identification ID, and the latter target overhead view processed in the earlier batch is the same as the previous target overhead view processed in the later batch.

[0097] For example, taking three target overhead views as an example, each target overhead view includes 50 live animals. After the first target overhead view is input into the target detection model, 50 live animals are detected and the target position frames are marked, and then input into the image segmentation model. The overhead images (back images) of the 50 live animals that exist at the same time are cropped out according to the target position frames to obtain 50 target overhead sub-images. These 50 target overhead sub-images are input into the target Re-ID model for feature extraction and classification and adding identification IDs. When the second target overhead view is input, 50 live target overhead sub-images are also obtained. After feature extraction, they are classified and matched with the target overhead sub-image corresponding to the first target overhead view and an identification ID is added, so that the same living animal object in the first target overhead view and the second target overhead view is added with the same identification ID; when the third target overhead view is input, 50 live target overhead sub-images are also obtained. After feature extraction, they are classified and matched with the target overhead sub-images corresponding to the first and second target overhead views and an identification ID is added, so that the same living animal object in the third target overhead view and the second target overhead view is added with the same identification ID.

[0098] In actual implementation, after the target overhead sub-image is segmented out by the image segmentation model, the target overhead sub-image is input into the target Re-ID model in sequence. After receiving the target overhead sub-image, the target Re-ID model classifies and matches the target overhead sub-image with the stored overhead sub-image and adds an identification ID.

[0099] The stored bird's-eye view sub-image is a bird's-eye view of a live animal object pre-stored in a database. The database may be a local MySQL database or Oracle database, or a remote SQL Server database or MongoDB database. This embodiment does not limit the type of database.

[0100] The virtual electronic ear tag model training method provided in the present embodiment obtains a first training sample set; obtains an initial convolutional network, uses the first training sample set to train the initial neural network and updates model parameters to obtain a target detection model; obtains a second training sample set; obtains an initial Re-ID model, uses the second training sample set to train the part of the initial Re-ID model that performs feature extraction and updates model parameters to obtain a target Re-ID model; constructs a virtual electronic ear tag adding model, the virtual electronic ear tag adding model includes a target detection model, an image segmentation model and a target Re-ID model that are set in sequence, the target detection model obtains and inputs a plurality of continuous target top-view images of a target livestock shed block, and outputs target position frames of a plurality of target live animal objects in each target top-view image; the image segmentation model cuts out a target top-view sub-image of each target live animal object according to the target position frame in each target top-view image; the target Re-ID model performs similar identification on the target live animal objects between each target top-view image, and marks the target live animal objects of the same category in each target top-view image with the same identification ID. The invention can solve the problem that the communication between the radio frequency identification electronic ear tag and the Internet of Things setting may be interrupted due to mutual occlusion between the live animals, resulting in the failure of the entry of the feeding data of the live animals. The target top view of the live animal object is collected by the image sensor, and the target top view is input into the virtual electronic ear tag adding model to add the identification ID as the virtual electronic ear tag. There is no need to set the physical electronic ear tag of radio frequency identification on the ear of the live animal object, which avoids the possibility of communication interruption between the radio frequency identification electronic ear tag and the Internet of Things setting, and improves the success rate of the entry of the feeding data of the live animal; at the same time, when the number of live animal objects is large, there is no need to set the radio frequency identification electronic ear tag, which can save the feeding cost of the live animal objects.

[0101] In addition, the use of virtual electronic ear tags can prevent the ear tags from falling off due to activities or fighting of live animals, thereby avoiding the failure of feeding data entry of live animals and improving the success rate of feeding data entry.

[0102] In addition, the use of virtual electronic ear tags avoids the need to manually set ear tags on live animals, which can provide safety for breeders and reduce the difficulty of raising live animals. At the same time, it also avoids emergency and maladaptive reactions in live animals during the process of manually setting ear tags, thereby slowing down the weight gain of live animals, and can improve the safety and health of live animals during the breeding process.

[0103] like Figure 3As shown, an embodiment of the present application provides a method for adding a virtual electronic ear tag. The method may rely on a computer program. The computer program may be run on a computer device such as a smart phone, a tablet computer, a personal computer, or a server. This embodiment does not limit the running subject of the method. The method at least includes steps S301 to S302:

[0104] Step S301, obtaining at least one top view of the target.

[0105] The target bird's-eye view refers to a bird's-eye view image of one or more target live animals in a preset livestock shed area acquired by an image sensor.

[0106] In this embodiment, the target bird's-eye view is a complete bird's-eye view image of a preset barn block. When the number of image sensors is one, the acquisition area of ​​the image sensor covers the complete preset barn block.

[0107] When the number of image sensors is at least two, the acquisition areas of the at least two image sensors cover the entire preset barn block. At this time, the target bird's-eye view is a complete bird's-eye view of the preset barn block after the bird's-eye images acquired by the at least two image sensors are spliced.

[0108] In this embodiment, the distance between the image sensor and the ground of the preset barn block is determined by the focal length of the image sensor and the width of the preset barn block. It is required that the acquisition area between each image sensor has a repeated coverage range, and the boundary of the preset barn block is within the acquisition range of the image sensor. At the same time, a router with coverage is set up in each preset barn block, and all devices are only connected to the power supply. The image sensor is connected through the deployed router local network, and the video stream data is communicated with the cloud server or the local server through the Real Time Streaming Protocol (RTSP).

[0109] like Figure 4 As shown, taking the number of image sensors as 2 as an example, the acquisition areas of the two image sensors overlap, and the acquisition areas of the two image sensors can cover the entire preset barn block.

[0110] Optionally, acquisition areas of multiple image sensors are connected.

[0111] Specifically, in the case where the preset livestock shed block includes at least two image sensors, obtaining at least one overhead view of the target includes: obtaining overhead view image data acquired by at least two image sensors; performing image extraction processing on the overhead view image data respectively to obtain the overhead view image corresponding to each image sensor; and stitching the overhead view images by a preset stitching algorithm to obtain target live animal image data.

[0112] The preset stitching algorithm refers to a preset image or video stitching algorithm. In this embodiment, the preset stitching algorithm includes an Oriented FAST and Rotated BRIEF (ORB) algorithm, a Panorama Stitching Algorithm (PSA) or a Direct Method Stitching Algorithm (DMSA).

[0113] In this embodiment, n overhead view images can be obtained by performing image extraction processing on the overhead view image data, where n is an integer greater than 0. When n is greater than or equal to 2, that is, when the number of overhead view images that can be obtained by performing image extraction processing on the overhead view image data is greater than or equal to 2, it is necessary to first group the overhead view images corresponding to at least two image sensors in chronological order according to the acquisition time, and then stitch them together according to each group.

[0114] For example: take the number of image sensors as 2, including image sensor A and image sensor B; image sensor A and image sensor B respectively collect overhead image data at 4 pm, including overhead image data A and overhead image data B; the overhead image data A is subjected to frame extraction processing to obtain the overhead image A1 corresponding to the first moment and the overhead image A2 corresponding to the second moment; the overhead image data B is subjected to frame extraction processing to obtain the overhead image B1 corresponding to the first moment and the overhead image B2 corresponding to the second moment; the overhead image A1 and the overhead image B1 are divided into the same group and image stitching is performed; the overhead image A2 and the overhead image B2 are divided into another group and image stitching is performed.

[0115] Specifically, the number of overhead images corresponding to each image sensor is at least two, and the overhead images are stitched using a preset stitching algorithm to obtain target live animal image data, including: grouping the overhead images according to the acquisition time of the overhead image data acquired by the image sensor; the overhead images in each overhead image group are stitched into an overhead image covering a preset livestock shed block; and the overhead images in each overhead image group are stitched using a preset stitching algorithm to obtain target live animal image data.

[0116] Step S302: input the target top view into the virtual electronic ear tag adding model to add an identification ID to the target live animal object in the target top view as a virtual electronic ear tag.

[0117] The virtual electronic ear tag adding model is obtained based on the virtual electronic ear tag adding model training method mentioned in any of the above embodiments.

[0118] In this embodiment, the target detection model in the virtual electronic ear tag adding model is also used to output the angular coordinates of the target position box. When the acquisition screen of the image sensor is parallel to the top view of the preset barn block, the angular coordinates include the upper left corner coordinates and the lower right corner coordinates; when the acquisition screen of the image sensor is not parallel to the top view of the preset barn block, the angular coordinates include the upper left corner coordinates, the upper right corner coordinates and the lower right corner coordinates; or, the angular coordinates include the upper left corner coordinates, the lower right corner coordinates and the lower left corner coordinates.

[0119] In addition, in order to intuitively demonstrate whether the acquisition screen of the image sensor is parallel to the overhead view of the preset barn block, when marking the target position box, when the acquisition screen of the image sensor is parallel to the overhead view of the preset barn block, the target position box is marked as a red box; when the acquisition screen of the image sensor is not parallel to the overhead view of the preset barn block, the target position box is marked as a black box.

[0120] Specifically, after adding an identification ID as a virtual electronic ear tag to the target live animal object in the target overhead view, the method further includes: storing the identification ID in correspondence with the angular coordinates corresponding to the target position frame.

[0121] For example, if the number of target live animals in the target overhead view is 50, 50 rows of data are stored in the server database, and each row of data consists of an identification ID and 2 or 3 angular coordinates of the target position box corresponding to the identification ID.

[0122] After adding the identification ID, the corresponding identification ID can be queried in the server database. If the added identification ID already exists in the database, after querying the corresponding data field, the target live animal object's feeding information and movement data for the day corresponding to the identification ID will be updated. If the identification ID is added for the first time, the database will be interpolated and the feeding data such as the time of entering the pen will be entered. A non-contact and non-sensing operation process is realized throughout the process.

[0123] The virtual electronic ear tag adding method provided in this embodiment obtains at least one target top view; inputs the target top view into the virtual electronic ear tag adding model to add an identification ID to the target live animal object in the target top view as a virtual electronic ear tag. The virtual electronic ear tag adding model is obtained based on the virtual electronic ear tag adding model training method mentioned in any of the above embodiments. It can solve the problem that due to the mutual occlusion between live animals, there is a possibility of communication interruption between the wireless radio frequency identification electronic ear tag and the Internet of Things setting, resulting in the failure of the entry of live animal feeding data. The target top view of the live animal object is collected by an image sensor, and the target top view is input into the virtual electronic ear tag adding model to add the identification ID as a virtual electronic ear tag. There is no need to set a physical electronic ear tag of wireless radio frequency identification on the ear of the live animal object, which avoids the possibility of communication interruption between the wireless radio frequency identification electronic ear tag and the Internet of Things setting, and improves the success rate of live animal feeding data entry; at the same time, when the number of live animal objects is large, there is no need to set a wireless radio frequency identification electronic ear tag, which can save the cost of feeding live animal objects.

[0124] In addition, the use of virtual electronic ear tags can prevent the ear tags from falling off due to activities or fighting of live animals, thereby avoiding the failure of feeding data entry of live animals and improving the success rate of feeding data entry.

[0125] In addition, the use of virtual electronic ear tags avoids the need to manually set ear tags on live animals, which can ensure the safety of breeders and reduce the difficulty of raising live animals. At the same time, it also avoids emergency and maladaptive reactions in live animals during the process of manually setting ear tags, thereby slowing down the weight gain of live animals, and improving the safety and health of live animals during the breeding process.

[0126] Figure 5 The block diagram of the virtual electronic ear tag adding model training provided by an embodiment of the present application includes at least the following modules: a first training sample acquisition module 510, an initial convolutional network acquisition module 520, a second training sample acquisition module 530, a Re-ID model acquisition module 540 and an ear tag adding model construction module 550.

[0127] The first training sample acquisition module 510 acquires a first training sample set, which includes a plurality of first-category samples. Each first-category sample includes a first-category overhead view of a preset barn block. The first-category overhead view includes one or more live animal objects. The real position frame of each live animal object is added to the first-category overhead view as a label; the real position frame is used to indicate the relative position of each live animal object in the first-category overhead view.

[0128] An initial convolutional network acquisition module 520 is used to acquire an initial convolutional network. The initial convolutional network takes the first type of top view as input and outputs a predicted position frame of the live animal object, constructs a loss based on the deviation between the predicted position frame and the true position frame, and uses the first training sample set to train the initial neural network and update the model parameters to obtain a target detection model.

[0129] The second training sample acquisition module 530 acquires a second training sample set, wherein the second training sample set includes a plurality of second-category samples, each of which includes a second-category top view of a single live animal object, and a corresponding identification ID is added to each second-category top view as a label; the second-category samples are divided into multiple categories according to a set number of live animal objects, and the second-category samples in each category are generated for the same live animal object, and their identification IDs are consistent;

[0130] Re-ID model acquisition module 540, obtains an initial Re-ID model, the initial Re-ID model takes two second-category top views as input and outputs a recognition result of whether they belong to the same category; wherein the part of the initial Re-ID model that performs feature extraction takes the second-category top view as input and outputs the intermediate image features; establishes downstream subtasks, the downstream subtasks include performing an ID classification task with the image features of a single second-category top view as input, and performing a same category recognition task with the image features of two second-category top views as input; constructs a loss function by minimizing the deviation of the ID classification task, the deviation of the same category recognition task, maximizing the difference between image feature classes, and / or minimizing the difference within image feature classes, and uses the second training sample set to train the part of the initial Re-ID model that performs feature extraction and update the model parameters to obtain a target Re-ID model;

[0131] The ear tag adding model construction module 550 constructs a virtual electronic ear tag adding model, which includes a target detection model, an image segmentation model and a target Re-ID model which are set in sequence. The target detection model obtains and inputs a plurality of consecutive target top-view images of the target livestock shed block, and outputs a target position frame of a plurality of target live animal objects in each target top-view image. The image segmentation model cuts out a target top-view sub-image of each target live animal object according to the target position frame in each target top-view image. The target Re-ID model performs the same type of recognition on the target live animal objects between each target top-view image, and marks the target live animal objects of the same category in each target top-view image with the same identification ID.

[0132] For relevant details, please refer to the embodiments described above.

[0133] It should be noted that: the virtual electronic ear tag adding model training device provided in the above embodiment only uses the division of the above functional modules as an example when performing virtual electronic ear tag adding model training. In actual applications, the above functional distribution can be completed by different functional modules as needed, that is, the internal structure of the virtual electronic ear tag adding model training device is divided into different functional modules to complete all or part of the functions described above. In addition, the virtual electronic ear tag adding model training device provided in the above embodiment and the virtual electronic ear tag adding model training method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0134] Figure 6 6 is a block diagram of a virtual electronic ear tag adding device provided by an embodiment of the present application. The device comprises at least the following modules: an image acquisition module 610 and an ear tag adding module 620.

[0135] An image acquisition module 610 acquires at least one target top view, where the target top view refers to a top view image of one or more target live animals in a preset barn block acquired by an image sensor;

[0136] The ear tag adding module 620 inputs the target top view into the virtual electronic ear tag adding model to add an identification ID to the target live animal object in the target top view as a virtual electronic ear tag. The virtual electronic ear tag adding model is obtained based on the virtual electronic ear tag adding model training method mentioned in any of the above embodiments.

[0137] For relevant details, please refer to the embodiments described above.

[0138] It should be noted that: the virtual electronic ear tag adding device provided in the above embodiment only uses the division of the above functional modules as an example when adding a virtual electronic ear tag. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the virtual electronic ear tag adding device is divided into different functional modules to complete all or part of the functions described above. In addition, the virtual electronic ear tag adding device provided in the above embodiment and the virtual electronic ear tag adding method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0139] This embodiment provides an electronic device, such as Figure 7 As shown, the electronic device at least includes a processor 701 and a memory 702 .

[0140] The processor 701 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 701 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 701 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 701 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 701 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0141] The memory 702 may include one or more computer-readable storage media, which may be non-transitory. The memory 702 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 702 is used to store at least one instruction, which is used to be executed by the processor 701 to implement the virtual electronic ear tag adding model training method and virtual electronic ear tag adding method provided in the method embodiment of the present application.

[0142] In some embodiments, the electronic device may further optionally include: a peripheral device interface and at least one peripheral device. The processor 701, the memory 702 and the peripheral device interface may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface via a bus, a signal line or a circuit board. Schematically, the peripheral devices include but are not limited to: a radio frequency circuit, a touch display screen, an audio circuit, and a power supply.

[0143] Of course, the electronic device may also include fewer or more components, which is not limited in this embodiment.

[0144] Optionally, the present application also provides a computer-readable storage medium, in which a program is stored, and the program is loaded and executed by a processor to implement the virtual electronic ear tag adding method, virtual electronic ear tag adding model training method and virtual electronic ear tag adding method of the above method embodiment.

[0145] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0146] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

[0147] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0148] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0149] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.

[0150] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A virtual electronic ear tag adding model training method, characterized in that: include: Acquire a first training sample set, wherein the first training sample set includes a plurality of first-category samples, each of which includes a first-category overhead view for a preset livestock shed block, wherein the first-category overhead view includes one or more live animal objects, and a real position frame of each live animal object is added to the first-category overhead view as a label; the real position frame is used to indicate the relative position of each live animal object in the first-category overhead view; Acquire an initial convolutional network, wherein the initial convolutional network takes the first type of top view as input and outputs a predicted position frame of the live animal object, constructs a loss based on the deviation between the predicted position frame and the true position frame, and uses the first training sample set to train the initial neural network and update model parameters to obtain a target detection model; Obtain a second training sample set, wherein the second training sample set includes a plurality of second-category samples, each of the second-category samples includes a second-category top view of a single live animal object, and a corresponding identification ID is added to each of the second-category top views as a label; the second-category samples are divided into multiple categories according to a set number of live animal objects, and the second-category samples in each category are generated for the same live animal object, and their identification IDs are consistent; Obtaining an initial Re-ID model, wherein the initial Re-ID model takes the two second-category top views as input and outputs a recognition result of whether they belong to the same category; wherein a part of the initial Re-ID model that performs feature extraction takes the second-category top views as input and outputs intermediate image features; Establishing downstream subtasks, wherein the downstream subtasks include performing an ID classification task with the image features of a single second-category top view as input, and performing a similar identification task with the image features of two second-category top views as input; constructing a loss function by minimizing the deviation of the ID classification task, the deviation of the similar identification task, maximizing the difference between image feature classes, and / or minimizing the difference within image feature classes, using the second training sample set to train the part of the initial Re-ID model that performs feature extraction and update model parameters to obtain a target Re-ID model; A virtual electronic ear tag adding model is constructed, and the virtual electronic ear tag adding model includes the target detection model, the image segmentation model and the target Re-ID model which are sequentially arranged. The target detection model obtains and inputs a plurality of consecutive target top-view images of the target livestock shed block, and outputs a target position frame of a plurality of target live animal objects in each target top-view image; the image segmentation model cuts out a target top-view sub-image of each target live animal object according to the target position frame in each target top-view image; the target Re-ID model performs the same type of recognition on the target live animal objects between each target top-view image, and marks the target live animal objects of the same category in each target top-view image with the same identification ID.

2. The virtual electronic ear tag adding model training method according to claim 1, characterized in that: The target Re-ID model performs the same-type identification on the target live animal objects between the target top views, and marks the target live animal objects of the same category in the target top views with the same ID, including: The target top-view sub-images corresponding to each target top-view are input into the target Re-ID model, so that the Re-ID model extracts the image features corresponding to each target top-view sub-image, performs top-view classification processing on the target top-view sub-images, and matches the target top-view sub-images belonging to the same target live animal object between the target top-views, and classifies the target top-view sub-images corresponding to the same target live animal object in different target top-views into the same category; An identification ID is added to the target overhead sub-image in each target overhead view according to the classification result, and different identification IDs are marked for different categories.

3. The virtual electronic ear tag adding model training method according to claim 2, characterized in that: For the target top-view sub-images corresponding to each continuously input target top-view, the Re-ID model classifies and matches the target top-view sub-images corresponding to two consecutive target top-views in each batch in chronological order and adds identification IDs. The latter target top-view processed in the earlier batch is the same as the previous target top-view processed in the later batch.

4. The virtual electronic ear tag adding model training method according to claim 1, characterized in that: After obtaining the second training sample set, the method further includes: The second type of top view is subjected to image enhancement processing, wherein the image enhancement processing includes flipping and rotating processing, scaling and cropping processing, translation and transformation processing, color and brightness adjustment processing, noise addition processing, color change and filter processing or mixed enhancement processing.

5. The virtual electronic ear tag adding model training method according to claim 1, characterized in that: The target position frame includes corner coordinates, and the corner coordinates include upper left corner coordinates and lower right corner coordinates; or, The angular coordinates include the upper left corner coordinates, the upper right corner coordinates and the lower right corner coordinates; or, The corner coordinates include the upper left corner coordinates, the lower right corner coordinates, and the lower left corner coordinates.

6. A method for adding a virtual electronic ear tag, characterized in that: The steps include: Acquire at least one target top view, wherein the target top view refers to a top view image of one or more target live animals in a preset livestock shed block acquired by an image sensor; The target top view is input into a virtual electronic ear tag adding model to add an identification ID to the target live animal object in the target top view as a virtual electronic ear tag, and the virtual electronic ear tag adding model is obtained based on the virtual electronic ear tag adding model training method described in any one of claims 1 to 5.

7. The method for adding a virtual electronic ear tag according to claim 6, characterized in that: The step of acquiring at least one top view of the target includes: Acquire overhead image data acquired by at least two image sensors; Performing image frame extraction processing on the overhead view image data respectively to obtain an overhead view image corresponding to each image sensor; The overhead images are spliced ​​using a preset splicing algorithm to obtain the target live animal image data.

8. The method for adding a virtual electronic ear tag according to claim 7, characterized in that: The number of overhead images corresponding to each image sensor is at least two, and the overhead images are spliced ​​by a preset splicing algorithm to obtain the target live animal image data, including: The overhead images are grouped according to the acquisition time of the overhead image data acquired by the image sensor; the overhead images in each overhead image group are spliced ​​to form an overhead image covering the preset barn block; The overhead images in each overhead image group are spliced ​​respectively by the preset splicing algorithm to obtain the target live animal image data.

9. A device for adding a virtual electronic ear tag, comprising a processor and a memory, characterized in that: The memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the method as claimed in any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.