Method, system and device for detecting security risk features of border tree and storage medium
Through the improved YOLOv8 network model, combined with the selective multi-scale convolution kernel attention mechanism and average pooling module, efficient identification of pests and diseases of street tree trunks is achieved, solving the high cost and omissions of manual inspection, and providing a more comprehensive Urban pest monitoring.
Patent Information
- Application Number
- CN202411342106.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, the methods of manually detecting pests and diseases of street trees are costly and easily missed, and have high professional knowledge requirements for investigators, making it difficult to fully grasp the pests and diseases within the city.
The road tree safety risk feature detection method based on the YOLOv8 network model is adopted. Multiple identifications are identified by obtaining tree trunk image information, preprocessing and training of the improved YOLOv8 network model, including the selective multi-scale convolution kernel attention mechanism module and the average pooling module. Types of pests and diseases.
It improves the robustness and detection capabilities of the pest and disease identification model, reduces the identification time and cost, and provides a more comprehensive reference for urban greening management and decision-making.
Smart Images

Figure CN119131600A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method, system, device and storage medium for detecting safety risk characteristics of roadside trees. Background Art
[0002] Street trees are an important part of urban greening, playing a key role in reducing greenhouse gas emissions, purifying the air, and improving mental health. Street tree pests and diseases can reduce tree vitality and may lead to widespread tree death, reduce the quality of urban landscapes and urban air quality, increase urban management costs, affect the stability and health of the ecosystem, and cause multi-faceted harm to the urban ecological environment and citizens' lives. According to surveys, the current safety risks of Shanghai's street trees mainly come from pests and diseases. Among them, common pests and diseases on tree trunks mainly include tree holes, mechanical damage, termites, corruption, longhorn beetles, and fungi. These pests and diseases not only exist alone, but also affect each other, aggravating tree damage. In recent years, the maintenance of street trees has been an important task in Shanghai's urban construction and is of great significance to the future development of Shanghai.
[0003] The traditional field measurement method is the most accurate method to quantify pests. It sends investigators to conduct on-site sampling, observe and record or capture the main harmful pests on the street trees in the study area, and judge the type of disease based on the external symptoms and plant characteristics of the trees, taking into account the life cycle and transmission mode of the pathogen. Although the traditional manual inspection method has a high accuracy in identifying street tree trunk diseases and pests, it is costly, easy to miss, and requires high professional knowledge from the inspectors, which makes it difficult to fully grasp the situation of urban street tree diseases and pests. Summary of the invention
[0004] Based on this, it is necessary to provide a detection method, system, equipment and storage medium for the safety risk characteristics of street trees in response to the above-mentioned technical problems, so as to solve the problem that although the manual inspection method in the existing technology has high accuracy in identifying street tree trunk diseases and insect pests, it is costly and easy to miss, and requires high professional knowledge from the inspection personnel, resulting in certain limitations in large-scale monitoring and identification, making it difficult to fully grasp the disease and insect pest situation of urban street trees.
[0005] In a first aspect, the present application provides a method for detecting safety risk characteristics of roadside trees, comprising:
[0006] Obtain image information of the diseased area of the trunk of a roadside tree;
[0007] Preprocessing the image information to obtain training samples;
[0008] Based on the training samples, the improved YOLOv8 network model is trained to obtain a trained pest and disease recognition model; wherein the improved YOLOv8 network model includes a selective multi-scale convolution kernel attention mechanism module and an average pooling module;
[0009] The pest and disease identification model is used to detect the tree trunk image to be identified to obtain a detection result.
[0010] In one embodiment, the preprocessing of the image information includes:
[0011] Perform data cleaning and data enhancement operations on the image information.
[0012] In one embodiment, the data enhancement operation includes any one or more of a random rotation operation, a brightness transformation operation, a noise addition operation, a random cropping operation, an image flipping operation, and an image translation operation.
[0013] In one embodiment, the preprocessing of the image information further includes:
[0014] Annotating the image information;
[0015] The categories of the image information are counted, and additional annotations are performed for categories whose sample size is less than a preset number.
[0016] In one embodiment, the preprocessing of the image information further includes:
[0017] Negative sample image information is added to the image information, and the image information and the negative sample image information constitute the training sample.
[0018] In one embodiment, the improved YOLOv8 network model includes a detection head, which includes a large target prediction module and a medium target prediction module, and the selective multi-scale convolution kernel attention mechanism module is arranged before the large target prediction module and the medium target prediction module.
[0019] In one of the embodiments, the improved YOLOv8 network model also includes a feature fusion network, and the average pooling module is arranged in the feature fusion network.
[0020] In a second aspect, the present application provides a detection system for roadside tree safety risk characteristics, including:
[0021] An acquisition module, used to acquire image information of the diseased area on the roadside tree;
[0022] A processing module, used for preprocessing the image information to obtain training samples;
[0023] A training module, used to train the improved YOLOv8 network model based on the training samples to obtain a trained pest and disease recognition model; wherein the improved YOLOv8 network model includes a selective multi-scale convolution kernel attention mechanism module and an average pooling module;
[0024] The detection module is used to use the pest and disease recognition model to detect the tree trunk image to be identified and obtain the detection result.
[0025] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method steps described in any one of the first aspects are implemented.
[0026] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method steps described in any one of the first aspects are implemented.
[0027] The above-mentioned method, system, device and storage medium for detecting safety risk characteristics of roadside trees have at least the following advantages:
[0028] This application obtains image information of diseased areas on street trees, preprocesses the image information, obtains a large number of diverse training samples, and improves the robustness of the pest and disease recognition model; the improved YOLOv8 network model including the selective multi-scale convolution kernel attention mechanism module can enable the model to more adaptively select the appropriate receptive field, capture multi-scale pest and disease feature information, and improve the detection capability; the improved YOLOv8 network model including the average pooling module can enable the model to make corresponding decisions in combination with the high-level semantic information in the deep layer of the network and obtain global context information; in addition, it can also reduce computational complexity and improve model efficiency. The pest and disease recognition model trained with the above training samples and the improved YOLOv8 network model can identify large quantities of various types of tree trunk pest and disease images, and quickly provide high-precision recognition results, saving recognition time and reducing investigation costs, providing a more comprehensive reference basis for urban greening management and decision-making. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The drawings constituting a part of this application are used to provide a further understanding of the present invention. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1 A diagram of an application environment for an embodiment of a method for detecting safety risk characteristics of street trees;
[0032] Figure 2 A schematic diagram of a flow chart of a method for detecting safety risk characteristics of street trees according to an embodiment;
[0033] Figure 3 is a schematic flow chart of a step of preprocessing image information in one embodiment;
[0034] Figure 4 It is a schematic diagram of the structure of an improved YOLOv8 network model in one embodiment;
[0035] Figure 5 is a schematic diagram of error data of a training set in one embodiment;
[0036] Figure 6 Schematic diagram of accuracy data and recall data of a training set in one embodiment;
[0037] Figure 7 is a schematic diagram of error data of a verification set in one embodiment;
[0038] Figure 8 A schematic diagram of accuracy data and recall data of a validation set in one embodiment;
[0039] Fig. 9 A structural block diagram of tree trunk disease and insect pest detection in one embodiment;
[0040] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0041] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0042] While some exemplary embodiments of the present invention have been described for the purpose of illustration, it should be understood that the present invention may be implemented in other ways not specifically shown in the drawings.
[0043] The detection method of roadside tree safety risk characteristics provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers.
[0044] Among them, the terminal 102 can send the image information of the diseased area on the roadside tree to the server 104, so that the server 104 pre-processes the image information after obtaining the image information to obtain a training sample. Then, based on the training sample, the improved YOLOv8 network model is trained to obtain a trained pest and disease recognition model; wherein the improved YOLOv8 network model includes a selective multi-scale convolution kernel attention mechanism module and an average pooling module; finally, the trained pest and disease recognition model is used to detect the tree trunk image to be identified to obtain a detection result. In this way, the server 104 feeds back the detection result to the terminal 102.
[0045] The above-mentioned detection method of the safety risk characteristics of roadside trees obtains the image information of the diseased area on the roadside trees, pre-processes the image information, obtains a large number of diverse training samples, and improves the robustness of the pest and disease recognition model; the improved YOLOv8 network model including the selective multi-scale convolution kernel attention mechanism module can enable the model to more adaptively select the appropriate receptive field, capture multi-scale pest and disease feature information, and improve the detection ability; the improved YOLOv8 network model including the average pooling module can enable the model to make corresponding decisions in combination with the high-level semantic information in the deep layer of the network and obtain global context information; in addition, it can also reduce the computational complexity and improve the model efficiency. The pest and disease recognition model trained with the above-mentioned training samples and the improved YOLOv8 network model can identify large quantities of various types of tree trunk pest and disease images, and quickly provide high-precision recognition results, saving recognition time and reducing the cost of investigation, providing a more comprehensive reference basis for urban greening management and decision-making.
[0046] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0047] In a feasible embodiment, the present application embodiment provides a method for detecting safety risk characteristics of roadside trees. Figure 1 The server 104 in FIG. 1 is used as an example for explanation.
[0048] See also Figure 2 , Figure 2 The flowchart of the method for detecting the safety risk characteristics of roadside trees in this embodiment specifically includes the following steps:
[0049] Step S202, obtaining image information of the diseased area of the trunk of the roadside tree.
[0050] Specifically, the diseased area on the roadside tree refers to the damage to the trunk caused by pests and diseases. Taking the roadside trees in Shanghai as an example, the common pests and diseases on the trunk mainly include tree holes, wounds, termites, longhorn beetles and fungi, among which corruption and longhorn beetles are two extremely harmful pests and diseases. The corruption of trees can cause the trunks to gradually become hollow or even the plants to die. The damage to the tree structure can also easily cause the trees to fall over, break and injure pedestrians. Longhorn beetles can easily harm the bark of trees, causing damage to the nutrient transport of trees, and can also easily cause the death of plants. At the same time, these pests and diseases can often promote each other and occur in combination. For example, mechanically damaged tree wounds are often the beginning of corruption, providing an environment for the spread of fungi and other pests and diseases. Tree holes that are not repaired in time are also prone to spread into corruption. The main definitions of the various types of pests and diseases involved in the embodiments of the present application are as follows:
[0051] 1. Tree holes: Trees suffer from human or natural damage during their growth process, which causes bark trauma and exposes the wood to be soaked by rainwater, decomposed and rotted by bacteria, fungi and other organisms, and continuously spread along the wood to form tree holes.
[0052] 2. Tree wounds; for example, trunk decay, invasion of pests and diseases or other mechanical damage may cause different types of wounds to form on the trunk.
[0053] 3. Corruption: Due to improper pruning and external force damaging the tree trunk, the wood is exposed for a long time and cannot heal, the wood gradually changes its original structure and color, and the wood becomes soft and brittle.
[0054] 4. Damage caused by longhorn beetles: Longhorn beetles damage the phloem and xylem of trees, forming hammer-shaped galls on the damaged parts, which hinder the transport of nutrients, causing the branches to dry up, the interior to become hollow, and even causing the entire plant to die.
[0055] 5. Termite damage: The two main termites that harm Shanghai’s urban greening are the Formosan coptotermes and the yellow-breasted Reticulitermes. If trees are not pruned properly or tree holes are not repaired in time, the resulting wounds will become entry points for termites.
[0056] 6. Fungi: Fungi are also a common threat. They infect the roots, stems and leaves of trees, causing various diseases and seriously affecting the growth and health of trees. When trees are attacked by fungi, their roots rot, their stems rot, and even tree holes form, weakening the structural stability of the trees.
[0057] Based on this, when acquiring image information of the diseased area on the roadside trees, the above-mentioned multiple types of image information should be taken into account to achieve sample diversity.
[0058] Furthermore, image information can be obtained based on high-definition camera photography, where high-definition cameras photograph street trees in both close-up and long-range modes, capturing subtle disease features such as disease spots, insect holes, color changes, etc. through close-up shots, combined with long-range shots to help identify the overall disease pattern and distribution, and then systematically evaluate the spread and severity of the disease. This multi-scale sample covers more practical application scenarios, and the trained model has learned enough complex scenarios. Under ideal conditions, the model's robustness and generalization capabilities will be improved, and it can accurately identify diseases at different distances and different viewing angles.
[0059] Furthermore, in order to make the sample data set meet the diversity requirements, the embodiment of the present application also collects data images from different shooting angles such as front, side, and upward viewing under various weather conditions such as sunny days, cloudy days, and snowy days, and finally obtains image information containing different background noises such as dense, sparse, overlapping, occluded, front light, and back light.
[0060] It should be understood that the above-mentioned image information can be obtained by manually operating a high-definition camera, and image information can also be obtained through a high-definition camera, wherein each high-definition camera is pre-set at a shooting position close to the tree trunk, and image information from a variety of shooting angles can be obtained by adjusting the angle of the camera.
[0061] Step S204: pre-process the image information to obtain training samples.
[0062] Specifically, the purpose of preprocessing the image information is to remove poor quality and atypical pest images, and obtain high-definition images with obvious pest characteristics. Specifically in this embodiment, the training samples finally retained include six typical pest types, such as tree holes, corruption, wounds, termites, longhorn beetles, and fungi.
[0063] It should be understood that after obtaining the training samples, it is also necessary to compare the feature differences between different pest and disease samples in order to construct a unified tree pest and disease labeling standard for subsequent labeling.
[0064] Step S206: Based on the training samples, the improved YOLOv8 network model is trained to obtain a trained pest and disease recognition model. The improved YOLOv8 network model includes a selective multi-scale convolution kernel attention mechanism module and an average pooling module.
[0065] Specifically, the YOLOv8 network model usually includes an input end, a feature extraction network, a feature fusion network, a detection head, and an output end. The input end is used to receive input training samples; the feature extraction network is used to extract useful feature information from the input training samples; the feature fusion network is used to fuse the feature information of different levels and scales extracted by the feature extraction network; the detection head is used to predict the bounding box, category, and confidence of the target in the image based on the feature information output by the feature fusion network; the output end is used to post-process the results predicted by the detection head and output the final detection result.
[0066] The Selective Kernel attention (SKattention) module can flexibly select between convolution kernels of different sizes to adapt to different contextual information by dynamically adjusting the receptive field of the convolution kernel. By adding SKattention to the improved YOLOv8 network model, the model can more adaptively select the appropriate receptive field, capture multi-scale pest and disease feature information, and improve the detection capability of multiple types of pests and diseases.
[0067] The average pooling module aggregates information by averaging, which is suitable for tasks such as classification or global feature extraction. By introducing the average pooling module in the improved YOLOv8 network model, the model can make corresponding decisions based on the high-level semantic information in the deep layer of the network and obtain global context information; in addition, it can also reduce computational complexity and improve model efficiency.
[0068] Step S208: using the pest and disease recognition model to detect the tree trunk image to be identified, and obtaining a detection result.
[0069] Specifically, the tree trunk image to be identified is a tree trunk image randomly acquired by a high-definition camera or a high-definition camera. After the pest and disease recognition model reads the input tree trunk image to be identified, it extracts its feature information, compares the extracted feature information with the features learned during training, and then classifies according to the comparison result, and finally outputs the detection result according to the classification result, which is the pest and disease category or probability distribution to which the identified tree trunk image belongs.
[0070] The above-mentioned detection method of the safety risk characteristics of street trees obtains the image information of the diseased area on the street trees, pre-processes the image information, obtains a large number of diverse training samples, and improves the robustness of the pest and disease recognition model; the improved YOLOv8 network model including the selective multi-scale convolution kernel attention mechanism module can enable the model to more adaptively select the appropriate receptive field, capture multi-scale pest and disease feature information, and improve the detection ability of various types of pests and diseases; the improved YOLOv8 network model including the average pooling module can enable the model to make corresponding decisions in combination with the high-level semantic information in the deep layer of the network and obtain global context information; in addition, it can also reduce the computational complexity and improve the model efficiency. The pest and disease recognition model trained with the above-mentioned training samples and the improved YOLOv8 network model can identify large quantities of various types of tree trunk pest and disease images, and quickly provide high-precision recognition results, saving recognition time and reducing the cost of investigation, providing a more comprehensive reference basis for urban greening management and decision-making.
[0071] Optionally, the image information is preprocessed, including: performing data cleaning and data enhancement operations on the image information.
[0072] Specifically, in order to improve the recognition ability of the model, it is necessary to collect a large amount of image information for model training from various sources, such as public data sets, web crawlers, own databases, etc. In order to remove invalid information, the embodiments of the present application filter, deduplicate, and repair these image information. Among them, filtering is to delete low-quality images or images that do not belong to pests and diseases to avoid interference; deduplication is to delete duplicate or highly similar images to avoid model overfitting; repair is to remove noise in the image and fill in missing areas or occlusions to improve image quality.
[0073] Furthermore, the cleaned image information is processed by format conversion, size adjustment and normalization to facilitate subsequent model training.
[0074] See also Figure 3 Optionally, preprocessing the image information further includes:
[0075] Step S302: annotate the image information.
[0076] Step S304 , counting the categories of the image information, and performing supplementary annotation for categories whose sample size is less than a preset number.
[0077] Specifically, each image information after the above processing is also labeled based on the pre-constructed tree pest labeling standard. Since the sample quality will directly affect the recognition accuracy of the model, careful judgment and repeated confirmation are required during labeling to reduce random errors. For example, the embodiment of the present application uses the LabelImg tool to perform feature labeling on the original image.
[0078] Supplementary annotation is performed on categories with sample sizes less than the preset number to consider the sample balance issue in order to improve the stability of the model.
[0079] Furthermore, the annotated image information is divided into a training set, a validation set, and a test set according to a preset ratio, such as 6:3:1.
[0080] Furthermore, the manifestations of pests and diseases in the real world are diverse, and existing training samples are difficult to represent the complexity of pests and diseases in the real world. Obtaining enough disease samples requires a lot of manpower and material costs, which is extremely challenging. Therefore, the embodiment of the present application adopts a method of data enhancement for the training set to generate diversified training samples, which can prevent the model from overfitting on the training data, thereby improving the performance of the model on unseen data, and then simulating different scenes in the real world, improving the robustness of the model, enabling the model to learn stronger and more extensive features, reducing the model's bias towards specific scenes or specific conditions, and better identifying various types of diseases.
[0081] Optionally, the data enhancement operation includes any one or more of: a random rotation operation, a brightness transformation operation, a noise addition operation, a random cropping operation, an image flipping operation, and an image translation operation.
[0082] Specifically, the steps of random rotation include: obtaining the width and height of the image, converting the rotation angle into radians, and then calculating the width and height of the rotated new image according to the rotation angle. Next, use the getRotationMatrix2D function of OpenCV to obtain the rotation matrix, calculate the translation from the center of the old image to the center of the new image, and update the translation in the rotation matrix. Then use the affine transformation function cv2.warpAffine to rotate the image to obtain the rotated image. Next, traverse each bounding box of the image, transform the four corner points of the bounding box into the new coordinate system through the rotation matrix, calculate and obtain the new bounding box coordinates, and finally return the rotated image and bounding box list. Pests and diseases such as corruption, fungi, and mechanical damage have irregular shapes and directions. By randomly rotating the image, simulating its views at different angles, simulating the recognition ability of pests and diseases at different angles and directions, the model can adapt to the characteristics of diseases at various angles, which is more effective for detecting irregular-shaped diseases such as tree holes and corruption.
[0083] The brightness transformation first defines an all-zero matrix with the same shape and data type as the input image, and then uses the cv2.addWeighted function to perform a weighted calculation on the image by multiplying the input image by the brightness adjustment coefficient alpha, adding the all-zero matrix multiplied by (1-alpha), and adding a constant offset (usually 0) to the result. This method can linearly adjust the brightness of the image to obtain a new image with adjusted brightness. Tree trunk pests and diseases are often obscured by the shadows of the leaf canopy, which increases the difficulty of detection. By adjusting the image brightness and simulating images under different lighting conditions, the model can adapt to different lighting conditions and can still accurately identify pests and diseases in insufficient or enhanced light conditions, such as tree holes above the tree, mechanical damage such as broken branches, etc.
[0084] Adding noise usually refers to adding Gaussian noise to the input image. First, a random seed is generated to ensure the randomness of the noise, and then the mean and variance of the noise are set (usually the mean is 0 and the variance is 0.01). Then the standard deviation is calculated, and a noise matrix with the same shape as the image is generated. Each value in the matrix is a Gaussian distribution value generated according to the set mean and standard deviation. Then this noise matrix is added to the original image to obtain a new image after adding noise. Since the pixel value of the new image is between 0 and 1, it is finally multiplied by 255 and converted to an unsigned 8-bit integer type to obtain the final noisy image. Adding Gaussian noise to the image simulates the irregular features such as spots and particles that may appear on the surface of the disease in reality, so that the model can better identify the subtle changes of these diseases. In the detection of pests and diseases, the noise may be closer to some characteristics of the actual disease, rather than a simple degradation of image quality, so the robustness of the model in these cases is enhanced, so that the model can learn to accurately identify pests and diseases in a noisy environment, and the ability of the model to process low-quality images is enhanced.
[0085] Random cropping first defines a mask matrix with all 1s and the same shape as the input image. Then, for the specified number of crops, the center point of the cropped area is randomly selected in the image, and the coordinates of the cropped area are calculated to ensure that the cropped area is within the image range. Next, the intersection of the cropped area and each bounding box in the image is calculated. If the intersection of the cropped area and any bounding box exceeds the specified threshold, the cropped area is reselected until a suitable area is found. Finally, the value of the cropped area in the mask matrix is set to 0, and the original image is multiplied by the mask matrix to obtain the cropped image. Through random cropping, occluding certain areas on the image can help simulate various obstacles or occlusions that may occur in the real environment, so that the model can focus more on the diseased part of the tree trunk. The model will pay more attention to the unoccluded areas in the image, thereby improving the situation of insufficient learning of few-sample disease features caused by imbalanced disease samples. It is more effective for diseases with obvious local features, especially areas such as longhorn beetles and termites that often appear as long strips of diseases. The random cropping technique greatly enhances the robustness of the model when dealing with partially occluded or incomplete inputs.
[0086] Image flipping first makes a deep copy of the input image and obtains the height and width of the image. Generate a random number and determine the flip type based on its value: if the random number is between 0 and 0.33, perform a vertical flip; if the random number is between 0.33 and 0.66, perform a horizontal flip; otherwise, perform a horizontal and vertical flip. Then, adjust the coordinates of the bounding box to adapt to the flipped image: for vertical flipping, adjust the y coordinate; for horizontal flipping, adjust the x coordinate; for horizontal and vertical flipping, adjust both the x and y coordinates. Finally, return the flipped image and the updated bounding box list. By randomly flipping the image in multiple directions, the model can be adapted to different perspectives, which can improve the recognition accuracy of some pests and diseases with strong symmetry, such as corrupt tree holes and some mechanical damage with regular shapes.
[0087] Image translation first obtains the width and height of the input image and initializes the minimum and maximum coordinates of all target boxes to determine the maximum translation distance. Then, the minimum and maximum coordinates of all bounding boxes in the input image are calculated to obtain the maximum left, right, up, and down distances. Next, the translation distances x and y are randomly generated within these distances and a translation matrix M is created. The image is translated using the cv2.warpAffine function to obtain the translated image. Finally, each bounding box is traversed, its coordinates are adjusted to reflect the translation effect, and the translated image and the updated bounding box list are returned. In the original sample, the location of termite pests is relatively fixed, most of which appear at the junction of branches and trunks or in the middle of branches, and termites also appear on the trunk. Similarly, tree hole samples often appear on branches and trunks in the data, and tree holes may also appear at the roots. By randomly translating the image, the model can learn to correctly locate and identify the disease even when the location changes, which is especially important for highly mobile pests such as longhorn beetles and termites. In addition, translation can simulate the displacement that may occur in the process of camera capturing images to enhance the robustness of the model to pests and diseases in different locations and ensure accurate identification when the location of the disease changes.
[0088] Optionally, the steps after obtaining the training sample further include:
[0089] Negative sample image information is added to the image information, and the image information and the negative sample image information constitute the training sample.
[0090] Specifically, negative sample images usually refer to images that do not contain the target object. If a negative sample image does not contain the target object at all, it can be left unlabeled or labeled as "empty". If a negative sample image contains distractors that are similar to the target object, the distractors can be labeled. This solution can reduce the probability of the model misreporting the background as the target object during actual detection, allowing the model to be exposed to more different types of backgrounds during training.
[0091] The above-mentioned detection method of the safety risk characteristics of roadside trees improves the image quality by performing data cleaning on the image information; supplements the annotation of the categories with less than the preset number of samples, solves the sample balance problem and improves the stability of the model; performs data enhancement on the image information to generate diversified training samples, which can prevent the model from overfitting on the training data, thereby improving the performance of the model on unseen data, and then simulates different scenes in the real world to improve the robustness of the model, so that the model can learn stronger and more extensive features, reduce the model's bias towards specific scenes or specific conditions, and better identify various types of diseases; adding negative sample image information to the image information can reduce the probability of the model misreporting the background as the target object during actual detection, so that the model is exposed to more different types of backgrounds during training. The pest and disease recognition model trained based on the above-mentioned training samples can identify large quantities of various types of tree trunk pest and disease images, and quickly provide high-precision recognition results, saving recognition time, reducing investigation costs, and providing a more comprehensive reference basis for urban greening management and decision-making.
[0092] Optionally, the YOLOv8 network model typically includes an input end, a feature extraction network, a feature fusion network, a detection head, and an output end.
[0093] See also Figure 4 ,The detection head of the improved YOLOv8 network model includes a large target prediction module and a medium target prediction module, and the selective multi-scale convolution kernel attention mechanism module is set before the large target prediction module and the medium target prediction module.
[0094] Specifically, the detection head includes a large target prediction module, a medium target prediction module and a small target prediction module for detecting targets of different sizes. The selective multi-scale convolution kernel attention mechanism module is set before the large target prediction module and the medium target prediction module. Due to the large size of these targets, the network needs a larger receptive field to cover the entire target to ensure full perception of the target as a whole. Therefore, the selective multi-scale convolution kernel attention mechanism can select a larger receptive field to help the network focus on the global features of large or medium targets. For small targets, the network often only needs a smaller receptive field, because the target itself occupies a small space, and an overly large receptive field may introduce redundant background information, which is not conducive to the detection of small targets. Therefore, it is not applied before the small target prediction module in the embodiment of the present application.
[0095] Furthermore, the selective multi-scale convolution kernel attention mechanism module includes Split operation, Fuse operation and Select operation to implement. Among them, due to the differences in the morphology of pests and diseases in the training samples and the different distance scales of pests and diseases displayed on the photos, in order to capture multi-scale feature information as much as possible, the Split operation processes the input features through convolution kernels of different sizes to capture multi-scale feature information. The purpose of the Fuse operation is to process the spliced features and guide the selection operation through global information, so that the model can select the most appropriate kernel convolution according to the scale of the disease and effectively extract the features of diseases of different scales. The purpose of the Select operation is to dynamically select and fuse features of different scales according to the scale weights generated by the Fuse operation, and weight the sum of the weight of each scale with the corresponding result after the previous convolution to obtain different branch weight combinations. Combined with these features, the network can focus on the most effective feature scale at the moment, thereby optimizing the processing results.
[0096] Optionally, the average pooling module is provided in the feature fusion network.
[0097] Specifically, the feature fusion network of the present application adopts the SPPF network (Spatial Pyramid Pooling-Fast), which is optimized on the basis of the SPP network (Spatial Pyramid Pooling), and achieves faster speed and fewer floating-point operations by reducing unnecessary calculations. At the same time, SPPF is also combined with the perceptual large kernel convolution UniRepLK to further improve the receptive field and detection accuracy of the model. It extracts multi-scale spatial information by dividing the feature map into grids of different sizes and performing a maximum pooling operation on each grid. This technology helps the model to better handle targets of different sizes and improve detection accuracy. However, before the target feature enters the SPPF network, it usually goes through multiple layers of convolution, resulting in the model usually lacking low-level semantic features in the feature fusion stage, resulting in insufficient learning.
[0098] Based on this, the embodiment of the present application introduces an average pooling module into the SPPF network, which enables the model to make corresponding decisions based on the high-level semantic information deep in the network and obtain global context information.
[0099] At the same time, since the YOLOv8 network model is an end-to-end target detection model, after the selective multi-scale convolution kernel attention mechanism module is introduced into it, the addition of the fully connected layer will bring a huge number of parameters to the model, causing the model reasoning speed to slow down. The average pooling module can effectively alleviate the huge number of parameters of the fully connected layer, thereby reducing the black box operation of the fully connected layer and achieving a balance between the lightness and accuracy of the model.
[0100] Exemplarily, the improved YOLOv8 network model trained in the embodiment of the present application is based on the Pytorch framework, the hardware device is NVIDIA GeForce RTX 4090, and two GPUs are used for acceleration.
[0101] Exemplarily, the feature extraction network adopts the CSPDarknet53 network, including the C2f module and the FPN (FeaturePyramid Network) module. Among them, the introduced C2f module realizes more efficient feature transfer and fusion through partial connections across stages. The C2f module divides the input data into two branches for processing, one of which is directly passed to the output, and the other is processed by multiple Bottleneck modules in the C2f module. This branch design helps to increase the nonlinear ability and representation ability of the network. Different branches can focus on different types of disease characteristics, making the model more balanced in detecting various diseases, and improving the network's modeling ability for complex data. At the same time, the residual structure introduced in the Bottleneck module greatly reduces the computational complexity and the number of parameters, effectively reduces redundant calculations, improves the computational efficiency and feature expression ability of the model, and retains the model performance.
[0102] In addition, the C2f module performs feature transformation on the input data through two convolutional layers cv1 and cv2. These convolution operations help extract features of different levels and abstraction levels in the input data and capture the diverse disease features existing at different scales and levels. Finally, the C2f module helps to achieve feature fusion of different scales and enhance the detection capability of diseases of different scales by splicing features of different branches in the channel dimension.
[0103] The FPN module enhances the detection capability of small and large targets by constructing a top-down path and combining feature maps at different levels. This multi-scale feature fusion method makes YOLOv8 more robust when facing targets of different sizes and shapes, ensuring that the characteristics of pests and diseases from small to large can be effectively captured. In addition, similar to the C2f module, the cross-level feature sharing structure within FPN combines high-level and low-level features, integrates global context information and detail information, effectively takes into account the overall distribution and local characteristics of disease samples, and significantly improves the generalization ability of the model. The head network of YOLOv8 is responsible for decoding the feature map and generating the final detection result. This part includes multiple convolutional layers for predicting bounding boxes, category probabilities, and confidence scores. The improved loss function further optimizes the regression effect of the bounding box during training.
[0104] Exemplarily, there are 7 categories of targets to be identified in this application, of which six are tree holes, corruption, wounds, termites, longhorn beetles, fungi, and one is background. The detection head generates a large number of target frames in the input image information, and the NMS (Non-Maximum Suppression) algorithm is used to process these target frames, for example, to screen and sort the target frames according to their confidence and overlap, thereby selecting the best target frame from multiple candidate target frames to improve the accuracy and efficiency of model detection. Specifically, the NMS algorithm first sorts the bounding boxes in descending order according to the confidence level of each bounding box, where confidence level is usually a comprehensive indicator of classification probability and positioning accuracy; the bounding box with the highest confidence level is considered to be the most likely to correctly detect the target. Then, the bounding box with the highest confidence level is selected from the sorted list, marked as selected, and added to the final detection result list. For each remaining bounding box, its IOU (Intersection over Union) with the selected bounding box is calculated. In this process, if the IOU of a bounding box with the selected box exceeds the preset threshold, it is considered that the two boxes represent the same target, so the low-confidence bounding box is eliminated according to the principle of low confidence. Finally, repeat the above steps until all bounding boxes have been checked and each target corresponds to an optimal bounding box.
[0105] During the processing, the identified pests and diseases will be framed by boxes of various colors, and the corresponding confidence and coordinate information of the boxes will be stored. The higher the confidence, the higher the probability of being a disease.
[0106] Through the above steps, the improvement of the YOLOv8 network model can be completed. Further, the steps of training the improved YOLOv8 network model include:
[0107] First, the initial hyperparameters of model training are set, and then the training set is input into the improved YOLOv8 network model. Specifically in this embodiment, 3685 original image information is obtained, which is expanded to 6 times the original through data enhancement technology, totaling 20262 high-definition images, including 7602 corruptions, 372 termites, 330 longhorn beetles, 2612 mechanical damages, 1046 fungi and 1860 tree holes, totaling 13822 pest and disease samples. Among them, the initial hyperparameters set in this embodiment are shown in Table 1.
[0108] Table 1 Model training hyperparameter settings
[0109] Training parameter name Parameter Value Number of processes 16 Initial learning rate 1e-4 Training batches 300 Batch size 16 Confidence Threshold 0.25 GPU Number 0,1
[0110] Furthermore, under the constraint of the loss function, the improved YOLOv8 network model is iteratively trained, and the model parameters are gradually adjusted until the preset requirements are met.
[0111] Specifically, the output of the model is obtained by stepping through the network layer; the loss function compares the model output with the true label to calculate the loss value; the gradient is calculated by the back propagation algorithm, and the gradient of each layer parameter is calculated according to the size of the loss value, and the model parameters are updated by gradient descent or other optimization algorithms (such as Adam, SGD, etc.) to reduce the loss value; after multiple iterations, the prediction result of the model will gradually approach the true value, and the loss value will gradually decrease. Exemplarily, the loss function includes classification loss and regression loss.
[0112] Classification loss usually adopts the cross entropy loss function. For binary classification problems, BCE is used as the classification loss. For multi-classification problems, the binary cross entropy loss of N targets is calculated, that is, the binary cross entropy losses of N targets are summed and then averaged.
[0113] The regression loss includes bounding box loss and distribution aggregation function loss. The former usually adopts CIOU, and the latter still takes the form of cross entropy, which enables the network to quickly focus on the distribution of positions close to the target position, thereby maximizing the probability density at the label.
[0114] Furthermore, during the training process, the validation set is used to fine-tune the model, helping to select the best model hyperparameters and prevent model overfitting.
[0115] Furthermore, after the training is completed, the test set is used to evaluate the final performance of the model, and evaluation indicators such as accuracy, precision, recall, F1 value, mean square error, etc. are calculated to measure the model's generalization ability to new data.
[0116] It should be understood that during the above training process, the training samples can be adjusted as needed. For example, if the detection results of a certain category of pests and diseases are not accurate, sample images that better reflect the characteristics of this category can be added in the next round of training.
[0117] For example, after each round of training, the accuracy of the pest and disease identification model is evaluated. The evaluation indicators of this embodiment include precision P (Precision) and recall R (Recall), and the formula is as follows:
[0118]
[0119] The curve formed by Precision and Recall is called the PR curve. Based on the PR curve, by calculating the average value of the Precision value corresponding to each Recall value, a numerical evaluation index AP can be obtained to measure the detection ability of the trained model in the category of interest. However, the AP value calculation is only for one category. In order to achieve a comprehensive evaluation of multiple types of diseases, it is necessary to calculate the AP of all categories and take the average value, that is, mAP. mAP measures the detection ability of the trained model in all categories. Assuming there are k categories, the calculation formula of mAP is as follows.
[0120] AP = ∫0 1 P(R)dR
[0121]
[0122] Among them, TP is the number of samples that are actually positive and correctly classified as positive; FP is the number of samples that are actually negative and incorrectly classified as positive; FN is the number of samples that are actually positive and incorrectly classified as negative. In addition, in this experiment, the mAP threshold is selected as 0.5 for verification to achieve a balance between precision and recall, ensuring that the model can accurately identify and locate pest targets in the image, and ensuring the lowest missed detection rate and false detection rate as possible.
[0123] See also Figure 5-Figure 8 , Figure 5 The train / box_loss in the function measures the error between the target bounding box predicted by the model on the training set and the true label bounding box. Figure 5 The train / cls_loss in the model is used to measure the error between the classification result of the target object category in the training set and the actual category label; Figure 5 The train / dfl_loss in is a measure of how finely the model refines the bounding box coordinates predicted by the model on the training set. Figure 6 The metrics / precision in the table is the accuracy of the model on the training set; the metrics / recall is the recall rate of the model on the training set. Figure 7 val / box_loss in is used to evaluate the accuracy of the model's bounding box predictions on the validation set; Figure 7 val / cls_loss in: used to evaluate the accuracy of the model in object classification on the validation set; Figure 7 val / dfl_loss in: used to evaluate the refinement of the bounding box coordinates of the model on the validation set. Figure 8 Metrics / mAP50(B) in is the average precision when IOU is 0.5; Figure 8Metrics / mAP50-95(B) is the average accuracy when IOU is 0.5-0.95.
[0124] like Figure 5-Figure 8 As shown in the figure, the model learns better features and parameters during the training process, gradually adapts to the training data, and the verification loss decreases rapidly in the early stage and then gradually stabilizes; the verification accuracy increases rapidly in the early stage and then gradually stabilizes.
[0125] Optionally, the method for detecting safety risk characteristics of roadside trees in this embodiment further includes: analyzing the detection results and generating an analysis report.
[0126] For example, the image information obtained from all roadside trees in the monitoring area can be input into the pest identification model to obtain the detection result, which is the pest category or probability distribution to which each image information belongs. By analyzing the detection result, the distribution of pests and diseases in different areas and the severity of each type of pests and diseases can be obtained, providing an important basis for users to carry out subsequent tree maintenance and tree planning.
[0127] The above-mentioned detection method of safety risk characteristics of roadside trees improves image quality by performing data cleaning on image information; supplements annotations on categories with sample sizes less than a preset number, thereby solving the sample balance problem and improving the stability of the model; performs data enhancement on image information to generate diversified training samples, which can prevent the model from overfitting on the training data, thereby improving the performance of the model on unseen data, and then simulating different real-world scenarios to improve the robustness of the model, enabling the model to learn stronger and broader features, reduce the model's bias towards specific scenarios or specific conditions, and better identify various types of diseases; adding negative sample image information to image information can reduce the probability of the model misreporting the background as the target object during actual detection, so that the model is exposed to more different types of backgrounds during training.
[0128] Furthermore, in the improved YOLOv8 network model, the feature extraction network adopts the C2f module and the FPN module, which significantly improves the detection ability of various pests and diseases, while effectively reducing redundant calculations, improving the computational efficiency and feature expression ability of the model, and retaining the model performance; the feature fusion network adopts the SPPF network and introduces the average pooling module, which enables the model to make corresponding decisions based on the high-level semantic information in the deep layer of the network and obtain global context information; at the same time, it can effectively alleviate the huge parameters of the fully connected layer, thereby reducing the black box operation of the fully connected layer and achieving a balance between the lightness and accuracy of the model.
[0129] The pest and disease recognition model trained based on the above training samples and the improved YOLOv8 network model can identify large quantities of various types of tree trunk pest and disease images and quickly provide high-precision recognition results, saving recognition time and reducing investigation costs, providing a more comprehensive reference for urban greening management and decision-making.
[0130] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0131] Based on the same inventive concept, the embodiment of the present application also provides a detection system for roadside tree safety risk characteristics for implementing the detection method for roadside tree safety risk characteristics provided above. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the detection system for roadside tree safety risk characteristics provided below can refer to the limitations of the model training method above, and will not be repeated here.
[0132] See also Fig. 9 In a feasible embodiment, the embodiment of the present application also provides a detection system for safety risk characteristics of roadside trees, including: an acquisition module, a processing module, a training module and a detection module.
[0133] The acquisition module is used to acquire image information of the diseased area on the roadside trees.
[0134] The processing module is used to pre-process the image information to obtain training samples.
[0135] The training module is used to train the improved YOLOv8 network model based on the training samples to obtain a trained pest and disease recognition model; wherein the improved YOLOv8 network model includes a selective multi-scale convolution kernel attention mechanism module and an average pooling module.
[0136] The detection module is used to detect the tree trunk image to be identified by using the pest and disease identification model to obtain the detection result.
[0137] Optionally, the processing module pre-processes the image information, including: performing data cleaning and data enhancement operations on the image information.
[0138] Optionally, the data enhancement operation includes any one or more of: a random rotation operation, a brightness transformation operation, a noise addition operation, a random cropping operation, an image flipping operation, and an image translation operation.
[0139] Optionally, the processing module pre-processes the image information and further includes: labeling the image information; counting the categories of the image information, and performing supplementary labeling for categories whose sample size is less than a preset number.
[0140] Optionally, after the processing module obtains the training sample, the step further includes: adding negative sample image information to the image information, and the image information and the negative sample image information constitute the training sample.
[0141] Optionally, the improved YOLOv8 network model includes an input end, a feature extraction network, a feature fusion network, a detection head and an output end; wherein the feature extraction network adopts a CSPDarknet53 network, including a C2f module and an FPN module; and the feature fusion network adopts an SPPF network, including an average pooling module. Then the training module trains the improved YOLOv8 network model according to the training samples, including: setting the initial hyperparameters of the model training, inputting the training set into the improved YOLOv8 network model, iteratively training the improved YOLOv8 network model under the constraint of the loss function, and gradually adjusting the model parameters until the preset requirements are met.
[0142] Furthermore, during the training process, the training module uses the validation set to fine-tune the model, helping to select the best model hyperparameters and prevent model overfitting.
[0143] Furthermore, after the training module is completed, the test set is used to evaluate the final performance of the model, and evaluation indicators such as accuracy, precision, recall, F1 value, mean square error, etc. are calculated to measure the model's generalization ability to new data.
[0144] Furthermore, during the training process, the training module can also adjust the training samples as needed.
[0145] Optionally, the detection system for roadside tree safety risk characteristics provided in the embodiment of the present application further includes: a parsing module.
[0146] The analysis module is used to analyze the detection results and generate analysis reports.
[0147] The above-mentioned detection system for safety risk characteristics of roadside trees improves image quality by performing data cleaning on image information; supplements the annotation of categories with sample sizes less than the preset number, solves the sample balance problem and improves the stability of the model; performs data enhancement on image information to generate diversified training samples, which can prevent the model from overfitting on the training data, thereby improving the performance of the model on unseen data, and then simulates different real-world scenarios to improve the robustness of the model, enabling the model to learn stronger and broader features, reduce the model's bias towards specific scenarios or specific conditions, and better identify various types of diseases; adding negative sample image information to the image information can reduce the probability of the model misreporting the background as the target object during actual detection, so that the model is exposed to more different types of backgrounds during training.
[0148] Furthermore, in the improved YOLOv8 network model, the feature extraction network adopts the C2f module and the FPN module, which significantly improves the detection ability of various pests and diseases, while effectively reducing redundant calculations, improving the computational efficiency and feature expression ability of the model, and retaining the model performance; the feature fusion network adopts the SPPF network and introduces the average pooling module, which enables the model to make corresponding decisions based on the high-level semantic information in the deep layer of the network and obtain global context information; at the same time, it can effectively alleviate the huge parameters of the fully connected layer, thereby reducing the black box operation of the fully connected layer and achieving a balance between the lightness and accuracy of the model.
[0149] The pest and disease recognition model trained based on the above training samples and the improved YOLOv8 network model can identify large quantities of various types of tree trunk pest and disease images and quickly provide high-precision recognition results, saving recognition time and reducing investigation costs, providing a more comprehensive reference for urban greening management and decision-making.
[0150] Each module in the above-mentioned detection system for roadside tree safety risk characteristics can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0151] In a feasible embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.10As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for detecting the safety risk characteristics of roadside trees can be implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0152] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0153] In a feasible embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the steps in the method for detecting safety risk characteristics of roadside trees provided in the above embodiment.
[0154] In a feasible embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program is used by a processor to execute the steps in the method for detecting safety risk characteristics of roadside trees provided in the above embodiment.
[0155] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0156] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0157] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
[0158] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A method for detecting safety risk characteristics of roadside trees, characterized in that: include: Obtain image information of the diseased area of the trunk of a roadside tree; Preprocessing the image information to obtain training samples; Based on the training samples, the improved YOLOv8 network model is trained to obtain a trained pest and disease recognition model; wherein the improved YOLOv8 network model includes a selective multi-scale convolution kernel attention mechanism module and an average pooling module; The pest and disease identification model is used to detect the tree trunk image to be identified to obtain a detection result.
2. The method according to claim 1, characterized in that The preprocessing of the image information comprises: Perform data cleaning and data enhancement operations on the image information.
3. The method according to claim 2, characterized in that The data enhancement operation includes: any one or more of a random rotation operation, a brightness transformation operation, a noise addition operation, a random cropping operation, an image flipping operation, and an image translation operation.
4. The method according to claim 2, characterized in that The preprocessing of the image information further includes: Annotating the image information; The categories of the image information are counted, and additional annotations are performed for categories whose sample size is less than a preset number.
5. The method according to claim 4, characterized in that The preprocessing of the image information further includes: Negative sample image information is added to the image information, and the image information and the negative sample image information constitute the training sample.
6. The method according to claim 1, characterized in that: The improved YOLOv8 network model includes a detection head, which includes a large target prediction module and a medium target prediction module. The selective multi-scale convolution kernel attention mechanism module is arranged before the large target prediction module and the medium target prediction module.
7. The method according to claim 6, characterized in that: The improved YOLOv8 network model also includes a feature fusion network, and the average pooling module is arranged in the feature fusion network.
8. A detection system for roadside tree safety risk characteristics, characterized in that: include: An acquisition module, used to acquire image information of the diseased area on the roadside tree; A processing module, used for preprocessing the image information to obtain training samples; A training module, used to train the improved YOLOv8 network model based on the training samples to obtain a trained pest and disease recognition model; wherein the improved YOLOv8 network model includes a selective multi-scale convolution kernel attention mechanism module and an average pooling module; The detection module is used to use the pest and disease identification model to detect the tree trunk image to be identified and obtain the detection result.
9. A computer device 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 method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Intelligent bone marrow cell image detection system and method thereof
CN119762489A
A bone marrow cell image intelligent detection system and method
CN119762489B
Method, system and device for detecting security risk features of border tree and storage medium
CN119810630A
Ancient and famous tree informatization management method and system
CN121037800A
An information management method and system for ancient trees and famous trees
CN121037800B
