Construction method of chick sex identification model and chick sex identification method and system
By constructing a chick sex identification model, using k-means and K-nearest neighbor algorithms to preprocess chick vent images, and performing multi-task learning, the problems of low accuracy and efficiency in chick sex identification were solved, achieving efficient and accurate chick sex identification.
Patent Information
- Application Number
- CN202511294646.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2026-01-09
AI Technical Summary
Existing methods for sex identification in chicks suffer from low accuracy and efficiency, especially manual and automatic vent-turning methods, which are not accurate enough.
A chick sex identification model was constructed by acquiring historical images of the vents of chicks of multiple breeds, using k-means clustering and K-nearest neighbor algorithms for image preprocessing, and combining localization, feature extraction, and classification networks for multi-task learning and transfer learning to construct chick sex identification models for multiple breeds.
It significantly improves the accuracy of chick sex identification to about 98%, freeing up manual identification, improving work efficiency, and enabling the identification of 1,400 chicks per hour. It solves the problems of reduced accuracy and low efficiency caused by human eye identification.
Smart Images

Figure CN121305607A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of chick breeding technology, and in particular to a method for constructing a chick sex identification model, a chick sex identification method and system. Background Technology
[0002] To save on various feeding costs such as feed, poultry houses, and labor, farms often separate male and female chicks. Currently, the main methods for sexing chicks are the fast / slow feather identification method and the vent identification method, with the vent identification method being the most common practice in the industry.
[0003] Currently, identification of chicks is mainly done manually by identifiers through cloacal turning. Manual identification suffers from low accuracy and efficiency. Although there are now methods for automatic cloacal turning identification of chicks, these methods still have problems with insufficient accuracy. Summary of the Invention
[0004] Therefore, it is necessary to provide a method for constructing a chick sex identification model, a chick sex identification method and system to address the problems in the relevant technologies, in order to solve the problems of low accuracy and efficiency of existing manual cloacal sex identification, as well as the problem of insufficient accuracy of existing automatic cloacal sex identification methods.
[0005] To achieve the above objectives, firstly, this application provides a method for sex determination of chicks, the method comprising:
[0006] Historical anal images of chicks of multiple breeds were obtained, and the historical anal images were extracted frame by frame from a continuous video stream;
[0007] The historical anal images are preprocessed to obtain a historical image dataset. The preprocessing of the historical anal images includes: clustering the historical anal images using the k-means clustering algorithm to identify target tissues and interfering objects in the historical anal images; removing interfering objects from the historical anal images; and filling in the historical anal images after removing interfering objects using the K-nearest neighbor algorithm.
[0008] A basic sex identification model for chicks is constructed based on the historical image dataset. The basic sex identification model for chicks includes a localization network, a feature extraction network, and a classification network.
[0009] The basic chick sex identification model is subjected to multi-task learning and transfer learning to obtain multiple chick sex identification models corresponding to multiple breeds.
[0010] In some embodiments, a basic sex identification model for chicks is constructed based on the historical image dataset, including:
[0011] Label the location of the chick's anus in each of the aforementioned historical anal images;
[0012] The sex of the chicks was labeled in each of the historical anal images;
[0013] A very deep multichannel neural network with an attention mechanism is used to extract features from each historical anal image to obtain a high-dimensional feature map of each historical anal image.
[0014] Based on the high-dimensional feature map and the chick anal location label, a regression network with spatial attention mechanism is used as the localization network to identify the region of interest corresponding to the chick anal region.
[0015] The region of interest is combined with the high-dimensional feature map and used as input to a deep CNN classification model to construct a basic sex identification model for chicks.
[0016] In some embodiments, the basic chick sex identification model is subjected to multi-task learning and transfer learning to obtain a chick sex identification model, including:
[0017] Data augmentation techniques were used to merge the cloaca data of chicks from multiple breeds into a single merged dataset.
[0018] The localization network and the feature extraction network are decoupled and trained using the merged dataset, and an attention mechanism is used to dynamically focus on key regions.
[0019] With the parameters of the localization network fixed, the feature extraction network and the classification network are optimized using the merged dataset;
[0020] Repeat the above training and optimization steps several times to obtain multiple chick sex identification models corresponding to multiple breeds.
[0021] In some embodiments, during the acquisition of historical anal images of chicks of multiple breeds, consecutive frames from the video stream are selected for each chick's anus to obtain multiple historical anal images for each chick's anus; before the k-means clustering algorithm is used to cluster the historical anal images to identify target tissues and interfering elements in each historical anal image during the preprocessing of each historical anal image, the method further includes:
[0022] Deep learning algorithms are used to fuse multiple historical anal images of the same chick at the same anal site into a single historical anal image.
[0023] The k-means clustering algorithm clusters the historical anal images after image fusion to identify target tissues and interfering objects in the historical anal images after image fusion; and removes interfering objects in the historical anal images after image fusion.
[0024] Secondly, this application also provides a system for constructing a chick sex identification model, the system comprising:
[0025] The image acquisition module is used to acquire historical anal images of chicks of multiple breeds, which are extracted frame by frame from a continuous video stream;
[0026] A preprocessing module is used to preprocess each of the historical anal images to obtain a historical image dataset. The preprocessing of each of the historical anal images includes: clustering each of the historical anal images using a k-means clustering algorithm to identify target tissues and interfering objects in each of the historical anal images; removing interfering objects from each of the historical anal images; and filling in each of the historical anal images after removing interfering objects using a K-nearest neighbor algorithm.
[0027] A basic sex identification model construction module for chicks is used to construct a basic sex identification model for chicks based on the historical image dataset. The basic sex identification model for chicks includes a localization network, a feature extraction network, and a classification network.
[0028] The chick sex identification model construction module is used to perform multi-task learning and transfer learning on the basic chick sex identification model to obtain multiple chick sex identification models corresponding to multiple breeds.
[0029] In some embodiments, during the process of acquiring historical anal images of chicks of multiple breeds, the image acquisition module selects images of consecutive frames in the video stream for each chick's anal area to obtain multiple historical anal images of each chick's anal area.
[0030] Before using the k-means clustering algorithm to cluster the historical anal images to identify target tissues and interfering objects in each historical anal image, the preprocessing module also uses a deep learning algorithm to fuse multiple historical anal images of the same chick's anus into a single historical anal image. The k-means clustering algorithm then clusters the fused historical anal images to identify target tissues and interfering objects in each fused historical anal image.
[0031] Thirdly, this application also provides a method for sexing chicks, the method comprising:
[0032] A chick sex identification model is constructed using the method described in the first aspect.
[0033] A real-time anal image of the chick to be tested is obtained, which is extracted frame by frame from a continuous video stream;
[0034] The real-time anal image is preprocessed, which includes: clustering the real-time anal image using the k-means clustering algorithm to identify target tissue and interfering objects in the real-time anal image; removing interfering objects from the real-time anal image; and filling in the real-time anal image after removing interfering objects using the K-nearest neighbor algorithm.
[0035] The preprocessed real-time anal image is input into the corresponding breed of chick sex identification model for identification, so as to obtain the sex identification result of the chick to be tested.
[0036] In some embodiments, during the acquisition of real-time anal images of the chicks to be tested, consecutive frames of images from the video stream are selected at the anus of the chicks to be tested to obtain multiple real-time anal images of the chicks to be tested; during the preprocessing of the real-time anal images, before using the k-means clustering algorithm to cluster the real-time anal images to identify target tissues and interference in the real-time anal images, the process further includes:
[0037] A deep learning algorithm is used to fuse multiple real-time anal images of the chick under test into a single real-time anal image.
[0038] The k-means clustering algorithm clusters the image-fused real-time anal images to identify target tissues and interfering objects in the image-fused real-time anal images; and removes interfering objects from the image-fused real-time anal images.
[0039] Fourthly, this application also provides a chick sex identification system; the chick sex identification system includes:
[0040] The image acquisition module is used to acquire historical anal images of chicks of multiple breeds and real-time anal images of chicks under test. Both the historical anal images and the real-time anal images are extracted frame by frame from a continuous video stream.
[0041] A preprocessing module is used to preprocess each of the historical anal images to obtain a historical image dataset, and to preprocess the real-time anal images. The preprocessing of the historical anal images includes: clustering each of the historical anal images using a k-means clustering algorithm to identify target tissues and interfering objects in each historical anal image; removing interfering objects from each historical anal image; and filling in the historical anal images after removing interfering objects using a K-nearest neighbor algorithm. The preprocessing of the real-time anal images includes: clustering the real-time anal images using a k-means clustering algorithm to identify target tissues and interfering objects in the real-time anal image; removing interfering objects from the real-time anal image; and filling in the real-time anal images after removing interfering objects using a K-nearest neighbor algorithm.
[0042] A basic sex identification model construction module for chicks is used to construct a basic sex identification model for chicks based on the historical image dataset. The basic sex identification model for chicks includes a localization network, a feature extraction network, and a classification network.
[0043] The chick sex identification model construction module is used to perform multi-task learning and transfer learning on the basic chick sex identification model to obtain multiple chick sex identification models corresponding to multiple breeds; the chick sex identification model is used to identify the preprocessed real-time anal image of the corresponding breed to obtain the sex detection result of the chick to be tested.
[0044] In one embodiment, during the process of acquiring historical anal images of chicks of multiple breeds, the image acquisition module selects images of consecutive frames in the video stream for each chick's anal area to obtain multiple historical anal images of each chick's anal area; during the process of acquiring real-time anal images of chicks to be tested, images of consecutive frames in the video stream are selected for the chicks to be tested's anal area to obtain multiple real-time anal images of the chicks to be tested's anal area.
[0045] Before using the k-means clustering algorithm to cluster the historical anal images to identify target tissues and interfering objects, the preprocessing module also uses a deep learning algorithm to fuse multiple historical anal images of the same chick's anus into a single historical anal image. The k-means clustering algorithm then clusters the fused historical anal images to identify target tissues and interfering objects within them.
[0046] Before using the k-means clustering algorithm to cluster the real-time anal images to identify target tissues and interfering objects, the preprocessing module also uses a deep learning algorithm to fuse multiple real-time anal images of the chick under test into a single real-time anal image. The k-means clustering algorithm then clusters the fused real-time anal images to identify target tissues and interfering objects, removing any interfering objects from the fused real-time anal images.
[0047] In the aforementioned chick sex identification model construction method, chick sex identification method, and system, during the preprocessing of historical anal images, the k-means clustering algorithm is used to cluster the historical anal images, which can effectively distinguish target tissues and interferences (such as fecal residue) in the historical anal images. By using the K-nearest neighbor algorithm to fill in the historical anal images after removing interferences, the continuity of the historical anal images can be preserved while eliminating discrete noise. Through end-to-end fusion of k-means coarse-grained clustering and k-nearest neighbor algorithm fine-grained repair, the accuracy of removing adhesive noise (such as contaminants around the anus) in historical anal images is greatly improved. This solves the common problem of feature loss in high-noise biomedical images of traditional methods, avoids the edge jaggedness problem caused by conventional clustering, and significantly improves the accuracy of chick sex identification model for chick sex identification. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 This is a flowchart of a method for constructing a chick sex identification model provided in one embodiment of this application;
[0050] Figure 2 This is a structural block diagram of the system for constructing a chick sex identification model provided in another embodiment of this application;
[0051] Figure 3 This is a flowchart of a method for identifying the sex of chicks provided in another embodiment of this application;
[0052] Figure 4 This is a structural block diagram of a chick sex identification system provided in another embodiment of this application.
[0053] Figure labeling: 10, 20, Image acquisition module; 11, 21, Preprocessing module; 12, 22, Basic sex identification model construction module for chicks; 13, 23, Sex identification model construction module for chicks. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0055] In one embodiment, see Figure 1 This application provides a method for constructing a chick sex identification model, which includes the following steps: S10 to S13.
[0056] S10: Obtain historical anal images of chicks of multiple breeds, the historical anal images being extracted frame by frame from a continuous video stream.
[0057] S11: Preprocess each of the historical anal images to obtain a historical image dataset; the preprocessing of each of the historical anal images includes: using the k-means clustering algorithm to cluster each of the historical anal images to identify target tissues and interfering objects in each of the historical anal images; removing interfering objects from each of the historical anal images; and using the K-nearest neighbor algorithm to fill in each of the historical anal images after removing interfering objects.
[0058] S12: Construct a basic sex identification model for chicks based on the historical image dataset. The basic sex identification model for chicks includes a localization network, a feature extraction network, and a classification network.
[0059] S13: Perform multi-task learning and transfer learning on the basic chick sex identification model to obtain multiple chick sex identification models corresponding to multiple breeds.
[0060] In the method for constructing the chick sex identification model of this application, during the preprocessing of historical anal images, the k-means clustering algorithm is used to cluster the historical anal images, which can effectively distinguish target tissues and interferences (such as fecal residue) in the historical anal images. By using the k-nearest neighbor algorithm to fill in the historical anal images after removing interferences, the continuity of the historical anal images can be preserved while eliminating discrete noise. Through end-to-end fusion of k-means coarse-grained clustering and k-nearest neighbor algorithm fine-grained repair, the accuracy of removing adhesive noise (such as contaminants around the anus) in historical anal images is greatly improved. This solves the common problem of feature loss in high-noise biomedical images of traditional methods, avoids the edge jaggedness problem caused by conventional clustering, and significantly improves the accuracy of chick sex identification model for chick sex identification.
[0061] In step S10, please refer to Figure 1 In step S10, historical anal images of chicks of multiple breeds are obtained, which are extracted frame by frame from a continuous video stream.
[0062] As an example, in step S10, an image acquisition module can be used to acquire historical images of the anus of multiple breeds of chicks. Specifically, a high-definition industrial camera with a telecentric lens can be used, but is not limited to, to acquire historical images of the anus of multiple breeds of chicks with the aid of a light source. Utilizing the parallax correction characteristics of the telecentric lens, objects such as the chick's anus that are not on a single plane can be clearly imaged. A high-angle ring light source can be used, which can concentrate the light source more on the chick's anus, resulting in a fuller imaging effect.
[0063] As an example, in step S10, images of consecutive frames from the video stream can be selected for each chick's anus to obtain multiple historical anus images for each chick. Specifically, the video stream at this time can be a historical video stream for each chick's anus.
[0064] As an example, in step S10, historical anal images of each chick's anus from different image sources can be obtained, such as infrared and visible light images of each chick's anus.
[0065] In step S11, please refer to Figure 1 In step S11, each of the historical anal images is preprocessed to obtain a historical image dataset. The preprocessing of each of the historical anal images includes: using the k-means clustering algorithm to cluster each of the historical anal images to identify target tissues and interfering objects in each of the historical anal images; removing interfering objects from each of the historical anal images; and using the K-nearest neighbor algorithm to fill in each of the historical anal images after removing interfering objects.
[0066] As an example, before using the k-means clustering algorithm to cluster each of the historical anal images to identify target tissues and interfering objects in each of the historical anal images in step S11, the method further includes: using a deep learning algorithm to perform image fusion on multiple historical anal images at the same chick's anus, so as to fuse multiple historical anal images at the same chick's anus into a single historical anal image.
[0067] Specifically, a generative adversarial network (GAN) can be designed for image fusion of multiple historical images of the same chick's anus. The architecture of this GAN can be based on a GAN algorithm, which performs automatic feature-preserving fusion. Through an innovative two-branch adversarial learning mechanism, it eliminates the need for manually designed fusion rules. Through dynamic game between the generator and discriminator, it adaptively preserves complementary features from multiple source images (such as visible light texture details and infrared thermal target information). Simultaneously, a multi-scale attention module is introduced to automatically weight key regions during feature extraction, solving the problems of target blurring or texture loss in traditional methods. This algorithm can simultaneously preserve texture details from images of different sources, is an end-to-end model, and does not require manual design of fusion rules. Image fusion preserves features from different image sources, resulting in a fused image with prominent targets and rich textures.
[0068] As an example, the k-means clustering algorithm can cluster points in historical anal images whose pixels are greater than a biometric threshold (which can be set based on practical experience). The K-nearest neighbors (knn) algorithm fills in the gaps based on the average pixel value of the 5 nearest neighbors. By fusing the k-means and knn algorithms, points with similar pixels in historical anal images can be filtered out uniformly. For example, fecal pixels on the anus are similar and can be filtered out as noise points, thus leaving accurate feature points.
[0069] Specifically, in step S11, an intelligent pixel filtering algorithm based on the collaborative optimization of k-means and kNN is adopted. Accurate feature extraction is achieved through a two-stage architecture of "clustering-filling": 1. Adaptive threshold clustering: An improved k-means algorithm is used, where the k value, i.e., the cluster, is automatically generated by the algorithm through the fitting curve of the Method; 2. Dynamically identify and cluster regions where pixel values exceed the biometric threshold, effectively distinguishing target tissue from interfering substances (such as fecal residue); 3. KNN-guided semantic filling: The K-nearest neighbor algorithm (where the k value is consistent with the cluster in k-means) is innovatively applied to the clustered region. Through weighted intelligent filling of local pixels, discrete noise is eliminated while preserving the continuity of the anatomical structure; 4. Multi-algorithm cascaded denoising: For the first time, end-to-end fusion of coarse-grained k-means clustering and fine-grained kNN repair is achieved, significantly improving the accuracy of removing adhesive noise (such as contaminants around the anus) in anal images. This "clustering-filling" two-stage structure solves the problem of feature loss in high-noise biomedical images by traditional methods, and avoids the edge jaggedness problem caused by conventional clustering through the knn local optimization strategy.
[0070] It should be noted that when using a deep learning algorithm to fuse multiple historical anal images of the same chick's anus into a single historical anal image, the k-means clustering algorithm clusters each of the fused historical anal images to identify target tissues and interfering objects in each of the fused historical anal images and removes interfering objects from each of the fused historical anal images.
[0071] In step S12, please refer to Figure 1 In step S12, a basic sex identification model for chicks is constructed based on the historical image dataset. The basic sex identification model for chicks includes a localization network, a feature extraction network, and a classification network.
[0072] As an example, in step S12, constructing a basic sex identification model for chicks based on the historical image dataset may include the following steps: S121 to S125.
[0073] S121: Label the location of the chick's anus in each of the historical anal images.
[0074] S122: Label the sex of the chicks in each of the historical anal images.
[0075] S123: Use an extremely deep multichannel neural network with an attention mechanism to extract features from each historical anal image to obtain a high-dimensional feature map of each historical anal image.
[0076] S124: Based on the high-dimensional feature map and the chick anal location label, a regression network with spatial attention mechanism is used as the localization network to identify the region of interest corresponding to the chick anal region.
[0077] S125: Combine the region of interest with the high-dimensional feature map and use it as input to a deep CNN classification model to construct a basic sex identification model for chicks.
[0078] As an example, in step S123, a dual-branch feature extractor can be used to extract features from each historical anal image using an extremely deep multi-channel neural network with an attention mechanism to obtain a high-dimensional feature map of each historical anal image. Specifically, the global branch captures the overall morphological features of the chick's anus, especially the combination of muscle tissue and feature points; the local ROI branch focuses on subtle differences in the anal region (genital features of male and female chicks).
[0079] As an example, the extremely deep multichannel neural network with an attention mechanism in step S123 can be a feature extraction network.
[0080] As an example, in step S124, an improved regression network (i.e., a regression network with spatial attention mechanism) is used to accurately output the center coordinates (X, Y) and radius (R) of the chick's anus region based on the high-dimensional feature map (such as feather texture and body contour) and the chick's anus location label, forming a circular Region of Interest (ROI). By innovatively introducing a spatial attention mechanism, the localization ability for small targets (such as the anus) can be enhanced, with a localization error of <0.5mm in complex backgrounds. In this step, dynamic adaptive localization can adapt to the anus variations of different chick breeds through multi-scale feature fusion technology, solving the localization failure problem caused by breed differences in traditional methods.
[0081] As an example, in step S125, the coordinates of the region of interest output by the localization network in step S124 are combined with the high-dimensional feature map and input into the deep CNN classification model to achieve end-to-end gender discrimination.
[0082] In step S13, please refer to Figure 1 In step S13, the basic sex identification model of chicks is subjected to multi-task learning and transfer learning to obtain multiple sex identification models of chicks corresponding to multiple breeds.
[0083] As an example, in step S13, the basic sex identification model of chicks is subjected to multi-task learning and transfer learning to obtain a chick sex identification model, which may include the following steps: S131 to S134.
[0084] S131: Using data augmentation techniques, merge the anal data of chicks from multiple breeds into a single merged dataset.
[0085] S132: Use the merged dataset to decouple the localization network and the feature extraction network during training.
[0086] S133: Fix the parameters of the localization network, and optimize the feature extraction network and the classification network using the merged dataset.
[0087] S134: Repeat the above training and optimization steps several times to obtain multiple chick sex identification models corresponding to multiple breeds.
[0088] As an example, in step S13, regarding the multi-task learning architecture, a shared backbone network can be used to extract common features (such as anal region morphology and texture). Simultaneously, independent classification heads (Task-Specific Heads) are constructed for each breed (e.g., chicken breeds) within the shared backbone network, achieving "one-time training, multiple model outputs." A gradient conflict optimization algorithm is used to balance the loss function weights among different breed tasks, preventing the model from favoring a particular breed (e.g., breeds with large datasets).
[0089] Specifically, an independent classifier head refers to an independent module or sub-network specifically designed for classification tasks. It can receive features extracted by the shared backbone network and output the final classification result. The input of the independent classifier head is the features output by the shared backbone network (such as a vector after global average pooling), the processing layers are fully connected layers, Dropout, etc., and the output is a neuron representing the number of classes (here, 2 classes, i.e., whether the chicks are male or female).
[0090] Specifically, for shared backbone networks, since gradients from different tasks in the shared backbone network may conflict when they converge on the shared parameters during backpropagation, gradient conflict optimization algorithms can be used to optimize the parameters of the layers shared by all tasks in the shared backbone network. More specifically, gradient normalization (such as GradNorm) can be used to dynamically adjust the magnitude of the gradients of each task and update them in a balanced manner.
[0091] Specifically, for a task-specific layer (e.g., the independent classification head), the gradient of the independent classification head may backpropagate to the shared backbone network, affecting the extraction of shared features; the task weights of the independent classification head can be adjusted using a gradient conflict algorithm, for example, the gradients can be weighted and fused according to the importance or difficulty of the task.
[0092] It should be noted that when a new breed of chicks is added, and the new breed is not significantly different from the existing breeds, the corresponding independent classification head can be fine-tuned without retraining the chick sex identification model.
[0093] As an example, in step S131, taking chicks as an example, in the process of constructing the merged dataset of multi-breed joint data, by introducing data augmentation techniques (lighting, pose simulation), the importance of scarce samples is enhanced, the comparison of scarce samples and problem feedback are strengthened, and scarce samples in the long-tail distribution can be covered.
[0094] As an example, step S132 belongs to the global feature learning stage (i.e., global training). In step S132, the cross-variety general anal positioning ability can be learned by jointly training the localization network and the feature extraction network.
[0095] As an example, step S133 belongs to the classification fine-tuning stage. In step S133, the parameters of the localization network are fixed, and the merged dataset is used to optimize only the feature extraction network and the classification network. This can adapt to subtle feature differences between different breeds (for example, taking chicks as an example, it can adapt to the difference in vent pigmentation between white-feathered chickens and yellow-feathered chickens). This step, through flexible parameter transfer, can partially freeze the underlying network, allowing the classification layer to adaptively adjust feature weights.
[0096] As an example, step S134 belongs to the iterative training phase. In step S134, steps S132 and S133 can be repeated several times. For instance, the robustness of the chick sex identification model can be enhanced by alternating training with "global-local" parameters three times. In step S134, training can be conducted in stages according to the complexity of the chick breeds, gradually increasing the difficulty. That is, for simple chick breeds (which can be easily identified), repeating steps S132 and S133 fewer times is sufficient to meet the requirements, while for complex chick breeds (which can be more difficult to identify), repeating steps S132 and S133 more times is required to meet the requirements. The specific number of times steps S132 and S133 are repeated can be determined by the loss function (MES) inherent in the chick sex identification model.
[0097] The chick sex identification model constructed in this application has the advantages of being able to distinguish between male and female chicks, replacing the function of human eye identification and freeing up human eyes; improving accuracy, reducing labor costs, and greatly improving work efficiency. It can improve the accuracy of chick sex identification to approximately 98%; it solves the problem of accuracy reduction due to prolonged human eye work, as the model does not experience computational fatigue; and when combined with supporting equipment, the identification speed is faster than manual identification, reaching 1400 chicks per hour, resulting in higher efficiency.
[0098] It should be understood that, although Figure 1 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0099] In another embodiment, please refer to Figure 2 This application also provides a system for constructing a chick sex identification model, which may include: an image acquisition module 10, a preprocessing module 11, a basic chick sex identification model construction module 12, and a chick sex identification model construction module 13; wherein, the image acquisition module 10 is used to acquire historical anal images of chicks of multiple breeds, the historical anal images being extracted frame by frame from a continuous video stream; the preprocessing module 11 is used to preprocess each of the historical anal images to obtain a historical image dataset; the preprocessing of each of the historical anal images includes: using a k-means clustering algorithm. Clustering is performed on each of the historical anal images to identify target tissues and interfering objects in each historical anal image; interfering objects are removed from each historical anal image; the K-nearest neighbor algorithm is used to fill in the historical anal images after removing interfering objects; the chick basic sex identification model construction module 12 is used to construct a chick basic sex identification model based on the historical image dataset, the chick basic sex identification model includes a localization network, a feature extraction network and a classification network; the chick sex identification model construction module 13 is used to perform multi-task learning and transfer learning on the chick basic sex identification model to obtain multiple chick sex identification models corresponding to multiple breeds.
[0100] In the chick sex identification model construction system of this application, the preprocessing module 11 uses the k-means clustering algorithm to cluster the historical anal images during the preprocessing process. This can effectively distinguish target tissues and interferences (such as fecal residue) in the historical anal images. By using the K-nearest neighbor algorithm to fill in the historical anal images after removing interferences, the continuity of the historical anal images can be preserved while eliminating discrete noise. Through the end-to-end fusion of k-means coarse-grained clustering and k-nearest neighbor algorithm fine-grained repair, the accuracy of removing adhesive noise (such as contaminants around the anus) in the historical anal images is greatly improved. This solves the common problem of feature loss in high-noise biomedical images in traditional methods, avoids the edge jaggedness problem caused by conventional clustering, and significantly improves the accuracy of the chick sex identification model in identifying the sex of chicks.
[0101] As an example, the image acquisition module 10 can, but is not limited to, using a high-definition industrial camera with a telecentric lens to acquire historical images of the anus of multiple breeds of chicks with the aid of a light source. Utilizing the parallax correction characteristics of the telecentric lens, objects such as the chick's anus that are not on a single plane can be clearly imaged; the light source can be a high-angle ring light source, which can make the light source more concentrated at the chick's anus, resulting in a fuller imaging effect.
[0102] As an example, in the process of acquiring historical anal images of multiple breeds of chicks, the image acquisition module 10 selects consecutive frames of images from the video stream (which can be the aforementioned historical video stream) for each chick's anus to obtain multiple historical anal images for each chick's anus; before the preprocessing module 11 uses the k-means clustering algorithm to cluster the historical anal images to identify target tissues and interferences in each historical anal image, it also uses a deep learning algorithm to fuse multiple historical anal images of the same chick's anus into a single historical anal image; the k-means clustering algorithm clusters the fused historical anal images to identify target tissues and interferences in the fused historical anal images.
[0103] As an example, the chick sex identification model construction system of this application can be used to perform, for example... Figure 1 And the method for constructing the chick sex identification model in the relevant embodiments.
[0104] Specific limitations regarding the construction system of the chick sex identification model can be found in the limitations on the construction method of the chick sex identification model above, and will not be repeated here. Each module in the above-mentioned chick sex identification model construction system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0105] In yet another embodiment, please refer to Figure 1 See Figure 3 This application also provides a method for identifying the sex of chicks, which may include the following steps: S20 to S23.
[0106] S20: Adopting as follows Figure 1 The method for constructing the chick sex identification model described in the corresponding embodiment is used to construct the chick sex identification model.
[0107] S21: Obtain a real-time anal image of the chick to be tested, wherein the real-time anal image is extracted frame by frame from a continuous video stream.
[0108] S22: Preprocess the real-time anal image, which includes: using the k-means clustering algorithm to cluster the real-time anal image to identify target tissue and interference in the real-time anal image; removing interference in the real-time anal image; and using the K-nearest neighbor algorithm to fill in the real-time anal image after removing interference.
[0109] S23: Input the preprocessed real-time anal image into the corresponding breed of chick sex identification model for identification, so as to obtain the sex identification result of the chick to be tested.
[0110] The method for sex determination of chicks in this application employs, as follows: Figure 1 The chick sex identification model in the embodiments, and in the process of preprocessing the real-time anal image of the chick to be tested, the k-means clustering algorithm is used to cluster the real-time anal image, which can effectively distinguish the target tissue and interference (such as fecal residue) in the real-time anal image. By using the K-nearest neighbor algorithm to fill in the real-time anal image after removing interference, the continuity of the real-time anal image can be preserved while eliminating discrete noise. Through the end-to-end fusion of k-means coarse-grained clustering and k-nearest neighbor algorithm fine-grained repair, the accuracy of removing adhesive noise (such as contaminants around the anus) in the real-time anal image is greatly improved. It solves the common problem of feature loss in high-noise biomedical images of traditional methods, avoids the edge jaggedness problem caused by conventional clustering, and significantly improves the accuracy of chick sex identification.
[0111] In step S20, please refer to Figure 3 In step S20, the following method is used: Figure 1 The method for constructing the chick sex identification model described in the corresponding embodiment is used to construct the chick sex identification model.
[0112] For details on the construction method of the chick sex identification model, please refer to [link / reference]. Figure 1 And related textual descriptions, which will not be repeated here.
[0113] In step S21, please refer to Figure 3 In step S21, a real-time image of the anus of the chick to be tested is obtained.
[0114] As an example, in step S21, the following can be used: Figure 1 The device and method for acquiring historical anal images in S11 of the invention acquire real-time anal images of the anus of the chick to be tested.
[0115] As an example, in step S21, images of consecutive frames from the video stream can be selected at the anus of the chick to be tested to obtain multiple real-time anus images of the chick. Specifically, in this embodiment, the video stream can be a real-time video stream of the anus of the chick to be tested.
[0116] In step S22, please refer to Figure 3 Step S22 involves preprocessing the real-time anal image, which includes: clustering the real-time anal image using the k-means clustering algorithm to identify target tissues and interfering objects in the real-time anal image; removing interfering objects from the real-time anal image; and filling in the real-time anal image after removing interfering objects using the K-nearest neighbor algorithm.
[0117] As an example, in step S22, before using the k-means clustering algorithm to cluster the real-time anal images to identify target tissues and interfering elements in the real-time anal images during the preprocessing of the real-time anal images, the method further includes: using a deep learning algorithm to fuse multiple real-time anal images of the chick under test into a single real-time anal image. Specifically, this can be achieved by fusing multiple historical anal images into a single historical hepatic hilum image, or by fusing multiple real-time anal images into a single real-time anal image.
[0118] As an example, the method for preprocessing the real-time anal image in this step can be similar to the method for preprocessing the historical anal image in step S11. The specific methods for k-means clustering and k-nearest neighbor algorithm filling can be found in step S11, and will not be repeated here.
[0119] It should be noted that when using a deep learning algorithm to fuse multiple real-time anal images of the chick under test into a single real-time anal image, the k-means clustering algorithm in this step clusters the fused real-time anal image to identify target tissues and interfering objects in the fused real-time anal image and remove interfering objects.
[0120] In step S23, please refer to Figure 3 In step S23, the preprocessed real-time anal image is input into the corresponding breed of chick sex identification model for identification, so as to obtain the sex identification result of the chick to be tested.
[0121] The chick sex identification method developed in this application has the advantages of using an identification model to determine the sex of chicks, replacing the function of human eye identification and freeing up human eyes; it improves accuracy, reduces labor costs, and greatly improves work efficiency. It can increase the accuracy of chick sex identification to approximately 98%; it solves the problem of accuracy reduction due to prolonged human eye work, as the model calculation does not suffer from fatigue; and when combined with supporting equipment, the identification speed is faster than manual identification, reaching 1400 chicks per hour, resulting in higher efficiency.
[0122] It should be understood that, although Figure 3 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 3 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0123] In yet another embodiment, please refer to Figure 4This application also provides a chick sex identification system, which may include: an image acquisition module 20, a preprocessing module 21, a chick basic sex identification model construction module 22, and a chick sex identification model construction module 23; wherein, the image acquisition module 20 is used to acquire historical anal images of chicks of multiple breeds and real-time anal images of chicks to be tested, wherein both the historical anal images and the real-time anal images are extracted frame by frame from a continuous video stream; the preprocessing module 21 is used to preprocess each of the historical anal images to obtain a historical image dataset, and to preprocess the real-time anal images; the preprocessing of each of the historical anal images includes: using a k-means clustering algorithm to cluster each of the historical anal images to identify target tissues and interference in each of the historical anal images; removing interference in each of the historical anal images; and using a K-nearest neighbor algorithm to cluster the interference. The historical anal images, excluding interfering elements, are filled in; the real-time anal images are preprocessed by: using the k-means clustering algorithm to cluster the real-time anal images to identify target tissues and interfering elements in the real-time anal images; removing interfering elements from the real-time anal images; and using the K-nearest neighbor algorithm to fill in the real-time anal images after removing interfering elements. A chick basic sex identification model construction module 22 is used to construct a chick basic sex identification model based on the historical image dataset. The chick basic sex identification model includes a localization network, a feature extraction network, and a classification network. A chick sex identification model construction module 23 is used to perform multi-task learning and transfer learning on the chick basic sex identification model to obtain multiple chick sex identification models corresponding to multiple breeds. The chick sex identification model is used to identify the preprocessed real-time anal images of the corresponding breed to obtain the sex detection result of the chick to be tested.
[0124] In the chick sex identification system of this application, the preprocessing module 21 uses the k-means clustering algorithm to cluster the historical anal images and the real-time anal images during the preprocessing process. This can effectively distinguish target tissues and interferences (such as fecal residue) in the historical anal images and the real-time anal images. By using the K-nearest neighbor algorithm to fill in the historical anal images and the real-time anal images after removing interferences, the continuity of the historical anal images and the real-time anal images can be preserved while eliminating discrete noise. Through the end-to-end fusion of k-means coarse-grained clustering and k-nearest neighbor algorithm fine-grained repair, the accuracy of removing adhesive noise (such as contaminants around the anus) in the historical anal images and the real-time anal images is greatly improved. This solves the common problem of feature loss in high-noise biomedical images in traditional methods, avoids the edge jaggedness problem caused by conventional clustering, and significantly improves the accuracy of chick sex identification.
[0125] As an example, the image acquisition module 20 can, but is not limited to, use a high-definition industrial camera with a telecentric lens to acquire historical anal images of multiple breeds of chicks and real-time anal images of the chicks to be tested using a light source. Utilizing the parallax correction characteristics of the telecentric lens, objects like the chick's anus that are not on a single plane can be clearly imaged; a high-angle ring light source can be used, allowing the light source to be more concentrated on the chick's anus, resulting in a fuller imaging effect.
[0126] As an example, the historical anal images can be extracted frame by frame from the aforementioned historical video stream, and the real-time anal images can be extracted frame by frame from the aforementioned real-time video stream. In the process of acquiring historical anal images of multiple breeds of chicks, the image acquisition module 20 selects images of consecutive frames in the video stream (i.e., the aforementioned historical video stream) for each chick's anal area to obtain multiple historical anal images of each chick's anal area. In the process of acquiring real-time anal images of the chick to be tested, images of consecutive frames in the video stream (i.e., the aforementioned real-time video stream) are selected for the chick to be tested's anal area to obtain multiple real-time anal images of the chick to be tested's anal area. Before using the k-means clustering algorithm to cluster the historical anal images in the preprocessing module 21 to identify target tissues and interfering objects in each historical anal image, the preprocessing module 21 also uses a deep learning algorithm to fuse multiple historical anal images of the same chick's anus into a single historical anal image. The k-means clustering algorithm then clusters the fused historical anal images to identify target tissues and interfering objects in each fused historical anal image. Before using the k-means clustering algorithm to cluster the real-time anal images to identify target tissues and interfering objects in the real-time anal images, the preprocessing module 21 also uses a deep learning algorithm to fuse multiple real-time anal images of the chick under test into a single real-time anal image. The k-means clustering algorithm then clusters the fused real-time anal images to identify target tissues and interfering objects and removes interfering objects from the fused real-time anal images.
[0127] As an example, the chick sex identification system of this application can be used to perform, for example... Figure 3 And the method for identifying the sex of chicks in related embodiments.
[0128] Specific limitations regarding the chick sex identification system can be found in the limitations of the chick sex identification method described above, and will not be repeated here. Each module in the aforementioned chick sex identification system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0129] It should be noted that the historical anal images in this application are mainly used to construct a chick sex identification model, while the real-time anal images are mainly used for real-time detection to obtain the chick sex detection results.
[0130] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features of the above 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.
[0131] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for constructing a chick sex identification model, characterized in that, include: Historical anal images of chicks of multiple breeds were obtained, and the historical anal images were extracted frame by frame from a continuous video stream; The historical anal images are preprocessed to obtain a historical image dataset; The preprocessing of each of the historical anal images includes: clustering each of the historical anal images using the k-means clustering algorithm to identify target tissue and interfering objects in each of the historical anal images; removing interfering objects from each of the historical anal images; and filling in each of the historical anal images after removing interfering objects using the K-nearest neighbor algorithm. A basic sex identification model for chicks is constructed based on the historical image dataset. The basic sex identification model for chicks includes a localization network, a feature extraction network, and a classification network. The basic chick sex identification model is subjected to multi-task learning and transfer learning to obtain multiple chick sex identification models corresponding to multiple breeds.
2. The method according to claim 1, characterized in that, A basic sex identification model for chicks is constructed based on the aforementioned historical image dataset, including: Label the location of the chick's anus in each of the aforementioned historical anal images; The sex of the chicks was labeled in each of the historical anal images; A very deep multichannel neural network with an attention mechanism is used to extract features from each historical anal image to obtain a high-dimensional feature map of each historical anal image. Based on the high-dimensional feature map and the chick anal location label, a regression network with spatial attention mechanism is used as the localization network to identify the region of interest corresponding to the chick anal region. The region of interest is combined with the high-dimensional feature map and used as input to a deep CNN classification model to construct a basic sex identification model for chicks.
3. The method according to claim 1, characterized in that, The basic chick sex identification model is subjected to multi-task learning and transfer learning to obtain a chick sex identification model, including: Data augmentation techniques were used to merge the cloaca data of chicks from multiple breeds into a single merged dataset. The localization network and the feature extraction network are decoupled and trained using the merged dataset, and an attention mechanism is used to dynamically focus on key regions. With the parameters of the localization network fixed, the feature extraction network and the classification network are optimized using the merged dataset; Repeat the above training and optimization steps several times to obtain multiple chick sex identification models corresponding to multiple breeds.
4. The method according to any one of claims 1 to 3, characterized in that, In the process of acquiring historical anal images of chicks of multiple breeds, consecutive frames from the video stream are selected for each chick's anus to obtain multiple historical anal images for each chick's anus. Before preprocessing each historical anal image using the k-means clustering algorithm to cluster the historical anal images to identify target tissues and interfering elements in each historical anal image, the process further includes: Deep learning algorithms are used to fuse multiple historical anal images of the same chick at the same anal site into a single historical anal image. The k-means clustering algorithm clusters the historical anal images after image fusion to identify target tissues and interfering objects in the historical anal images after image fusion; and removes interfering objects in the historical anal images after image fusion.
5. A system for constructing a chick sex identification model, characterized in that, include: The image acquisition module is used to acquire historical anal images of chicks of multiple breeds, which are extracted frame by frame from a continuous video stream; A preprocessing module is used to preprocess each of the historical anal images to obtain a historical image dataset; The preprocessing of each of the historical anal images includes: clustering each of the historical anal images using the k-means clustering algorithm to identify target tissue and interfering objects in each of the historical anal images; removing interfering objects from each of the historical anal images; and filling in each of the historical anal images after removing interfering objects using the K-nearest neighbor algorithm. A basic sex identification model construction module for chicks is used to construct a basic sex identification model for chicks based on the historical image dataset. The basic sex identification model for chicks includes a localization network, a feature extraction network, and a classification network. The chick sex identification model construction module is used to perform multi-task learning and transfer learning on the basic chick sex identification model to obtain multiple chick sex identification models corresponding to multiple breeds.
6. The construction system according to claim 5, characterized in that, In the process of acquiring historical anal images of chicks of multiple breeds, the image acquisition module selects images of consecutive frames in the video stream for each chick's anal area to obtain multiple historical anal images of each chick's anal area. Before using the k-means clustering algorithm to cluster the historical anal images to identify target tissues and interfering objects in each historical anal image, the preprocessing module also uses a deep learning algorithm to fuse multiple historical anal images of the same chick's anus into a single historical anal image. The k-means clustering algorithm then clusters the fused historical anal images to identify target tissues and interfering objects in each fused historical anal image.
7. A method for sexing chicks, characterized in that, include: A chick sex identification model is constructed using the method described in any one of claims 1 to 4. A real-time anal image of the chick to be tested is obtained, which is extracted frame by frame from a continuous video stream; The real-time anal image is preprocessed, which includes: clustering the real-time anal image using the k-means clustering algorithm to identify target tissue and interfering objects in the real-time anal image; removing interfering objects from the real-time anal image; and filling in the real-time anal image after removing interfering objects using the K-nearest neighbor algorithm. The preprocessed real-time anal image is input into the corresponding breed of chick sex identification model for identification, so as to obtain the sex identification result of the chick to be tested.
8. The method according to claim 7, characterized in that, In the process of acquiring real-time anal images of the chick under test, images of consecutive frames in the video stream are selected at the anal area of the chick under test to obtain multiple real-time anal images of the chick under test. Before using the k-means clustering algorithm to cluster the real-time anal images to identify target tissue and interfering elements in the real-time anal images during preprocessing, the process also includes: A deep learning algorithm is used to fuse multiple real-time anal images of the chick under test into a single real-time anal image. The k-means clustering algorithm clusters the image-fused real-time anal images to identify target tissues and interfering objects in the image-fused real-time anal images; and removes interfering objects from the image-fused real-time anal images.
9. A chick sex identification system, characterized in that, include: The image acquisition module is used to acquire historical anal images of chicks of multiple breeds and real-time anal images of chicks under test. Both the historical anal images and the real-time anal images are extracted frame by frame from a continuous video stream. The preprocessing module is used to preprocess each of the historical anal images to obtain a historical image dataset, and to preprocess the real-time anal images. Preprocessing the historical anal images includes: clustering the historical anal images using a k-means clustering algorithm to identify target tissues and interfering objects in each historical anal image; removing interfering objects from each historical anal image; and filling in the historical anal images with removed interfering objects using a K-nearest neighbor algorithm. Preprocessing the real-time anal images includes: clustering the real-time anal images using a k-means clustering algorithm to identify target tissues and interfering objects in the real-time anal images; removing interfering objects from the real-time anal images; and filling in the real-time anal images with removed interfering objects using a K-nearest neighbor algorithm. A basic sex identification model construction module for chicks is used to construct a basic sex identification model for chicks based on the historical image dataset. The basic sex identification model for chicks includes a localization network, a feature extraction network, and a classification network. The chick sex identification model construction module is used to perform multi-task learning and transfer learning on the basic chick sex identification model to obtain multiple chick sex identification models corresponding to multiple breeds; the chick sex identification model is used to identify the preprocessed real-time anal image of the corresponding breed to obtain the sex detection result of the chick to be tested.
10. The system according to claim 9, characterized in that, In the process of acquiring historical anal images of chicks of multiple breeds, the image acquisition module selects images of consecutive frames in the video stream for each chick's anal area to obtain multiple historical anal images of each chick's anal area; in the process of acquiring real-time anal images of chicks to be tested, the module selects images of consecutive frames in the video stream for the chicks to be tested to obtain multiple real-time anal images of the chicks to be tested. Before using the k-means clustering algorithm to cluster the historical anal images to identify target tissues and interfering objects, the preprocessing module also uses a deep learning algorithm to fuse multiple historical anal images of the same chick's anus into a single historical anal image. The k-means clustering algorithm then clusters the fused historical anal images to identify target tissues and interfering objects within them. Before using the k-means clustering algorithm to cluster the real-time anal images to identify target tissues and interfering objects in the real-time anal images, the preprocessing module also uses a deep learning algorithm to fuse multiple real-time anal images of the chick under test into a single real-time anal image. The k-means clustering algorithm clusters the image-fused real-time anal images to identify target tissues and interfering objects in the image-fused real-time anal images; and removes interfering objects from the image-fused real-time anal images.
