Field weed recognition method and system based on intelligent vision, electronic equipment and storage medium
Through intelligent vision technology, the YOLOv4 and scSE attention modules are used to extract feature information and identify weeds in the field, solving the problem of insufficient stability in identifying small weed groups and different lighting conditions in the prior art, and achieving high accuracy and high efficiency weed recognition.
Patent Information
- Application Number
- CN202510282130.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-06-27
AI Technical Summary
When identifying field weeds, the prior art has difficulty in identifying small or dense weed groups, and its stability is insufficient, especially under different light and weather conditions, and the classification accuracy of different weed species is not high.
Using an intelligent vision-based method, through image acquisition and preprocessing, YOLOv4 is used for image cutting, and combined with the scSE attention module to extract spatial and channel feature information, grid division and color distinction are performed, and accurate identification of field weeds is finally achieved.
It improves the recognition accuracy of field weeds, enhances the robustness of the model to different environmental conditions, reduces misjudgment, reduces the consumption of computing resources, and improves the efficiency of field management.
Smart Images

Figure CN120219959A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine vision, and particularly relates to a method, system, electronic device and storage medium for identifying field weeds based on intelligent vision. Background Technique
[0002] Weeds are one of the typical hazards in agricultural production activities and have a great negative impact on the growth of crops. Weeds are one of the main factors affecting crop growth and production, and effective measures must be taken to deal with them. Currently, the main weeding methods include manual, mechanical and chemical weeding. Chemical weeding has the characteristics of economy and high efficiency and is the main weeding method in most agricultural areas at present.
[0003] There are challenges in the identification of small or dense weed groups, insufficient stability under different lighting and weather conditions, and the classification accuracy of different weed species needs to be improved. How to effectively identify weeds at different growth stages and different densities; how to maintain high identification accuracy under complex backgrounds and different lighting conditions; and how to solve the problem of small-sample learning urgently need to be solved. Summary of the Invention
[0004] To solve the above problems, the present invention provides a method, system, electronic device and storage medium for identifying field weeds based on intelligent vision, including:
[0005] Step S1: Collect field crop images and perform preprocessing to obtain preprocessed images, and extract features from the preprocessed images to obtain non-weed crop features;
[0006] Step S2: Divide the preprocessed images into grids, and screen out the grids containing non-weed crop features from the grids based on the non-weed crop features to obtain grids containing weed crop features;
[0007] Step S3: Distinguish the colors of the grids containing weed crop features and perform feature comparison to obtain field weed images, and complete the identification of field weeds based on intelligent vision.
[0008] Optionally, in the step S1, the process of extracting features from the preprocessed images to obtain non-weed crop features specifically includes:
[0009] Use YOLOv4 to cut the preprocessed images, and use the scSE attention module to extract features from the cut images, specifically: use the sSE module to extract the spatial feature information of the preprocessed images; use the cSE module to extract the channel feature information of the preprocessed images.
[0010] Optionally, the process of using the sSE module to extract the spatial feature information of the preprocessed images specifically includes:
[0011] Let the spatial feature map set of the preprocessed image be U H,W , U H,W = [u 1,1 , u 1,2 ,..., u i,j , where u i,j is the channel feature information at the image pixel coordinates (i, j), and the spatial feature information is calculated as:
[0012]
[0013] where q i,j is the channel feature map at the image pixel coordinates (i, j) when the number of channels of the preprocessed image is compressed to 1, σ(·) is the sigmoid normalization function, and F sSE is the spatial feature map.
[0014] Optionally, the process of using the cSE module to extract the channel feature information of the preprocessed image specifically includes:
[0015] Let the channel feature map set of the preprocessed image be U c , U c = [u1, u2,..., u c , where u c is the feature map when the image channel is c. After using the global average pooling layer to obtain the feature values of each channel in the feature map and taking the average, a vector z with the length of the number of channels is obtained. Based on the vector z, the feature importance degree of the c-th channel u c is calculated
[0016] where W1 and W2 are the weights of the fully connected layer, and δ(·) is the ReLu function;
[0017] The channel feature information is calculated as:
[0018]
[0019] where σ(·) is the sigmoid normalization function.
[0020] The present invention also provides a field weed recognition system for intelligent vision. The system includes:
[0021] An image acquisition and preprocessing module, configured to acquire a field crop image, perform preprocessing on the image to obtain a preprocessed image, and perform feature extraction on the preprocessed image to obtain non-weed crop features;
[0022] An image grid division module, which is used to divide the preprocessed image into grids, and screen out the grids containing non-weedy crop features from the grids based on the non-weedy crop features, so as to obtain grids containing weedy crop features;
[0023] A field weed recognition module, which is used to distinguish the colors of the grids containing weedy crop features and compare the features to obtain a field weed image, and complete the recognition of field weeds based on intelligent vision.
[0024] Optionally, in the image acquisition and preprocessing module, the process of extracting non-weedy crop features from the preprocessed image specifically includes:
[0025] Using YOLOv4 to cut the preprocessed image, and using the scSE attention module to extract features from the cut image, specifically: using the sSE module to extract the spatial feature information of the preprocessed image; using the cSE module to extract the channel feature information of the preprocessed image.
[0026] Optionally, the process of using the sSE module to extract the spatial feature information of the preprocessed image specifically includes:
[0027] Let the spatial feature map set of the preprocessed image be U H,W , U H,W = [u 1,1 , u 1,2 ,..., u i,j , u i,j is the channel feature information at the image pixel coordinates (i, j), and the spatial feature information is calculated as:
[0028]
[0029] Among them, q i,j is the channel feature map at the image pixel coordinates (i, j) when the number of channels of the preprocessed image is compressed to 1, σ(·) is the sigmoid normalization function, and F sSE is the spatial feature map.
[0030] Optionally, the process of using the cSE module to extract the channel feature information of the preprocessed image specifically includes:
[0031] Let the channel feature map set of the preprocessed image be U c , U c = [u1, u2,..., u c , u c is the feature map when the image channel is c. After using the global average pooling layer to obtain the feature values of each channel in the feature map and taking the average value, a vector z with the length of the number of channels is obtained. Based on the vector z, the c-th channel u cFeature importance
[0032]
[0033] Among them, W1 and W2 are the weights of the fully connected layer, and δ(·) is the ReLu function;
[0034] Channel feature information It is calculated as:
[0035]
[0036] Among them, σ(·) is the sigmoid normalization function, and F cSE is the channel feature map.
[0037] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the method for identifying field weeds based on intelligent vision.
[0038] The present invention also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed, it implements the method for identifying field weeds based on intelligent vision.
[0039] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0040] Through feature extraction and grid division, weeds and crops can be identified more accurately, reducing misjudgment. By screening grids containing non-weed crop features, the amount of data for subsequent processing can be reduced, thereby reducing the consumption of computing resources. Through image cutting by YOLOv4 and feature extraction by the scSE attention module, the robustness of the model to images under different environmental conditions can be enhanced. Optimization of preprocessing and feature extraction can speed up image processing, enabling the system to respond faster to changes in field conditions. Through accurate weed identification, the labor intensity of farmers can be reduced, and the efficiency of field management can be improved. Through the extraction of spatial features and channel features, the model can better adapt to different lighting and weather conditions. By collecting and analyzing weed image data, data support can be provided for field management to help farmers make more scientific decisions. Description of the drawings
[0041] The drawings constituting a part of this application are used to provide a further understanding of this application. The schematic embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation to this application. In the drawings:
[0042] Figure 1 It is the method step diagram of the method for identifying field weeds based on intelligent vision designed for the embodiments of the present invention;
[0043] Figure 2 This is a schematic structural diagram of the electronic device according to an embodiment of the present invention. Description of the drawings:
[0045] 1010, processor; 1020, memory; 1030, input / output interface; 1040, communication interface; 1050, bus. Detailed implementation manners
[0046] In order to better understand the technical solution of the present invention, the embodiments of the present invention will be described in detail below with reference to the drawings. It should be clear that the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention. The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms of "a", "the" and "said" used in the embodiments of the present invention and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.
[0047] Embodiment 1
[0048] A method for identifying field weeds based on intelligent vision, as Figure 1 shown, includes:
[0049] Step S1: Collect field crop images and perform preprocessing to obtain preprocessed images, and extract features from the preprocessed images to obtain non-weed crop features, specifically including:
[0050] The preprocessing process includes denoising filtering, and the methods of denoising filtering can use median filtering and Gaussian filtering.
[0051] Use YOLOv4 to cut the preprocessed image, and use the scSE attention module to extract features from the cut image, specifically: use the sSE module to extract the spatial feature information of the preprocessed image; use the cSE module to extract the channel feature information of the preprocessed image.
[0052] The process of using the sSE module to extract the spatial feature information of the preprocessed image specifically includes: setting the spatial feature map set of the preprocessed image as U H,W , U H,W =[u 1,1 , u 1,2 ,..., u i,j , u i,j is the channel feature information at the image pixel coordinates (i, j), and the spatial feature information is calculated as:
[0053]
[0054] Among them, q i,j is the channel feature map at the image pixel coordinates (i, j) when the number of channels of the preprocessed image is compressed to 1, σ(·) is the sigmoid normalization function, and F sSE is the spatial feature map.
[0055] The process of using the cSE module to extract the channel feature information of the preprocessed image specifically includes: setting the channel feature map set of the preprocessed image as U c , U c = [u1, u2,..., u c , u c is the feature map when the image channel is c. After using the global average pooling layer to obtain the feature values of each channel in the feature map and taking the average, a vector z with the length of the number of channels is obtained. Based on the vector z, the feature importance degree of the c-th channel u c is calculated
[0056]
[0057] Among them, W1 and W2 are the weights of the fully connected layer, and δ(·) is the ReLu function; the channel feature information is calculated as:
[0058]
[0059] Among them, σ(·) is the sigmoid normalization function, and F cSE is the channel feature map.
[0060] Adding the preprocessed image feature scSE obtained by fusing the spatial feature information and the channel feature information into the YOLOv4 Decoupled-head specifically includes:
[0061] Calculating the global context information: For each feature map F, first calculate the global context information, that is, for each channel, calculate the importance of each channel in the feature map;
[0062] Calculating the channel attention weight: According to the global context information, calculate the attention weight of each channel, so that the YOLOv4 model pays more attention to important features;
[0063] Applying the channel attention weight to the feature map: Applying the channel attention weight to each feature map, so as to enhance the perception ability of the YOLOv4 model to important features.
[0064] For the input feature map, calculate the global context information, obtain the global feature vector Q using the global pooling operation, and calculate the attention weight s for each channel according to Q. Specifically:
[0065] s c = s(w1 × Q + w1 × ReLU(w3 × Q));
[0066] Apply the attention weight to the feature map to obtain the enhanced feature map F~:
[0067]
[0068] Based on the enhanced feature map, calculate the spatial context information, obtain the global feature vector through spatial pooling, and calculate the attention weight r for each pixel point based on the global feature vector:
[0069] r i,j = σ(u1 × Q′ c + u2);
[0070] Apply r to the feature map to obtain the enhanced feature map
[0071]
[0072] Step S2: Divide the preprocessed image into grids, and screen out the grids containing non - weed crop features from the grids based on the non - weed crop features to obtain the grids containing weed crop features;
[0073] Adopt the split - validation method, randomly divide the data samples into a training set, a validation set, and a test set according to a ratio. After division, there are 5000 crop and background grid images in the training set, 600 crop and background grid images in the validation set, and the number of samples in the test set is the same as that in the validation set.
[0074] Weeds are similar in color to crops but have a large color difference from the soil background. After the neural grid model identifies the grid image containing crops, color segmentation technology is used to distinguish the image containing only soil and the image containing only weeds to achieve the final weed identification. Crops and weeds are green in the image, and the soil is yellowish-brown. The super-green factor is used to segment green plants, and conditional transformation is carried out on this basis to further improve the image segmentation effect. In the RGB color space, the G (green) component of crops and weeds is greater than the R (red) component or the B (blue) component. Traverse each pixel point in the grid image. First, judge whether its G component is less than the R component or the B component. If so, set its pixel value to 0 (background). Otherwise, calculate the pixel value according to the expression -19R + 24G - 2B > 862. During the image processing process, due to the influence of the background color value, there will be several noise points in the segmented image. In this study, area filtering is used to filter the segmented image to eliminate noise points and improve the segmentation effect. By calculating and marking the pixel connected regions, the regions below the area threshold are marked as noise points and removed from the image.
[0075] Step S3: Differentiate the colors of the grids containing the characteristics of weeds and crops and compare the characteristics to obtain the field weed image, and complete the identification of field weeds based on intelligent vision.
[0076] Color comparison can quickly remove the grid blocks containing soil images. However, for the grid blocks where crops and weeds coexist, feature comparison is needed for screening:
[0077] According to the enhanced feature map obtained in step S1 The enhanced feature map Perform RGB adjustment to obtain the feature map of crops, compare the feature blocks with the feature map, calculate the gradient structural similarity between the features, and obtain the screening result based on the gradient structural similarity.
[0078] Embodiment 2
[0079] An intelligent vision-based field weed identification system, the system includes:
[0080] An image acquisition and preprocessing module, which is used to acquire field crop images and perform preprocessing to obtain preprocessed images, and extract features from the preprocessed images to obtain non-weed crop features.
[0081] The preprocessing process includes denoising filtering, and the methods of denoising filtering can use median filtering and Gaussian filtering.
[0082] Use YOLOv4 to cut the preprocessed image, and use the scSE attention module to extract features from the cut image. Specifically: Use the sSE module to extract the spatial feature information of the preprocessed image; use the cSE module to extract the channel feature information of the preprocessed image.
[0083] The process of using the sSE module to extract the spatial feature information of the preprocessed image specifically includes: Let the spatial feature map set of the preprocessed image be U H,W , U H,W =[u 1,1 , u 1,2 ,..., u i,j , where u i,j is the channel feature information at the image pixel coordinates (i, j). The spatial feature information is calculated as:
[0084]
[0085] where q i,j is the channel feature map at the image pixel coordinates (i, j) when the number of channels of the preprocessed image is compressed to 1, σ(·) is the sigmoid normalization function, and F sSE is the spatial feature map.
[0086] The process of using the cSE module to extract the channel feature information of the preprocessed image specifically includes: Let the channel feature map set of the preprocessed image be U c , U c =[u1, u2,..., u c , where u c is the feature map when the image channel is c. After using the global average pooling layer to obtain the feature values of each channel in the feature map and taking the average, a vector z with the length of the number of channels is obtained. Based on the vector z, calculate the feature importance degree of the c-th channel u c
[0087]
[0088] where W1 and W2 are the weights of the fully connected layer, and δ(·) is the ReLu function; the channel feature information is calculated as:
[0089]
[0090] where σ(·) is the sigmoid normalization function, and F cSE is the channel feature map.
[0091] The preprocessed image features scSE obtained by fusing spatial feature information and channel feature information are added to the YOLOv4 Decoupled-head. Specifically:
[0092] Calculate the global context information: For each feature map F, first calculate the global context information, that is, for each channel, calculate the importance of each channel in the feature map;
[0093] Calculate the channel attention weight: According to the global context information, calculate the attention weight of each channel, so that the YOLOv4 model pays more attention to important features;
[0094] Apply the channel attention weight to the feature map: Apply the channel attention weight to each feature map, so as to enhance the perception ability of the YOLOv4 model to important features.
[0095] For the input feature map, calculate the global context information, use the global pooling operation to obtain the global feature vector Q, and calculate the attention weight s of each channel according to Q. Specifically:
[0096] s c = s(w1 × Q + w1 × ReLU(w3 × Q));
[0097] Apply the attention weight to the feature map to obtain the enhanced feature map F~:
[0098]
[0099] Based on the enhanced feature map, calculate the spatial context information, obtain the global feature vector through spatial pooling, and calculate the attention weight r of each pixel point based on the global feature vector:
[0100] r i,j = σ(u1 × Q′ c + u2);
[0101] Apply r to the feature map to obtain the enhanced feature map
[0102]
[0103] The image grid division module is used to divide the preprocessed image into grids, and based on the non-weed crop features, screen out the grids containing non-weed crop features from the grids to obtain grids containing weed crop features.
[0104] Using the split validation method, the data samples are randomly divided into a training set, a validation set and a test set according to a ratio. After division, there are 5000 crop and background grid images in the training set, 600 crop and background grid images in the validation set, and the number of samples in the test set is the same as that in the validation set.
[0105] Weeds are similar in color to crops but have a large color difference from the soil background. After the neural grid model identifies the grid image containing crops, color segmentation technology is used to distinguish the images containing only soil and the images containing only weeds, so as to achieve the final weed identification. Crops and weeds are green in the image, and the soil is yellowish-brown. The super green factor is used to segment green plants, and conditional transformation is carried out on this basis to further improve the image segmentation effect. In the RGB color space, the G (green) component of crops and weeds is greater than the R (red) component or the B (blue) component. Traverse each pixel point in the grid image. First, judge whether its G component is less than the R component or the B component. If so, set its pixel value to 0 (background). Otherwise, calculate the pixel value according to the expression -19R + 24G - 2B > 862. During the image processing process, due to the influence of the background color value, there will be several noise points in the segmented image. In this study, area filtering is used to filter the segmented image to eliminate noise points and improve the segmentation effect. By calculating and marking the pixel connected regions, the regions below the area threshold are marked as noise points and removed from the image.
[0106] The field weed recognition module is used to distinguish the colors of the grids containing the characteristics of weeds and crops and compare the characteristics to obtain the field weed image, and complete the field weed recognition based on intelligent vision.
[0107] According to the obtained enhanced feature map The enhanced feature map Perform RGB adjustment to obtain the feature map of the crops, compare the feature blocks with the feature map, calculate the gradient structural similarity between the features, and obtain the screening result based on the gradient structural similarity.
[0108] Embodiment III
[0109] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the method for field weed recognition based on intelligent vision described in any one of the above embodiments.
[0110] Figure 2 Fig. shows a more specific schematic diagram of the hardware structure of the electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. Among them, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other inside the device through the bus 1050.
[0111] The processor 1010 can be implemented in the form of a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0112] The memory 1020 can be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 1020 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0113] The input / output interface 1030 is used to connect to the input / output module to achieve information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Among them, the input device can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device can include a display, a speaker, a vibrator, an indicator light, etc.
[0114] The communication interface 1040 is used to connect to a communication module (not shown in the figure) to achieve communication interaction between this device and other devices. Among them, the communication module can achieve communication through a wired method (such as USB (Universal Serial Bus), network cable, etc.) or can also achieve communication through a wireless method (such as a mobile network, WIFI (Wireless Fidelity), Bluetooth, etc.).
[0115] The bus 1050 includes a path for transmitting information between various components of the device (such as the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0116] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, this device may also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device may also only include the components necessary to implement the solutions of the embodiments of this specification and does not necessarily include all the components shown in the figure.
[0117] The system of the above embodiment is used to implement a corresponding method for identifying field weeds based on intelligent vision in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated herein.
[0118] Embodiment 4
[0119] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute a method for identifying field weeds based on intelligent vision as described in any of the foregoing embodiments.
[0120] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device.
[0121] The computer instructions stored in the storage medium of the above embodiment are used to cause the computer to execute a method for identifying field weeds based on intelligent vision as described in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be elaborated herein.
[0122] Those of ordinary skill in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples; under the concept of the present disclosure, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of brevity.
[0123] In addition, for simplicity of explanation and discussion, and so as not to make the embodiments of the present disclosure difficult to understand, well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Further, the devices may be shown in block diagram form in order to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that details regarding the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure are to be implemented (i.e., these details should be fully within the understanding of those skilled in the art). In cases where specific details (such as circuits) are set forth to describe exemplary embodiments of the present disclosure, it will be apparent to those skilled in the art that the embodiments of the present disclosure may be practiced without these specific details or with variations of these specific details. Accordingly, these descriptions should be regarded as illustrative rather than restrictive.
[0124] Although the present disclosure has been described in connection with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art based on the foregoing description. For example, other memory architectures (such as dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0125] Thus, the units of the examples described in the embodiments of this application can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of this application.
[0126] The embodiments of the present disclosure are intended to cover all such alternatives, modifications, and variations that fall within the broad scope of the appended claims. Accordingly, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of the present disclosure shall be included within the protection scope of the present disclosure.
Claims
1. A method for identifying weeds in a field based on intelligent vision, characterized in that: The method specifically comprises: Step S1, collecting field crop images and preprocessing them to obtain preprocessed images, and extracting features from the preprocessed images to obtain non-weed crop features; Step S2, dividing the preprocessed image into grids, and based on the non-weed crop features, filtering out grids containing non-weed crop features from the grids to obtain grids containing weed crop features; Step S3: Perform color differentiation and feature comparison on the grids containing the weed crop features to obtain a field weed image, thereby completing field weed recognition based on intelligent vision.
2. The method for identifying weeds in the field based on intelligent vision according to claim 1, characterized in that: In step S1, the process of extracting features from the preprocessed image to obtain non-weed crop features specifically includes: The preprocessed image is cut using YOLOv4, and the cut image is feature extracted using the scSE attention module, specifically: the spatial feature information of the preprocessed image is extracted using the sSE module; and the channel feature information of the preprocessed image is extracted using the cSE module.
3. The method for identifying weeds in the field based on intelligent vision according to claim 2, characterized in that: The process of extracting the spatial feature information of the preprocessed image using the sSE module specifically includes: Assume that the spatial feature atlas of the preprocessed image is U H,W , U H,W =[u 1,1 ,u 1,2 ,...,u i,j ],u i,j is the channel feature information and spatial feature information at the image pixel coordinate (i, j) Calculated as: Among them, q i,j is the channel feature map at the image pixel coordinate (i, j) when the number of channels of the preprocessed image is compressed to 1, σ(·) is the sigmoid normalization function, and F sSE It is a spatial feature map.
4. The method for identifying weeds in the field based on intelligent vision according to claim 3, characterized in that: The process of extracting the channel feature information of the preprocessed image using the cSE module specifically includes: Assume that the channel feature atlas of the preprocessed image is U c , U c =[u1,u2,...,u c ],u c is the feature map when the image channel is c. The global average pooling layer is used to obtain the feature values of each channel in the feature map and then take the average value to obtain a vector z with a length of the number of channels. Based on the vector z, the cth channel u is calculated. c The feature importance of Among them, W1 and W2 are the weights of the fully connected layer, and δ(·) is the ReLu function; Channel characteristic information Calculated as: Among them, σ(·) is the sigmoid normalization function, F cSE is the channel feature map.
5. An intelligent visual field weed recognition system, the system applying the field weed recognition method according to any one of claims 1 to 4, characterized in that: The system includes: An image acquisition and preprocessing module is used to acquire field crop images and perform preprocessing to obtain preprocessed images, and to perform feature extraction on the preprocessed images to obtain non-weed crop features; An image grid division module, used for gridding the preprocessed image, filtering out grids containing non-weed crop features from the grids based on the non-weed crop features, and obtaining grids containing weed crop features; The field weed recognition module is used to perform color differentiation and feature comparison on the grid containing the weed crop features to obtain a field weed image, thereby completing field weed recognition based on intelligent vision.
6. The field weed identification system based on intelligent vision according to claim 5, characterized in that: In the image acquisition preprocessing module, the process of extracting features from the preprocessed image to obtain non-weed crop features specifically includes: The preprocessed image is cut using YOLOv4, and the cut image is feature extracted using the scSE attention module, specifically: the spatial feature information of the preprocessed image is extracted using the sSE module; and the channel feature information of the preprocessed image is extracted using the cSE module.
7. The field weed identification system based on intelligent vision according to claim 6, characterized in that: The process of extracting the spatial feature information of the preprocessed image using the sSE module specifically includes: Assume that the spatial feature atlas of the preprocessed image is U H,W , U H,W =[u 1,1 ,u 1,2 ,...,u i,j ],u i,j is the channel feature information and spatial feature information at the image pixel coordinate (i, j) Calculated as: Among them, q i,j is the channel feature map at the image pixel coordinate (i, j) when the number of channels of the preprocessed image is compressed to 1, σ(·) is the sigmoid normalization function, and F sSE It is a spatial feature map.
8. The field weed identification system based on intelligent vision according to claim 6, characterized in that: The process of extracting the channel feature information of the preprocessed image using the cSE module specifically includes: Assume that the channel feature atlas of the preprocessed image is U c , U c =[u1,u2,...,u c ],u c is the feature map when the image channel is c. The global average pooling layer is used to obtain the feature values of each channel in the feature map and then take the average value to obtain a vector z with a length of the number of channels. Based on the vector z, the cth channel u is calculated. c The feature importance of Among them, W1 and W2 are the weights of the fully connected layer, and δ(·) is the ReLu function; Channel characteristic information Calculated as: Among them, σ(·) is the sigmoid normalization function, F cSE is the channel feature map.
9. An electronic device, characterized in that: The method comprises 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 4 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 4 is implemented.