Method, device, equipment and medium for identifying invasive alien species
By introducing the CBAM attention mechanism and C2f module into the YOLOv5-Lite network model and improving the detection head, the problem of difficulty in identifying closely related species in the existing technology has been solved, and accurate identification of the guava fruit fly and Bactrocarpus tangerine has been achieved. , improving the accuracy of insect identification and biosecurity monitoring capabilities.
Patent Information
- Application Number
- CN202411161785.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-08-23
AI Technical Summary
Existing recognition algorithm models rely on subtle morphological differences between species in insect and plant morphological identification, making it difficult to accurately distinguish between closely related species such as guava fruit fly and Bactrocarpus tangerine, which can easily lead to confusion and misjudgment.
Introduce the CBAM attention mechanism into the detection head part of the YOLOv5-Lite network model, and replace the C3 module in the P3/8-small and P4/16-medium levels with the C2f module to form an improved detection head to enhance edge structure and details The ability to extract information improves the accuracy of identification of closely related species.
It has significantly improved the ability to identify closely related species, improved the classification and identification accuracy of guava fruit fly and orange fruit fly, and enhanced the ability to respond to biosecurity threats.
Smart Images

Figure CN118692113B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition technology, and in particular to a method, device, equipment and medium for identifying alien invasive species. Background Art
[0002] Fruit flies belong to the order Diptera and the family Tephritidae. They are widely distributed throughout the world and have a wide variety of species, among which more than 250 species are of great economic significance and are an important group of quarantine pests. In the identification and monitoring of fruit flies, the research on fruit fly identification (classification and identification) technology occupies a vital position. The guava fruit fly belongs to the tribe Tephritidae and the genus Bactrocera, and the genus Bactrocera to which it belongs is a quarantine pest for imported plants in my country. Statistical results show that the total potential economic losses caused by the guava fruit fly to my country's citrus industry can reach 260 billion yuan. The citrus fruit fly is another imported plant quarantine pest in the genus Bactrocera. The citrus fruit fly and the guava fruit fly partially overlap in distribution area, have common host plants, similar morphological characteristics, and can both be attracted by the male attractant methyleugenol (ME). Therefore, it is necessary and difficult to identify and distinguish the citrus fruit fly from the guava fruit fly in field monitoring.
[0003] With the limitations of traditional insect identification methods and the development of computer vision, image processing and automatic recognition technology have been applied and developed in the field of insect identification since the 1990s; traditional image recognition algorithms mainly include image preprocessing, feature extraction, classification and recognition steps; traditional image recognition algorithms usually have high requirements on image quality, and the feature extraction is complex and the algorithm capabilities are limited.
[0004] With the rise of deep learning technology, especially the widespread application of convolutional neural networks (CNN), the field of image recognition has ushered in a revolutionary change. By simulating the working mechanism of human brain neural networks, deep learning models can automatically learn high-level features in images and build complex and nonlinear feature extractors, which have been widely used in the field of insect classification and recognition. Among them, YOLO (You Only Look Once) is a target detection algorithm. Its advent has led to the development of lighter and faster single-stage target detection networks and has attracted widespread attention from scholars. Researchers have improved and studied YOLOv5 in the YOLO series of algorithms, and have achieved remarkable results in the detection and recognition of insects and plant pests. However, the recognition algorithm models studied at this stage are mainly based on the morphological identification of insects and plants, relying on the accurate distinction of subtle morphological differences between species. When identifying closely related species such as guava fruit flies and citrus fruit flies, it is often easy to cause confusion and misjudgment, making it difficult to classify and recognize. Summary of the invention
[0005] The embodiments of the present invention provide a method, device, equipment and medium for identifying alien invasive species, which can solve the problem in the prior art that the identification algorithm models currently studied are mainly based on the morphological identification of insects and plants, and rely on the accurate distinction of subtle morphological differences between species. When identifying closely related species such as guava fruit flies and citrus fruit flies, it is often easy to cause confusion and misjudgment, making it difficult to classify and identify them.
[0006] The present invention provides a method for identifying invasive alien species, comprising the following steps:
[0007] Obtain image datasets of target species and native species respectively;
[0008] Build a YOLOv5-Lite network model, introduce a CBAM attention mechanism after the first convolutional layer of the detection head of the YOLOv5-Lite network model; replace the C3 module in the P3 / 8-small layer of the detection head of the YOLOv5-Lite network model with the C2f module to form an improved P3 / 8-small layer; replace the C3 module in the P4 / 16-medium layer of the detection head of the YOLOv5-Lite network model with the C2f module to form an improved P4 / 16-medium layer;
[0009] The CBAM attention mechanism is fused with the first convolutional layer of the detection head, the improved P3 / 8-small layer, and the improved P4 / 16-medium layer in the detection head of the YOLOv5-Lite network model to form an improved detection head; the YOLOv5-Lite network model including the improved detection head is used as the YOLOv5-Lite-s network model; and the YOLOv5-Lite-s network model is trained using the image datasets of the target species and the local species respectively to obtain the trained YOLOv5-Lite-s network model;
[0010] The images of the target species and the local species were respectively input into the trained YOLOv5-Lite-s network model, and the network layers containing the CBAM attention mechanism in the trained YOLOv5-Lite-s network model were used to extract the features of the images of the target species and the local species, respectively, and the shallow feature maps of the target species and the local species containing edge structure features and overlapping structure features were obtained respectively; the P3 / 8-small and P4 / 16-medium network layers containing the C2f module level in the trained YOLOv5-Lite-s network model were used to extract the features of the images of the target species and the local species, and the deep feature maps of the target species and the local species containing species detail information and scale feature information were obtained respectively; the detection head of the YOLOv5-Lite-s network model was used to sum the feature elements in the shallow feature map and the deep feature map of the target species and the local species, and to visualize them, respectively, to obtain the recognition images of the target species and the local species; the recognition images of the target species and the local species were compared to identify the alien invasive species in the target species images.
[0011] Preferably, the step of obtaining a mixed image dataset of invasive alien species and native species comprises:
[0012] Collect multiple images of target species and local species respectively, and filter out incomplete and blurred images;
[0013] The LabelImg software was used to annotate the target category data of the screened images. The minimum circumscribed rectangular boxes of the guava fruit fly and the citrus fruit fly were selected as the true boxes. The guava fruit fly was labeled as class 0 and named Bezzi, and the citrus fruit fly was labeled as class 1 and named Hendel, and the image datasets of the target species and local species were obtained respectively.
[0014] Preferably, the image sizes in the image data set are all 320×320 pixels.
[0015] Preferably, the introduction of the CBAM attention mechanism includes:
[0016] The CBAM attention mechanism consists of two modules: channel attention CAM and spatial attention SAM. The channel attention CAM completes channel weighting and feature optimization, and the spatial attention SAM completes spatial positioning and detail enhancement.
[0017] A CBAM attention mechanism is introduced after the first convolutional layer of the detection head of the YOLOv5-Lite network model, and the channel attention CAM module and the spatial attention SAM are respectively fused with the first convolutional layer of the detection head.
[0018] Preferably, the forming of the improved P3 / 8-small level comprises:
[0019] The P3 / 8-small layer of the detection head of the YOLOv5-Lite network model is used to capture the details of small objects due to its smallest receptive field and highest feature map resolution;
[0020] The P3 / 8-small layer contains one C3 module. After the C3 module is replaced with a C2f module, an improved P3 / 8-small layer is formed.
[0021] Preferably, the forming of the improved P4 / 16-medium layer comprises:
[0022] The detection head of the YOLOv5-Lite network model has a moderate P4 / 16-medium receptive field, retains medium-scale feature information, and focuses on contextual understanding of small objects.
[0023] The P4 / 16-medium layer contains one C3 module, and the C3 module is replaced by a C2f module to form an improved P4 / 16-medium layer.
[0024] The embodiment of the present invention further provides a device for identifying alien invasive species, comprising:
[0025] The Module 3 Wide CSI camera of the Raspberry Pi 5 was used to obtain image datasets of target species and local species respectively;
[0026] Raspberry Pi 5, used to build the YOLOv5-Lite network model, introduce a CBAM attention mechanism after the first convolutional layer of the detection head of the YOLOv5-Lite network model; replace the C3 module in the P3 / 8-small layer of the detection head of the YOLOv5-Lite network model with the C2f module to form an improved P3 / 8-small layer; replace the C3 module in the P4 / 16-medium layer of the detection head of the YOLOv5-Lite network model with the C2f module to form an improved P4 / 16-medium layer;
[0027] The CBAM attention mechanism is fused with the first convolutional layer of the detection head, the improved P3 / 8-small layer, and the improved P4 / 16-medium layer in the detection head of the YOLOv5-Lite network model to form an improved detection head; the YOLOv5-Lite network model including the improved detection head is used as the YOLOv5-Lite-s network model; and the YOLOv5-Lite-s network model is trained using the image datasets of the target species and the local species respectively to obtain the trained YOLOv5-Lite-s network model;
[0028] The images of the target species and the local species were respectively input into the trained YOLOv5-Lite-s network model, and the network layers containing the CBAM attention mechanism in the trained YOLOv5-Lite-s network model were used to extract the features of the images of the target species and the local species, respectively, and the shallow feature maps of the target species and the local species containing edge structure features and overlapping structure features were obtained respectively; the P3 / 8-small and P4 / 16-medium network layers containing the C2f module level in the trained YOLOv5-Lite-s network model were used to extract the features of the images of the target species and the local species, and the deep feature maps of the target species and the local species containing species detail information and scale feature information were obtained respectively; the detection head of the YOLOv5-Lite-s network model was used to sum the feature elements in the shallow feature map and the deep feature map of the target species and the local species, and to visualize them, respectively, to obtain the recognition images of the target species and the local species; the recognition images of the target species and the local species were compared to identify the alien invasive species in the target species images.
[0029] An embodiment of the present invention further provides an electronic device, including a memory and a processor;
[0030] The memory is used to store computer programs;
[0031] The processor is used to implement the steps of the above-mentioned method for identifying an alien invasive species when executing the computer program stored in the memory.
[0032] An embodiment of the present invention further provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the steps of the method for identifying an alien invasive species as described above.
[0033] The embodiments of the present invention provide a method, device, equipment and medium for identifying alien invasive species. Compared with the prior art, the beneficial effects thereof are as follows:
[0034] The present invention introduces a CBAM attention mechanism after the first convolution layer of the detection head part of the YOLOv5-Lite network model, so that it is more inclined to clearly identify the edge structure information of the species and identify the occluded target; at the same time, the C2f module is introduced to replace the C3 module in the P3 / 8-small layer and the P4 / 16-medium layer of the detection head part of the YOLOv5-Lite network model, so that more attention is paid to the detail information of small target species and the feature information of medium scale, so that the smaller feature differences in closely related species can be more clearly distinguished, and the recognition ability of closely related species is greatly improved; and the image data sets of the target species and the local species are used to train the improved YOLOv5-Lite-s network model respectively, so that the trained network model can clearly reveal the similarities and differences between the target species and the local species, provide support and help for the monitoring of alien invasive species in agricultural production, especially greatly improve the classification and recognition accuracy of fruit flies, and enhance my country's ability to respond to biosafety threats. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A schematic diagram of the overall process of an alien invasive species identification method, device, equipment and medium provided by an embodiment of the present invention;
[0036] Figure 2 A schematic diagram of a photo taken by a Raspberry Pi of a method, device, equipment and medium for identifying invasive alien species provided by an embodiment of the present invention;
[0037] Figure 3 A schematic diagram of a photo taken by Mate20pro of a method, device, equipment and medium for identifying invasive alien species provided by an embodiment of the present invention;
[0038] Figure 4 A schematic diagram of a photo taken by vivo X90s, showing a method, device, equipment and medium for identifying invasive alien species provided by an embodiment of the present invention;
[0039] Figure 5 A schematic diagram of a method, device, equipment and medium for identifying invasive alien species provided by an embodiment of the present invention;
[0040] Figure 6 A schematic diagram of the file contents of an invasive alien species identification method, device, equipment and medium provided by an embodiment of the present invention;
[0041] Figure 7 A schematic diagram of a training process curve of an alien invasive species identification method, device, equipment and medium provided by an embodiment of the present invention;
[0042] Figure 8 A schematic diagram of detection results of a method, device, equipment and medium for identifying invasive alien species provided by an embodiment of the present invention;
[0043] Fig. 9 A schematic diagram of misdetection caused by overlap of a method, device, equipment and medium for identifying invasive alien species provided by an embodiment of the present invention;
[0044] Fig.10 A schematic diagram of improved overlapping detection results of an alien invasive species identification method, device, equipment and medium provided by an embodiment of the present invention;
[0045] Fig.11 A schematic diagram of real-time detection results of a method, device, equipment and medium for identifying invasive alien species provided by an embodiment of the present invention;
[0046] Fig.12 A schematic diagram of the overall framework of a fruit fly identification system for an alien invasive species identification method, device, equipment and medium provided by an embodiment of the present invention;
[0047] Fig.13 A schematic diagram of a fruit fly crawling channel design of a method, device, equipment and medium for identifying invasive alien species provided by an embodiment of the present invention;
[0048] Fig.14 A schematic diagram of a video acquisition window and thread design of a method, device, equipment and medium for identifying invasive alien species provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific embodiments disclosed below.
[0050] See also Figure 1 The embodiment of the present invention provides a method for identifying alien invasive species, comprising:
[0051] 1. Establishment of data set: A large number of high-quality photos of guava fruit flies and citrus fruit flies were taken in the present invention, and data were annotated by labelImg software to produce data sets of the two fruit flies.
[0052] 1. Image acquisition.
[0053] After screening and eliminating incomplete and unclear images, 1571 images were finally selected to construct a dataset containing guava fruit flies and citrus fruit flies; in order to ensure that the dataset can fully reflect the actual deployment environment, the present invention uses a Raspberry Pi module 3 wide camera to take 1150 photos with a resolution of 1024×1024, such as Figure 2 As shown in Figure 2; In order to further enhance the robustness and diversity of the dataset, 421 auxiliary photos with different styles and exposures were taken using Huawei Mate20pro and vivo X90s phones, as shown in Figure 2. Figure 3 and Figure 4 As shown; given that different species of fruit flies are mainly distinguished by the features of their backs, the dataset mainly contains photos of insects with their backs facing upwards.
[0054] 2. Data labeling.
[0055] LabelImg software was used to label the target category data. The minimum bounding rectangle of the guava fruit fly and the citrus fruit fly was selected as the true frame to reduce the background pixels in the true frame. To ensure the consistency of the labeling, the guava fruit fly was uniformly labeled as class "0" and named "Bezzi" in this dataset; the citrus fruit fly was labeled as class "1" and named "Hendel". The labeling diagram and labeling file are shown in Figure 2. Figure 5 and Figure 6 shown.
[0056] 2. Construction and optimization of fruit fly identification model based on YOLOv5-Lite.
[0057] The feature extraction and recognition models of guava fruit fly and citrus fruit fly were successfully constructed using YOLOv5-Lite; and the model was optimized by introducing the CBAM attention mechanism and C2f module; the experimental results show that the optimized model achieved higher precision, recall rate and mean average precision (mAP@0.5) in the fruit fly identification task, significantly improving the recognition performance.
[0058] 1. Model construction.
[0059] YOLO stands for "you only look once", which means that you only need to browse once to identify the category and position of the object in the image; the YOLO series of algorithms adopts an end-to-end processing idea, which combines the two steps of candidate box prediction and target classification into one, thereby cleverly transforming the target detection problem into a regression problem; YOLOv5-Lite is a lightweight model created by the present invention through a series of improvements on the basis of YOLOv5, which is more conducive to deployment on edge devices; by removing the Focus layer and avoiding multiple uses of the C3 module, the memory usage efficiency is improved, the number of parameters and the amount of calculation are significantly reduced, making the model more lightweight and still showing good detection performance overall; the present invention uses the YOLOv5-Lite-s network structure model to train the fruit fly feature extraction and recognition model; Figure 7 The figure shows the improvement trajectory of the model performance during the training process. As the training cycle increases, the training loss gradually decreases, and shows a similar downward trend on the validation set, which indicates that the model is constantly learning and gradually improving its prediction ability, achieving an effective convergence model. By comparing and analyzing the loss function values on the training set and the validation set, it can be found that the loss curves of the two always maintain a similar trend during the training process, without significant separation, which means that the simulation does not overfit.
[0060] The model is tested using a test set containing 157 images. The ideal detection effect is as follows Figure 8 As shown in the figure, there is no blurring of the image or overlap of the insect body due to the movement of the fruit flies, and the fruit flies are all facing upward with obvious classification characteristics; however, if the degree of insect body overlap is high, misdetection may occur, such as Fig. 9 This situation is shown in the figure. The overlap of the three fruit flies in the red circle results in an additional detection frame for the guava fruit fly. The false detection situation will be optimized later.
[0061] 2. Model optimization.
[0062] ①Insert the CBAM attention mechanism module into the detection head.
[0063] The CBAM attention mechanism module consists of two modules: Channel Attention Module (CAM) and Spatial Attention Module (SAM). CAM completes channel weighting and feature optimization, and SAM completes spatial positioning and detail enhancement. The detection head of the deep learning model is responsible for processing multi-scale feature maps in order to detect targets of different sizes. The present invention introduces a layer of CBAM attention mechanism after the first convolution layer of the detection head of the YOLOv5-Lite model. The introduction of the CBAM attention mechanism in the detection head can help the model better allocate attention resources, especially for the detection of small targets or occluded targets. In addition, since the first convolution layer of the detection head is the starting stage of feature map processing, the introduction of the CBAM attention mechanism at this time can realize early weighting of features. This means that the model can focus on the features that are more important to the fruit fly detection task earlier in the detection process, thereby optimizing the selectivity and utilization efficiency of the features.
[0064] ② Use the C2f module in YOLOv8 to replace the two C3 modules in the detection head.
[0065] In YOLOv8, the C2f module is introduced to replace the C3 module in YOLOv5. The characteristics of this module are its unique feature conversion, branch processing and feature fusion mechanism. The C2f module is introduced into the original YOLOv5-Lite model to improve the feature fusion ability of the model, because it can more effectively combine feature information from different levels, thereby enhancing the model's ability to identify fruit fly features. The original detection head structure of YOLOv5-Lite used in the present invention uses a total of 4 C3 modules, 3 of which are located in P3 / 8-small, P4 / 16-medium and P5 / 32- large layer; the P3 / 8-small layer is very suitable for capturing detailed information of small targets due to its smallest receptive field and highest feature map resolution; the P4 / 16-medium layer has a moderate receptive field and retains medium-scale feature information, which is crucial for contextual understanding of small targets; and the P5 / 32-large layer has the largest receptive field and the lowest feature map resolution, focusing more on large-scale features and global context of the image; in order to balance the complexity and performance of the model, the C2f module is used only in the P3 / 8-small layer and the P4 / 16-medium layer to replace the original C3 module.
[0066] ③Ablation experiments compare model performance.
[0067] In the field of deep learning and machine learning, ablation studies are widely used to explore the specific contributions of different components within a model to the overall performance, providing an important basis for model optimization. After adding the CBAM attention mechanism and replacing the original C3 module with the C2f module in YOLOv8, the present invention conducted 4 groups of ablation experiments to compare the recognition capabilities of the models.
[0068] The original YOLOv5-Lite without CBAM attention mechanism and C2f module is used as the baseline model (Baseline); based on the baseline model, the CBAM attention mechanism is introduced to construct the model YOLOv5-Lite_A; the two C3 modules in the baseline model are replaced by the C2f module in YOLOv8 to obtain the model YOLOv5-Lite_B; in order to comprehensively explore the effects of the CBAM attention mechanism and the C2f module, the two are introduced at the same time to construct the model YOLOv5-Lite_C.
[0069] The ablation experiment results are shown in Table 1. It can be seen that model C, which introduces the CBAM attention mechanism and the C2f module at the same time, achieves the highest values of precision, recall and mAP@0.5 among the four models, which are 92.1%, 91.6% and 93.5% respectively. Model C combines the advantages of the CBAM attention mechanism and the C2f module, and significantly improves the detection performance while keeping the model complexity relatively acceptable. Fig.10 From the detection results, the original overlap caused the false detection (such as Fig. 9 ), which was optimized by the improved C model; therefore, model C was used for subsequent research.
[0070] Table 1 Ablation experiment results
[0071]
[0072] 3. Model deployment based on Raspberry Pi 5 to complete the real-time fruit fly monitoring task.
[0073] 1. Hardware equipment.
[0074] Raspberry Pi is a microcomputer designed for computer programming education. The present invention adopts the latest model of the Raspberry Pi series - Raspberry Pi 5; the selected model is equipped with 8GB of RAM and a 2.4GHz quad-core 64-bit Arm Cortex-A76 central processor, which has a significant improvement in performance compared with the previous generation.
[0075] 2. Deployment analysis.
[0076] Deep learning models, especially convolutional neural networks (CNNs), usually require fixed-size inputs. The Resize operation can adjust the image size through interpolation algorithms (such as bilinear interpolation, bicubic interpolation, etc.) to make it meet the input requirements of the model. In theory, the larger the input image size, the more feature information the model can extract and the higher the detection accuracy.
[0077] During the deployment process, the present invention conducts detailed performance testing in combination with actual hardware device resources and finds that the frame rate of real-time detection is closely related to the Resize size. Table 2 shows the comparison of detection frame rate and accuracy under different Resize sizes.
[0078] Table 2 Comparison of detection frame rate and accuracy under different resizes
[0079]
[0080] As shown in Table 2, with an input of 320×320 pixels, the actual detection frame rate on the Raspberry Pi can reach up to 20FPS, which meets the basic requirements of real-time monitoring. When the input size is increased to 640×640 pixels, although the mAP@0.5 on the test set can reach 98.1%, the frame rate drops sharply to less than 5FPS, which obviously cannot meet the fluency requirements of real-time monitoring. Therefore, the present invention selects 320×320 as the input size of the neural network to achieve the best balance between frame rate and detection accuracy under limited computing resources.
[0081] 3. Complete real-time detection tasks on Raspberry Pi.
[0082] ①Use ONNX for format conversion.
[0083] The source code of the YOLOv5-Lite model contains the export.py script for converting the PyTorch (.pt) model to the ONNX (.onnx) model. By running this program, you can convert the trained YOLOv5-lite model from the PyTorch format to the ONNX format; install the ONNX Runtime inference engine optimized for the ONNX format on the Raspberry Pi for efficient inference; when porting, pay attention to setting the batch size of the model to 1 to ensure that the model only processes one image at a time on the Raspberry Pi.
[0084] ② Real-time detection using the inference model on the Raspberry Pi.
[0085] like Fig.11The figure shows the real-time detection results. It can be seen that the detection frame rate meets the deployment expectations and can reach 20FPS. The average frame rate is around 17FPS, and the fruit fly identification and classification accuracy is good. The guava fruit fly is in the blue detection frame, and the citrus fruit fly is in the yellow detection frame.
[0086] 4. Overall design and testing of the fruit fly identification system.
[0087] 1. Overall system framework.
[0088] like Fig.12 The figure shows the overall framework of the fruit fly identification system. Specifically, methyleugenol (ME) traps are used to lure guava fruit flies and citrus fruit flies into the shooting range of the Module 3 Wide CSI camera. The camera then captures high-definition images of the fruit flies and stably transmits the real-time image data stream to the Raspberry Pi. Based on the model building and deployment strategies detailed above, the Raspberry Pi can smoothly run the detection program based on YOLOv5-Lite to identify and distinguish the two fruit flies. The identification results can be visualized through the dedicated display connected to the Raspberry Pi. When the PC and the Raspberry Pi are in the same local area network, the RealVNC software can be used to remotely access the Raspberry Pi to monitor and view the identification of the fruit flies in real time.
[0089] 2. Design of fruit fly crawling channel and video acquisition window.
[0090] In the actual use environment, due to the fast flying speed of fruit flies, direct shooting often leads to blurred images, thus affecting the accuracy of recognition. To solve this problem, it is necessary to design a crawling channel to slow down the movement speed of guava fruit flies and citrus fruit flies. The present invention uses SolidWorks2017 software for modeling, such as Fig.13 As shown; the design includes a circular platform that corresponds to the shooting range of the camera, and a thin-wall structure is used to divide the platform into four parts to form four independent crawling channels to slow down the movement speed of fruit flies and thus ensure the shooting quality.
[0091] In order to enhance the integrity of the system, the Raspberry Pi motherboard, camera, and power supply module need to be integrated and installed together. For this purpose, a video acquisition window is designed, such as Fig.14 As shown in the figure on the left; the upper part is used to fix the Raspberry Pi and UPS power supply, and the lower part is used to place and fix the camera to ensure that the camera can accurately capture the situation on the fruit fly crawling channel; the video acquisition window can be connected to the fruit fly crawling channel through studs to achieve the overall function.
[0092] like Fig.14As shown in the figure on the right, there are two circles of carefully designed threads inside the lower part of the crawling channel, with models PCO28mm and PCO38mm respectively; through these two circles of threads, the parts can be installed on common beverage bottles sold on the market, greatly improving the practicality of the system and reducing costs.
[0093] The present invention takes a large number of photos of guava fruit flies and citrus fruit flies, and uses LabelImg software to annotate them, and establishes a high-quality guava fruit fly and citrus fruit fly data set; based on YOLOv5-Lite, a feature extraction and recognition model of fruit flies is successfully constructed, and the optimization method of the model by introducing CBAM attention mechanism and C2f module is studied; the experimental results show that the optimized model achieves better recognition performance in the fruit fly recognition task, and the average precision reaches 93.5%, which is 2.5 percentage points higher than the original model; after optimizing the model, 320×320 is selected as the input size of the neural network to achieve the best balance between frame rate and detection accuracy under limited computing resources; the fruit fly recognition model is successfully deployed on Raspberry Pi 5, and the real-time monitoring and recognition tasks are completed through the CSI camera; at the same time, the fruit fly crawling channel and video acquisition window are designed, and a complete fruit fly recognition and monitoring system is constructed. The system has the advantages of high efficiency, low cost, strong real-time performance, and good recognition effect.
[0094] The present invention combines deep learning with machine vision technology to construct a new fruit fly identification and monitoring system. The system not only improves the accuracy and efficiency of fruit fly monitoring, but also has the characteristics of real-time and high degree of automation, which is of great significance for preventing and controlling fruit fly disasters. At the same time, the system also provides high-value reference and reference for other similar insect monitoring.
[0095] An embodiment of the present invention further provides an electronic device, including a memory and a processor.
[0096] The memory is used to store computer programs.
[0097] When the processor is used to execute the computer program stored in the memory, the steps of the above-mentioned method for identifying alien invasive species are implemented.
[0098] An embodiment of the present invention further provides a computer-readable storage medium for storing a computer program, which implements the steps of the above-mentioned method for identifying an alien invasive species when executed by a processor.
[0099] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A method for identifying invasive alien species, characterized in that: The following steps are involved: Obtain image datasets of target species and native species respectively; Build a YOLOv5-Lite network model, introduce a CBAM attention mechanism after the first convolutional layer of the detection head of the YOLOv5-Lite network model; replace the C3 module in the P3 / 8-small layer of the detection head of the YOLOv5-Lite network model with the C2f module to form an improved P3 / 8-small layer; replace the C3 module in the P4 / 16-medium layer of the detection head of the YOLOv5-Lite network model with the C2f module to form an improved P4 / 16-medium layer; The CBAM attention mechanism is fused with the first convolutional layer of the detection head, the improved P3 / 8-small layer, and the improved P4 / 16-medium layer in the detection head of the YOLOv5-Lite network model to form an improved detection head; the YOLOv5-Lite network model including the improved detection head is used as the YOLOv5-Lite-s network model; and the YOLOv5-Lite-s network model is trained using the image datasets of the target species and the local species respectively to obtain the trained YOLOv5-Lite-s network model; The images of the target species and the local species were respectively input into the trained YOLOv5-Lite-s network model, and the network layers containing the CBAM attention mechanism in the trained YOLOv5-Lite-s network model were used to extract the features of the images of the target species and the local species, respectively, and the shallow feature maps of the target species and the local species containing edge structure features and overlapping structure features were obtained respectively; the P3 / 8-small and P4 / 16-medium network layers containing the C2f module level in the trained YOLOv5-Lite-s network model were used to extract the features of the images of the target species and the local species, and the deep feature maps of the target species and the local species containing species detail information and scale feature information were obtained respectively; the detection head of the YOLOv5-Lite-s network model was used to sum the feature elements in the shallow feature map and the deep feature map of the target species and the local species, and to visualize them, respectively, to obtain the recognition images of the target species and the local species; the recognition images of the target species and the local species were compared to identify the alien invasive species in the target species images.
2. The method for identifying invasive alien species according to claim 1, characterized in that: The step of obtaining the image datasets of the target species and the local species includes: Collect multiple images of target species and local species respectively, and filter out incomplete and blurred images; The LabelImg software was used to annotate the target category data of the screened images. The minimum circumscribed rectangular boxes of the guava fruit fly and the citrus fruit fly were selected as the true boxes. The guava fruit fly was labeled as class 0 and named Bezzi, and the citrus fruit fly was labeled as class 1 and named Hendel, and the image datasets of the target species and local species were obtained respectively.
3. The method for identifying invasive alien species according to claim 2, characterized in that: The image size in the image dataset is 320×320 pixels.
4. The method for identifying invasive alien species according to claim 1, characterized in that: The introduction of the CBAM attention mechanism includes: The CBAM attention mechanism consists of two modules: channel attention CAM and spatial attention SAM. The channel attention CAM completes channel weighting and feature optimization, and the spatial attention SAM completes spatial positioning and detail enhancement. A CBAM attention mechanism is introduced after the first convolutional layer of the detection head of the YOLOv5-Lite network model, and the channel attention CAM module and the spatial attention SAM are respectively fused with the first convolutional layer of the detection head.
5. The method for identifying invasive alien species according to claim 1, characterized in that: The improved P3 / 8-small level is formed, including: The P3 / 8-small layer of the detection head of the YOLOv5-Lite network model is used to capture the details of small objects due to its smallest receptive field and highest feature map resolution; The P3 / 8-small layer contains one C3 module. After the C3 module is replaced with a C2f module, an improved P3 / 8-small layer is formed.
6. The method for identifying invasive alien species according to claim 1, characterized in that: The formation of an improved P4 / 16-medium level includes: The detection head of the YOLOv5-Lite network model has a moderate P4 / 16-medium receptive field, retains medium-scale feature information, and focuses on contextual understanding of small objects. The P4 / 16-medium layer contains one C3 module, and the C3 module is replaced by a C2f module to form an improved P4 / 16-medium layer.
7. A device for identifying invasive alien species, characterized in that: include: The Module 3 Wide CSI camera of the Raspberry Pi 5 was used to obtain image datasets of target species and local species respectively; Raspberry Pi 5, used to build the YOLOv5-Lite network model, introduce a CBAM attention mechanism after the first convolutional layer of the detection head of the YOLOv5-Lite network model; replace the C3 module in the P3 / 8-small layer of the detection head of the YOLOv5-Lite network model with the C2f module to form an improved P3 / 8-small layer; replace the C3 module in the P4 / 16-medium layer of the detection head of the YOLOv5-Lite network model with the C2f module to form an improved P4 / 16-medium layer; The CBAM attention mechanism is fused with the first convolutional layer of the detection head, the improved P3 / 8-small layer, and the improved P4 / 16-medium layer in the detection head of the YOLOv5-Lite network model to form an improved detection head; the YOLOv5-Lite network model including the improved detection head is used as the YOLOv5-Lite-s network model; and the YOLOv5-Lite-s network model is trained using the image datasets of the target species and the local species respectively to obtain the trained YOLOv5-Lite-s network model; The images of the target species and the local species were respectively input into the trained YOLOv5-Lite-s network model, and the network layers containing the CBAM attention mechanism in the trained YOLOv5-Lite-s network model were used to extract the features of the images of the target species and the local species, respectively, and the shallow feature maps of the target species and the local species containing edge structure features and overlapping structure features were obtained respectively; the P3 / 8-small and P4 / 16-medium network layers containing the C2f module level in the trained YOLOv5-Lite-s network model were used to extract the features of the images of the target species and the local species, and the deep feature maps of the target species and the local species containing species detail information and scale feature information were obtained respectively; the detection head of the YOLOv5-Lite-s network model was used to sum the feature elements in the shallow feature map and the deep feature map of the target species and the local species, and to visualize them, respectively, to obtain the recognition images of the target species and the local species; the recognition images of the target species and the local species were compared to identify the alien invasive species in the target species images.
8. An electronic device, characterized in that: include: Memory and processor; The memory is used to store computer programs; The processor is used to implement the steps of the method for identifying an alien invasive species as described in any one of claims 1 to 6 when executing the computer program stored in the memory.
9. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the steps of a method for identifying an alien invasive species as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Target detection algorithm for tiny object
CN117392375A
Small target detection method and device and terminal equipment
CN118397253A
Submarine cable target detection method based on improved deep network
CN118447363A
Model training method and device, target detection method and device and electronic equipment
CN118521856A
KR20230137007A
