Low-cost, high-precision and multifunctional self-adaptive laser weeding device based on improved YOLOv5
By using an improved YOLOv5 model and an adaptive laser weeding device, combined with an electrically driven laser and a dual lifting platform, the problems of low efficiency, high cost and environmental pollution of traditional weeding methods have been solved. This has enabled efficient, environmentally friendly and precise weeding operations, adapting to complex terrain and low light conditions, and improving field operation efficiency.
Patent Information
- Application Number
- CN202511487237.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-17
- Publication Date
- 2026-01-23
AI Technical Summary
In existing technologies, traditional weeding methods are inefficient, labor-intensive, or costly, chemical weeding pollutes the environment, and existing laser weeding robots are expensive and have limited applicability, and their detection accuracy is insufficient under low light conditions, making it difficult to meet the actual needs of farmers.
It adopts an improved YOLOv5 model combined with an electrically driven high-energy-density laser, equipped with a dual adaptive lifting platform and an infrared ranging sensor. The laser is controlled by a servo motor for targeted weeding, and a double-hole connection device is installed at the front end of the first lifting platform to facilitate the movement of agricultural implements. Combined with a mid-tiller and fertilizer applicator, it realizes the integration of weeding, loosening soil and fertilizing.
It achieves efficient and precise weeding operations, reduces manufacturing costs, adapts to complex terrain, reduces damage to soil structure and environmental pollution, improves the accuracy of weed identification and location under low light conditions, and improves field operation efficiency.
Smart Images

Figure CN121369338A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the field of laser weeding machinery for agricultural use, and in particular to a low-cost, high-precision and multifunctional self-adaptive laser weeding device based on an improved YOLOv5. BACKGROUND
[0002] Weed problems have always been a key factor restricting crop yield and quality. Traditional weeding methods have many limitations: manual weeding is low in efficiency and high in labor intensity; mechanical weeding is high in cost and easy to damage soil structure; chemical weeding is economical and efficient, but may cause environmental pollution and food safety problems; with the development of computer vision technology, the YOLO series target detection model in deep learning has shown great potential in weed identification and precision management in agriculture. However, the traditional YOLO model has limitations in low-light environments and small target detection, which limits its application in night-time and fine weeding operations. Laser weeding robots, as a new technology, use high-energy laser beams for weeding, which is efficient and precise. However, the manufacturing cost is high, which is difficult for farmers to bear. The existing equipment is difficult to adapt to the complex and diverse terrain conditions in China, which does not meet the actual needs of agricultural production in China. In addition, laser weeding robots need to turn on the light supplement lamp to improve the lighting conditions when working at night, which not only increases the power consumption, but also may have a certain impact on the ecological environment. SUMMARY
[0003] In order to solve the above problems, the application provides a laser weeding device, which adopts a rudder control high-energy-density laser driven by electric energy, uses the thermal effect of the laser to target and efficiently green weeds, and adopts a double self-adaptive lifting platform, which uses the extension of the electric push rod to drive the first lifting platform and the second lifting platform to move in the vertical direction, so that the camera module and the laser generating system fixed below the second lifting platform are adjusted to the optimal weeding height without damaging crops and equipment. The second lifting platform is equipped with an infrared distance sensor, which can transmit the height data of the second lifting platform to the ground to the upper computer, and the upper computer compares the data with the average height of the preset crops and transmits a control signal to the electric push rod, so that the platform is automatically adjusted to the optimal weeding height. By installing a double-hole connecting device at the front end of the first lifting platform, the laser weeding device can be quickly installed on the existing agricultural vehicle of the farmer, and the mobile weeding is realized by the power of the agricultural vehicle, so as to replace the high-cost manufacturing of the existing automatic laser weeding robot. By installing a cultivator at the rear end of the first lifting platform, the weeding, soil loosening and fertilization integration can be realized in the seeding stage, so as to greatly improve the efficiency of field work. By improving the original YOLOv5 model, the improved model enhances the identification and positioning ability of small targets in low light conditions. The application solves the problems of low efficiency, soil structure damage and serious pollution of traditional weeding methods, and solves the problems of high manufacturing cost, limited application range and high power consumption of existing laser weeding robots when working at night.
[0004] In order to achieve the above object, the application provides the following technical scheme: a low-cost, high-precision and multifunctional self-adaptive laser weeding device based on improved YOLOv5, comprising a self-adaptive lifting transport vehicle, characterized in that: the self-adaptive lifting transport vehicle comprises a bottomless four-wheel frame, the bottomless four-wheel frame is provided with an electric push rod group on the left side and the right side above the bottomless four-wheel frame, the electric push rod group is provided with a first lifting platform fixed above the electric push rod group, the height of the first lifting platform can be adjusted according to the height of crops and agricultural vehicles to meet the demand, the first lifting platform is provided with a double-hole connecting device fixed at the front end and a cultivator installed at the rear end, and a shearing type self-adaptive lifting device is installed at the lower end.
[0005] As a technical scheme of the present application, the double-hole connecting device comprises a T-shaped extension structure and a triangular connecting piece, the T-shaped extension structure and the triangular connecting piece are welded together, the double-hole connecting device is fixed to the front end of the first lifting platform, and when in use, the double-hole connecting device is installed at the rear end of the agricultural vehicle, so that after the agricultural vehicle is started, the whole laser weeding device can move for weeding through the double-hole connecting device by the power of the agricultural vehicle.
[0006] As a technical scheme of the present application, the base of the shearing type self-adaptive lifting device is movably connected with two lifting frames, the planes formed by the two lifting frames are in parallel, the stability of the second lifting platform during lifting is ensured, the two lifting frames are hingedly connected through a connecting cross bar at the middle position, the stability of the whole lifting structure is ensured, a driving cross bar is fixed between the ends of the two lifting frames close to the base, an electric push rod is fixed at the center of one side of the base, the other end of the electric push rod is fixed at the center of the driving cross bar, a second lifting platform is installed at the other end of the lifting frame, a guide wheel is hingedly connected to the end of the lifting frame close to the second lifting platform, a guide wheel groove is fixed to the back of the second lifting platform, guide rails are arranged on both sides of the base, the driving cross bar slides in the guide rails under the extension of the electric push rod, and then drives the guide wheel to slide in the guide wheel groove, so that the second lifting platform is lifted or lowered.
[0007] As a technical scheme of the present application, the camera module is fixed below the center of the second lifting platform by bolts, and the laser generating system is fixed below the rear end of the second lifting platform by bolts, the camera module and the laser generating system can be lifted together with the second lifting platform, so that the most effective working height is achieved without damaging crops and equipment.
[0008] As a technical scheme of the present application, the laser generating system comprises a laser generator and a rudder holder, the rudder holder comprises a rudder holder base, a horizontal rotation rudder structure is installed above the rudder holder base, the horizontal rotation rudder structure controls the rotation of the laser generator in the horizontal direction, the horizontal rotation rudder structure comprises a horizontal rudder and a horizontal mechanism, an up-down rotation rudder structure is combined above the horizontal rotation rudder structure, the up-down rotation rudder structure controls the rotation of the laser generator in the vertical direction, the up-down rotation rudder structure comprises an up-down rudder and an up-down mechanism, the laser generator is fixed at the center of the bearing plane of the up-down mechanism, the rudder rotates by receiving the pulse width modulation signal from the controller and drives the laser generator to rotate, so that the laser generator aims at the weeds.
[0009] As a technical scheme of the present application, the two infrared distance sensors are installed perpendicular to each other in front of the second lifting platform below, and the infrared distance sensor parallel to the ground is responsible for judging whether there is an obstacle in the forward direction, and if there is an obstacle, the infrared distance sensor will transmit the signal of the obstacle in front to the upper computer, and after the data is processed by the upper computer, the control signal will be transmitted to the electric push rod, and the lifting frame is driven upward by the electric push rod to prevent the camera module and the laser generating system from colliding with the obstacle. The infrared distance sensor perpendicular to the ground is responsible for measuring the height between the second lifting platform and the ground, and after the height data is measured, the data is transmitted to the upper computer, and the upper computer compares the data with the average height of the crops and transmits the control signal to the electric push rod, and the lifting frame is driven to move in the vertical direction by the electric push rod, thereby driving the second lifting platform to rise and fall, and adjusting the second lifting platform to the most effective laser weeding height.
[0010] As a technical scheme of the present application, the cultivator-fertilizer machine includes a frame, a fertilizer box is installed above the frame, four fertilizer outlets are arranged at the bottom of the fertilizer box, and a fertilizer discharge pipe is connected to the lower end of the fertilizer outlet. The fertilizer discharge pipe is fixed on the frame, a seven-tooth cultivator is installed at the rear end of the frame, and a walking wheel is installed at the front end to facilitate the laser weeding device to walk in the field and maintain balance. During the seeding stage, the cultivator-fertilizer machine can be installed at the rear end of the first lifting platform to facilitate soil loosening and fertilization while laser weeding.
[0011] On the other hand, the present application proposes an improved method for the YOLOv5 algorithm in the above-mentioned device, which specifically includes:
[0012] S1: using BIFPN weighted feature fusion instead of the ordinary splicing operation in the YOLOv5;
[0013] S2: introducing a CBAM module in the backbone module of YOLOv5;
[0014] S3: using EIoU loss function as the loss function of the network to improve the detection accuracy.
[0015] As a technical scheme of the present application, the step S1 specifically includes:
[0016] The YOLOv5 network structure includes a Backbone module, a Neck module, and a Head module, and BIFPN weighted feature fusion is used to replace all Contact operations in the Neck module of the YOLOv5;
[0017] The introduction of the weighted bidirectional feature pyramid network BIFPN can improve the detection ability of small targets of the model through weighted feature fusion, enhance the efficiency and accuracy of feature extraction, better capture the detailed information of small targets, adapt to complex environments, further improve the robustness and detection accuracy of the model, and thus realize more accurate weed identification and positioning in complex agricultural scenes such as low light.
[0018] As a technical solution of the present application, the step S2 specifically comprises:
[0019] S21: The YOLOv5 network structure comprises a Backbone module, a Neck module and a Head module, a CBAM module is added before the SPPF module after the last C3 structure in the backbone module, the CBAM module comprises a channel attention module and a spatial attention module;
[0020] S22: In the C3 structure described in step S21, a feature map F with a size of HxWxC is generated, wherein H and W represent the height and width of the feature map respectively, C represents the number of channels of the feature map, and the feature map F will be processed by the channel attention module and the spatial attention module in series;
[0021] S23: input the HxWxC feature map F generated in step S22 into the channel attention module, first perform global maximum pooling and global average pooling operations on the feature map F based on the height and width of the feature map, obtain two 1x1xC dimension feature maps, then process the two feature maps through a two-layer neural network MLP respectively, and perform weighted summation on the output feature maps after processing, to generate the weight of channel attention, then normalize the weight through the Sigmoid activation function, then multiply the normalized channel attention weight with the original input feature map, to obtain the channel attention feature map with a dimension of HxWxC , the formula is as follows:
[0022] =
[0023] =
[0024] = +
[0025] wherein, represents the normalized channel attention weight; represents the input feature map of the channel attention module; AvgPool and respectively represent the average pooling operation and the max pooling operation; MLP represents a multi-layer perception network; represents a Sigmoid activation function; and respectively represent the average pooling operation and the max pooling operation output feature maps of the feature map in the height and width dimensions; represents the weight of the multi-layer perception;
[0026] S24: Taking the HxWxC channel attention feature map obtained in step S23 as the input of the spatial attention module, first performing global max pooling and global average pooling operations on the feature map based on the channel dimension of the feature map to obtain two HxWx1 dimension feature maps, then splicing the two feature maps in the channel dimension and generating spatial attention weights through a 7x7 convolution layer, then normalizing the weights through a Sigmoid activation function, then multiplying the normalized spatial attention weights with the input feature map of the spatial attention module to obtain the final HxWxC spatial attention feature map , the formula is as follows:
[0027] =
[0028] =
[0029] wherein, represents the normalized spatial attention weight; represents the channel attention module output feature map; and respectively represent the average pooling operation and the max pooling operation output feature maps of the feature map in the channel dimension; represents a convolution operation with a 7x7 convolution kernel; represents splicing operation of the feature map in the channel dimension.
[0030] As a technical solution of the present application, the step S3 specifically comprises:
[0031] The loss function is a loss function, The formula is as follows:
[0032] +
[0033]
[0034] wherein For the intersection over union of the prediction box and the actual box, B is the prediction box, For the real box, b is the center point of B, The center point of B, For the Euclidean distance between the center of the prediction box and the real box, c is the diagonal length of the minimum circumscribed box of B and B, For the width and height of the prediction box B, And For the width and height of B, The width and height of B, The width of the minimum circumscribed box of B, The height of the minimum circumscribed box of B, The height of the minimum circumscribed box of B, The height of the minimum circumscribed box of B,
[0035] The loss function splits the loss term of the aspect ratio into the difference between the predicted width and height and the minimum circumscribed box, including overlap loss, center distance loss and width and height loss, relative to The loss function converges faster and has higher detection accuracy.
[0036] Compared with the prior art, the beneficial effects of the present application are:
[0037] 1、The present application combines laser technology with an improved target detection model YOLOv5 to develop a laser control system based on target detection, uses a high-energy density laser driven by electric energy to use its thermal effect for weeding, uses the improved YOLOv5 model to accurately identify weeds, and then controls the laser to aim at the weeds through a servo gimbal, so as to achieve the purpose of targeted weeding. Compared with manual weeding, the present application has higher weeding efficiency. Compared with mechanical weeding, the present application will not damage the soil structure when weeding. Compared with chemical weeding, the present application is more environmentally friendly.
[0038] 2、The improved YOLOv5 model of the present application uses a weighted bidirectional feature pyramid network BiFPN to replace all Contact operations in the Neck module of YOLOv5, improves the detection ability of small targets of the model through weighted feature fusion, enhances the efficiency and accuracy of feature extraction, can better capture the detailed information of small targets, adapts to complex environments, further improves the robustness and detection accuracy of the model, so as to realize more accurate weed identification and positioning in complex agricultural scenes such as low light; the CBAM attention mechanism is introduced into the backbone network of YOLOv5 to enhance the attention of important channels and spatial positions of the model, thereby enhancing the detection accuracy and model robustness of the model in complex environments such as night; the Loss function is used to replace the Loss function in the original model to improve the detection accuracy and speed of the model at night.
[0039] 3. The dual self-adaptive lifting platform of the application can automatically adjust the positions of the first lifting platform and the second lifting platform according to the height of crops and the flatness of the terrain, ensuring precise weeding without damaging the crops, which greatly improves the applicability of the device, and the rear end of the first lifting platform can be equipped with a cultivator and fertilizer applicator, allowing for soil loosening and fertilization while laser weeding, effectively improving the efficiency of field work.
[0040] 4. The application finds that the existing independent automatic laser weeding robot has high manufacturing cost, which is difficult for farmers to bear, and instead provides a laser weeding device that can be quickly deployed at the rear end of the existing agricultural implement of the farmers, and a double-hole connecting device is installed at the rear end of the agricultural implement, so that after starting the agricultural implement, the entire laser weeding device can be moved by the power of the agricultural implement through the double-hole connecting device for mobile laser weeding, greatly reducing the manufacturing cost. BRIEF DESCRIPTION OF DRAWINGS
[0041] Figure 1 It is a three-dimensional structure diagram of a low-cost, high-precision, multifunctional self-adaptive laser weeding device based on improved YOLOv5.
[0042] Figure 2 It is a three-dimensional view of a self-adaptive lifting transport vehicle in a low-cost, high-precision, multifunctional self-adaptive laser weeding device based on improved YOLOv5.
[0043] Figure 3 It is a three-dimensional view of a shearing type self-adaptive lifting device in a low-cost, high-precision, multifunctional self-adaptive laser weeding device based on improved YOLOv5.
[0044] Figure 4 It is a three-dimensional view of a double-hole connecting device in a low-cost, high-precision, multifunctional self-adaptive laser weeding device based on improved YOLOv5.
[0045] Figure 5 It is a three-dimensional view of a camera module in a low-cost, high-precision, multifunctional self-adaptive laser weeding device based on improved YOLOv5.
[0046] Figure 6 It is a three-dimensional view of a laser generating system in a low-cost, high-precision, multifunctional self-adaptive laser weeding device based on improved YOLOv5.
[0047] Figure 7 It is a three-dimensional view of a cultivator and fertilizer applicator in a low-cost, high-precision, multifunctional self-adaptive laser weeding device based on improved YOLOv5.
[0048] Figure 8Figure 1 is a network structure diagram of the improved YOLOv5.
[0049] In the figure, the labels are: 1, self-adaptive lifting transport vehicle; 2, double-hole connecting device; 3, cultivator-fertilizer machine; 4, shearing type self-adaptive lifting device; 5, camera module; 6, laser generating system; 7, infrared distance measuring sensor; 21, four-wheel chassis-free vehicle frame; 22, electric push rod group; 23, first lifting platform; 31, base; 32, lifting frame; 33, connecting cross bar; 34, driving cross bar; 35, electric push rod; 36, second lifting platform; 37, guide wheel; 38, guide wheel groove; 39, guide rail; 41, T-shaped extension structure; 42, triangular connecting piece; 51, camera fixing frame; 52, identification positioning camera; 61, servo gimbal base; 62, horizontal mechanism; 63, horizontal servo; 64, up-down servo; 65, up-down mechanism; 66, laser generator; 71, rack; 72, fertilizer box; 73, fertilizer discharge pipe; 74, seven-tooth cultivator; 75, walking wheel. DETAILED DESCRIPTION
[0050] In order to further understand the features, technical means and specific purposes and functions achieved by the present application, the present application will be described in further detail below in conjunction with the drawings and specific embodiments.
[0051] Example 1
[0052] Referring to Figures 1-2 As shown in the figure, a low-cost, high-precision, multi-functional self-adaptive laser weeding device based on improved YOLOv5 includes a self-adaptive lifting transport vehicle (1), characterized in that: the self-adaptive lifting transport vehicle (1) includes a chassis-free four-wheel vehicle frame (21), the chassis-free four-wheel vehicle frame (21) has an electric push rod group (22) built-in on the left and right sides above it, the electric push rod group (22) has a first lifting platform (23) fixed above it, the electric push rod group (22) can adjust the height of the first lifting platform (23) according to the height of crops and agricultural implements, the first lifting platform (23) has a double-hole connecting device (2) fixed at the front end, the first lifting platform (23) has a cultivator-fertilizer machine (3) installed at the rear end, and the first lifting platform (23) has a shearing type self-adaptive lifting device (4) installed at the lower end.
[0053] Referring to Figures 1-3As shown, the shearing type self-adaptive lifting device (4) comprises a base (31), two lifting frames (32) are movably connected to the base (31), the planes formed by the two lifting frames (32) are in parallel relationship, which ensures the stability during the lifting of the platform, the two lifting frames (32) are hingedly connected through a connecting cross rod (33) at the middle position, which ensures the stability of the overall lifting structure, a driving cross rod (34) is fixed between the ends of the two lifting frames (32) close to the base (31), a motor-driven push rod (35) is fixed on the side of the base (31) in the center, the other end of the motor-driven push rod (35) is fixed in the center of the driving cross rod (34), a second lifting platform (36) is installed at the other end of the lifting frame (32), a guide wheel (37) is hingedly connected to the end of the lifting frame (32) close to the second lifting platform (36), a guide wheel groove (38) is fixed to the back of the second lifting platform (36), guide rails (39) are arranged on both sides of the base (31), the driving cross rod (34) slides in the guide rails (39) under the extension of the motor-driven push rod (35), in turn drives the guide wheel (37) to slide in the guide wheel groove (38), so as to realize the lifting or lowering of the second lifting platform. The laser generating system (6) is installed at the lower front end of the second lifting platform (36), the camera module (5) is installed at the lower center, and the two infrared distance sensors (7) are installed at the lower front end.
[0054] Referring to Figures 1-4 As shown, the double-hole connecting device (2) comprises a T-shaped extension structure (41) and a triangular connecting piece (42), the T-shaped extension structure and the triangular connecting piece are integrally welded, the double-hole connecting device (2) is fixed at the front end of the first lifting platform (23), and in use, the double-hole connecting device (2) is installed at the rear end of the agricultural implement, so that after the agricultural implement is started, the entire laser weeding device can move through the double-hole connecting device (2) by the power of the agricultural implement.
[0055] Referring to Figures 1-3As shown, the two infrared distance sensors (7) are installed perpendicular to each other at the front end of the second lifting platform (36), and the infrared distance sensor parallel to the ground is responsible for determining whether there is an obstacle in the forward direction. If an obstacle appears, the infrared distance sensor will transmit an obstacle signal to the upper computer, and after the data is processed by the upper computer, a control signal will be transmitted to the electric push rod (35), which will drive the lifting frame (32) to move upward through the electric push rod (35), preventing the camera module (5) and the laser generating system (6) from colliding with the obstacle. The infrared distance sensor perpendicular to the ground is responsible for measuring the height between the second lifting platform (36) and the ground. After measuring the height data, the data is transmitted to the upper computer, which compares the data with the average height of the crops and transmits a control signal to the electric push rod (35). The electric push rod (35) drives the lifting frame (32) to move in the vertical direction, thereby driving the second lifting platform (36) to rise and fall, adjusting the second lifting platform (36) to the most effective laser weeding height.
[0056] Referring to Figures 1-5 As shown, the camera module (5) includes a camera fixing frame (51) and an identification positioning camera (52). The camera fixing frame (51) is fixed by bolts at the center below the second lifting platform (36), and the identification positioning camera (52) is installed at the center of the lower end of the camera fixing frame (51). The laser weeding device obtains the video stream of the field through the identification positioning camera (52) so that the improved YOLOv5 model can identify weeds and obtain their position information using the video stream.
[0057] Referring to Figures 1-6The laser generating system (6) is fixed below the second lifting platform (36) by bolts, and includes a steering holder and a laser generator (66). The steering holder includes a steering holder base (61), and a horizontal rotating steering structure is installed above the steering holder base (61). The horizontal rotating steering structure includes a horizontal steering (63) and a horizontal mechanism (62), and controls the rotation of the laser generator (66) in the horizontal direction. An up-down rotating steering structure is combined above the horizontal rotating steering structure. The up-down rotating steering structure includes an up-down steering (64) and an up-down mechanism (65), and controls the rotation of the laser generator (66) in the vertical direction. The laser generator (66) is fixed at the center of the bearing plane of the up-down mechanism (65). The horizontal steering (63) and the up-down steering (64) rotate by receiving pulse width modulation signals from the controller, and drive the laser generator (66) to rotate, so that the laser generator (66) aims at the weeds.
[0058] Referring to Figures 1-7 The middle tillage fertilizer distributor (3) includes a frame (71), and a fertilizer box (72) is installed above the frame (71). The bottom of the fertilizer box (72) is provided with four fertilizer outlets, and the fertilizer outlets are connected with fertilizer discharge pipes (73). A seven-tooth middle tillage shovel (74) is installed at the rear end of the frame (71) for soil loosening, and a walking wheel (75) is installed at the front end for balancing the device and facilitating walking in the field. During the seeding stage, the middle tillage fertilizer distributor (3) can be installed at the rear end of the first lifting platform (23) to loosen the soil and fertilize while laser weeding.
[0059] The application is used, first, the height of the first lifting platform (23) is adjusted to the appropriate position according to the height of crops and agricultural implements, and then the double-hole connecting device (2) is installed at the rear end of the agricultural implement, so that after starting the agricultural implement, the whole laser weeding device can be moved by the power of the agricultural implement through the double-hole connecting device (2) for laser weeding, after starting the agricultural implement, the infrared distance sensor (7) equipped on the second lifting platform (36) keeps working, when obstacles or crops with too high height are found in the forward direction, the upper computer controls the second lifting platform (36) to rise to protect the camera module (5), the laser generating system (6) and the crops, when the height between the weeds and the second lifting platform (36) is not suitable, the upper computer will adjust the height of the second lifting platform (36) to ensure that the laser generating system (6) is always at a safe and most effective height, during the seeding stage, the cultivator-fertilizer machine (3) can be installed at the rear end of the first lifting platform before starting the agricultural implement, and the fertilizer is poured into the fertilizer box (72), so as to loosen the soil and fertilize while weeding.
[0060] Embodiment 2
[0061] The improved method of YOLOv5 algorithm in the embodiment, Figure 8 The improved YOLOv5 algorithm network structure specifically comprises:
[0062] S1: using BIFPN weighted feature fusion instead of the ordinary splicing operation in the YOLOv5;
[0063] S2: introducing a CBAM module in the backbone module of YOLOv5;
[0064] S3: using EIoU loss function as the loss function of the network to improve the detection accuracy.
[0065] In the embodiment, the step S1 specifically comprises:
[0066] The YOLOv5 network structure comprises a Backbone module, a Neck module and a Head module, and all Contact operations of the Neck module of the YOLOv5 are replaced by using BIFPN weighted feature fusion;
[0067] Introducing the weighted bidirectional feature pyramid network BIFPN can improve the detection ability of small targets of the model through weighted feature fusion, enhance the efficiency and accuracy of feature extraction, better capture the detailed information of small targets, adapt to complex environments, further improve the robustness and detection accuracy of the model, and thus realize more accurate weed identification and positioning in complex agricultural scenes such as low light and high contrast.
[0068] In the embodiment, the step S2 specifically comprises:
[0069] S21: The YOLOv5 network structure includes a Backbone module, a Neck module, and a Head module, a CBAM module is added before the SPPF module after the last C3 structure in the backbone module, the CBAM module includes a channel attention module and a spatial attention module;
[0070] S22: In the C3 structure described in step S21, a feature map F with a size of HxWxC is generated, wherein H and W represent the height and width of the feature map respectively, C represents the number of channels of the feature map, and the feature map F will be processed by the channel attention module and the spatial attention module in series;
[0071] S23: Input the HxWxC feature map F generated in step S22 into the channel attention module, first perform global maximum pooling and global average pooling operations on the feature map F based on the height and width of the feature map, obtain two 1x1xC dimension feature maps, then process the two feature maps through a two-layer neural network MLP respectively, the output feature maps after processing will be weighted and summed to generate the weight of channel attention, then the weight is normalized by Sigmoid activation function, then the normalized channel attention weight is multiplied with the original input feature map to obtain the channel attention feature map with a dimension of HxWxC , the formula is as follows:
[0072]
[0073]
[0074]
[0075] wherein, represents the normalized channel attention weight; represents the input feature map of the channel attention module; AvgPool and represent the average pooling operation and the maximum pooling operation respectively; MLP represents a multi-layer perceptron network; represents the Sigmoid activation function; and represent the feature maps output by the average pooling operation and the maximum pooling operation in the height and width dimensions of the feature map respectively; represents the weight of the multi-layer perceptron;
[0076] S24: Taking the HxWxC channel attention feature map obtained in step S23 as the input of the spatial attention module, first performing global maximum pooling and global average pooling operations on the feature map based on the channel dimension of the feature map to obtain two HxWx1 dimension feature maps, then splicing the two feature maps in the channel dimension and generating spatial attention weights through a 7x7 convolution layer, then normalizing the weights through a Sigmoid activation function, then multiplying the normalized spatial attention weights with the input feature map of the spatial attention module to obtain the final HxWxC spatial attention feature map , as follows:
[0077]
[0078]
[0079] wherein, denotes the normalized spatial attention weight; denotes the output feature map of the channel attention module; and denote the feature maps output by the average pooling operation and the maximum pooling operation in the channel dimension of the feature map, respectively; denotes a convolution operation with a 7x7 convolution kernel; denotes splicing operation of the feature map in the channel dimension;
[0080] The introduction of the CBAM module in YOLOv5 can improve the feature expression ability through channel and spatial attention mechanisms, especially when dealing with complex scenes or small target detection, it can better capture the details and context information of the target, and enhance the model detection accuracy and model robustness.
[0081] In the embodiment, the step S3 specifically comprises:
[0082] The loss function is loss function, as shown in the following formula:
[0083]
[0084]
[0085] wherein is the intersection over union of the predicted frame and the actual frame, B is the predicted frame, is the actual frame, b is the center point of B, is the center point of b, and To predict the Euler distance between the prediction box and the real box center, c is the width and height of the minimum enclosing box of B and the diagonal length of the minimum enclosing box, To predict the width and height of the prediction box B, and To predict the width and height of the prediction box B, To predict the width and height of the prediction box B, To predict the width and height of the prediction box B, the width of the minimum enclosing box of B and the height of the minimum enclosing box of B and the height of the minimum enclosing box of B and
[0086] The loss function divides the aspect ratio loss term into the difference between the predicted width and height and the minimum enclosing box, including overlap loss, center distance loss and width and height loss, relative to The loss function converges faster and has higher detection accuracy.
[0087] Finally, it should be noted that: the above examples are used to illustrate the technical solutions of the present application, but not to limit it, although the present application has been described in detail with reference to the above examples, those skilled in the art should understand that: the specific embodiments of the present application can still be modified or replaced by the equivalent, without departing from the spirit and scope of the present application, any modification or equivalent replacement, which should be covered within the protection scope of the claims of the present application.
Claims
1. An improved YOLOv5-based low-cost, high-precision, multi-functional adaptive laser weeding device, comprising a self-adaptive lifting transport vehicle (1), characterized in that: The adaptive lifting transport vehicle (1) includes a chassisless four-wheel frame (21). An electric push rod assembly (22) is built into each of the left and right sides above the chassisless four-wheel frame (21). A first lifting platform (23) is fixed above the electric push rod assembly. A double-hole connecting device (2) is fixed at the front end of the first lifting platform (23). A mid-tiller fertilizer applicator (3) is installed at the rear end of the first lifting platform (23). A shear-type adaptive lifting device (4) is installed at the lower end of the first lifting platform (23).
2. The low-cost, high-precision, multi-functional self-adaptive laser weeding device based on improved YOLOv5 according to claim 1, characterized in that: The shear-type adaptive lifting device (4) includes a base (31), on which two parallel lifting frames (32) are movably connected. The two lifting frames (32) are hinged together at the middle position by a connecting crossbar (33). A drive crossbar (34) is fixed between the two lifting frames (32) near the base (31). An electric push rod (35) is fixed at the center of one side of the base (31). The other end of the electric push rod (35) is fixed at the center of the drive crossbar (34). A second lifting platform (36) is installed at the other end of the lifting frame (32). A guide wheel (37) is hinged to the end of the lifting frame (32) near the second lifting platform (36). A guide wheel groove (38) is fixed to the back of the second lifting platform (36). The guide wheel (37) slides in the guide wheel groove (38). There are guide rails (39) on both sides of the base (31). The drive crossbar (34) slides in the guide rails (39). The second lifting platform (36) is equipped with a laser generating system (6) at the rear end, a camera module (5) at the center, and two infrared ranging sensors (7) placed perpendicularly to each other at the front end.
3. The low-cost, high-precision, multi-functional self-adaptive laser weeding device based on improved YOLOv5 according to claim 2, characterized in that: The camera module (5) includes a camera mounting bracket (51) and an identification and positioning camera (52). The camera mounting bracket (51) is fixed at the center below the second lifting platform (36), and the identification and positioning camera (52) is installed at the center of the lower end of the camera mounting bracket (51).
4. The low-cost, high-precision, multi-functional self-adaptive laser weeding device based on improved YOLOv5 according to claim 2, characterized in that: The laser generating system (6) includes a laser generator (66) and a servo gimbal. The servo gimbal includes a servo gimbal base (61), on which a horizontal rotating servo structure is mounted. The horizontal rotating servo structure includes a horizontal servo (63) and a horizontal mechanism (62). Above the horizontal rotating servo structure is an up-and-down rotating servo structure, which includes an up-and-down servo (64) and an up-and-down mechanism (65). The servo gimbal base (61) is fixed at the rear end below the second lifting platform (36), and the laser generator (66) is installed at the center of the bearing plane of the up-and-down mechanism (65).
5. The low-cost, high-precision, multi-functional self-adaptive laser weeding device based on improved YOLOv5 according to claim 1, characterized in that: The inter-tillage fertilizer (3) includes a frame (71), a fertilizer box (72) is installed on the top of the frame (71), the fertilizer box (72) has four fertilizer outlets at the bottom, the lower end of the fertilizer outlets is connected to a fertilizer discharge pipe (73), the fertilizer discharge pipe (73) is fixed on the frame (71), a seven-tooth inter-tillage shovel (74) is installed at the rear end of the frame (71), and a walking wheel (75) is installed at the front end of the frame (71).
6. The improved method of YOLOv5 in the apparatus according to any one of claims 1-5, characterized in that: include: S1: Use BIFPN weighted feature fusion instead of the normal splicing operation in YOLOv5; S2: Introduce the CBAM module into the backbone module of YOLOv5; S3: Use the EIoU loss function as the network's loss function to improve detection accuracy.
7. The improved method of claim 6, wherein: Step S1 specifically includes: The YOLOv5 network structure includes a Backbone module, a Neck module, and a Head module. All Contact operations in the Neck module of YOLOv5 are replaced by BIFPN weighted feature fusion.
8. The improved method of claim 6, wherein: Step S2 specifically includes: S21: The YOLOv5 network structure includes a Backbone module, a Neck module, and a Head module. After the last C3 structure in the backbone module, i.e. before the SPPF module, a CBAM module is added. The CBAM module includes a channel attention module and a spatial attention module. S22: In the C3 structure described in step S21, a feature map F with size H×W×C will be generated, where H and W represent the height and width of the feature map, respectively, and C represents the number of channels of the feature map. The feature map F will be processed by the channel attention module and the spatial attention module simultaneously in a concatenated manner. S23: input the HxWxC feature map F generated in step S22 into a channel attention module, first perform global max-pooling and global average-pooling operations on the feature map F based on the height and width of the feature map, to obtain two feature maps of 1x1xC dimensions, the two feature maps are then processed through a two-layer neural network MLP respectively, the output feature maps after processing will be weighted and summed to generate the weight of channel attention, then the weight is normalized through the Sigmoid activation function, and then the normalized channel attention weight is multiplied with the original input feature map to obtain a channel attention feature map of HxWxC dimensions , the formula is as follows: = ; = ; = + ; wherein, denotes the normalized channel attention weight; denotes the input feature map of the channel attention module; AvgPool and denote the average pooling operation and the max pooling operation, respectively; MLP denotes a multi-layer perceptron network; denotes the Sigmoid activation function; and denote the feature maps outputted by the average pooling operation and the max pooling operation on the height and width dimensions of the feature map, respectively; denotes the weight of the multi-layer perceptron. S24: Using the H×W×C channel attention feature map obtained in step S23 as input to the spatial attention module, first, global max pooling and global average pooling operations are performed on the feature map based on the channel dimension to obtain two H×W×1 dimension feature maps. Then, these two feature maps are concatenated along the channel dimension and passed through a 7×7 convolutional layer to generate spatial attention weights. Next, the weights are normalized using the sigmoid activation function. Finally, the normalized spatial attention weights are multiplied by the input feature map of the spatial attention module to obtain the final H×W×C spatial attention feature map. The formula is as follows: = ; = ; in, Represents the normalized spatial attention weights; This represents the feature map output by the channel attention module; and These represent the feature maps output by the average pooling operation and the max pooling operation on the channel dimension, respectively. This indicates a convolution operation with a 7×7 kernel; express Feature map splicing operation in the channel dimension.
9. The improved method according to claim 6, characterized in that: Step S3 specifically includes: The loss function is: The loss function is shown in the formula below: + ; ; in Let B be the intersection-union ratio of the predicted bounding box and the actual bounding box. Let B be the true bounding box, and b be the center point of B. The center point, Let B be the Eulerian distance between the centers of the predicted bounding box and the ground truth bounding box, and let c be the distance between B and C. The diagonal length of the minimum bounding box. To predict the width and height of bounding box B, and for Width and height, For B and The width of the minimum bounding box. For B and The height of the minimum bounding box.