Method for identifying physiological status of young silkworms based on machine vision
By improving the YOLOv5 neural network model and SE attention module, the problem of identifying the physiological state of silkworms is solved, and the automatic and accurate identification of the physiological state of silkworms is realized, which improves the breeding efficiency and quality, and reduces the workload of breeders.
Patent Information
- Application Number
- CN202410978703.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-12-27
AI Technical Summary
Existing machine vision technology has little research on the recognition of the physiological status of silkworms, which has led to mulberry silkworm breeders relying on empirical judgment, which is prone to subjective errors and visual fatigue, affecting the breeding efficiency and quality.
Using the machine vision recognition method based on the YOLOv5 neural network model, the improved YOLOv5 model is constructed by making small silkworm picture data sets, image preprocessing, data enhancement, and the improved YOLOv5 model is constructed, and combined with the SE attention module, the physiological state of small silkworms is realized automatically and accurately. Identify.
It realizes rapid and accurate identification of the physiological status of silkworms, reduces the workload of breeders, improves the accuracy of silkworm sleep management, and reduces the risk of disease occurrence.
Smart Images

Figure CN119206767A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of silkworm breeding, and in particular to a method for identifying the physiological state of young silkworms based on machine vision. Background Art
[0002] With the rapid rise of agricultural contracting and large-scale farm models, the application of machine vision technology in the agricultural field has become increasingly important, especially in real-time monitoring of crop growth, pest detection, precision irrigation and fertilization. In recent years, the rapid advancement of agricultural mechanization has not only greatly increased agricultural output, but also accelerated the pace of technological innovation and promoted the continuous expansion of the agricultural industry. At the same time, the mulberry silkworm breeding industry has also experienced a transformation from traditional individual breeding to modern large-scale intensive production, injecting new vitality into the comprehensive upgrading of the agricultural industry.
[0003] The occurrence of silkworm diseases is greatly affected by adverse climatic conditions. There is a lot of rain in spring, and young silkworms are easily affected by the low temperature and high humidity environment, which induces stiffness. The silkworms stop eating before molting and usually stay fixed on mulberry leaves. This phenomenon of not eating and not moving is called silkworm sleep. Silkworms need to molt four times in their life. Although they do not eat or move on the surface, they are actually undergoing intense tissue renewal in their bodies. If the silkworms are not well cared for during the sleep period, pathogens can easily invade the silkworms, making it difficult to molt, which will bring difficulties and losses to the later feeding. Therefore, it is necessary to pay attention to the management of silkworms during the sleep period.
[0004] At present, the recognition of the physiological state of young silkworms mainly relies on the experience of silkworm breeders, but the breeding experience of silkworm breeders is uneven, and too many silkworm foils will cause visual fatigue to silkworm breeders, and subjective judgment and error will occur in judging the physiological state of silkworms, resulting in unnecessary losses in the breeding process. Therefore, the research on the recognition of the physiological state of young silkworms based on machine vision is conducive to the realization of automatic, accurate, fast and instant recognition of the physiological state of young silkworms, helping silkworm breeders to intelligently identify the physiological state of young silkworms, and strengthening the prevention and early warning of the physiological state of young silkworms, thereby protecting the people's treasure house of wealth. However, the existing research on the recognition of the physiological state of young silkworms by machine vision is very little, and the research is not comprehensive enough. Summary of the invention
[0005] The present invention provides a method for identifying the physiological state of young silkworms based on machine vision, which can overcome certain defects of the prior art.
[0006] According to the present invention, a method for identifying the physiological state of young silkworms based on machine vision comprises the following steps:
[0007] Step 1: Create a dataset of images of silkworms in different physiological states;
[0008] Step 2: Image preprocessing;
[0009] Step 3: Construction of data set;
[0010] Step 4: Build an improved YOLOv5 neural network model;
[0011] Step 5: Determine whether the silkworm is in dormancy by printing out the coordinates;
[0012] Step 6: Set hyperparameters and complete training;
[0013] Step 7: Classify the physiological status of the silkworms through the trained model, and feed back the results to the interface output in real time.
[0014] Preferably, in step 1, use a suitable industrial camera and lens to take about 10,000 pictures of silkworms under different light sources, at different times, in different spaces, and at different angles, including silkworms in normal state and silkworms with diseases, and make a data set in a 1:1 ratio.
[0015] Preferably, in step 2, image preprocessing includes image normalization and data enhancement; data enhancement processing includes four data enhancement methods: image rotation and translation, image binarization, image median filtering, and image Gaussian noise.
[0016] Preferably, in step 3, the images obtained after preprocessing in step 2 are constructed into a silkworm dataset, and the labelimg tool is used for data annotation, and the annotated dataset is divided into a training set, a validation set, and a test set in a ratio of 92:4:4.
[0017] Preferably, in step 4, an improved YOLOv5 neural network model is used to identify the physiological state of the silkworm, and the improved YOLOv5 neural network model structure includes four parts: an input end, an improved Backbone module, an improved Neck, and a Head;
[0018] The input end includes Mosaic data enhancement, unified scaling and adaptive anchor box functions. The improved Backbone module includes BottleneckCSP and Focus modules. The C3 module is optimized and the SE attention module is added. The C3 modules of the 16-layer, 19-layer and 22-layer in Neck are optimized and the SE attention module is added. In the optimization of the C3 module, the C3-T module is designed to appropriately compress the model and reduce the amount of calculation without affecting the performance of the model. The C3 module includes Bottleneck. The Bottleneck-T module includes 2 1*1 Conv modules and 2 3*3 Conv modules. After the Feature map passes through the 1*1 Conv module, the C in The number of channels is reduced to 1 / 4 of the original, that is, C in4 Continue to pass the Featuremap to two 1*1 Conv modules and 3*3 Conv modules respectively. At this time, the number of channels of the two Featuremaps is C03; after the three Featuremaps are Concat operated, the output of Bottleneck-T is obtained; in adding the SE attention module, the SE attention module is added to the Neck part of the backbone network, with a total of 3 attention modules. The purpose of the SE module is to use a weight matrix to give different weights to different positions of the image from the perspective of the channel domain, so as to obtain more important feature information and improve the accuracy of the neural network model.
[0019] Preferably, in step 5, after the improved YOLOv5 model is established, the bounding box coordinates are output and printed. Under the same model and the same equipment conditions, the coordinates predicted and printed for the same picture or video are the same, so they can be used to identify whether the silkworms are in a dormant state. Specifically, the camera is set to take a picture at intervals of 10 seconds, and the established model is used to identify the silkworms and then output the printed coordinate information. The two coordinate positions are compared. If the coordinates change, it means that the silkworms are in the mulberry-eating period. If the coordinates do not change, it means that the silkworms are in a dormant period.
[0020] Preferably, in step 6, after improving the improved YOLOv5 model, PyTorch-GPU1.12+cu113 is used in combination with OpenCV to import the processed data set into a deep learning framework for training, and hyperparameters, learning rate, cosine annealing, learning rate momentum and weight decay coefficient are set. After the setting is completed and the training is completed, the optimal model is obtained, and the optimal model is selected after parameter adjustment and saved as a .pt file; PyQT5, QTDesigner and Eric6 tools are used to implement the research and design of the system for identifying the physiological state of silkworms in a Python environment, and then the percentage of the number of normal silkworms is set to be lower than 90%, that is, the system determines that there is a problem with the physiological state of the silkworms, and an alarm is issued; finally, the entire system is encapsulated into an exe executable file, and the constructed system is embedded in a host or embedded device of a windows or linux system for operation.
[0021] The beneficial effects of the present invention are as follows:
[0022] The present invention optimizes the C3 module and adds the SE attention module. In the optimization of the C3 module, the C3-T module is designed. The purpose is to appropriately compress the model and reduce the amount of calculation without affecting the model performance, so that the model is more lightweight and more suitable for using the edge device of the Linux system to identify the physiological state of silkworms.
[0023] The present invention determines whether the young silkworm is in the dormant period by printing out the coordinates, setting the camera to take a picture every 10 seconds, using the established model to identify the young silkworm and then outputting the printed coordinate information, and then comparing the coordinate positions twice. If the coordinates change, it means that the young silkworm is in the mulberry feeding period, and if the coordinates do not change, it means that the young silkworm is in the dormant period. This method can effectively determine whether the young silkworm is in the dormant period, greatly reducing the workload of the working people. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A flowchart of a method for identifying the physiological state of young silkworms based on machine vision in an embodiment;
[0025] Figure 2 The Bottleneck-T module structure diagram in the embodiment;
[0026] Figure 3 It is a flow chart of the SE module algorithm in the embodiment;
[0027] Figure 4 It is a structural diagram of the SE module in the embodiment;
[0028] Figure 5 It is the improved YOLOv5 network model in the embodiment. DETAILED DESCRIPTION
[0029] In order to further understand the content of the present invention, the present invention is described in detail in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments are only for explaining the present invention and are not intended to limit it.
[0030] Example
[0031] like Figure 1 As shown, this embodiment provides a method for identifying the physiological state of young silkworms based on machine vision, which includes the following steps:
[0032] Step 1: Create a dataset of images of silkworms in different physiological states;
[0033] Use a suitable industrial camera and lens (in this embodiment, a CMOS camera is selected to collect data set images), and take about 10,000 pictures of silkworms under different light sources, different times, different spaces, and different angles (collect image data of silkworms in different physiological states), including silkworms in normal state and silkworms with diseases, and make a data set in a 1:1 ratio (data annotation is performed on the pictures to obtain two classifications: normal state and diseased state).
[0034] Before making the data set, we first studied the mechanism of diseased silkworms, classified the diseased silkworms according to the cause of disease, and tested the four common silkworm diseases: bacterial disease, fungal disease, pus disease, and myiasis. Since the final confirmation of silkworm disease requires the dissection of the silkworm, if only the silkworm disease image is visually judged, it is impossible to accurately determine the type of silkworm disease to which the target detected diseased silkworm belongs. Therefore, the calibration of the data set is based on the consultation with silkworm experts to select the most likely type of silkworm disease. The standard judgment table for silkworm disease is shown in Table 1.
[0035] Table 1: Silkworm disease standard judgment table
[0036]
[0037] Step 2: Image preprocessing;
[0038] Image preprocessing includes image normalization and data enhancement; normalizing the image improves the robustness and accuracy of the model and the normalized image can make the training process more stable, accelerate convergence, and improve training efficiency. The common normalization formula is as follows:
[0039]
[0040] Among them, x' represents the image pixel value, min(x) and max(x) are the minimum and maximum values of the image pixels.
[0041] Data enhancement processing includes four data enhancement methods: image rotation and translation, image binarization, image median filtering, and image Gaussian noise. These methods can greatly reduce the impact of insufficient data, improve the robustness of the model, provide various "invariances" for the model, and increase the model's ability to resist overfitting.
[0042] Step 3: Construction of data set;
[0043] The images obtained after preprocessing in step 2 are constructed into a silkworm dataset, and the labelimg tool is used for data annotation. The annotated dataset is divided into a training set, a validation set, and a test set in a ratio of 92:4:4, so that the trained model is more realistic and reliable.
[0044] Step 4: Build an improved YOLOv5 neural network model;
[0045] The improved YOLOv5 neural network model is used to identify the physiological state of silkworms. The improved YOLOv5 neural network model structure includes four parts: input end, improved Backbone module, improved Neck, and Head. In order to continue to improve the detection accuracy of small objects, YOLOv5 still continues the previous version of the Mosaic data enhancement method. The Mosaic data enhancement is: cleverly splicing multiple different images into a comprehensive image for model training. This method not only injects diversity into the detection data set, but also contains various defect targets and complex background information, thereby greatly enriching the training samples. It is particularly worth mentioning that through random scaling, Mosaic data enhancement also significantly increases the number of small targets, which is crucial to improving the robustness of the network. In addition, this technology can effectively reduce the use of GPU video memory because it allows the data of multiple images to be processed simultaneously. Therefore, even at a smaller Mini-batch size, it can achieve quite excellent training results.
[0046] The input includes Mosaic data enhancement, unified scaling and adaptive anchor frame functions. Unified scaling means using grayscale filling to scale the image to a standard size. The adaptive anchor frame calculation compares the output prediction frame with the real frame based on the initial anchor frame, calculates the difference and then updates it in reverse, continuously iterating the parameters to obtain the most appropriate anchor frame value.
[0047] The improved Backbone module includes BottleneckCSP and Focus modules. The BottleneckCSP module significantly reduces the amount of computation while enhancing the learning performance of the entire convolutional neural network. The Focus module slices the image, expands the input channel to 4 times the original, and obtains a downsampled feature map after one convolution, which reduces the amount of computation and improves the speed while achieving downsampling.
[0048] The C3 module is optimized and the SE attention module is added. Taking into account the complex background of silkworm breeding, YOLOv5s is reasonably compressed and pruned without reducing its detection accuracy. In YOLOv5s, the C3 module contains 3 Conv modules and multiple Bottleneck modules. The C3 module structure contains two branches, one is composed of 1 Conv module and n Bottleneck modules, and the other is through a Conv module, and finally the Concat operation merges the two branches. The 16-layer, 19-layer and 22-layer C3 modules in Neck are optimized and SE attention modules are added. In the optimization of the C3 module, the C3-T module is designed to appropriately compress the model and reduce the amount of calculation without affecting the performance of the model; the C3 module includes Bottleneck, and the Bottleneck-T module is designed to include 2 1*1 Conv modules and 2 3*3 Conv modules; after the Featuremap passes through the 1*1 Conv module, C in The number of channels is reduced to 1 / 4 of the original, that is, C in 4. Continue to pass the Featuremap to two 1*1 Conv modules and 3*3 Conv modules respectively. At this time, the number of channels of the two Featuremaps is C03; after the three Featuremaps are concat, the output of Bottleneck-T is obtained; in the absence of bias, the parameter calculation formula for each convolution layer is:
[0049] params=C0×(k w ×k h ×C in )
[0050] C in and C0 are the number of input and output channels respectively, k w and k h are the width and height of the convolution kernel respectively.
[0051] In the C3 module, the number of parameters P1 required for the convolutional layer in the Bottleneck module is:
[0052] P1=C×(1×1×C)+C×(3×3×C)+C×(3×3×C)=19C 2
[0053] Where C represents the number of input and output channels.
[0054] In the C3-T module, the number of parameters P2 required for the convolutional layer in the Bottleneck-T module is:
[0055]
[0056] From the above formula, we can get that the parameter of Bottleneck-T is about 13.8% of Bottleneck. The structure diagram of Bottleneck-T module is as follows: Figure 2 shown.
[0057] When training a neural network, the attention mechanism can guide the network to focus on key feature information. In particular, the SE attention mechanism introduces a small number of additional parameters while hardly increasing the computational burden, but can significantly improve the performance of the model. The core idea of the SE module is to use a weight matrix to assign weights to different positions of the image from the perspective of the channel domain, thereby highlighting more critical feature information. This design enables the network to capture and utilize important features in the image more efficiently. The SE module algorithm flow chart is as follows: Figure 3 As shown. Based on the improvement of YOLOv5s, this embodiment introduces the SE module into the backbone network to improve the network detection performance. The main operations of the SE module are: Squeeze and Excitation. The process is:
[0058] (1)Transformation(F tr ): Given an input feature map X, let it pass through F tr The operation generates a feature map U;
[0059] (2) Squeeze(F sq (·)): This step performs global average pooling on the feature map to generate a (1*1*C) vector, so that each channel is represented by a numerical value, and a global low-dimensional embedding is achieved for U, which is equivalent to a numerical value having the global receptive field of the channel. The formula is:
[0060]
[0061] (3)Excitation(F ex ): This step is completed through two fully connected layers, and the weight information we need is generated through the weight W, where W is obtained through learning and is used to show the feature correlation we need. The formula is:
[0062] s=F ex (z,W)=σ(g(z,W))=σ(W2δ(W1z))
[0063] The vector z obtained in the previous step is processed by two fully connected layers W1 and W2 to obtain the channel weight value s we want. After two layers of fully connected layers, different values in s represent the weight information of different channels, giving different weights to the channels;
[0064] (4)Scale(Fscale ): As can be seen from the algorithm flow chart, the fourth step is to assign weights to the feature map U using the weight vector s generated in the third step to obtain the feature map we want Its size is exactly the same as the feature map U. The SE module does not change the size of the feature map. Its formula is:
[0065]
[0066] The generated feature vector s(1*1*C) is multiplied by the corresponding channel of the feature map U(H*W*C), that is, the H*W values of each channel in the feature map U are multiplied by the weight of the corresponding channel in s.
[0067] The SE module is a plug-and-play module. Figure 4 This is the structural diagram of the SE module.
[0068] The choice of algorithm depends on the specific application scenario, and there is no fixed guiding principle for the embedding position of the SE attention module in the network. In shallow networks, due to insufficient feature extraction, the SE module may find it difficult to effectively focus on key information in low dimensions. On the contrary, in deep networks, high-dimensional feature information is abundant, and SE modules are required to maintain the contextual relationship of this information through channel attention. However, when using SE modules, their number also needs to be controlled. Too many SE modules will significantly increase the number of parameters of the model, thereby reducing the computational efficiency of the network. Therefore, through experimental comparison, this embodiment adds the SE attention module to the Neck part of the backbone network, with a total of 3 attention modules, and finally obtains the improved YOLOv5 model structure diagram, as shown in the figure. Figure 5 shown.
[0069] Neck adopts a structure that combines FPN and PAN. By integrating the traditional FPN layer with the bottom-up feature pyramid structure, the model can integrate the extracted semantic features and position features, and further combine the features of the backbone layer with the detection layer to obtain more comprehensive and rich feature information.
[0070] In the head part, the model outputs a vector containing the probability of the target object category, the object score, and the corresponding bounding box position. The detection network is constructed by three layers of detection layers of different scales, which use feature maps of different sizes to identify and locate target objects of various sizes. Each detection layer will output its corresponding vector, and these vectors will be processed together to generate and mark the predicted bounding box and category of the target in the original image.
[0071] Step 5: Determine whether the silkworm is in dormancy by printing out the coordinates;
[0072] In object detection, a bounding box is usually used to describe the object location. A bounding box is a rectangular box that can be determined by the x and y coordinates of the upper left corner and the x and y coordinates of the lower right corner. There are two common ways to represent the coordinates of a bounding box:
[0073] (1) (x1, y1, x2, y2), where (x1, y1) is the coordinate of the upper left corner of the bounding box, and (x2, y2) is the coordinate of the lower right corner of the bounding box;
[0074] (2) (x, y, w, h), where (x, y) is the coordinate of the center of the bounding box, and (w, h) is the width and height of the bounding box. In the detection task, the label of the training data set will give the (x1, y1, x2, y2) corresponding to the real bounding box of the target object. Such a bounding box is also called the ground truth box. The model will predict the possible location of the target object. The bounding box predicted by the model is called the prediction box.
[0075] After the improved YOLOv5 model is established, the bounding box coordinates are output and printed. Under the same model and the same equipment conditions, the predicted printed coordinates of the same picture or video are the same, so it can be used to identify whether the silkworms are in a dormant state. Specifically, the camera is set to take a picture at intervals of 10 seconds, and the established model is used to identify the silkworms and then output the printed coordinate information. The two coordinate positions are compared. If the coordinates change, it means that the silkworms are in the mulberry-eating period. If the coordinates do not change, it means that the silkworms are in a dormant period.
[0076] Step 6: Set hyperparameters and complete training;
[0077] After improving the improved YOLOv5 model, we use PyTorch-GPU1.12+cu113 combined with OpenCV to import the processed data set into the deep learning framework for training, set the hyperparameters, learning rate, cosine annealing, learning rate momentum and weight decay coefficient, and obtain the optimal model after setting and training. After adjusting the parameters, we select the optimal model and save it as a .pt file. Then, we use PyQT5 and QT Designer and Eric6 tools were used in Python environment to realize the research and design of the system for identifying the physiological status of silkworms. The interface design outputs the following four data: 'total number of silkworms', 'number of normal silkworms', 'number of diseased silkworms', and 'number of silkworms in dormancy'. Percentages will appear next to these four data, that is, the output numbers of normal silkworms, diseased silkworms, and dormant silkworms will be divided by the total number of silkworms and then multiplied by 100%. If the percentage of normal silkworms is lower than 90%, the system will determine that there is a problem with the physiological status of the silkworm and issue an alarm. Finally, the whole system will be packaged into an exe executable file and embedded in a host or embedded device with Windows or Linux system for operation.
[0078] The silkworm physiological state model training is based on the classification-labeled training image set to train the silkworm physiological state recognition model, including: the silkworm images in the training image set, as well as the classification labels and feature vectors corresponding to the silkworm images in different physiological states are input into the silkworm physiological state recognition model for model training.
[0079] Step 7: Classify the physiological status of the silkworms through the trained model, and feed back the results to the interface output in real time.
[0080] This embodiment provides a method for identifying the physiological state of young silkworms based on machine vision, which can detect and record the physiological state of young silkworms, the rate of good development, whether they are in the dormant period, the mortality rate and other indicators in real time, and provide real-time feedback to silkworm breeders. If diseased or dormant silkworms appear, breeders will take corresponding measures. A method for identifying the physiological state of young silkworms based on machine vision is provided, which can increase the detection speed, maintain the detection accuracy and improve the robustness.
[0081] The present invention and its embodiments are described schematically above, and the description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. Therefore, if a person skilled in the art is inspired by it and designs a structural method and an embodiment similar to the technical solution without creativity without departing from the purpose of the invention, they shall all fall within the protection scope of the present invention.
Claims
1. A method for identifying the physiological state of young silkworms based on machine vision, characterized in that: The following steps are involved: Step 1: Create a dataset of images of silkworms in different physiological states; Step 2: Image preprocessing; Step 3: Construction of data set; Step 4: Build an improved YOLOv5 neural network model; Step 5: Determine whether the silkworm is in dormancy by printing out the coordinates; Step 6: Set hyperparameters and complete training; Step 7: Classify the physiological status of the silkworms through the trained model, and feed back the results to the interface output in real time.
2. The method for identifying the physiological state of young silkworms based on machine vision according to claim 1, characterized in that: In step 1, an industrial camera and lens are used to take about 10,000 pictures of silkworms under different light sources, at different times, in different spaces, and at different angles. These pictures include silkworms in normal conditions and silkworms with diseases, and a data set is created at a 1:1 ratio.
3. The method for identifying the physiological state of young silkworms based on machine vision according to claim 2, characterized in that: In step 2, image preprocessing includes image normalization and data enhancement; data enhancement processing includes four data enhancement methods: image rotation and translation, image binarization, image median filtering, and image Gaussian noise.
4. The method for identifying the physiological state of young silkworms based on machine vision according to claim 3, characterized in that: In step 3, the images obtained after preprocessing in step 2 are constructed into a silkworm dataset, and the labelimg tool is used for data annotation. The annotated dataset is divided into a training set, a validation set, and a test set in a ratio of 92:4:
4.
5. The method for identifying the physiological state of young silkworms based on machine vision according to claim 4, characterized in that: In step 4, the improved YOLOv5 neural network model is used to identify the physiological state of the silkworm. The improved YOLOv5 neural network model structure includes four parts: input end, improved Backbone module, improved Neck, and Head; The input end includes Mosaic data enhancement, unified scaling and adaptive anchor box functions. The improved Backbone module includes BottleneckCSP and Focus modules. The C3 modules of 16 layers, 19 layers and 22 layers in Neck are optimized and SE attention modules are added. In the optimization of C3 modules, C3-T modules are designed to appropriately compress the model and reduce the amount of calculation without affecting the performance of the model. The C3 module includes Bottleneck. The Bottleneck-T module includes 2 1*1 Conv modules and 2 3*3 Conv modules. After the feature map passes through the 1*1 Conv module, C in The number of channels is reduced to 1 / 4 of the original, that is, C in / 4 Continue to pass the Feature map to two 1*1 Conv modules and 3*3 Conv modules respectively. At this time, the number of channels of the two Feature maps is C0 / 3; after the three Feature maps are Concat operated, the output of Bottleneck-T is obtained; in adding the SE attention module, the SE attention module is added to the Neck part of the backbone network, with a total of 3 attention modules. The purpose of the SE module is to use a weight matrix to give different weights to different positions of the image from the perspective of the channel domain, so as to obtain more important feature information and improve the accuracy of the neural network model.
6. The method for identifying the physiological state of young silkworms based on machine vision according to claim 5, characterized in that: In step 5, after the improved YOLOv5 model is established, the bounding box coordinates are output and printed. Under the same model and the same equipment conditions, the predicted printed coordinates of the same picture or video are the same, so it can be used to identify whether the silkworm is in a dormant state. Specifically, the camera is set to take a picture at intervals of 10 seconds, and the established model is used to identify the silkworm and then output the printed coordinate information. The two coordinate positions are compared. If the coordinates change, it means that the silkworm is in the mulberry feeding period. If the coordinates do not change, it means that the silkworm is in a dormant period.
7. The method for identifying the physiological state of young silkworms based on machine vision according to claim 6, characterized in that: In step 6, after the improved YOLOv5 model is improved, PyTorch-GPU1.12+cu113 is used in combination with OpenCV to import the processed data set into the deep learning framework for training, and the hyperparameters, learning rate, cosine annealing, learning rate momentum and weight decay coefficient are set. After the setting is completed and the training is completed, the optimal model is obtained, and the optimal model is selected after parameter adjustment and saved as a .pt file; PyQT5, QT Designer and Eric6 tools are used to implement the research design of the system for identifying the physiological state of silkworms in the Python environment, and then the percentage of normal silkworms is set to be less than 90%, that is, the system determines that there is a problem with the physiological state of the silkworms and issues an alarm; finally, the entire system is encapsulated into an exe executable file, and the built system is embedded in a host or embedded device with a windows or linux system for operation.
