Rapid detection equipment for cordyceps sinensis

By improving the combination of YOLOv8 object detection algorithm and dendritic module, the Cordyceps sinensis automatic detection model was constructed, which solved the problem of difficulty in human eye recognition, and achieved efficient Cordyceps sinensis picking, protecting the ecological environment and improving economic benefits.

CN120385668APending Publication Date: 2025-07-29ZHENGZHOU UNIV

Patent Information

Application Number
CN202510680492.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

Cordyceps sinensis identification mainly relies on the human eye to be carried out in complex backgrounds, resulting in low picking efficiency and high prices.

Method used

The improved YOLOv8 object detection algorithm is adopted, combining attention mechanism and dendritic module to build a Cordyceps automatic detection model, and reduce parameters through the channel pruning algorithm. It is deployed on the jetson nano platform, and is equipped with a multi-camera image capture system and an alarm system to achieve rapid detection.

Benefits of technology

It improves the identification efficiency of Cordyceps sinensis, reduces labor costs, protects the ecological environment, increases the supply of Cordyceps sinensis, and increases the income of farmers in Tibetan areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120385668A_ABST
    Figure CN120385668A_ABST
Patent Text Reader

Abstract

The invention discloses rapid detection equipment for cordyceps sinensis. The rapid detection equipment comprises an image capturing system, a cordyceps sinensis real-time detection system and an alarm system, the image capturing system consists of a plurality of cameras and is used for acquiring multi-angle image data of an object to be detected; the cordyceps sinensis real-time detection system is composed of an automatic cordyceps sinensis detection model running based on a jetson nano platform and is used for rapidly detecting an object to be detected; according to the automatic detection method of the cordyceps sinensis, an improved YOLOv8 target detection algorithm is used. The method has the advantages that a picker holds the rapid cordyceps sinensis detection equipment by hand and does not need to climb to the ground to damage the local environment, the recognition efficiency can be greatly improved, the required labor cost is reduced, the damage to the ecological environment caused by a traditional multi-manpower and low-efficiency search mode is avoided, and the method is suitable for popularization and application. The supply amount of the cordyceps sinensis can be increased to a certain extent, the income of peasants in Tibetan areas is increased, and then sustainable growth of the cordyceps sinensis in the Qinghai-Tibet Plateau areas is protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agricultural detection, and is particularly applicable to a rapid detection device for Cordyceps sinensis. Background Art

[0002] Cordycepin, an active ingredient in Cordyceps sinensis, has multiple effects such as antibacterial and anti-inflammatory, antioxidant, anti-tumor, endocrine regulation and immune enhancement, and can effectively improve the physical fitness of modern people. Therefore, Cordyceps sinensis shows great application potential whether it is used for disease rehabilitation or daily health care.

[0003] However, Cordyceps sinensis is extremely small in size, overall club-shaped, with a length of only 3-5 cm and a diameter of 0.5-1 cm exposed on the ground after maturity, and it fits well with its growth environment, making it extremely difficult to identify with the naked eye. The identification of Cordyceps sinensis has become the most difficult step in the picking process. So far, the identification of Cordyceps sinensis mainly relies on the naked eye to identify in a complex background, which results in low picking efficiency of Cordyceps sinensis and high prices. Summary of the Invention

[0004] The purpose of the present invention is to provide a rapid detection device for Cordyceps sinensis to solve the problem that the identification of Cordyceps sinensis mainly relies on the naked eye to identify in a complex background and the picking efficiency is low.

[0005] To achieve the above purpose, the present invention adopts the following technical solutions: The rapid detection method and device for Cordyceps sinensis of the present invention include an image capture system, a real-time detection system for Cordyceps sinensis and an alarm system; the image capture system is composed of multiple cameras and is used to collect multi-angle image data of the object to be detected; the real-time detection system for Cordyceps sinensis is composed of an automatic detection model for Cordyceps sinensis running on the jetson nano platform and is used to quickly detect the object to be detected; The automatic detection method for Cordyceps sinensis uses an improved YOLOv8 target detection algorithm.

[0006] Furthermore, the improved YOLOv8 target detection model includes adding an attention mechanism to the convolutional layer of the YOLOv8 backbone network, improving the detection head of YOLOv8 using a dendrite module, and reducing the parameters of the YOLOv8 target detection algorithm through a channel pruning algorithm.

[0007] Furthermore, the attention mechanism performs global average pooling on the output feature map of each convolutional layer in the YOLOv8 backbone network, and generates the weight of the output feature map in each channel through two fully connected layers.

[0008] Furthermore, the steps for constructing the automatic detection model for Cordyceps sinensis are as follows: S1. According to the principle of the Cartesian coordinate system, collect the image data of Cordyceps sinensis under different angles, different distances, and different lighting conditions. S2. Expand the Cordyceps sinensis image dataset through rotation, cropping, and scaling. S3. After annotating the images, input them into the improved YOLOv8 object detection algorithm for training, validation, and optimization to obtain a real-time detection model for Cordyceps sinensis.

[0009] Further, after the Cordyceps sinensis automatic detection model is deployed, it is optimized using the TensorRT framework and the half-precision inference mode is used to improve the model inference speed.

[0010] Further, step S3 also includes using the Bayesian optimization method for hyperparameter tuning, taking the hyperparameters corresponding to the highest mAP value on the validation set as the optimal ones, and then using the sparse regularization method to perform channel pruning on the parameters of the improved YOLOv8 object detection algorithm.

[0011] Further, the hyperparameters include the initial learning rate, the target confidence loss weight, the classification loss weight, the bounding box regression weight, and the batch size.

[0012] The advantage of the present invention is that the rapid detection device for Cordyceps sinensis held by the picker does not need to climb on the ground, thus causing damage to the local environment. Moreover, it can greatly improve the recognition efficiency, reduce the required labor cost, avoid the damage to the ecological environment caused by the traditional multi-labor and low-efficiency search method, can increase the supply of Cordyceps sinensis to a certain extent, improve the income of farmers in Tibetan areas, and further protect the sustainable growth of Cordyceps sinensis in the Qinghai-Tibet Plateau region. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a block diagram of each module of the rapid detection device for Cordyceps sinensis of the present invention.

[0014] Figure 2 It is a construction and working flow chart of the automatic detection device for Cordyceps sinensis of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0015] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0016] Embodiment 1 As Figure 1 shown, the rapid detection device for Cordyceps sinensis of the present invention includes an image capture system, a real-time detection system for Cordyceps sinensis, and an alarm system.

[0017] The image capture system consists of multiple cameras, which are used to collect multi-angle image data of the object to be inspected and transmit it to the Cordyceps sinensis real-time detection system for real-time detection.

[0018] The Cordyceps sinensis real-time detection system is composed of an automatic detection model of Cordyceps sinensis running on the jetson nano platform, which is used to quickly detect the object to be inspected.

[0019] Among them, the automatic detection model of Cordyceps sinensis uses an improved YOLOv8 object detection algorithm. The improved YOLOv8 object detection algorithm includes adding an attention mechanism to the convolutional layer of the YOLOv8 backbone network, improving the detection head of YOLOv8 using a dendrite module, and reducing the parameters of the YOLOv8 object detection algorithm through a channel pruning algorithm.

[0020] The attention mechanism is an innovative architecture unit designed to enhance the network's representational ability by dynamically adjusting the channel feature responses. This module significantly improves the performance of existing deep neural networks by adaptively reweighting channel features and achieves higher accuracy in multiple tasks. In the present invention, an attention mechanism is added to the network structure of YOLOv8, enabling the network to dynamically adjust the importance of each channel according to different input features, better distinguish the importance of different channels, improve the model's representation ability of the input data, and thus improve the accuracy of Cordyceps sinensis recognition.

[0021] The attention mechanism performs global average pooling on the output feature map of each convolutional layer in the YOLOv8 backbone network, and generates the weights of the output feature map in each channel through two fully connected layers.

[0022] First, perform global average pooling on the output feature maps of each convolutional layer of the YOLOv8 object detection algorithm. For a feature map of size 𝐻×𝑊×𝐶, the pooling will compress it into a vector of size 1×1×𝐶, where 𝐶 is the number of channels of the feature map. Then, process the output feature map through a small fully connected network, usually two fully connected layers, to generate the weights for each channel of the output feature map. The first fully connected layer: The input dimension is 𝐶, and the output dimension is 𝐶 / 𝑟, where 𝑟 is a scaling factor, usually set to 16. Use the ReLU activation function. The second fully connected layer: Restore from the 𝐶 / 𝑟 dimension to the 𝐶 dimension, and use the Sigmoid activation function to limit the weights within the range [0,1]. Finally, multiply the channel weights to each channel of the original output feature map to achieve channel recalibration. In this way, the attention mechanism module dynamically enhances important channels and suppresses unimportant channels, adaptively adjusts the channel weights of each convolutional layer, helps the model better focus on the features of the target object, and ignores unnecessary background or noise.

[0023] The dendrite module is a white-box model for classification, regression, and system identification, which considers the role of dendrites in information transmission compared with previous neural networks. The present invention shows through experiments that the loss function of the dendrite network is larger, but the test accuracy is higher, indicating that the dendrite network is very unlikely to overfit, making the improved convolutional neural network have more excellent performance and recognition accuracy.

[0024] After adding the attention mechanism to the YOLOv8 object detection algorithm, feature enhancement can be used to improve the feature extraction ability of the feature extraction network. However, the enhanced feature information often gets lost again during the transmission of information in deeper feature extraction layers and fusion networks, especially the details and location features related to small objects. After adding the dendrite module to the detection head of the YOLOv8 object detection algorithm in the present invention, more gradient flow information can be obtained, solving the problem of the loss of feature information during the transmission in deeper feature extraction layers and fusion networks, effectively filtering out conflicting information, thereby improving the recognition accuracy of the model for complex samples and small targets.

[0025] In the present invention, the alarm system is composed of a buzzer and is connected to the Cordyceps sinensis real-time detection system. When a target is detected, the Cordyceps sinensis real-time detection system outputs a signal to make the buzzer alarm.

[0026] In some embodiments, the rapid detection device for Cordyceps sinensis of the present invention can also be configured with a display screen to display the picture processed by the Cordyceps sinensis real-time detection system, and after the Cordyceps sinensis real-time detection system detects a target, display the target picture on the display screen and mark it with a rectangular box.

[0027] It should be noted that as a portable device, the rapid detection device for Cordyceps sinensis of the present invention is configured with an energy storage power supply and provides a corresponding charging interface to provide a stable working power supply for the electrical devices in the device. Additionally, in some embodiments, the rapid detection device for Cordyceps sinensis of the present invention is further configured with an external power supply access interface, and the external power supply can be directly used to supply power to each electrical component of the device.

[0028] Embodiment 2 As Figure 2 shown, the specific steps to obtain the automatic detection model for Cordyceps sinensis based on the improved YOLOv8 object detection algorithm are as follows: S1, According to the principle of the Cartesian coordinate system, collect Cordyceps sinensis image data under different angles, different distances, and different lighting conditions to ensure the diversity and high quality of the data.

[0029] S2, Expand the Cordyceps sinensis image dataset through data augmentation methods such as rotation, cropping, and scaling to enhance the generalization ability of the Cordyceps sinensis automatic detection model under different scales and perspectives and reduce the risk of overfitting of the Cordyceps sinensis automatic detection model.

[0030] S3, After annotating the Cordyceps sinensis image data, input it into the improved YOLOv8 object detection algorithm for training, validation, and optimization to obtain a real-time detection model for Cordyceps sinensis.

[0031] Although the improved YOLOv8 object detection algorithm with the addition of the SE module and the dendritic module can effectively detect Cordyceps sinensis, the number of network parameters and the structure are relatively large, and the detection speed is slow. The computing power of the built portable Cordyceps sinensis recognition device is weak, and the feature importance values generated by the added SE attention module can also play a role in channel pruning. Therefore, it is necessary to perform pruning on the model to reduce the model complexity.

[0032] The present invention uses a method based on sparse regularization to perform channel pruning on the network parameters of the improved YOLOv8. The principle is to introduce a sparse constraint on the weights or features of the model during the training process, making the weights of unimportant channels gradually approach zero. When the weight or scaling factor approaches zero, it means that the influence of this channel on the model output is small and can be safely removed, thus naturally achieving pruning. There are two common sparsification strategies. One is to directly sparsify the weights, imposing a sparse constraint on the weight matrix of the convolution kernel. The other is to sparsify the parameters of the BN layer, imposing sparse regularization on the scaling factors in the Batch Normalization layer to indirectly evaluate the importance of channels, retain important channels, and prune unimportant channels.

[0033] The pruning process is mainly divided into three steps. First, sparse training is carried out. During the training process, L1 regularization constraint is used on the coefficients in the BN layer for sparse regularization to automatically identify unimportant channels. Second, the channels with smaller coefficients are pruned according to the set pruning rate to generate a lightweight model. Finally, the pruned model is fine-tuned, and fine-tuning training is performed on it to recover the accuracy lost due to pruning.

[0034] Example 3 Specific application example of obtaining the Cordyceps sinensis automatic detection model based on the improved YOLOv8 object detection algorithm of the present invention Step 1, collect Cordyceps sinensis image data.

[0035] In order to enable the improved YOLOv8 object detection algorithm to learn the appearance and shape changes of Cordyceps sinensis in different scenarios for better feature extraction, the collected data needs to meet the conditions of sufficiency, balance, diversity, and high quality.

[0036] During the collection process, 2 different mountain bodies with local altitudes between 3500 - 4000 meters were selected. In order to improve the diversity of the data as much as possible, 50 wild Cordyceps sinensis in the mature stage at different altitudes were selected. After the natural maturity of Cordyceps sinensis, the posture is vertically upward. Taking the tip of the cordyceps as the origin of the coordinate system and the direction of the cordyceps body as the z-axis. According to the principle of the Cartesian coordinate system, two orthogonal horizontal axes are randomly selected as the x-axis and the y-axis. When collecting images, the lens is rotated around the x-axis and y-axis of the cordyceps respectively, and images are captured at intervals of about 30°. And the lens is placed at 10 cm, 20 cm, and 40 cm from the cordyceps respectively to capture cordyceps images of different sizes.

[0037] Data under different lighting conditions was also collected, mainly including front lighting and back lighting. Among them, front lighting means that the lens and the sun are on the same side, and back lighting means that the lens and the sun are not on the same side.

[0038] Step 2, generate more training samples through data augmentation techniques. Rotation, translation, scaling, cropping, noise addition, etc. are used to help the model learn more target features, thereby improving its performance in practical applications. Finally, a dataset of 1305 high-quality images containing Cordyceps sinensis is obtained.

[0039] Step 3: Divide all the images in the dataset into a training set, a validation set, and a test set. The training set and the validation set are used for model training, and the test set is used to test the performance of the model. 90% (1174 images) of the prepared dataset is used as training data for the training of the YOLO model, where the training set accounts for 90% (1056) and the validation set accounts for 10% (118). The remaining 10% (131 images) in the dataset is used as test data to test the performance of the model in this study.

[0040] Label the images containing the target regions in each image of the dataset. The labeling tool used is labelimg. Use a rectangular box to label the target to obtain an annotation file corresponding to each image, and convert it into the VOC format or the YOLO format according to the needs of each model. When labeling the data, label the position and size of the object as accurately as possible to help the network model obtain better object detection capabilities.

[0041] Use the Cordyceps sinensis dataset to train the improved YOLOv8 object detection algorithm. Add the SE attention module to the convolutional layer of the YOLOv8 backbone network and the dendrite module to the detection head of the network, while obtaining more feature extraction capabilities, solve the problem that feature information disappears during the transmission in deeper feature extraction layers and the fusion network.

[0042] During the training process, use transfer learning to improve the training efficiency. The present invention uses the pre-trained weights of the YOLOv8 algorithm trained on the COCO dataset. The COCO dataset includes 1.2 million objects of 80 categories. And YOLOv8 provides pre-trained models of different scales, YOLOv8n, YOLOv8s, YOLOv8m, YOLOv8l, YOLOv8x. These models have been trained on the COCO dataset and can be used as the starting point for transfer learning. The role of transfer learning in YOLOv8 is to utilize the feature extraction capabilities of the pre-trained model and quickly adapt to the target task. By freezing the lower layers and fine-tuning the higher-layer weights, the model performance can be improved while reducing the training time.

[0043] The present invention uses the method of Bayesian optimization for automated hyperparameter tuning. First, define the objective function as the mAP value on the validation set. The input is the hyperparameter combination, and the output is the performance metric of the model. Then define the hyperparameter search space, define the hyperparameters to be optimized and their value ranges to prevent the hyperparameters from taking unreasonable values. The present invention selects five parameters, namely the initial learning rate, the target confidence loss weight, the classification loss weight, the bounding box regression weight, and the batch size, for automated hyperparameter tuning.

[0044] Use a method with improved probability to determine the next evaluation point, and set the number of evaluations (such as 20 times) to terminate the optimization process. The highest mAP value on the validation set is output, indicating that the corresponding hyperparameters are optimal. For easy detection, the network input size is set to 416 pixels × 416 pixels.

[0045] The core role of hyperparameter tuning in YOLOv8 is to optimize model performance, accelerate convergence, and adapt to resource limitations. By reasonably adjusting key hyperparameters such as the learning rate, batch size, and input image size, the model performance can be significantly improved, enabling the optimized model to achieve a better balance between detection effect and performance.

[0046] After that, for the optimal hyperparameters, channel pruning is performed on the parameters of the improved YOLOv8 network based on the sparse regularization method. First, perform sparse training. During the training process, L1 regularization constraints are used on the coefficients in the BN layer for sparse regularization to automatically identify unimportant channels. Secondly, prune the channels with smaller coefficients according to the set pruning rate to generate a lightweight model. Finally, fine-tune the pruned model and perform fine-tuning training to recover the accuracy lost due to pruning.

[0047] The number of iterations of sparse training is set to 300, and the sparsity rate is set to 0.001. As sparse training continues, the coefficient distribution centers of each BN layer gradually tend to zero, but not all decay to zero, indicating that the coefficients are gradually sparsified. After coefficient training, a pruning rate of 0.35 is selected to perform channel pruning on the YOLOv8 Cordyceps sinensis detection model after sparse training, pruning the channels with smaller coefficients to generate a lightweight model. Then, fine-tuning training is performed to recover the accuracy lost due to pruning.

[0048] The present invention deploys the Cordyceps sinensis real-time detection model to the Jetson Nano development board, assembles the image capture system accordingly, completes the construction of the Cordyceps sinensis recognition device, and then uses the camera in the image capture system to take pictures of Cordyceps sinensis as the input of the Cordyceps sinensis real-time detection model, and efficiently identifies Cordyceps sinensis according to the output of the Cordyceps sinensis real-time detection model.

[0049] The Jetson Nano development board is a low-cost AI computer with high performance and energy efficiency. It can run modern AI workloads, run multiple neural networks in parallel, and process data from multiple high-definition sensors simultaneously. It is designed to support entry-level edge AI applications and devices, and includes acceleration libraries for deep learning, computer vision, graphics, multimedia, etc.

[0050] The internal system of Jetson Nano runs on the Linux system. Its advantages lie not only in its powerful performance and high cost performance, but more importantly, it is very small in size, meeting the lightweight standard required by this project. Moreover, it has powerful computing capabilities, which can meet the computing requirements of this project and can also easily build and improve the network model.

[0051] After deploying the Cordyceps sinensis real-time detection model of the present invention on the basis of Jetson Nano, the TensorRT framework can also be used to optimize the model, and at the same time, the half-precision (FP16) inference mode is used to further improve the inference speed.

Claims

1. A rapid detection device for Cordyceps sinensis, characterized in that, It includes an image capture system, a cordyceps sinensis real-time detection system, and an alarm system; the image capture system consists of multiple cameras and is used to collect multi-angle image data of the object to be inspected; the cordyceps sinensis real-time detection system consists of a cordyceps sinensis automatic detection model running on the jetson nano platform and is used to quickly detect the object to be inspected; The cordyceps sinensis automatic detection method uses an improved YOLOv8 object detection algorithm.

2. The rapid detection device for Cordyceps sinensis according to claim 1, wherein: The improved YOLOv8 object detection model includes adding an attention mechanism to the convolutional layer of the YOLOv8 backbone network, using a dendrite module to improve the detection head of YOLOv8, and reducing the parameters of the YOLOv8 object detection algorithm through a channel pruning algorithm.

3. The rapid detection device for Cordyceps sinensis according to claim 2, characterized in that: The attention mechanism performs global average pooling on the output feature map of each convolutional layer in the YOLOv8 backbone network, and through two fully connected layers, generates the weights of the output feature map in each channel.

4. The rapid detection device for Cordyceps sinensis according to claim 1, wherein: The steps for constructing the cordyceps sinensis automatic detection model are as follows: S1, According to the principle of the Cartesian coordinate system, collect cordyceps sinensis image data under different angles, different distances, and different lighting conditions; S2, Expand the cordyceps sinensis image dataset by rotation, cropping, and scaling; S3, After annotating the images, input them into the improved YOLOv8 object detection algorithm for training, validation, and optimization to obtain a cordyceps sinensis real-time detection model.

5. The rapid detection device for Cordyceps sinensis according to claim 1, characterized in that: After the cordyceps sinensis automatic detection model is deployed, it is optimized using the TensorRT framework and the semi-precision inference mode is used to improve the model inference speed.

6. The rapid detection device for Cordyceps sinensis according to claim 4, characterized in that: Step S3 also includes using the Bayesian optimization method for hyperparameter tuning, taking the hyperparameters corresponding to the highest mAP value on the validation set as the optimal ones, and then using the sparse regularization method to perform channel pruning on the parameters of the improved YOLOv8 object detection algorithm.

7. The rapid detection device for Cordyceps sinensis according to claim 6, characterized in that: The hyperparameters include the initial learning rate, the weight of the object confidence loss, the weight of the classification loss, the weight of the bounding box regression, and the batch size.

Citation Information

Patent Citations

  • Method and system for searching and recognizing wild cordyceps sinensis

    CN112417193A

  • Method for identifying cordyceps sinensis in complex environment

    CN116486256A

  • Strawberry maturity detection method and system based on improved YOLOv8

    CN117315473A

  • Pest detection and identification method based on improved YOLOv8 model

    CN117975278A

  • Field weed detection method based on YOLOv8 optimization

    CN118314438A

Cited By

  • Method, device and system for monitoring suitable growth area of harmful insects in grassland, and storage medium

    CN121959256A