A method and system for detecting silkworm cocoons based on a control network

By building a cocoon detection image acquisition system and building a lightweight feature extraction network, automatic detection of cocoon under silkworm cocoons is realized, solving the problem of inefficient artificial cocoon selection and improving detection accuracy and speed.

CN113936159BActive Publication Date: 2025-02-07KUNMING UNIV OF SCI & TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111242070.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-25
Publication Date
2025-02-07
Estimated Expiration
2041-10-25

AI Technical Summary

Technical Problem

In the prior art, the cocoon selection is mainly artificial when selecting cocoons, which has a high labor intensity, which is prone to misjudgment, has a high missed selection rate, and has low efficiency in selecting cocoons.

Method used

By building a cocoon detection image acquisition system, collecting cocoon detection images, using the K-means algorithm cluster analysis, establishing a cocoon detection model under silkworm cocoon, and using model depth regulation and lightweight convolution module to build a lightweight feature extraction network. Realize automatic detection of cocoons under silkworm cocoons.

Benefits of technology

It effectively solves the problem of inefficient cocoon selection by manual cocoon selection, improves the accuracy and speed of cocoon detection, and improves the quality of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113936159B_ABST
    Figure CN113936159B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and system for detecting cocoon lower cocoons based on a control network, and belongs to the technical field of cocoon detection. The method of the present invention comprises configuring image acquisition system parameters, building an image acquisition system; acquiring cocoon linear array images and synthesizing area array images by a computer, and then expanding the images by a diagonal mirror method to establish a cocoon lower cocoon detection data set; dividing the cocoon lower cocoon detection data set into a training set and a test set, and annotating the images in the training set and the test set; clustering analysis of the cocoon lower cocoon detection data set by a K-means algorithm, presetting the candidate frame parameters of a YOLOv4 target detection model to improve the model accuracy; using a model depth control method to perform model compression and designing a lightweight convolution module to construct a lightweight feature extraction network to improve the speed of the model. The method of the present invention can detect lower cocoons instead of humans when selecting cocoons, solves the problem of low efficiency caused by manual visual inspection when selecting cocoons during cocoon processing, and has high detection speed and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a silkworm cocoon detection method and system based on a control network, belonging to the technical field of silkworm cocoon detection. Background Art

[0002] Silkworm cocoons are the most important product of sericulture, and they become the raw materials of the silk industry through the circulation of commodity markets. At present, silkworm cocoons are mainly divided into two categories: "cocoons for silk reeling" and "cocoons for silk reeling". "Cocoons for silk reeling" refers to cocoons that can be put on the silk reeling machine to reel genuine raw silk, and "cocoons for silk reeling" refers to cocoons with serious defects that cannot or are difficult to reel genuine raw silk. Processing raw cocoons into twisted raw silk requires the following processes: mixing cocoons, peeling cocoons, selecting cocoons, boiling cocoons, reeling, re-shaking, and finishing. Before the silk reeling process, a cocoon selection process is required to remove the cocoons for silk reeling to ensure the quality of the cocoons and improve the economic benefits of silk products. The main method of selecting cocoons is manual selection, which is labor-intensive, prone to misjudgment, high omission rate, and low efficiency. Summary of the invention

[0003] The present invention aims at the problem that the cocoon selection in the prior art is mainly done manually, which has high labor intensity, is prone to misjudgment, has a high rate of missed selection, and has low cocoon selection efficiency. A method and system for detecting cocoon fall based on a control network is proposed, that is, a cocoon fall detection image acquisition system is built to collect cocoon fall detection images, and the images are expanded by diagonal mirroring to establish a cocoon fall detection data set; the images in the cocoon fall detection data set are clustered and analyzed by a K-means algorithm to obtain candidate frame parameters to improve the model accuracy; the model is compressed by a model depth control method and a lightweight convolution module is designed to construct a lightweight feature extraction network to improve the speed of the model. The problem that the detection of cocoons fall during the selection of cocoons in the current cocoon processing process is inefficient due to manual visual inspection is solved, and the detection method of machine vision is used instead of manual detection of cocoons. The technical effect of detecting cocoons through a control network, effectively ensuring the accuracy of cocoon fall detection, and improving the detection speed and detection quality is achieved.

[0004] A method for detecting silkworm cocoons based on a regulatory network, the specific steps are as follows:

[0005] Configure image acquisition system parameters and build the image acquisition system;

[0006] The cocoon line array images were collected and synthesized into planar array images by computer, and then the images were expanded by diagonal mirroring to establish the cocoon detection data set.

[0007] The cocoon detection dataset is divided into a training set and a test set, and the images in the training set and the test set are annotated;

[0008] The K-means algorithm is used to perform cluster analysis on the cocoon detection dataset, and the candidate box parameters of the YOLOv4 target detection model are preset;

[0009] Perform model depth control on the model after the candidate box parameters are preset;

[0010] Reconstructing the feature extraction network of the model after model depth regulation, and establishing a silkworm cocoon detection model;

[0011] The silkworm cocoon laying detection model is used to detect the silkworm cocoon laying.

[0012] The configuration of image acquisition system parameters and the construction of the image acquisition system include:

[0013] Select line scan camera and lens;

[0014] Determine the width of the field of view;

[0015] Calculate the shooting object distance and depth of field of the image acquisition system, and round off the shooting distance according to the depth of field;

[0016] Set the image height in pixels;

[0017] Calculate the sampling frequency;

[0018] Build an image acquisition system.

[0019] Furthermore, the calculation formula for the shooting object distance and depth of field of the image acquisition system is:

[0020]

[0021] Where f is the focal length of the lens, D is the object distance, S is the field of view, and s is the CCD size.

[0022] The formula for calculating depth of field is:

[0023]

[0024] Where F is the aperture value of the lens, d is the diameter of the circle of confusion, and L is the shooting distance.

[0025] The calculation formula for the sampling frequency is:

[0026]

[0027] Where V is the moving speed of the conveyor belt in the image acquisition system.

[0028] The collected linear array images are synthesized into planar array images by computer, and the images are expanded by diagonal mirroring to establish a cocoon detection data set, including:

[0029] Taking yellow spot cocoons, thin skin cocoons, deflated cocoons and extra small cocoons as detection objects, linear array images with different quantity distribution, different angles and different quantity categories were collected;

[0030] The collected linear array images are synthesized into planar array images through computers;

[0031] The synthesized area array image is expanded by diagonal mirroring to obtain the cocoon detection data.

[0032] The data ratio of the training set and the test set is 3:1;

[0033] The method for annotating images in the training set and test set is

[0034] Use the labelImg annotation tool to annotate the images in the training set and the validation set, that is, mark the bounding boxes of the corresponding cocoon categories for all objects that need to be identified in each image.

[0035] The method of using the K-means algorithm to perform cluster analysis on the cocoon detection data set and presetting the candidate box parameters of the YOLOv4 target detection model is as follows:

[0036] The sizes of the labeled boxes in the cocoon detection dataset are clustered using 3, 6, 9 and 12 points as the centers, and the sizes of the labeled boxes close to the center points are classified. The values ​​of the cluster centers are updated successively through an iterative method to reach the optimal clustering result.

[0037] Use the size of the annotation box obtained by cluster analysis to modify the candidate box parameters of the YOLOv4 object detection model.

[0038] The depth control of the model after the candidate frame parameters are preset includes:

[0039] Perform sparse training on the model after the candidate box parameters are preset;

[0040] The mean value of the γ parameter in the first convolutional layer of each CSP residual module in the feature extraction network CSPDarknet53 of the YOLOv4 basic model after sparse training is used as the discriminant indicator of the importance of the residual module to deeply regulate the model to compress the model size;

[0041] When the model depth is adjusted, the CSP residual modules are ranked according to their contribution to the prediction of the final feature map according to the mean value of the γ parameter;

[0042] By setting the number of CSP residual modules to be regulated and deleted, the model is deeply regulated. Regulating and deleting one CSP residual module corresponds to regulating and deleting 3 layers of the model.

[0043] The reconstructing of the feature extraction network of the model after the model depth regulation and establishing the cocoon detection model includes:

[0044] Referring to the G-bneck module in GhostNet, two lightweight convolution modules are designed, namely lightweight convolution module 1 with stride = 1 and lightweight convolution module 2 with stride = 2, according to the different moving strides of the convolution kernel.

[0045] Use lightweight convolution module 1 and lightweight convolution module 2 to replace the remaining CSP residual modules of the model after model depth regulation, and rebuild the feature extraction network of the model.

[0046] The present invention discloses a silkworm cocoon laying cocoon detection system based on a regulatory network, which is applied to a silkworm cocoon laying cocoon detection method based on a regulatory network, wherein the system comprises:

[0047] A first construction unit, the first construction unit is used to configure various parameters of the image acquisition system and build the image acquisition system;

[0048] A first acquisition unit, the first acquisition unit is used to collect line array images and synthesize area array images through a computer, and then expand the image through a diagonal mirror method to establish a cocoon detection data set;

[0049] A first execution unit, the first execution unit is used to divide the data set into a training set and a test set and annotate the images in the training set and the test set;

[0050] A second construction unit, wherein the second construction unit is used to perform cluster analysis on the cocoon detection data set by using a K-means algorithm, and preset YOLOv4 target detection model candidate box parameters;

[0051] A third construction unit, the third construction unit is used to perform model depth control on the model after the candidate box parameters are preset;

[0052] A second execution unit, the second execution unit is used to reconstruct the feature extraction network of the model after the model depth regulation, and establish a cocoon detection model for silkworm cocoons;

[0053] The third execution unit is used to detect the silkworm cocoon laying through the silkworm cocoon laying detection model.

[0054] The silkworm cocoon laying cocoon detection system based on the regulatory network includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the silkworm cocoon laying cocoon detection method based on the regulatory network when executing the program.

[0055] The beneficial effects of the present invention are:

[0056] (1) The present invention solves the problem of low efficiency in detecting the cocoons when selecting cocoons in the current cocoon processing process by manual visual inspection, and replaces manual inspection of the cocoons with a machine vision inspection method;

[0057] (2) The present invention detects the cocooning by regulating the network, which effectively ensures the accuracy of the cocooning detection and improves the detection speed and detection quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 A schematic diagram of a process for detecting silkworm cocoons based on a regulatory network according to an embodiment of the present application;

[0059] Figure 2 This is a schematic diagram of the depth control sequence of the model in the embodiment of the present application;

[0060] Figure 3 This is a schematic diagram of the structure of a lightweight convolution module according to an embodiment of the present application;

[0061] Figure 4 This is a schematic diagram of the control network structure of the embodiment of the present application;

[0062] Figure 5 This is a schematic diagram of the process of a silkworm cocoon detection system based on a control network according to an embodiment of the present application;

[0063] Figure 6 This is a schematic diagram of the structure of an exemplary electronic device according to an embodiment of the present application;

[0064] In the figure: 501-first construction unit, 502-first acquisition unit, 503-first execution unit, 504-second construction unit, 505-third construction unit, 506-second execution unit, 507-third execution unit, 601-storage, 602-processor, 603-receiver, 604-transmitter, 605-bus interface, 606-bus. DETAILED DESCRIPTION

[0065] The embodiment of the present invention provides a method and system for detecting cocoon laying based on a control network, which solves the problem of low efficiency of detecting cocoons by manual visual inspection when selecting cocoons in the current cocoon processing process, and replaces manual detection of cocoons with a machine vision detection method. The technical effect of detecting cocoons by a control network, effectively ensuring the accuracy of cocoon laying detection, and improving the detection speed and detection quality is achieved.

[0066] The present invention is further described in detail below in conjunction with specific implementation modes, but the protection scope of the present invention is not limited to the described contents.

[0067] Application Overview

[0068] Silkworm cocoons are the most important product of sericulture, and they become the raw materials of the silk industry through the circulation of commodity markets. At present, silkworm cocoons are mainly divided into two categories: "on-carriage cocoons" and "off-carriage cocoons". "On-carriage cocoons" refer to cocoons that can be put on the silk reeling machine to reel genuine raw silk, and "off-carriage cocoons" refer to cocoons with serious defects that cannot or are difficult to reel genuine raw silk. Processing raw cocoons into twisted raw silk requires a process of mixing cocoons, peeling cocoons, selecting cocoons, boiling cocoons, reeling, re-shaking, and finishing. Before the silk reeling process, a cocoon selection process is required to remove the off-carriage cocoons to ensure the quality of the cocoon silk and improve the economic benefits of silk products. The main method of selecting cocoons is manual selection, which is labor-intensive, prone to misjudgment, high missed selection rate, and low cocoon selection efficiency. Therefore, using machine vision methods to replace manual detection of off-carriage cocoons during cocoon selection is the key to realizing the mechanization and intelligence of silkworm cocoon processing equipment.

[0069] In view of the above technical problems, the technical solution provided by this application is:

[0070] A method for detecting silkworm cocoons based on regulatory networks (see Figure 1 ), the specific steps are as follows:

[0071] Step S100: configuring image acquisition system parameters and building an image acquisition system;

[0072] Step S200: collecting the cocoon line array image and synthesizing the area array image by computer, and then expanding the image by diagonal mirroring method to establish the cocoon detection data set;

[0073] Step S300: dividing the cocoon detection data set into a training set and a test set, and annotating the images in the training set and the test set;

[0074] Step S400: performing cluster analysis on the cocoon detection data set using a K-means algorithm, and presetting YOLOv4 target detection model candidate box parameters;

[0075] Step S500: performing model depth control on the model after the candidate box parameters are preset;

[0076] Step S600: reconstructing the feature extraction network of the model after the model depth adjustment, and establishing a silkworm cocoon detection model;

[0077] Step S700: detecting the silkworm cocoon laying by using the silkworm cocoon laying detection model.

[0078] Various non-limiting embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.

[0079] Embodiment 1: A method for detecting silkworm cocoons based on a regulatory network, the specific steps are as follows:

[0080] Step S100: Configure image acquisition system parameters and build an image acquisition system:

[0081] Select line scan camera and lens;

[0082] Determine the width of the field of view;

[0083] Calculate the shooting object distance and depth of field of the image acquisition system, and round off the shooting distance according to the depth of field;

[0084] The calculation formula for the shooting object distance and depth of field of the image acquisition system is:

[0085]

[0086] Where f is the focal length of the lens, D is the object distance, S is the field of view, and s is the CCD size.

[0087] The formula for calculating depth of field is:

[0088]

[0089] Where F is the aperture value of the lens, d is the diameter of the circle of confusion, and L is the shooting distance.

[0090] The calculation formula for the sampling frequency is:

[0091]

[0092] Where V is the moving speed of the conveyor belt in the image acquisition system;

[0093] Set the image height in pixels;

[0094] Calculate the sampling frequency;

[0095] Build an image acquisition system;

[0096] Step S200: Collect the cocoon line array image and synthesize the area array image through a computer, and then expand the image through the diagonal mirror method to establish the cocoon detection data set:

[0097] Taking yellow spot cocoons, thin skin cocoons, deflated cocoons and extra small cocoons as detection objects, linear array images with different quantity distribution, different angles and different quantity categories were collected;

[0098] The collected linear array images are synthesized into planar array images through computers;

[0099] The synthesized area array image is expanded by diagonal mirroring to obtain the cocoon detection data;

[0100] Step S300: dividing the cocoon detection data set into a training set and a test set, and annotating the images in the training set and the test set, wherein the data ratio of the training set to the test set is 3:1;

[0101] The method for annotating images in the training set and test set is

[0102] Use the labelImg annotation tool to annotate the images in the training set and the validation set, that is, mark the corresponding bounding boxes of the lower cocoon category for all objects that need to be identified in each image;

[0103] Step S400: Perform cluster analysis on the cocoon detection dataset using the K-means algorithm, and preset the candidate box parameters of the YOLOv4 target detection model:

[0104] The sizes of the labeled boxes in the cocoon detection dataset are clustered using 3, 6, 9 and 12 points as the centers, and the sizes of the labeled boxes close to the center points are classified. The values ​​of the cluster centers are updated successively through an iterative method to reach the optimal clustering result.

[0105] Use the size of the annotation box obtained by cluster analysis to modify the candidate box parameters of the YOLOv4 object detection model;

[0106] Step S500: performing model depth control on the model after the candidate box parameters are preset:

[0107] Perform sparse training on the model after the candidate box parameters are preset;

[0108] The mean value of the γ parameter in the first convolutional layer of each CSP residual module in the feature extraction network CSPDarknet53 of the YOLOv4 basic model after sparse training is used as the discriminant indicator of the importance of the residual module to deeply regulate the model to compress the model size;

[0109] When the model depth is adjusted, the CSP residual modules are ranked according to their contribution to the prediction of the final feature map according to the mean value of the γ parameter;

[0110] By setting the number of CSP residual modules to be deleted, the model is deeply regulated. Deleting one CSP residual module corresponds to deleting three layers of the model.

[0111] Step S600: Reconstruct the feature extraction network of the model after model depth regulation, and establish a silkworm cocoon detection model:

[0112] Referring to the G-bneck module in GhostNet, two lightweight convolution modules are designed, namely lightweight convolution module 1 with stride = 1 and lightweight convolution module 2 with stride = 2, according to the different moving strides of the convolution kernel.

[0113] Use lightweight convolution module 1 and lightweight convolution module 2 to replace the remaining CSP residual module of the model after model depth regulation, and rebuild the feature extraction network of the model;

[0114] Step S700: detecting the silkworm cocoon laying by using the silkworm cocoon laying detection model.

[0115] Example 2: A method for detecting silkworm cocoons based on a regulatory network (see Figure 1 ), the specific steps are as follows:

[0116] Step S100: configuring various parameters of the image acquisition system and building the image acquisition system;

[0117] Specifically, the image acquisition system uses a three-line high-speed color line scan camera, model: PC-30-04K80-00-R, CCD size s is 4096 pixels, pixel size d is 10μm×10μm, then CCD size s is 40.96mm; high-precision detection lens, model: PENTAX, YF3528L, focal length f is 35mm, aperture value F is 2.6mm. The conveyor belt used for image acquisition is 600mm wide, that is, the width dimension S of the field of view is 600mm;

[0118] The object distance D of the image acquisition system is calculated by formula (1):

[0119]

[0120] In the machine vision inspection system, when the diameter of the circle of confusion d is less than 0.035 mm, the image is considered to be a clear image. The depth of field ΔL of the image acquisition system is calculated by formula (2):

[0121]

[0122] When building the image acquisition system, because the depth of field ΔL is 44.69mm, which is relatively large, it is only necessary to ensure that the conveyor belt surface is within the depth of field of the image acquisition system to obtain a clear image. Therefore, the object distance D can be rounded to 500mm during shooting.

[0123] The camera used to collect images is a linear scan camera. To meet the 1:1 requirement of the YOLOv4 target detection model input image aspect ratio, the camera image height pixel needs to be set to 4096 pixels, that is, 4096 frames.

[0124] According to formula (3), the sampling frequency q during image acquisition is calculated as:

[0125]

[0126] After the above calculation and analysis, when building the image acquisition system, the object distance D is 500mm, the width and height pixels are both set to 4096 frames, and the sampling frequency q is 1024Hz, which can ensure that the image acquisition system can acquire clear images;

[0127] Step S200: Collecting linear array images, synthesizing planar array images through computers, and expanding the images through diagonal mirroring to establish a cocoon detection data set;

[0128] Specifically, four types of cocoons, namely yellow-spotted cocoons, thin-skinned cocoons, deflated cocoons and extra-small cocoons, were selected as the detection objects. They were photographed in different numbers, at different angles and in different numbers to ensure that the images obtained were in line with the actual situation when selecting cocoons. A total of 556 images were collected, which were expanded to 1112 images by diagonal mirroring.

[0129] Step S300: dividing the data set into a training set and a test set, and then annotating the images in the training set and the test set;

[0130] Specifically, the images were randomly divided into training set and test set in a ratio of 3:1, that is, 834 images were used for training and 278 images were used for testing. The labelImg annotation tool was used to annotate the images in the training set and the test set.

[0131] Step S400: performing cluster analysis on the cocoon detection data set using a K-means algorithm, and presetting YOLOv4 basic model candidate box parameters;

[0132] Specifically, the candidate box parameters obtained by clustering analysis when the number of candidate boxes is 3, 6, 9, and 12 are shown in Table 1.

[0133] Table 1 Parameters of different candidate boxes

[0134]

[0135] As shown in Table 2, re-presetting the candidate box parameters has no effect on the size of the model weight, and the weight size of all models is 245.00M; among them, when the number of candidate boxes is 3, the average detection speed is the fastest compared with other numbers of candidate boxes, reaching 30.95 frames / s, and the mAP is the highest, reaching 96.08%; the results show that when the number of candidate boxes is 3, the detection effect is better for the cocoon detection dataset;

[0136] Table 2 Model effect after presetting candidate box parameters

[0137]

[0138] Therefore, the number of candidate boxes is selected as 3, and the sizes of the candidate boxes are (20, 22), (31, 25), and (24, 32) respectively. One candidate box is allocated to the YOLO layer of each YOLOv4 base model to predict the target;

[0139] Step S500: performing model depth control on the model after the candidate box parameters are preset;

[0140] Specifically, in the BN layer of the YOLOv4 target detection model, γ and β are parameters at the channel level of the neural network model. The feature map on each channel is calculated by the convolution kernel of the convolution layer. The feature map corresponds to the convolution kernel one by one and does not interfere with each other. Therefore, γ can be used to measure the importance of the current channel. Model sparsification is a sparse method that performs L1 regularization on the γ parameter. After introducing L1 regularization, the sparse training loss function L of the model is obtained. xishu for:

[0141]

[0142] In the formula, is the original loss function of the model; is the prediction result of the model input x after the weight W of the convolutional neural network is calculated; y is the true value of the model output; λ is the sparsification (regularization) factor, which determines the strength of sparsification; M(γ) = |γ|, is the L1 norm of all BN layers. Using L1 regularization training can form sparse weights;

[0143] The feature extraction network CSPDarknet53 of the original YOLOv4 basic model is mainly composed of CSP residual modules, and is divided into 5 groups of CSP residual modules with the same feature map size. The cascade times of the 5 groups of CSP residual modules are 1, 2, 8, 8, and 4, respectively. There are 23 CSP residual modules in total. According to their positions in the model, the sequence numbers are 1, 2, 3...22, 23 from the front to the back. When each group of CSP residual modules is predicting the target, one or more CSP residual modules may contribute less to the prediction of the final feature map; therefore, regulating and deleting one or more CSP residual modules with less contribution does not affect the model's reasoning in terms of dimensions;

[0144] When the model depth is regulated, the model depth can be regulated by setting the number of CSP residual modules to be regulated and deleted. Regulating and deleting one CSP residual module corresponds to regulating and deleting three layers of the model. When the model depth is regulated, too many CSP residual modules are regulated and deleted, which will lead to excessive loss of model accuracy. Therefore, the number of CSP residual modules to be regulated and deleted is set to 3, 6, 9, 12, and 15 respectively; Figure 2The figure shows a schematic diagram of the depth control sequence of the model. In the figure, the contribution of the CSP residual module from top to bottom to the prediction of the final feature map gradually increases, that is, when controlling and deleting the CSP residual module, select from top to bottom according to the sequence number in the figure; Figure 2 The model is compressed in depth according to the order shown in . After the CSP residual module is deleted, the model accuracy decreases a lot, so the model needs to be fine-tuned. When fine-tuning, 100 fine-tuning epochs can be selected. The results are shown in Table 3. When the number of CSP residual modules is deleted by adjusting to 15, the model weight is reduced to the minimum, which is 182.00M, and the average detection speed reaches the highest, which is 35.68 frames / s. The mAP of the fine-tuned model reaches 94.53%, indicating that when the number of CSP residual modules is deleted by adjusting to 15, the detection performance of the model is better. Therefore, the number of CSP residual modules is selected to be deleted by adjusting to 15, and the number of remaining CSP residual modules is 8.

[0145] Table 3 Model depth control effect

[0146]

[0147] Step S600: reconstructing the feature extraction network of the model after the model depth adjustment, and establishing a silkworm cocoon detection model;

[0148] Specifically, if Figure 3 As shown in the figure, referring to the G-bneck module in GhostNet, two lightweight convolution modules are designed according to the different moving strides of the convolution kernel, one is lightweight convolution module 1 (stride=1), and the other is lightweight convolution module 2 (stride=2); lightweight convolution module 1 and lightweight convolution module 2 are used to replace the remaining 8 CSP residual modules of the model after the model depth regulation, and the feature extraction network of the model is rebuilt;

[0149] After the model depth regulation, the remaining 8 CSP residual modules of the YOLOv4 basic model are used alternately 4 times of lightweight convolution module 1 and lightweight convolution module 2 to rebuild the feature extraction network of the model, and the output after the second, third and fourth use of lightweight convolution module 2 is used as the input of the PANet multi-scale feature fusion network. The structure of the regulation network after using the lightweight feature extraction network is as follows: Figure 4 As shown in Table 4, compared with the model after model depth regulation, the mAP of the regulated network increased by 1.02% to 95.55%; the model weight size decreased by 25.52% to 145.00M; the average detection speed increased by 38.37% to 49.37 frames / s. This shows that the ICNet cocoon detection model has good overall performance and meets the actual application requirements of real-time cocoon detection;

[0150] Table 4 Performance of the control network model

[0151]

[0152] Step S700: detecting the silkworm cocoon by using the silkworm cocoon detection model;

[0153] The present invention solves the problem of low efficiency of manual visual inspection in the cocoon selection during the cocoon processing, and replaces manual inspection of cocoons with the detection method of machine vision; the technical effect of detecting cocoons through the control network, effectively ensuring the accuracy of the detection, and improving the detection speed and quality is achieved.

[0154] Embodiment 3: A silkworm cocoon detection system based on a regulatory network, such as Figure 5 As shown, the system comprises:

[0155] A first construction unit 501, which is used to configure various parameters of the image acquisition system and build the image acquisition system;

[0156] A first acquisition unit 502, the first acquisition unit 502 is used to collect line array images, synthesize area array images through a computer, and expand the images through a diagonal mirroring method to establish a cocoon detection data set;

[0157] A first execution unit 503, wherein the first execution unit 503 is used to divide the data set into a training set and a test set and then annotate the images in the training set and the test set;

[0158] A second construction unit 504, wherein the second construction unit 504 is used to perform cluster analysis on the cocoon detection data set using a K-means algorithm and preset YOLOv4 target detection model candidate box parameters;

[0159] A third construction unit 505, wherein the third construction unit 505 is used to perform model depth control on the model after the candidate box parameters are preset;

[0160] A second execution unit 506, the second execution unit 506 is used to reconstruct the feature extraction network of the model after the model depth adjustment, and establish a cocoon detection model;

[0161] The third execution unit 507 is used to detect the silkworm cocoon laying through the silkworm cocoon laying detection model.

[0162] Exemplary electronic devices (see Figure 6 ),

[0163] A silkworm cocoon laying cocoon detection system based on a control network, wherein a computer program is stored thereon, and when the program is executed by a processor, the steps of any one of the methods of the silkworm cocoon laying cocoon detection system based on a control network are implemented as described above;

[0164] Among them, the bus architecture (represented by bus 606), bus 606 can include any number of interconnected buses and bridges, bus 606 links various circuits including one or more processors represented by processor 602 and memory represented by memory 601. Bus 606 can also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and therefore will not be further described; bus interface 305 provides an interface between bus 606 and receiver 603 and transmitter 604; receiver 603 and transmitter 604 can be the same element, i.e., a transceiver, providing a unit for communicating with various other systems on a transmission medium; processor 602 is responsible for managing bus 606 and general processing, while memory 601 can be used to store data used by processor 602 when performing operations.

[0165] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0166] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or boxes.

[0167] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction system, which is implemented in the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0169] Although preferred embodiments of the present invention have been described, additional changes and modifications may be made to these embodiments by those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

[0170] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. A method for detecting silkworm cocoons based on a regulatory network, characterized in that: The specific steps are as follows: Configure the image acquisition system parameters and build the image acquisition system, including: Select line scan camera and lens; Determine the width of the field of view; The object distance and depth of field of the image acquisition system are calculated, and the shooting distance is rounded according to the depth of field. The calculation formula of the object distance and depth of field of the image acquisition system is: Where f is the focal length of the lens, D is the object distance, S is the field of view, and s is the CCD size; The formula for calculating depth of field is: In the formula, F is the aperture value of the lens, d is the diameter of the circle of confusion, and L is the shooting distance; Set the image height in pixels; Calculate the sampling frequency; the calculation formula of the sampling frequency is: Where V is the moving speed of the conveyor belt in the image acquisition system; Build an image acquisition system; The cocoon line array images were collected and synthesized into planar array images by computer, and then the images were expanded by diagonal mirroring to establish the cocoon detection data set. The cocoon detection dataset is divided into a training set and a test set, and the images in the training set and the test set are annotated; The K-means algorithm is used to perform cluster analysis on the cocoon detection dataset, and the candidate box parameters of the YOLOv4 target detection model are preset; Perform model depth control on the model after the candidate box parameters are preset; specifically including: Perform sparse training on the model after the candidate box parameters are preset; The mean value of the γ parameter in the first convolutional layer of each CSP residual module in the feature extraction network CSPDarknet53 of the YOLOv4 basic model after sparse training is used as the discriminant indicator of the importance of the residual module to deeply regulate the model to compress the model size; When the model depth is adjusted, the CSP residual modules are ranked according to their contribution to the prediction of the final feature map according to the mean value of the γ parameter; By setting the number of CSP residual modules to be deleted, the model is deeply regulated. Deleting one CSP residual module corresponds to deleting three layers of the model. Reconstructing the feature extraction network of the model after model depth regulation and establishing a cocoon detection model; specifically including: Referring to the G-bneck module in GhostNet, two lightweight convolution modules are designed, namely lightweight convolution module 1 with stride = 1 and lightweight convolution module 2 with stride = 2, according to the different moving strides of the convolution kernel. Use lightweight convolution module 1 and lightweight convolution module 2 to replace the remaining CSP residual module of the model after model depth regulation, and rebuild the feature extraction network of the model; The silkworm cocoon laying detection model is used to detect the silkworm cocoon laying.

2. The method for detecting silkworm cocoons based on a regulatory network according to claim 1, characterized in that: The collected linear array images are synthesized into planar array images by computer, and the images are expanded by diagonal mirroring to establish the cocoon detection data set, including: Taking yellow spot cocoons, thin skin cocoons, deflated cocoons and extra small cocoons as detection objects, linear array images with different quantity distribution, different angles and different quantity categories were collected; The collected linear array images are synthesized into planar array images through computers; The synthesized area array image is expanded by diagonal mirroring to obtain the cocoon detection data.

3. The method for detecting silkworm cocoons based on a regulatory network according to claim 1, characterized in that: The data ratio of the training set and the test set is 3:1; The method for annotating images in the training set and test set is Use the labelImg annotation tool to annotate the images in the training set and the validation set, that is, mark the bounding boxes of the corresponding cocoon categories for all objects that need to be identified in each image.

4. The method for detecting silkworm cocoons based on a regulatory network according to claim 1, characterized in that: The K-means algorithm is used to perform cluster analysis on the cocoon detection dataset, and the method for presetting the candidate box parameters of the YOLOv4 target detection model is as follows: The sizes of the labeled boxes in the cocoon detection dataset are clustered using 3, 6, 9 and 12 points as the centers, and the sizes of the labeled boxes close to the center points are classified. The values ​​of the cluster centers are updated successively through an iterative method to reach the optimal clustering result. Use the size of the annotation box obtained by cluster analysis to modify the candidate box parameters of the YOLOv4 object detection model.

5. A silkworm cocoon detection system based on a regulatory network, applied to the method according to any one of claims 1 to 4, wherein: The system comprises: A first construction unit, the first construction unit is used to configure various parameters of the image acquisition system and build the image acquisition system; A first acquisition unit, the first acquisition unit is used to collect line array images and synthesize area array images through a computer, and then expand the image through a diagonal mirror method to establish a cocoon detection data set; A first execution unit, the first execution unit is used to divide the data set into a training set and a test set and annotate the images in the training set and the test set; A second construction unit, wherein the second construction unit is used to perform cluster analysis on the cocoon detection data set by using a K-means algorithm, and preset YOLOv4 target detection model candidate box parameters; A third construction unit, the third construction unit is used to perform model depth control on the model after the candidate box parameters are preset; A second execution unit, the second execution unit is used to reconstruct the feature extraction network of the model after the model depth regulation, and establish a cocoon detection model for silkworm cocoons; The third execution unit is used to detect the silkworm cocoon laying through the silkworm cocoon laying detection model.

6. A silkworm cocoon detection system based on a control network, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Real-time detection method for silkworm cocoon feeding

    CN113269275A