Silkworm cocoon type pre-identification method based on generative artificial intelligence
Through the pre-identification method of cocoon types based on generative artificial intelligence, using silkworm images and trajectory data to train models and predict cocoon types, the problem of low cocoon sorting efficiency in the existing technology is solved, and efficient and accurate identification and pre-identification of cocoons are achieved. Cull.
Patent Information
- Application Number
- CN202410832765.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-10-15
AI Technical Summary
Existing cocoon sorting methods are inefficient and cannot effectively identify inferior cocoons due to adhesion of cocoon clothing and similar appearance, making it difficult to accurately remove them in actual production.
A cocoon type pre-identification method based on generative artificial intelligence is used to obtain silkworm images and trajectory data, train a cocoon sorting model, and predict cocoon types, including yellow-spotted cocoons, upper cocoons, thin-skinned cocoons and dead pupae, to achieve pre-identification of silkworm cocoons. Identify.
It improves the efficiency of cocoon sorting, can accurately identify inferior cocoons before silkworms spin cocoons, avoids the problem of low sorting efficiency after silkworms spin cocoons, and reduces the workload of mechanical equipment to clean cocoons.
Smart Images

Figure CN118781402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent agricultural technology, and in particular to a method for pre-identifying silkworm cocoon species based on generative artificial intelligence. Background Art
[0002] Silkworms are an important economic insect, which are raised in various parts of my country. In the process of silkworm rearing, the quality of silkworm cocoons varies due to factors such as mulberry leaf pests, silkworm diseases, and improper breeding. Common types of cocoons include upper cocoons, yellow spot cocoons, thin skin cocoons, and firewood print cocoons. Among them: upper cocoons are the cocoons with the best quality, and the rest are usually called inferior cocoons or lower cocoons, which need to be removed before reeling. Therefore, cocoon sorting is an important task before reeling.
[0003] At present, the main method of silk cocoon sorting is manual screening, which has the problems of high labor intensity and low work efficiency. In recent years, with the rapid development of artificial intelligence technology, researchers have proposed a method for identifying silk cocoon types based on deep learning and computer vision based on the partial differences in the appearance of different types of silk cocoons. However, two practical problems limit the application of existing methods in actual production: First, the surface of the silk cocoon is covered with a layer of cocoon skin, which causes the cocoons to stick together into a ball. The existing silk cocoon sorting method cannot accurately remove inferior cocoons in a real environment due to the adhesion of cocoon skin; and if mechanical equipment is used to remove the cocoon skin first, it will bring a huge workload, and the pus of some yellow spot cocoons will contaminate the cocoons around them. Second, some inferior cocoons, such as thin-skinned cocoons and dead pupa cocoons, are highly similar in appearance to the cocoons on the train, making it difficult to accurately identify them through visual features.
[0004] Therefore, an efficient and accurate method for sorting silkworm cocoons is urgently needed to meet the needs of industrial development. Summary of the invention
[0005] The present invention provides a method for pre-identifying silkworm cocoon species based on generative artificial intelligence to solve the defect of low silkworm cocoon sorting efficiency in the prior art.
[0006] A method for pre-identifying silkworm cocoon species based on generative artificial intelligence, comprising:
[0007] Step 1: Obtain the silkworm image dataset;
[0008] Step 2: Obtain a silkworm trajectory dataset corresponding to the silkworm image dataset;
[0009] Step 3: training a cocoon sorting model according to the silkworm image dataset and the silkworm trajectory dataset to obtain a trained cocoon sorting model;
[0010] Step 4: Input the silkworm image to be predicted into the trained cocoon sorting model, and predict the types of cocoons through the model; the types of cocoons include: yellow spot cocoons, on-board cocoons, thin-skinned cocoons and dead pupa cocoons.
[0011] Furthermore, in the method as described above, the silkworm image is an image taken on the 7th day of the 5th instar of the silkworm.
[0012] Furthermore, in the above method, the step of obtaining the silkworm image dataset comprises:
[0013] Step 1: Use a camera to collect a video of the growth of silkworms from a top-down direction;
[0014] Step 2: intercepting the growth video into silkworm growth images according to the time sequence;
[0015] Step 3: Use the pre-trained silkworm individual detection model to perform individual detection on all captured silkworm growth images, and uniquely encode each silkworm individual through the silkworm individual detection model;
[0016] Step 4: All the encoded silkworm growth images are used as the silkworm image dataset.
[0017] Furthermore, in the method described above, the length of the growth video is ≥ 6 hours.
[0018] Furthermore, in the above method, the training method of the silkworm individual detection model is as follows:
[0019] Step 1: Collect a growth video of silkworms; the growth video has a duration of ≥12 hours, the number of silkworms in each frame of the growth video is ≥50, and the growth video is intercepted into a sequence of images at intervals of 1 minute;
[0020] Step 2: Manually mark the cocoon category of each captured sequence image after the silkworm cocoons;
[0021] Step 3: Use manually labeled silkworm growth images as silkworm training set;
[0022] Step 4: Train a silkworm individual detection model according to the silkworm training set to obtain a trained silkworm individual detection model; the silkworm individual detection model is used to identify whether there are silkworms in each image, the number of silkworms, and the position of the silkworms; the silkworm individual detection model includes: a diffusion model and a generative adversarial network; the diffusion model is used to generate an intermediate layer, and the generative adversarial network is used to perform model training.
[0023] Furthermore, in the method described above, in the silkworm training set, the number of cocoons collected on the vehicle is ≥15,000; and the number of cocoons collected for each other category is ≥5,000.
[0024] Furthermore, according to the method described above, obtaining the silkworm trajectory dataset corresponding to the silkworm image dataset comprises:
[0025] Using a pre-trained silkworm multi-target tracking model to track each silkworm in the silkworm image dataset, so as to classify the motion trajectory of each silkworm by using the silkworm multi-target tracking model;
[0026] The silkworm images containing all types of motion trajectories are used as the silkworm trajectory dataset.
[0027] Furthermore, in the above method, the silkworm multi-target tracking model is trained according to the following method:
[0028] Step 1: Use a circumscribed rectangle to mark the positions of the silkworms in each silkworm growth image according to their numbers, so that the same silkworm is assigned an identity number from the initial image to the last image;
[0029] Step 2: Obtain the identity number of the silkworm in each frame image and the silkworm position corresponding to the identity number;
[0030] Step 3: according to the identification number and the silkworm position, the geometric center, head, and vertices of the circumscribed rectangular frame of the silkworm are used as single trajectory points to determine the motion trajectory of each silkworm, thereby obtaining the motion trajectories of all silkworms;
[0031] Step 4: Classify the movement trajectories of all silkworms according to the cocoon type, and obtain the movement trajectory dataset for each cocoon type;
[0032] Step 5: Use the motion trajectory data set corresponding to all cocoon types to train a multi-target tracking model to obtain a trained multi-target tracking model.
[0033] The method for pre-identifying silkworm cocoon species based on generative artificial intelligence provided by the present invention can predict the image of silkworm cocoons after cocooning by taking the image of silkworms and the corresponding trajectory data as the input of the cocoon sorting model, thereby realizing the pre-identification of silkworm cocoon species and improving the efficiency of cocoon sorting. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 A flow chart of the method for pre-identifying silkworm cocoon species based on generative artificial intelligence provided by the present invention;
[0036] Figure 2 This is the timeline of silkworm cocoon development;
[0037] Figure 3 Schematic diagram for constructing a multi-target tracking model for silkworms.
[0038] Figure 4 This is a schematic diagram of the detection results of the silkworm individual detection model. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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.
[0040] Figure 1 The flowchart of the method for pre-identifying silkworm cocoon species based on generative artificial intelligence provided by the present invention is as follows: Figure 1 As shown, the method includes:
[0041] Step 1: Obtain the silkworm image dataset;
[0042] Step 2: Obtain a silkworm trajectory dataset corresponding to the silkworm image dataset;
[0043] Step 3: training a cocoon sorting model according to the silkworm image dataset and the silkworm trajectory dataset to obtain a trained cocoon sorting model;
[0044] Step 4: Input the silkworm image to be predicted into the trained cocoon sorting model, and predict the types of cocoons through the model; the types of cocoons include: yellow spot cocoons, on-board cocoons, thin-skinned cocoons and dead pupa cocoons.
[0045] Specifically, Figure 2The traditional method of identifying the types of silkworm cocoons is to identify the types of silkworm cocoons after the silkworms have cocooned. After cocooning, there are problems that the cocoons are adhered to each other, and the appearance of thin-skinned cocoons and dead pupa cocoons is highly similar to that of wheeled cocoons, which leads to the problem of low efficiency in silkworm cocoon sorting. In order to solve this problem, the present invention predicts the types of cocoons before the silkworms cocoon, so that unqualified silkworms can be screened out in advance before the silkworms cocoon according to the predicted results, thereby avoiding the problem of low efficiency in silkworm cocoon sorting after the silkworms cocoon. The principle of silkworm cocoon sorting of the present invention is that the formation of inferior cocoons is closely related to the breeding stage. For example, yellow spot cocoons and dead pupa cocoons are formed by silkworms encountering minor diseases; thin skin cocoons are formed due to insufficient intake of mulberry leaves or disease invasion, and firewood-printed cocoons are formed due to improper cocooning tools or breeding. Based on the above factors, the present invention constructs a cocoon sorting model according to the intrinsic connection between the formation of cocoon categories and the vision and behavior of silkworms during breeding, so that it can predict the possible cocoon types of silkworms based on some dynamic characteristics exhibited by the silkworms, thereby achieving the purpose of sorting the cocoon types before cocooning.
[0046] The method provided by the present invention can predict the image of the silkworm after cocooning by taking the image of the silkworm and the corresponding trajectory data as the input of the cocoon sorting model, realize the pre-identification of the cocoon type, and improve the efficiency of cocoon sorting.
[0047] The following is an introduction on how to obtain the silkworm image dataset:
[0048] Step 1: Use a camera to collect a video of the growth of silkworms from a top-down direction;
[0049] Step 2: intercepting the growth video into silkworm growth images according to the time sequence;
[0050] Step 3: Use the pre-trained silkworm individual detection model to perform individual detection on all captured silkworm growth images, and uniquely encode each silkworm individual through the silkworm individual detection model;
[0051] Step 4: All the encoded silkworm growth images are used as the silkworm image dataset.
[0052] Specifically, firstly, the implementation environment of the present invention is to use a camera to collect the growth video of silkworms from a top-down direction under a standard environment, and the time is the day before the silkworms build cocoons, usually the 7th day of the 5th age. The collected video may contain more than about 100 silkworms, and the method can identify the type of cocoons of each silkworm after it builds cocoons. The length of the video collected first should be ≥ 6 hours. Then, after a video is collected, use an image processing tool, such as OpenCV, to capture 1 frame of image at intervals of 1 second from the collected video, and save the captured images in a folder on the computer in time series. Finally, use a pre-trained silkworm individual detection model to locate each silkworm individual (such as ) from a continuous sequence of images. Figure 4 As shown), and the result is saved in a text, thereby obtaining the silkworm image dataset.
[0053] Since there are many types of silk cocoons in the actual environment, and the reasons for the formation of different types of silk cocoons are relatively complicated, the present invention only targets yellow spot cocoons, thin-skinned cocoons and dead pupa cocoons caused by diseases or environmental factors during the breeding process, among which thin-skinned cocoons and dead pupa cocoons are difficult to identify by appearance characteristics.
[0054] The firewood-printed cocoons, fly maggot cocoons, etc. caused by external factors such as improper breeding or silkworm tool defects are not within the scope of this method.
[0055] Among them, the construction method of the silkworm individual detection model is as follows:
[0056] Step 1: Collect a growth video of silkworms; the growth video has a duration of ≥12 hours, the number of silkworms in each frame of the growth video is ≥50, and the growth video is intercepted into a sequence of images at intervals of 1 minute;
[0057] Step 2: manually mark the categories of silkworm cocoons in each captured sequence image; the categories of silkworm cocoons include: cocoons for loading, yellow-spotted cocoons, thin-skinned cocoons and dead pupa cocoons; and the number of cocoons for loading is ≥15,000; the number of cocoons of each other category is ≥5,000.
[0058] Step 3: Use manually labeled silkworm growth images as silkworm training set;
[0059] Step 4: Train a silkworm individual detection model according to the silkworm training set to obtain a trained silkworm individual detection model; the silkworm individual detection model is used to identify whether there are silkworms in each image, the number of silkworms, and the position of the silkworms; the silkworm individual detection model includes: a diffusion model and a generative adversarial network; the diffusion model is used to generate an intermediate layer, and the generative adversarial network is used to perform model training.
[0060] Specifically, growth videos of silkworms on the 7th day of the 5th instar are collected in actual environments, with a duration of ≥12 hours. The density of silkworms in each frame is ≥50, and the video is saved as a sequence of images at 1 minute intervals. Then, the silkworms are continued to be bred, and the type of cocoons of each silkworm after cocooning is manually recorded. From them, cocoons for loading onto a vehicle, yellow-spotted cocoons, thin-skinned cocoons and dead pupa cocoons are selected. For cocoons for loading onto a vehicle, the number collected is ≥15,000, and the number of cocoons of each other type collected is ≥5,000.
[0061] The silkworm individual detection model is based on the principle of single-step detection, and focuses on improving the algorithm's detection performance in small targets and dense environments. The feature extraction network is designed by using multi-scale feature fusion, increasing the receptive field, multi-granularity feature extraction, and dynamic convolution. The feature enhancement network is designed by using image channels, space, and self-attention mechanisms. During the training process, diffusion mechanisms, sample matching, bounding box loss functions, and transfer learning strategies are used to improve the overall performance of the algorithm.
[0062] The following is an introduction to how to obtain a silkworm trajectory dataset corresponding to a silkworm image dataset, specifically including: using a pre-trained silkworm multi-target tracking model to track each silkworm cocoon in the silkworm image dataset to obtain the motion trajectory of each silkworm cocoon; and using all silkworm cocoon images containing the motion trajectory of each silkworm cocoon as the silkworm trajectory dataset.
[0063] The silkworm multi-target tracking model is trained according to the following method:
[0064] Step 1: Use a circumscribed rectangle to mark the positions of the silkworms in each silkworm growth image according to their numbers, so that the same silkworm is assigned an identity number from the initial image to the last image;
[0065] Step 2: Obtain the identity number of the silkworm in each frame image and the silkworm position corresponding to the identity number;
[0066] Step 3: according to the identification number and the silkworm position, the geometric center, head, and vertices of the circumscribed rectangular frame of the silkworm are used as single trajectory points to determine the motion trajectory of each silkworm, thereby obtaining the motion trajectories of all silkworms;
[0067] Step 4: Classify the movement trajectories of all silkworms according to the cocoon type, and obtain the movement trajectory dataset for each cocoon type;
[0068] Step 5: Use the motion trajectory data set corresponding to all cocoon types to train a multi-target tracking model to obtain a trained multi-target tracking model.
[0069] Specifically, when building this model, you need to prepare a data set in advance. First, collect the growth video of the silkworm on the 7th day of the 5th instar, with a collection time of ≥1 hour, covering ≥3000 silkworms, and each frame of the image containing ≥50 silkworms. The video is saved as a sequence of images at an interval of 1 second.
[0070] Then, the position of the silkworm was annotated in each frame using an annotation tool, represented by a circumscribed rectangle, and the same silkworm was assigned an identity number from the initial image to the last image using manual tracking.
[0071] like Figure 3 As shown in the figure, the image processing method is used to read the identity label and position of the silkworm in each frame image to generate the true value of the multi-target tracking data. The silkworm multi-target tracking model is a tracking method based on target detection, that is, the silkworm individual is first detected from the current frame image using a pre-trained individual detection model, and then its position in the next frame is predicted, and then the identity is associated by integrating motion, geometry and position features. When generating the crawling trajectory of the silkworm, the silkworm's geometric center, head, vertices of the circumscribed rectangular frame, etc. are used as single trajectory points to obtain the silkworm's trajectory. And a recurrent neural network and interpolation algorithm are used to fill in the trajectory when detection is lost or tracking is lost.
[0072] Multi-target tracking includes a silkworm individual identity re-identification model, which is based on fine-grained image classification and pedestrian re-identification network, and uses multi-granularity feature extraction, feature space filtering, feature interaction, channel correction and other methods to improve the accuracy of individual detection.
[0073] Further, according to the silkworm image dataset and the silkworm trajectory dataset, a silkworm cocoon sorting model is trained to obtain a trained silkworm cocoon sorting model, including:
[0074] The present invention uses a convolutional neural network to encode individual images of silkworms, each image is encoded into a one-dimensional vector, and then the encoding structures of 20 images are added. The crawling trajectory of each silkworm is regarded as a one-dimensional vector and encoded using a Transformer structure method. The encoding results of the image and the trajectory are added as the input of a cocoon sorting model. The cocoon sorting model is pre-trained and can output different types of cocoons according to the input of different information, including yellow spot cocoons, on-board cocoons, thin-skinned cocoons and dead pupa cocoons.
[0075] The method provided by the present invention utilizes the output result of the silkworm cocoon sorting model, and can remove the silkworms corresponding to the yellow spot cocoons, thin skin cocoons and dead pupa cocoons according to the output result, so as to realize the pre-identification and sorting of inferior cocoons.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for pre-identifying silkworm cocoon species based on generative artificial intelligence, characterized in that: include: Step 1: Obtain the silkworm image dataset; Step 2: Obtain a silkworm trajectory dataset corresponding to the silkworm image dataset; Step 3: training a silkworm cocoon sorting model according to the silkworm image dataset and the silkworm trajectory dataset to obtain a trained silkworm cocoon sorting model; Step 4: inputting the silkworm image to be predicted into the trained cocoon sorting model, and predicting the type of the cocoon through the model; The types of silk cocoons include: yellow spot cocoons, on-car cocoons, thin-skin cocoons and dead pupa cocoons.
2. The method according to claim 1, characterized in that The silkworm image is an image taken at the 7th day of the 5th instar of the silkworm.
3. The method according to claim 2, characterized in that The obtaining of the silkworm image data set comprises: Step 1: Use a camera to collect a video of the growth of silkworms from a top-down direction; Step 2: intercepting the growth video into silkworm growth images according to the time sequence; Step 3: Use the pre-trained silkworm individual detection model to perform individual detection on all captured silkworm growth images, and uniquely encode each silkworm individual through the silkworm individual detection model; Step 4: All the encoded silkworm growth images are used as the silkworm image dataset.
4. The method according to claim 3, characterized in that The growth video duration is ≥ 6 hours.
5. The method according to claim 3, characterized in that: The training method of the silkworm individual detection model is as follows: Step 1: Collect a growth video of silkworms; the growth video has a duration of ≥12 hours, the number of silkworms in each frame of the growth video is ≥50, and the growth video is intercepted into a sequence of images at intervals of 1 minute; Step 2: Manually mark the cocoon category of each captured sequence image after the silkworm cocoons; Step 3: Use manually labeled silkworm growth images as silkworm training sets; Step 4: training a silkworm individual detection model according to the silkworm training set to obtain a trained silkworm individual detection model; the silkworm individual detection model is used to identify whether there are silkworms in each image, the number of silkworms, and the position of the silkworms; The silkworm individual detection model includes: a diffusion model and a generative adversarial network; The diffusion model is used to generate an intermediate layer, and the generative adversarial network is used to perform model training.
6. The method according to claim 5, characterized in that In the silkworm training concentration, the number of cocoons collected on the vehicle is ≥15,000; the number of cocoons collected for each other type is ≥5,000.
7. The method according to any one of claims 3 to 6, characterized in that: Acquiring a silkworm trajectory dataset corresponding to the silkworm image dataset comprises: Using a pre-trained silkworm multi-target tracking model to track each silkworm in the silkworm image dataset, so as to classify the motion trajectory of each silkworm by using the silkworm multi-target tracking model; The silkworm images containing all types of motion trajectories are used as the silkworm trajectory dataset.
8. The method according to claim 7, characterized in that The silkworm multi-target tracking model is trained according to the following method: Step 1: Use a circumscribed rectangle to mark the positions of the silkworms in each silkworm growth image according to their numbers, so that the same silkworm is assigned an identity number from the initial image to the last image; Step 2: Obtain the identity number of the silkworm in each frame image and the silkworm position corresponding to the identity number; Step 3: according to the identification number and the silkworm position, the geometric center, head, and vertices of the circumscribed rectangular frame of the silkworm are used as single trajectory points to determine the motion trajectory of each silkworm, thereby obtaining the motion trajectories of all silkworms; Step 4: Classify the movement trajectories of all silkworms according to the cocoon type, and obtain the movement trajectory dataset for each cocoon type; Step 5: Use the motion trajectory data set corresponding to all cocoon types to train a multi-target tracking model to obtain a trained multi-target tracking model.
