Small sample-based chicken identification method and device, storage medium and electronic equipment
Patent Information
- Application Number
- CN202411909200.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-03-18
AI Technical Summary
In the prior art, the chicken behavior data is obtained by manually observing chickens, which has a large workload and is prone to cause data deviations, affecting the accuracy of the data.
The identification model is constructed based on the meta-learning detector framework introduced with a deformable detector. The chicken monitoring videos in the breeding area are collected through pre-set shooting equipment, processed into multiple monitoring pictures, and input the pre-trained identification model for identification processing to obtain the chicken's identity identification information and behavior identification information.
There is no need for manual field observation, avoid stimulation to chickens, improve data accuracy, reduce data acquisition costs, and provide convenient and low-cost data acquisition methods.
Smart Images

Figure CN119649466A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a chicken identification method and device based on a small sample, a storage medium and an electronic device. Background Art
[0002] In the process of breeding broiler chickens, the behavioral data of chickens has many meanings. Some behaviors of chickens reflect the health status and growth status of chickens. Researchers can use the behavioral data of chickens to adjust feeding and management measures, screen individuals with genetic characteristics of oil content, etc. The behavioral data of chickens is an important research data for breeding chickens.
[0003] The inventors have found that currently, the behavioral data of chickens is obtained by manually observing chickens. This method of obtaining behavioral data of chickens is labor-intensive, and it is easy for humans to irritate the chickens during the process of observing them, resulting in deviations in the collected behavioral data of the chickens and inaccurate behavioral data. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a chicken identification method and device based on small samples, a storage medium and an electronic device. The present application uses a recognition model constructed based on a meta-learning detector framework that introduces a deformable detector to obtain the identification information of chickens in the breeding area. It does not require manual field observation, avoids stimulating the chickens, improves the accuracy of the collected data, and reduces the cost of collecting data.
[0005] To achieve the above objectives, the present application provides the following technical solutions:
[0006] The first aspect of the present application provides a chicken identification method based on a small sample, comprising:
[0007] Using a pre-set camera to collect chicken monitoring videos in a breeding area, where the breeding area contains a plurality of monitored chickens;
[0008] Processing the chicken monitoring video to obtain multiple monitoring pictures;
[0009] Multiple surveillance images are input into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the surveillance images, and obtain the identification information of each chicken in the breeding area output by the recognition model, wherein the identification information includes the chicken's identity recognition information and behavior recognition information; wherein the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector.
[0010] The second aspect of the present application provides a chicken identification device based on a small sample, comprising:
[0011] A collection unit, used to collect chicken monitoring videos in a breeding area using a pre-set shooting device, wherein the breeding area contains a plurality of monitored chickens;
[0012] A processing unit, used for processing the chicken monitoring video to obtain a plurality of monitoring pictures;
[0013] The recognition unit is used to input multiple monitoring pictures into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the monitoring pictures, and obtain the identification information of each chicken in the breeding area output by the recognition model, wherein the identification information includes the chicken's identity recognition information and behavior recognition information; wherein the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector.
[0014] A third aspect of the present application provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the chicken identification method based on a small sample as described above.
[0015] A fourth aspect of the present application provides an electronic device comprising a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to perform the small sample-based chicken identification method as described above.
[0016] Compared with the prior art, this application has the following advantages:
[0017] The present application provides a chicken identification method and device based on a small sample, a storage medium and an electronic device, including: using a pre-set shooting device to collect chicken monitoring videos in a breeding area, wherein the breeding area contains multiple monitored chickens; processing the chicken monitoring videos to obtain multiple monitoring pictures; inputting multiple monitoring pictures into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the monitoring pictures, and obtain the identification information of each chicken in the breeding area output by the recognition model, wherein the identification information includes the chicken identity recognition information and the behavior recognition information; wherein the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector. The scheme provided by the present application is used to obtain identification information containing the behavior data of the chickens, and the acquisition process does not require manual field observation to collect relevant data, thereby avoiding the situation where the data is inaccurate due to the stimulation of the chickens, providing a convenient and low-cost data collection method, and improving the accuracy of the collected chicken behavior data. Effectively reduce the labor cost of poultry breeding and improve the economic benefits of poultry breeding. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0019] Figure 1 A flowchart of a chicken identification method based on a small sample provided in an embodiment of the present application;
[0020] Figure 2 An example diagram of a scene in which a shooting device is set up in a breeding area provided in an embodiment of the present application;
[0021] Figure 3 An example diagram of an identity tag provided in an embodiment of the present application;
[0022] Figure 4 An example diagram of a chicken wearing an identity tag provided in an embodiment of the present application;
[0023] Figure 5 A schematic diagram of the Meta-DETR structure provided in the embodiment of the present application;
[0024] Figure 6 A schematic diagram of the structure of a chicken identification device based on a small sample provided in an embodiment of the present application;
[0025] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0028] The present application can be used in many general or special computing device environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multi-processor devices, distributed computing environments including any of the above devices or equipment, etc.
[0029] Reference Figure 1 , is a flow chart of a chicken identification method based on a small sample provided in an embodiment of the present application, and is specifically described as follows:
[0030] S101. Use a pre-set shooting device to collect chicken monitoring videos in a breeding area, where the breeding area contains a plurality of monitored chickens.
[0031] In one embodiment provided in the present application, a photographing device is used to photograph the breeding area without blind spots. In order to achieve the goal of photographing without blind spots, multiple photographing devices may be used for photographing.
[0032] Reference Figure 2 , is an example diagram of a scene in which a shooting device is set up in a breeding area according to an embodiment of the present application, such as Figure 2 As shown, two cameras are used to monitor a single breeding area in a side-by-side manner at different angles, and all chickens in the breeding area are photographed without blind spots. When the camera is set up in a side-by-side manner, a monitoring probe is installed at the top of the corner of the breeding area. The monitoring probe is connected to the computer via a network cable to achieve real-time monitoring and collection of individual chickens. The advantage is that the field of view is large, and individual chickens in most spaces of the chicken house can be monitored in real time.
[0033] The photographing device may be a monitoring probe or a device with a camera function.
[0034] In another embodiment provided in the present application, each chicken in the breeding area wears an identity tag at a preset position on the chicken body, and the identity tag carries the chicken's identity information, and the chicken's identity information can be a globally unique number.
[0035] Each chicken's ID tag must be duplicated, of the same size and with the same number, and the number must be clearly marked on the front and back of each tag. Figure 3, which is an example diagram of an identity tag provided in an embodiment of the present application. When assigning numbers to chickens, you can use the uppercase character set of English letters (AZ), excluding I and O, and a total of 24 letters are used to assign numbers to chickens. Initially, it is a two-letter AA. After the second letter changes from A to Z, the first letter will increase by one unit, that is, from A to B, and so on, all the way to ZZ. In this way, 576 combinations can be formed, which is enough to cope with all situations in the breeding process of breeder chickens. Standard size of individual chicken identity tags: Use a cable tie label with a length of 5CM and a width of 4CM, and write the label number on the front and back of the label with a waterproof and oleophobic marker. The direction of the text is toward the bottom of the label, and two are made with the same number.
[0036] Each chicken wears an ID tag with the same number at the base of its left and right wings. The tag tie must be moderately tight and the ID tag must be perpendicular to the wing plane. Figure 4 , is an example of a chicken wearing an identity tag provided in an embodiment of the present application; specifically, the tip of the tie is passed through the lock of the tie head and tightened, and the diameter of the formed loop is about 2.5 cm. The diameter of the root of the chicken wing in the breeding stage is about 2.5 cm. The tie worn by both wings is perpendicular to the wing plane, so that the identity number is clearly visible.
[0037] S102: Process the chicken monitoring video to obtain multiple monitoring pictures.
[0038] The process of processing the chicken monitoring video to obtain multiple monitoring pictures is as follows: based on a preset frame extraction frequency, video frames are extracted from the chicken monitoring video; for each video frame, the video frame is preprocessed, and the processed video frame is determined as a monitoring picture.
[0039] The preset frame extraction frequency can be set according to actual needs, for example, a video frame can be extracted every 10 frames. For another example, in order to ensure the consistency between frames of the image obtained after the video is divided into frames, the smoothness of the fighting behavior and the information retention, the video image can be saved every 5 frames.
[0040] The preprocessing of video frames includes: image denoising, histogram equalization, and standardization. The noise in the image is removed by filtering and other methods to improve the image clarity; the image grayscale value is redistributed to enhance the contrast and make the image details clearer; the pixel value is adjusted to the standard distribution range through linear transformation, which is often used to improve the accuracy of subsequent recognition results.
[0041] For example, the video encoding parameters of the data acquisition equipment can be determined according to the fighting patterns and duration of chickens to ensure the consistency between video frames and avoid significant flickering, jumping or distortion. The integrity and smoothness of the chicken fighting process in the video can be guaranteed to avoid image jitter and discontinuity of image content. The retention of key information can be improved to avoid blurring and distortion of targets in the image.
[0042] S103. Input multiple monitoring images into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each monitoring image, and obtain the identification information of each chicken in the breeding area output by the recognition model, wherein the recognition information includes the chicken's identity recognition information and behavior recognition information; wherein the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector.
[0043] In another embodiment provided in the present application, the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each monitoring picture to obtain the recognition information of each chicken in the breeding area output by the recognition model, as described in detail as follows:
[0044] For each surveillance image, the chicken identification model extracts the first detection area of each identity tag in the surveillance image, and each identity tag is in the first detection area corresponding to it; extracts the first feature data in each first detection area, performs identity identification processing on the first feature data, and outputs the identity identification information of the identity tag; preferably, the identity identification information includes the identified identity number; further, the first detection area can be obtained according to the edge of the identity tag, the first detection area is a closed area, and the first detection area frames the identity tag; the first feature data includes relevant feature data about the code on the identity tag in the first detection area;
[0045] For each identity tag of each monitoring picture, the chicken behavior recognition model extracts a second detection area of the detection object corresponding to the identity tag from the monitoring picture, the detection object is the chicken carrying the identity tag, and the detection object is in the second detection area; extracts second feature data in the second detection area, performs behavior recognition processing on the second feature data, and outputs behavior recognition information of the identity tag; the second detection area is a closed area, and the second detection area frames the detection object; the behavior recognition information includes a label representing the behavior of the chicken carrying the identity tag;
[0046] For each identity tag of each monitoring image, the identification information of the chicken carrying the identity tag is generated based on the identity identification information and behavior identification information of the identity tag.
[0047] Furthermore, the identification information includes identity identification information and behavior identification information of the identity tag.
[0048] In the embodiment provided in the present application, since there are multiple surveillance pictures, the same chicken will appear in multiple surveillance pictures, and therefore, the same chicken will have multiple identification information.
[0049] In the method provided in the embodiment of the present application, a pre-set shooting device is used to collect chicken monitoring videos in a breeding area, and the breeding area contains multiple monitored chickens; the chicken monitoring videos are processed to obtain multiple monitoring pictures; the multiple monitoring pictures are input into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the monitoring pictures, and obtain the identification information of each chicken in the breeding area output by the recognition model, and the identification information includes the chicken identity recognition information and behavior recognition information; wherein, the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on the meta-learning detector framework that introduces a deformable detector. The scheme provided by the present application is used to obtain identification information containing the behavior data of chickens. The acquisition process does not require manual field observation to collect relevant data, avoids the situation where the data is inaccurate due to stimulation of chickens, provides a convenient and low-cost data collection method, and improves the accuracy of the collected chicken behavior data. Effectively reduce the labor cost of poultry breeding and improve the economic benefits of poultry breeding.
[0050] In another embodiment provided in the present application, after obtaining the identification information of each chicken, a behavior label can be obtained from the behavior identification information of each identification information; the behavior label characterized by fighting behavior is determined as a target label; for each target label, the identification information containing the target label is determined as the target information, and the number of fights of the chicken corresponding to the target information is increased.
[0051] It can also be understood as: for each chicken, obtain the behavior label in the behavior identification information of each identification information of the chicken, determine the number of behavior labels representing fighting behavior, and update the number of fights of the chicken based on the determined number.
[0052] In another embodiment provided in the present application, during a fight between chickens, the first detection area of the chicken (i.e., the detection area of the chicken's identity tag) and the second detection area (i.e., the detection area of the chicken's body) may overlap. When the overlapping area between the two exceeds 85%, the fighting record of the chicken carrying the identity tag may be increased by one.
[0053] Therefore, the chicken identification information can be used to count the fighting situations of chickens, providing key data for chicken breeding.
[0054] The scheme provided in this application is used to obtain the identification information of chickens. The identification information can be used to analyze the fighting behavior of chickens and improve the breeding environment. The environmental settings can be optimized by analyzing the identification information, such as increasing the activity space, adjusting the feeding strategy, etc., to reduce conflicts and avoid fighting; using the identification information for behavioral research, individuals with low aggressiveness and mild personality can be screened for breeding, thereby reducing the aggressiveness in the group and promoting a healthier and more stable group environment. By monitoring the frequency and intensity of fighting behavior, it can help analyze the relationship between the personality characteristics and reproductive efficiency of the breeder chickens, optimize the breeding strategy, and ensure that the breeder chickens can maintain a good state and efficient reproductive capacity during the breeding period. By reducing the damage caused by fighting behavior, reducing the cost of drug treatment, mortality and unnecessary waste of resources, the farm can significantly reduce costs and improve economic benefits. By improving the living environment of the flock and reducing fighting behavior, the growth rate and weight of the chickens can be increased, thereby improving the meat quality and economic benefits, and enhancing the market competitiveness of chicken products.
[0055] In another embodiment provided in the present application, the chicken identity model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector.
[0056] This solution uses Deformable DETR (deformable detector) to improve Meta-DETR (meta-learning detector framework), introduces a deformable attention mechanism to improve computational efficiency and convergence speed, especially in the target detection task, keeps the Meta mechanism unchanged, and only improves DETR. It aims to solve the problems of high computational complexity and slow convergence of DETR when processing high-resolution images, while retaining the advantages of Transformer in global context modeling.
[0057] Deformable DETR improves the self-attention mechanism in DETR and adopts local self-attention. Each query only interacts with a specific local area in the image, rather than the entire image. This greatly reduces the computational complexity of the model, improves the training speed and convergence speed, while still effectively capturing key spatial information. In DeformableDETR, each query interacts only with several key positions in the image through deformable attention. These key positions are dynamically generated after feature extraction of the input image and are learnable. In other words, the "field of view" of each query is deformable and can be focused on different positions depending on the task. In this way, Deformable DETR can better focus on useful information in the image, reduce the amount of calculation, and improve computational efficiency. In order to better capture objects of different scales, Deformable DETR uses multi-scale feature maps. This design can help the model focus on features of different scales at the same time, thereby improving the detection ability of small objects. Each attention query not only focuses on a single scale, but can communicate information across multiple scales to obtain richer contextual information. Through the cross-scale attention mechanism, Deformable DETR can capture features at different levels at a more fine-grained level, thereby improving the detection ability of large and small objects. The above-mentioned measures ensure that the model focuses on key features and improves the detection accuracy of the model.
[0058] Deformable DETR is based on the architecture of DETR and uses a standard CNN backbone (ResNet50) to extract feature maps. These feature maps are fed into the Transformer module for processing. Similar to DETR, Deformable DETR also uses the Transformer encoder-decoder structure. The encoder part of the Transformer processes the feature maps of the image, and the decoder part predicts the location and category of the object based on the generated query. The difference is that the deformable attention mechanism is introduced in the decoder of Deformable DETR. The queries in the decoder are designed as deformable queries, and each query focuses on different feature map locations based on the learned reference position, thereby avoiding the excessive reliance on global information in the traditional self-attention mechanism. Deformable DETR outputs the category label and bounding box regression results of each object through a prediction head. Similar to DETR, it performs object detection tasks by predicting the category and location of the object. Each query corresponds to a candidate object, and the model generates the category and bounding box of these candidate objects through the output of the decoder.
[0059] The loss function still consists of two parts, classification loss and positioning loss. Classification loss is used to calculate the difference between the category of each predicted box and the true label, usually using cross entropy loss. Positioning loss is used to calculate the error between the coordinates of the predicted box and the true box, usually using IoU loss.
[0060] Deformable DETR is a significant improvement on DETR. By introducing local self-attention and multi-scale feature design, it effectively solves the problems of low computational efficiency and slow convergence in DETR. Deformable DETR achieves higher accuracy in target detection tasks, especially in small object detection and processing high-resolution images.
[0061] Reference Figure 5 , is a schematic diagram of the Meta-DETR structure provided in an embodiment of the present application, which shows an example process of using a query set and a support set to train a recognition model built based on Meta-DETR, extracting features from the query set to obtain features of the query set, extracting features from the support set to obtain features of the support set; inputting the features of the query set and the features of the support set into the relevance aggregation module in the recognition model, so that the relevance aggregation module uses the features of the query set and the features of the support set for learning, adjusting the weights of parameters and other parameters in the model, and finally, after the training is completed, it can be used to identify the identification information of chickens.
[0062] The Meta-DETR model used in this application is implemented on the pytorch deep learning framework. Meta-DETR inherits the Transformer architecture of DETR and uses its global context capture capability and flexible query mechanism for target detection. The Transformer architecture can capture global context information in the image through the self-attention mechanism, which helps to improve the accuracy of target detection. The query mechanism in DETR allows the model to use a set of query vectors to predict the category and location of the target in the target detection task. This mechanism is retained and optimized in Meta-DETR. Meta-DETR is especially optimized for the task of few-sample target detection, so that the model can maintain good detection performance even with only a small number of labeled samples. During the training process, Meta-DETR designed meta-tasks of chicken fighting behavior and identity labels. Each meta-task contains a small number of labeled samples. Through the training of these tasks, the model learned how to perform effective detection under few-sample conditions. Meta-DETR quickly adjusts model parameters in new tasks through meta-learning algorithms, improving its performance in few-sample target detection. By introducing the task of identifying fighting behaviors of chickens of different breeds during the training process, Meta-DETR improves the domain generalization ability of the model, enabling it to adapt to the task of identifying fighting behaviors of chickens of different breeds.
[0063] In another embodiment provided by the present application, the recognition model is trained. The training process refers to S201-S203, and the specific description is as follows:
[0064] S201. Obtain an identity label detection data set, where the identity label detection data set includes multiple label data, and the label data includes an identity label image and identity label annotation information of the identity label image; the identity label detection data set includes a first training set, a first verification set, and a first test set, and there are multiple label data in the first training set, the first verification set, and the first test set.
[0065] Each label data in the identity label detection dataset is pre-labeled data. Each label data contains an identity label image and identity label annotation information of the identity label image. The identity label image is an image framed in the sample image, which contains the identity label of the chicken. The identity label annotation information includes information such as the position and size of the identity label image in the sample image.
[0066] Multiple label data can be obtained for each sample image, and there are multiple sample images.
[0067] The proportions of labeled data in the first training set, the first validation set, and the first test set are different, and the data in the first data set, the first validation set, and the first test set are independent of each other.
[0068] S202, obtaining a chicken fighting behavior data set, wherein the chicken fighting behavior data set includes multiple chicken behavior data, and the chicken behavior data includes chicken fighting images and chicken fighting behavior annotation information of the chicken fighting images; the chicken fighting behavior data set includes a second training set, a second verification set, and a second test set, and the second training set, the second verification set, and the second test set all contain multiple label data.
[0069] The chicken behavior data includes chicken fighting images and chicken fighting behavior annotation information of the chicken fighting images. Preferably, the chicken behavior data can be obtained through sample images, and multiple chicken behavior data can be obtained from each sample image.
[0070] The chicken fighting image in the chicken behavior data is an image of the chicken framed in the sample image, and the chicken fighting behavior annotation information of the chicken fighting image includes descriptive information of the behavior of the chicken in the chicken fighting image; specifically, when the chicken's behavior is normal, the descriptive information includes the chicken's wings hanging down on both sides of the trunk and folded together, the neck bristles close to the body, presenting a tight and smooth shape, and the claws naturally open, etc.; when the chicken's behavior is a fighting behavior, the descriptive information includes the chicken's wings stretched out and flapping, the neck bristles erected and loose, and the claws tightened, etc.
[0071] Furthermore, the data in the identity tag detection dataset and the chicken fighting behavior dataset cover the data of chickens at different stages of their growth, such as the infancy and adulthood of chickens.
[0072] S203, using the identity tag detection data set and the chicken fighting behavior data set to train the chicken identity recognition model and the chicken behavior recognition model in the chicken recognition model, when the training of the chicken identity recognition model and the chicken model behavior recognition model is completed, a trained chicken recognition model is obtained.
[0073] The chicken identification model is trained using a first training set, and the model parameters of the chicken identification model are continuously adjusted during the training process, and the hyperparameters of the chicken identification model are adjusted using a first validation set until the chicken identification model meets a preset first convergence condition, thereby obtaining a trained chicken identification model; the model performance of the trained chicken identification model is evaluated using a first test set, and when the model performance of the trained chicken identification model reaches the preset performance, the training of the chicken identification model is terminated.
[0074] The chicken behavior recognition model is trained using the second training set, and the model parameters of the chicken behavior recognition model are continuously adjusted during the training process, and the hyperparameters of the chicken identity model are adjusted using the second validation set until the chicken behavior recognition model meets the preset second convergence condition, thereby obtaining a trained chicken behavior recognition model; the model performance of the trained chicken behavior recognition model is evaluated using the second test set, and when the model performance of the trained chicken behavior recognition model reaches the preset performance, the training of the chicken identity model is terminated.
[0075] Further, in the embodiments provided by the present application, the training set is used to train the model and is the basis of model learning. The model adjusts parameters on this data set, minimizes errors, learns how to extract features from input data, and makes predictions or classifications. The training set contains labeled data for the model to optimize parameters. The validation set is used for model tuning and selection. During the training process, the validation set is used to evaluate the intermediate effect of the model, help select the most appropriate hyperparameters (such as learning rate, regularization coefficient, etc.), and decide whether further training is needed. The validation set helps detect whether the model is overfitting (performing well on the training set but poorly on new data). The validation set is usually not involved in the final training of the model, but is used to select the best model configuration. The test set is used to evaluate the final performance of the model and is usually used after the model training and validation stages are completed. The test set is data that the model has not seen, and the purpose is to detect the generalization ability of the model, that is, its performance on new and unseen data. The test set should be strictly separated from the training set and the validation set to ensure the fairness and accuracy of the evaluation results.
[0076] Another embodiment provided in the present application illustrates the process of training a chicken identification model, specifically:
[0077] Step 1: Basic data collection and data set preparation:
[0078] According to the equipment layout plan, data acquisition equipment was installed inside the farm to collect monitoring videos of chicken fighting behavior in two ways: side acquisition and side acquisition. The monitoring video collected by the monitoring equipment was processed according to the video frame processing method to obtain the original video frame. Furthermore, the monitoring video frame rate was 25fps, the video resolution was 2560×1440, and the video encoding was H.264. According to the rules and duration of chicken fighting behavior, it was determined after multiple experiments that the image was saved every 10 frames.
[0079] Deep learning usually has high requirements for the scale of training data. Data augmentation can increase the scale of original image data to a certain extent, thereby improving the performance of the model. This application uses the following data augmentation algorithm:
[0080] 1. Image denoising: remove noise from the image through Gaussian filtering, median filtering and other methods to improve image clarity;
[0081] 2. Histogram equalization: redistribute the grayscale values of the image to make its histogram distribution more uniform, which is very effective in improving the visual effect of low-contrast images;
[0082] 3. Standardization: Linearly transforming the pixel values of an image to conform to a standard distribution helps eliminate scale differences between different images, making the images more comparable and consistent in subsequent processing.
[0083] The video frames extracted from the surveillance video are processed by using a data augmentation algorithm to obtain a processed sample image.
[0084] Step 2: Dataset creation:
[0085] First, obtain surveillance videos from surveillance cameras deployed in real farming environments. Second, perform frame processing on the surveillance videos, crop the images obtained by frame division to remove irrelevant redundant information in the images, and perform frame-level annotation according to the chicken target detection dataset annotation standard. Finally, store the target detection dataset in COCO annotation format and divide it into training set and test set in a ratio of 8:2.
[0086] That is, the sample images obtained from the surveillance video are annotated at the frame level, the images of the identity tags and the images of the chickens in the sample images are framed, and then the framed identity tag images and chicken images (i.e., the chicken fighting images mentioned above) are annotated. Specifically, the specific position, size, and encoding of the identity tag image in the sample image are annotated, and the behavior description information of the chicken image is annotated.
[0087] The data set can be divided according to a preset ratio to obtain an identity label data set and a chicken fighting behavior data set.
[0088] Step 3: Train the recognition model including the chicken behavior recognition model and the chicken identity recognition model:
[0089] The identification model is trained using the identity tag dataset and the chicken fighting behavior dataset obtained in step 2. Specifically, the chicken identity recognition model is trained using the identity tag dataset, and the chicken fighting behavior dataset is used to train the chicken behavior recognition model.
[0090] Preferably, the chicken behavior recognition model can be regarded as a chicken fighting task, and the chicken identity recognition model can be regarded as an identity tag recognition task. After the recognition model training is completed, a small batch support set (Support Set) and query set (Query Set) are set for the chicken fighting task and the identity tag recognition task respectively.
[0091] The support set contains a small number of labeled samples to guide model learning. The query set is used to evaluate the detection performance of the model on the task. Then, samples of different categories are randomly sampled from the training dataset to construct multiple tasks. Each task simulates a few-sample detection scenario, and these tasks are constantly changed during training to enhance the generalization ability of the recognition model.
[0092] The model is trained on the support set, the model parameters are updated, the model performance is evaluated on the query set, and the loss is calculated. According to the loss of the query set, the model parameters are updated through the meta-learning algorithm, the meta-gradient is calculated, and the global parameters of the model are updated to make it more generalizable.
[0093] The Meta-DETR used in this application uses a meta-learning task construction and training framework, combined with the dynamic sampling position of DeformableDETR, and uses sparse interactions to reduce the amount of computation while maintaining focus on key features, especially for small targets. It achieves fast adaptation and efficient detection in few-sample target detection tasks. Its training process includes task construction, meta-training, and meta-gradient updates, which makes the model perform better on new tasks.
[0094] Through the above steps, the fighting behavior of chickens can be identified based on the monitoring video. This identification method can improve efficiency, reduce subjective observation bias, and does not require close observation, thereby achieving non-interventional identification of chicken fighting behavior and providing a powerful technical support for intelligent precision farming.
[0095] This application uses a meta-learning-based recognition model to detect chicken fighting behavior, which can quickly adjust its parameters when encountering a small number of new samples, thereby achieving rapid adaptation and efficient detection, providing certain technical support for the monitoring of good fighting chickens, and making outstanding contributions to the scientific and refined breeding development. By using artificial intelligence technology to replace traditional manual supervision methods, fighting behaviors in breeding and raising areas are identified and the number of occurrences of the behaviors is counted, which is used to reduce the labor cost of poultry breeding and improve the economic benefits of poultry breeding.
[0096] Although the present invention depicts operations in a particular order, this should not be understood as requiring that the operations be performed in the particular order shown or in a sequential order.Multitasking and parallel processing may be advantageous under certain circumstances.
[0097] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0098] and Figure 1 Corresponding to the method shown in the figure, the embodiment of the present application also provides a chicken identification device based on a small sample, which is used to support Figure 1 Implementation of the method shown.
[0099] Reference Figure 6 , is a schematic diagram of the structure of a chicken identification device based on a small sample provided in an embodiment of the present application, and is specifically described as follows:
[0100] The collection unit 401 is used to collect chicken monitoring videos in a breeding area using a pre-set shooting device, where the breeding area contains a plurality of monitored chickens;
[0101] A processing unit 402 is used to process the chicken monitoring video to obtain multiple monitoring pictures;
[0102] The recognition unit 403 is used to input multiple monitoring pictures into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the monitoring pictures, and obtain the identification information of each chicken in the breeding area output by the recognition model, wherein the identification information includes the chicken's identity recognition information and behavior recognition information; wherein the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector.
[0103] In the device provided by the embodiment of the present application, a pre-set shooting device is used to collect chicken monitoring videos in a breeding area, and the breeding area contains multiple monitored chickens; the chicken monitoring videos are processed to obtain multiple monitoring pictures; the multiple monitoring pictures are input into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the monitoring pictures, and obtain the identification information of each chicken in the breeding area output by the recognition model, and the identification information includes the chicken identity recognition information and behavior recognition information; wherein, the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on the meta-learning detector framework that introduces a deformable detector. The scheme provided by the present application is used to obtain identification information containing the behavior data of chickens. The acquisition process does not require manual field observation to collect relevant data, avoids the situation where the data is inaccurate due to stimulation of chickens, provides a convenient and low-cost data collection method, and improves the accuracy of the collected chicken behavior data. Effectively reduce the labor cost of poultry breeding and improve the economic benefits of poultry breeding.
[0104] In another embodiment provided by the present application, the device further includes a training unit, wherein the training unit is used to train the recognition model;
[0105] The training unit performs a process of training the recognition model, including:
[0106] Acquire an identity tag detection data set, wherein the identity tag detection data set includes multiple tag data, wherein the tag data includes an identity tag image and identity tag annotation information of the identity tag image; the identity tag detection data set includes a first training set, a first validation set, and a first test set, wherein the first training set, the first validation set, and the first test set all contain multiple tag data;
[0107] Acquire a chicken fighting behavior data set, wherein the chicken fighting behavior data set includes a plurality of chicken behavior data, wherein the chicken behavior data includes a chicken fighting image and chicken fighting behavior annotation information of the chicken fighting image; the chicken fighting behavior data set includes a second training set, a second verification set, and a second test set, wherein the second training set, the second verification set, and the second test set all contain a plurality of label data;
[0108] The chicken identity recognition model and the chicken behavior recognition model in the chicken recognition model are trained using the identity tag detection data set and the chicken fighting behavior data set. When the training of the chicken identity recognition model and the chicken model behavior recognition model is completed, a trained chicken recognition model is obtained.
[0109] In another embodiment provided by the present application, the training unit of the device executes a process of training the chicken identity recognition model and the chicken behavior recognition model in the chicken recognition model using the identity tag detection dataset and the chicken fighting behavior dataset, including:
[0110] The chicken identification model is trained using the first training set, the model parameters of the chicken identification model are continuously adjusted during the training process, and the hyperparameters of the chicken identification model are adjusted using the first validation set until the chicken identification model meets a preset first convergence condition, thereby obtaining a trained chicken identification model;
[0111] Using the first test set to evaluate the model performance of the trained chicken identification model, when the model performance of the trained chicken identification model reaches a preset performance, the training of the chicken identification model is terminated;
[0112] The chicken behavior recognition model is trained using the second training set, the model parameters of the chicken behavior recognition model are continuously adjusted during the training process, and the hyperparameters of the chicken identification model are adjusted using the second validation set, until the chicken behavior recognition model meets the preset second convergence condition, thereby obtaining a trained chicken behavior recognition model;
[0113] The model performance of the trained chicken behavior recognition model is evaluated using the second test set. When the model performance of the trained chicken behavior recognition model reaches a preset performance, the training of the chicken identification model is terminated.
[0114] In another embodiment provided in the present application, each chicken in the breeding area of the device wears an identity tag at a preset position on the chicken's body, and the identity tag carries the chicken's identity information.
[0115] In another embodiment provided by the present application, the recognition unit of the device performs a process of inputting a plurality of monitoring pictures into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the monitoring pictures, and obtaining the identification information of each chicken in the breeding area output by the recognition model, including:
[0116] For each of the monitoring pictures, the chicken identification model extracts the first detection area of each identity tag in the monitoring picture, and each of the identity tags is in the first detection area corresponding to it; extracts the first feature data in each of the first detection areas, performs identity identification processing on the first feature data, and outputs the identity identification information of the identity tag;
[0117] For each identity tag of each monitoring picture, the chicken behavior recognition model extracts a second detection area of a detection object corresponding to the identity tag from the monitoring picture, where the detection object is a chicken carrying the identity tag, and the detection object is in the second detection area; extracts second feature data in the second detection area, performs behavior recognition processing on the second feature data, and outputs behavior recognition information of the identity tag;
[0118] For each identity tag in each monitoring image, identification information of the chicken carrying the identity tag is generated based on the identity identification information and behavior identification information of the identity tag.
[0119] In another embodiment provided by the present application, the device further includes:
[0120] An updating unit is used to obtain a behavior label from each of the behavior identification information; determine the behavior label characterized by fighting behavior as a target label; for each of the target labels, determine the identification information containing the target label as the target information, and increase the number of fights of the chicken corresponding to the target information.
[0121] In another embodiment provided by the present application, the processing unit of the device performs a process of processing the chicken monitoring video to obtain a plurality of monitoring pictures, including:
[0122] Extracting video frames from the chicken monitoring video based on a preset frame extraction frequency;
[0123] For each video frame, the video frame is preprocessed, and the processed video frame is determined as a monitoring picture.
[0124] An embodiment of the present invention further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned chicken identification method based on small samples.
[0125] The embodiment of the present invention further provides an electronic device, the structural diagram of which is shown in FIG. Figure 7As shown, it specifically includes a memory 601 and one or more instructions 602, wherein the one or more instructions 602 are stored in the memory 601 and are configured to be executed by one or more processors 603 to perform the following operations:
[0126] Using a pre-set camera to collect chicken monitoring videos in a breeding area, where the breeding area contains a plurality of monitored chickens;
[0127] Processing the chicken monitoring video to obtain multiple monitoring pictures;
[0128] Multiple surveillance images are input into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the surveillance images, and obtain the identification information of each chicken in the breeding area output by the recognition model, wherein the identification information includes the chicken's identity recognition information and behavior recognition information; wherein the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector.
[0129] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards in the relevant regions.
[0130] The specific implementation processes and derivative methods of the above-mentioned embodiments are all within the protection scope of the present invention.
[0131] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0132] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may 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.
[0133] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A chicken identification method based on a small sample, characterized in that: include: Using a pre-set camera to collect chicken monitoring videos in a breeding area, where the breeding area contains a plurality of monitored chickens; Processing the chicken monitoring video to obtain multiple monitoring pictures; Multiple surveillance images are input into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the surveillance images, and obtain the identification information of each chicken in the breeding area output by the recognition model, wherein the identification information includes the chicken's identity recognition information and behavior recognition information; wherein the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector.
2. The method according to claim 1, characterized in that: The process of training the recognition model includes: Acquire an identity tag detection data set, wherein the identity tag detection data set includes multiple tag data, wherein the tag data includes an identity tag image and identity tag annotation information of the identity tag image; the identity tag detection data set includes a first training set, a first validation set, and a first test set, wherein the first training set, the first validation set, and the first test set all contain multiple tag data; Acquire a chicken fighting behavior data set, wherein the chicken fighting behavior data set includes a plurality of chicken behavior data, wherein the chicken behavior data includes a chicken fighting image and chicken fighting behavior annotation information of the chicken fighting image; the chicken fighting behavior data set includes a second training set, a second verification set, and a second test set, wherein the second training set, the second verification set, and the second test set all contain a plurality of label data; The chicken identity recognition model and the chicken behavior recognition model in the chicken recognition model are trained using the identity tag detection data set and the chicken fighting behavior data set. When the training of the chicken identity recognition model and the chicken model behavior recognition model is completed, a trained chicken recognition model is obtained.
3. The method according to claim 2, characterized in that The using the identity tag detection data set and the chicken fighting behavior data set to train the chicken identity recognition model and the chicken behavior recognition model in the chicken recognition model includes: The chicken identification model is trained using the first training set, the model parameters of the chicken identification model are continuously adjusted during the training process, and the hyperparameters of the chicken identification model are adjusted using the first validation set until the chicken identification model meets a preset first convergence condition, thereby obtaining a trained chicken identification model; Using the first test set to evaluate the model performance of the trained chicken identification model, when the model performance of the trained chicken identification model reaches a preset performance, the training of the chicken identification model is terminated; The chicken behavior recognition model is trained using the second training set, the model parameters of the chicken behavior recognition model are continuously adjusted during the training process, and the hyperparameters of the chicken identification model are adjusted using the second validation set, until the chicken behavior recognition model meets the preset second convergence condition, thereby obtaining a trained chicken behavior recognition model; The model performance of the trained chicken behavior recognition model is evaluated using the second test set. When the model performance of the trained chicken behavior recognition model reaches the preset performance, the training of the chicken identification model is terminated.
4. The method according to claim 1, characterized in that: Each chicken in the breeding area wears an identity tag at a preset position on the chicken body, and the identity tag carries the chicken's identity information.
5. The method according to claim 1, characterized in that The plurality of monitoring pictures are input into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the monitoring pictures, and the recognition information of each chicken in the breeding area output by the recognition model is obtained, including: For each of the monitoring pictures, the chicken identification model extracts the first detection area of each identity tag in the monitoring picture, and each of the identity tags is in the first detection area corresponding to it; extracts the first feature data in each of the first detection areas, performs identity identification processing on the first feature data, and outputs the identity identification information of the identity tag; For each identity tag of each monitoring picture, the chicken behavior recognition model extracts a second detection area of a detection object corresponding to the identity tag from the monitoring picture, where the detection object is a chicken carrying the identity tag, and the detection object is in the second detection area; extracts second feature data in the second detection area, performs behavior recognition processing on the second feature data, and outputs behavior recognition information of the identity tag; For each identity tag in each monitoring image, identification information of the chicken carrying the identity tag is generated based on the identity identification information and behavior identification information of the identity tag.
6. The method according to claim 1, characterized in that Also includes: Obtaining a behavior label from each of the behavior identification information; The behavior label characterized as fighting behavior is determined as the target label; For each of the target tags, the identification information including the target tag is determined as the target information, and the number of fights of the chickens corresponding to the target information is increased.
7. The method according to claim 1, characterized in that The chicken monitoring video is processed to obtain a plurality of monitoring pictures, including: Extracting video frames from the chicken monitoring video based on a preset frame extraction frequency; For each video frame, the video frame is preprocessed, and the processed video frame is determined as a monitoring picture.
8. A chicken identification device based on a small sample, characterized in that: include: A collection unit, used to collect chicken monitoring videos in a breeding area using a pre-set shooting device, wherein the breeding area contains a plurality of monitored chickens; A processing unit, used for processing the chicken monitoring video to obtain a plurality of monitoring pictures; The recognition unit is used to input multiple monitoring pictures into a pre-trained recognition model, so that the chicken identity recognition model and the chicken behavior recognition model in the recognition model perform recognition processing on each of the monitoring pictures, and obtain the identification information of each chicken in the breeding area output by the recognition model, wherein the identification information includes the chicken's identity recognition information and behavior recognition information; wherein the chicken identity recognition model and the chicken behavior recognition model in the recognition model are both constructed based on a meta-learning detector framework that introduces a deformable detector.
9. A storage medium, characterized in that: The storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the chicken identification method based on a small sample as described in any one of claims 1 to 7.
10. An electronic device, characterized in that: The invention comprises a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the chicken identification method based on a small sample as described in any one of claims 1 to 7.
Citation Information
Cited By
Chicken flock individual stress monitoring and early warning method and system based on multi-modal semantic driving
CN122527785A