Small target detection method and equipment for sewage outlets in aerial images based on improved YOLOv8

By improving the YOLOv8 model and combining STN and GhostModule, the accuracy and robustness of small target detection of sewage outlets in drone aerial images are solved, efficient and accurate sewage outlet detection is achieved, and the intelligent level of water environment monitoring is improved.

CN119785003APending Publication Date: 2025-04-08SHANDONG JIEXUN COMM TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411844111.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-15
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The prior art is difficult to achieve efficient, accurate and automated detection of small targets in complex water environments, especially in aerial images of drones, where the target detection accuracy and robustness are poor, and missed detection and false detection are prone to occur.

Method used

Improve the YOLOv8 model, combine the spatial transformation network STN and GhostModule, and build a small object detection model for sewage outlets of aerial images, and improve the robustness and generalization capabilities of the model through multi-scale training, random rotation, color enhancement and other data enhancement technologies.

Benefits of technology

It significantly improves the detection accuracy and efficiency of small targets in the aerial images of the drone, enhances the adaptability of the model in complex environments, and improves the intelligence level in water environment monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119785003A_ABST
    Figure CN119785003A_ABST
Patent Text Reader

Abstract

The present invention proposes a method and device for detecting small targets of sewage outlets in aerial images based on improved YOLOv8. The method uses drone aerial photography technology to collect images of sewage outlets at different heights, angles, time periods and weather conditions, and improves the diversity and representativeness of training data through a variety of data enhancement technologies (such as multi-scale training, random rotation, color enhancement, etc.). In the improved YOLOv8 model, STN and GhostModule are combined to further improve the robustness and reasoning speed of the model under complex geometric changes. Compared with traditional target detection methods, the improved YOLOv8 model of the present invention has higher accuracy and recall rate in small target detection tasks, especially the robustness and generalization ability under complex backgrounds have been significantly improved. The method provides an efficient and reliable solution for sewage outlet detection in drone aerial images, which can significantly improve the intelligent level of water environment monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of machine vision and relates to a method, device, equipment and medium for detecting small targets at sewage outlets in aerial images based on improved YOLOv8. Background Art

[0002] As water pollution problems become increasingly serious around the world, water environment monitoring has gradually become one of the core areas of environmental protection, especially the monitoring of sewage outlets. As one of the main ways for pollutants to enter water bodies, accurate positioning and real-time monitoring of sewage outlets are of great significance to the protection of water resources and pollution prevention. Although traditional manual inspections and fixed monitoring equipment can monitor sewage outlets to a certain extent, they have shortcomings such as high cost, low efficiency, and limited coverage, and cannot achieve efficient monitoring of large areas of water. Therefore, how to achieve real-time, accurate, and automated monitoring of large-scale and complex waters has become an important technical requirement in current water environment monitoring.

[0003] In recent years, unmanned aerial vehicle (UAV) aerial photography technology has gradually become an efficient tool for water environment monitoring due to its advantages such as flexible maneuverability and high-altitude wide-angle observation. UAVs can fully cover the monitoring area at different heights and angles, and can collect a large amount of high-definition image and video data in a short period of time. This makes it possible to accurately detect large-scale sewage outlets. However, due to the changes in the flight altitude and angle of the drone, as well as the complex water surface environment (such as water surface reflection, vegetation occlusion, changes in lighting conditions, etc.), it is still a technical challenge to automatically and accurately detect smaller sewage outlets from aerial images.

[0004] The problem of small target detection is a typical challenge in the field of computer vision, especially in drone aerial images, where the targets of sewage outlets are small and easily overlooked or confused with other objects in complex backgrounds. At the same time, drone aerial images are often accompanied by geometric transformations (such as rotation, scaling, translation, etc.), which further increase the difficulty of the detection algorithm. Although existing target detection algorithms (such as the traditional YOLO series algorithms) perform well in large target detection, their performance in small target detection tasks is relatively limited. Especially when the target is not obvious enough in the background or is in complex environmental conditions, the detection accuracy and robustness of the model are poor, and missed detection and false detection are prone to occur. Summary of the invention

[0005] The purpose of the present invention is to provide a method, device, equipment and medium for detecting small targets of sewage outlets in aerial images based on improved YOLOv8, aiming to improve the detection accuracy and efficiency of small targets of sewage outlets in drone aerial images, enhance the adaptability of the model in complex environments, and provide effective technical support for intelligent sewage outlet detection in water environment monitoring.

[0006] To this end, the first object of the present invention is to propose a method for detecting small targets in sewage outlets in aerial images based on improved YOLOv8, comprising:

[0007] Acquire a water environment monitoring aerial image dataset that at least includes sewage outlet features, preprocess the water environment monitoring aerial image dataset, and obtain a model training dataset for sewage outlet small target detection in aerial images;

[0008] The YOLOv8 model is improved based on the spatial transformer network STN and the GhostModule feature generation module to build a small target detection model for sewage outlets in aerial images;

[0009] Through model training, the small target detection model of sewage outlet in aerial images is trained;

[0010] The aerial images of the target water environment monitoring area acquired in real time are input into the trained aerial image sewage outlet small target detection model, and the output result is the sewage outlet small target detection result in the input aerial image.

[0011] The acquisition of a water environment monitoring aerial image dataset that includes at least the characteristics of the sewage outlet includes:

[0012] Determine the target water environment monitoring area and the small target identification information contained in the area; wherein the small target identification information at least includes the water boundary information of the target water environment monitoring area, the building information and the vegetation information in the area;

[0013] According to the terrain of the target water environment monitoring area, the flight mode of the drone aerial photography is set; the flight mode includes the drone flight path mode and the drone aerial photography mode;

[0014] Set the shooting parameters of the camera carried by the drone;

[0015] According to the flight mode, the UAV is controlled to conduct aerial photography of the target water environment monitoring area in multiple time periods and weather conditions. All images obtained from the aerial photography are sorted to obtain a water environment monitoring aerial image dataset.

[0016] Among them, the UAV flight path modes include grid-based flight mode, spiral ascent flight mode and return flight mode;

[0017] The drone aerial photography mode adopts a multi-altitude aerial photography strategy to simultaneously obtain a panoramic view and local details of the target water environment monitoring area; the multi-altitude aerial photography strategy includes:

[0018] High-altitude aerial photography: The flight altitude of the UAV is set to the first altitude, and the long-distance image of the target water environment monitoring area is captured by the camera carried by the UAV to identify the overall distribution of potential sewage outlets in the target water environment monitoring area;

[0019] Low-altitude aerial photography: After obtaining the overall distribution of potential sewage outlets based on long-distance image recognition, the flight altitude is set at a second altitude to obtain close-range images that capture the detailed features of the sewage outlets;

[0020] The first height is greater than the second height.

[0021] The shooting parameters of the shooting device carried by the drone are set, including:

[0022] Image overlap and coverage control settings, including:

[0023] Set the image overlap rate during aerial photography to control the image overlap between adjacent aerial images to avoid shooting blind spots;

[0024] Conduct real-time assessment of the coverage of the target water environment monitoring area through aerial photography to ensure effective coverage of all key sewage outlet areas;

[0025] Shooting clarity and resolution settings, including:

[0026] Set the shooting clarity during aerial photography to ensure that the drone remains stable during flight and avoid affecting the clarity of aerial images due to drone vibration or high-speed flight;

[0027] Set the resolution for aerial photography and use 4K or higher resolution cameras to capture the subtle features of key sewage outlets;

[0028] Data transmission and preliminary image processing, including:

[0029] Use the drone's real-time data feedback function to monitor the quality of aerial image acquisition during flight at any time; if the image quality is poor or key areas are not fully captured, adjust the flight path or re-collect data in a timely manner;

[0030] After the flight, all aerial images taken by the drone are preliminarily screened to remove blurry, too dark, too bright, or images with inappropriate angles to ensure that the image quality used for model training and testing meets the standards;

[0031] Image data classification: the aerial images obtained by preliminary image processing are classified according to preset classification rules; wherein the preset classification rules include classification by time and classification by weather conditions;

[0032] The classified aerial images are stored and backed up;

[0033] The classified aerial images are stored in the original data format according to the initial image format; the classified aerial images that need to be quickly processed and transmitted are compressed to ensure the balance between image clarity and file size;

[0034] To ensure data security, the collected data are backed up in multiple locations in a timely manner to obtain a water environment monitoring aerial image dataset.

[0035] Among them, the water environment monitoring aerial image dataset is preprocessed, including:

[0036] Image scaling: Randomly adjust the input image size in the water environment monitoring aerial image dataset, enlarge or reduce the input image to generate training samples with different resolutions;

[0037] Adjust the network input size: Regularly change the size of the input image during the training phase so that the model can adapt to inputs of different scales and thus better handle multi-scale objects;

[0038] Random rotation: randomly adjust the azimuth angle of the input image in the water environment monitoring aerial image dataset;

[0039] Color enhancement: Adjust the brightness, contrast, saturation and random features of the input images in the water environment monitoring aerial image dataset.

[0040] Among them, the YOLOv8 model is improved based on the spatial transformation network STN and the GhostModule feature generation module to build a small target detection model for sewage outlets in aerial images, including:

[0041] The spatial transformer network STN is embedded into the image input and feature extraction stage of the YOLOv8 model to realize the combination of the spatial transformer network STN and the YOLOv8 model;

[0042] Replace the C2f module in the YOLOv8 model with the GhostModule feature generation module to achieve the combination of the GhostModule feature generation module and the YOLOv8 model.

[0043] Among them, the loss functions used in the small target detection model of sewage outlets in aerial images include:

[0044] GIoU, the formula is expressed as:

[0045]

[0046]

[0047] U loss =1-GIoU

[0048] Among them, PR is the predicted box, GT is the real box, C is the area of ​​the smallest enclosed rectangle between the predicted box and the real box; Conf loss and Class loss , the formula is:

[0049]

[0050]

[0051] Among them, C i is the confidence of the predicted i-th target, is the confidence that the true target matches the prediction, is whether the object is in the grid cell, Indicates that the prediction is determined by the jth prediction result in the grid cell;

[0052] The total loss of the small target detection model for the sewage outlet in aerial images is defined as:

[0053] Loss = GIoU loss +Conf loss +Class loss .

[0055] The second object of the present invention is to propose a small target detection device for sewage outlets in aerial images based on improved YOLOv8, comprising:

[0056] An image acquisition module is used to acquire a water environment monitoring aerial image dataset including at least sewage outlet features, preprocess the water environment monitoring aerial image dataset, and obtain a model training dataset for small target detection of sewage outlets in aerial images;

[0057] The model building module is used to improve the YOLOv8 model based on the spatial transformation network STN and the GhostModule feature generation module to build a small target detection model for sewage outlets in aerial images;

[0058] A model training module, used to train a small target detection model for sewage outlets in aerial images through model training;

[0059] The detection module is used to input the real-time acquired aerial images of the target water environment monitoring area into the trained aerial image sewage outlet small target detection model, and the output result is the sewage outlet small target detection result in the input aerial image.

[0060] A third object of the present invention is to provide an electronic device, comprising:

[0061] processor;

[0062] a memory for storing processor-executable instructions;

[0063] The processor is configured to execute instructions to implement the offline positioning method of the aforementioned technical solution.

[0064] A fourth object of the present invention is to provide a computer-readable storage medium, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the offline positioning method as described in the aforementioned technical solution.

[0065] Different from the prior art, the present invention provides a method for detecting small targets of sewage outlets in aerial images based on improved YOLOv8. The method uses drone aerial photography technology to collect images of sewage outlets at different heights, angles, time periods and weather conditions, and improves the diversity and representativeness of training data through a variety of data enhancement techniques (such as multi-scale training, random rotation, color enhancement, etc.). In the improved YOLOv8 model, STN and GhostModule are combined to further improve the robustness and reasoning speed of the model under complex geometric changes. Compared with traditional target detection methods, the improved YOLOv8 model of the present invention has higher accuracy and recall rate in small target detection tasks, especially the robustness and generalization ability under complex backgrounds have been significantly improved. This method provides an efficient and reliable solution for sewage outlet detection in drone aerial images, which can significantly improve the intelligent level of water environment monitoring. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The present invention and / or additional aspects and advantages will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0067] Figure 1 It is a flow chart of a method for detecting small targets at sewage outlets in aerial images based on improved YOLOv8 provided by the present invention.

[0068] Figure 2 It is a structural schematic diagram of an improved YOLOv8 model in a small target detection method for sewage outlets in aerial images based on improved YOLOv8 provided by the present invention.

[0069] Figure 3 It is a schematic diagram of the process of feature transformation of the spatial transformation network STN in the small target detection method of sewage outlets in aerial images based on improved YOLOv8 provided by the present invention.

[0070] Figure 4 It is a structural schematic diagram of a GhostModule feature generation module in a small target detection method for sewage outlets in aerial images based on improved YOLOv8 provided by the present invention.

[0071] Figure 5 The present invention provides an aerial image of a target water environment monitoring area that is captured in real time after preprocessing in a method for detecting small targets at sewage outlets in aerial images based on improved YOLOv8.

[0072] Figure 6 It is a detection result image after model detection in a small target detection method for sewage outlets in aerial images based on improved YOLOv8 provided by the present invention.

[0073] Figure 7 A schematic diagram of the structure of a small target detection device for sewage outlets in aerial images based on improved YOLOv8 provided in an embodiment of the present disclosure;

[0074] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0075] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0076] Figure 1 The present invention provides a method for detecting small targets at sewage outlets in aerial images based on improved YOLOv8. The method includes:

[0077] S101: Acquire a water environment monitoring aerial image dataset that at least includes sewage outlet features, preprocess the water environment monitoring aerial image dataset, and obtain a model training dataset for sewage outlet small target detection in aerial images.

[0078] The present invention uses a drone carrying a shooting device to shoot when acquiring aerial images. Drone aerial photography technology has become the main data source for sewage outlet detection in the present invention due to its flexibility and wide applicability. Aerial images of the target area are collected by drones at different heights, angles, time periods and weather conditions to ensure comprehensive data coverage. These images not only include sewage outlets, but also cover various complex backgrounds, such as water surface reflections, vegetation, buildings, etc. In order to improve the robustness of the model, especially its adaptability under different lighting and weather conditions, the present invention uses a variety of data enhancement technologies such as multi-scale training, random rotation, color enhancement, etc. to ensure the diversity and representativeness of the training data.

[0079] In an embodiment of the present invention, obtaining a water environment monitoring aerial image dataset including at least sewage outlet features includes:

[0080] Determine the target water environment monitoring area and the small target identification information contained in the area; wherein the small target identification information at least includes the water boundary information of the target water environment monitoring area, the building information and the vegetation information in the area.

[0081] Before taking drone aerial photos, you need to do the following steps:

[0082] Mission planning and preparation, including:

[0083] Regional survey and flight permit application: Determine the target area for sewage outlet monitoring through technologies such as Geographic Information System (GIS) or satellite maps. This includes information such as the boundaries of the water area, nearby buildings, and vegetation.

[0084] Apply for flight permits: Depending on the geographic location of the monitoring area, apply for necessary flight permits and security approvals, especially in areas close to buildings, military areas or airports.

[0085] UAV equipment selection and inspection, including:

[0086] Select UAV equipment: According to the requirements of the sewage outlet inspection task, select UAV equipment with high-definition camera function, long flight time and multi-rotor stable flight function;

[0087] Pre-flight inspection: Perform a comprehensive inspection of the drone and its equipment, including batteries, sensors, cameras, flight control systems, etc., to ensure that the equipment is in good condition and avoid equipment failure during flight.

[0088] The flight mode of the drone aerial photography is set according to the terrain of the target water environment monitoring area; the flight mode includes the drone flight path mode and the drone aerial photography mode.

[0089] In the embodiment of the present invention, the UAV flight path mode includes UAV flight route design and UAV flight route design; UAV flight route design software is used for design and planning. Specifically, the UAV flight path planning software is used to design the route of the monitoring area to ensure coverage of the entire area; the UAV flight path adopts a grid-based flight mode to perform grid-based aerial photography of the entire monitoring area. This mode can ensure that the UAV obtains continuous and seamless images in each voyage. Spiral ascent, return and other modes can also be used according to the complexity of the terrain.

[0090] The drone aerial photography mode includes the drone flight altitude setting; specifically, the drone flight altitude setting adopts a multi-altitude aerial photography strategy to simultaneously obtain a panoramic view and local details of the target water environment monitoring area; wherein, the multi-altitude aerial photography strategy includes:

[0091] High-altitude aerial photography: The flight altitude of the UAV is set to the first altitude, and the long-distance image of the target water environment monitoring area is captured by the camera carried by the UAV to identify the overall distribution of potential sewage outlets in the target water environment monitoring area;

[0092] Low-altitude aerial photography: After obtaining the overall distribution of potential sewage outlets based on long-distance image recognition, the flight altitude is set at a second altitude to obtain close-range images that capture the detailed features of the sewage outlets;

[0093] The first height is greater than the second height.

[0094] Set the shooting parameters of the camera carried by the drone. The shooting parameters include shooting angle and shooting direction.

[0095] Drone shooting angle settings include:

[0096] Vertical shooting uses orthophoto shooting. The drone performs vertical flight over the target area to obtain orthophotos. This type of image has no perspective distortion and is very suitable for subsequent image processing, stitching and target detection.

[0097] Tilt shooting: In order to capture the topographic features and structural details around the sewage outlet, the drone is tilted at a certain angle for side shooting. This can supplement the side information that cannot be captured by vertical shooting and enhance the understanding of the three-dimensional structure of the sewage outlet. The tilt angle of the drone is set to 30°-45°.

[0098] The shooting direction is set to all-around shooting. For a specific sewage outlet area, a drone is used for all-around shooting. The drone flies 360° around the sewage outlet to obtain image data from multiple angles. This helps the model learn the three-dimensional features of the sewage outlet and improves recognition accuracy.

[0099] According to the flight mode, the UAV is controlled to conduct aerial photography of the target water environment monitoring area in multiple time periods and weather conditions. All images obtained from the aerial photography are sorted to obtain a water environment monitoring aerial image dataset.

[0100] Multi-time shooting includes:

[0101] Morning aerial photography: The light conditions in the early morning are softer and the reflection on the water surface is weaker, which is conducive to taking clear images of the sewage outlet. It is recommended to take aerial photos after sunrise to capture the characteristics of the area in low light.

[0102] Noon aerial photography: During the noon period, the light is the strongest, and the images taken can clearly reflect the brightness difference of the sewage outlet and its surroundings. A high-light environment can help the model adapt to various light conditions.

[0103] Dusk aerial photography: Aerial photography before sunset can provide a special perspective under low light and oblique light. Images taken during this period can help the model adapt to environments with complex lighting.

[0104] Multi-weather shooting includes:

[0105] Sunny day aerial photography: Obtain image data under optimal lighting conditions in clear, cloudless weather. Such images can be used as a benchmark to help reference target features under optimal image quality during model training.

[0106] Cloudy aerial photography: Under the scattered light conditions of cloudy days, the reflection of the water surface is reduced, which can enhance the prominence of the sewage outlet target against the background. At the same time, images under cloudy conditions help the model improve detection capabilities in low-contrast environments.

[0107] Aerial photography in rainy days: Under the premise of safe flight, collect a small amount of data in rainy or humid environments to simulate sewage outlet monitoring scenarios in special environments and enhance the robustness of the model under severe weather conditions.

[0108] In addition, setting the shooting parameters of the shooting device carried by the drone also includes:

[0109] Image overlap and coverage control;

[0110] Overlap rate setting: ensure that there is appropriate overlap between adjacent images (horizontal overlap rate is 70%, vertical overlap rate is 80%), so as to ensure that there is no blind area when stitching images, while improving the integrity and continuity of the images.

[0111] Coverage assessment: Real-time assessment of the area coverage of aerial photography to ensure that all key sewage outlet areas are effectively covered to avoid omissions or blind spots.

[0112] Clarity and resolution requirements for data collection;

[0113] Image resolution setting: Ensure that the resolution of the aerial image is suitable for the needs of subsequent target detection. Use a camera with 4K resolution or higher to capture the subtle features of the sewage outlet.

[0114] Prevent motion blur: Make sure the drone remains stable during flight, especially in low light or high wind conditions, to avoid blurry images caused by drone vibration or high speed flight.

[0115] Real-time data transmission and preliminary processing;

[0116] Real-time image transmission: Use the real-time data transmission function of the drone to monitor the image acquisition quality at any time during flight. If the image quality is poor or key areas are not fully captured, adjust the flight path or re-collect data in time.

[0117] Preliminary image screening: After the flight, the images are screened to remove blurry, too dark, too bright, or images with inappropriate angles to ensure that the image quality used for model training and testing meets the standards.

[0118] Image data classification;

[0119] The aerial images obtained by the preliminary image processing are classified according to preset classification rules; wherein the preset classification rules include classification by time and classification by weather conditions; specifically,

[0120] Classification by time: Classify images according to the shooting time, such as morning, noon, dusk and other different time periods, and store them separately.

[0121] Classification by weather: Images under sunny, cloudy, rainy and other conditions are stored separately to facilitate subsequent training and verification of models under different weather conditions.

[0122] Data storage and backup of classified aerial images;

[0123] Data format selection: Select a high-quality image format (such as RAW, TIFF, etc.) to save the original data for subsequent processing. For images that need to be processed and transmitted quickly, use the JPEG format for appropriate compression to ensure a balance between image clarity and file size.

[0124] Data backup and storage: To ensure data security, the collected data should be backed up in multiple locations in a timely manner.

[0125] Through the above steps, comprehensive and accurate data collection can provide rich and reliable image data for the subsequent sewage outlet small target detection model, which helps the model to have stronger generalization ability and detection accuracy in various complex environments.

[0126] Furthermore, in order to improve the robustness and generalization ability of the YOLOv8 model for small target detection at sewage outlets, it is necessary to preprocess the water environment monitoring aerial image dataset, and the preprocessing step needs to be optimized for the diversity of image data. Through multi-scale training, random rotation, color enhancement and other technologies, the performance of the model can be enhanced under different environments, angles and lighting conditions.

[0127] Preprocessing methods include:

[0128] 1. Multi-scale training, the specific steps include:

[0129] Image scaling: Randomly adjust the input image size in the water environment monitoring aerial image dataset, enlarge or reduce the input image to generate training samples with different resolutions;

[0130] Adjust network input size: Regularly change the size of the input image during the training phase so that the model can adapt to inputs of different scales and thus better handle multi-scale objects.

[0131] 2. Random rotation, on the one hand, can effectively avoid the model's dependence on a fixed angle image and adapt to the image data collected by the drone at different angles and flight trajectories. On the other hand, it can increase the model's robustness to different poses of the target in the image and enhance the accuracy of sewage outlet detection at different angles. The steps of random rotation include:

[0132] Random rotation angle: During the training process, the input image is randomly rotated, and the rotation angle is usually selected between -90 degrees and 90 degrees. In this way, the model can learn to recognize objects at different rotation angles.

[0133] Padding and cropping after rotation: After the image is rotated, blank areas may appear at the edges of the image. You can choose to fill them with black or randomly crop these areas to ensure the integrity of the training image.

[0134] Maintain the integrity of the target: When rotating, ensure that key targets such as sewage outlets do not partially exceed the image boundary due to rotation, resulting in loss of information.

[0135] 3. Color enhancement: The color enhancement of the image enables the model to adapt to image changes under different lighting and weather conditions, such as cloudy days, direct sunlight, water surface reflection, etc. Through color enhancement, the model can adapt to various complex natural environments to improve the robustness of the sewage outlet under different lighting and background conditions. The steps of color enhancement include:

[0136] Brightness adjustment: Randomly change the brightness of the image so that there are samples in both bright and dark scenes for training, thereby improving the performance of the model under strong and weak light conditions.

[0137] Contrast adjustment: Increase or decrease the contrast of the image to simulate the effects of cloudy days, sunlight changes, etc., thereby enhancing the model's adaptability to different weather conditions.

[0138] Saturation adjustment: Adjust the saturation of the image so that the model can handle scenes with different color information and adapt to complex water surface reflections and vegetation backgrounds.

[0139] Random noise: Add a certain amount of noise to the image to simulate the changes in image quality in real scenes and improve the model's ability to resist interference from noisy images.

[0140] Through the above detailed data collection, image preprocessing and data enhancement steps, the YOLOv8 model can better adapt to complex drone aerial photography scenes and improve the detection effect of small targets at sewage outlets.

[0141] S102: Improve the YOLOv8 model based on the spatial transformer network STN and GhostModule feature generation module to build a small target detection model for sewage outlets in aerial images.

[0142] When optimizing the YOLOv8 model, two key improvement strategies are mainly applied: the introduction of the Spatial Transformer Network (STN) and the GhostModule. These improvements are aimed at improving the robustness of the model under complex geometric changes and the performance in small target detection tasks, especially in scenarios such as drone image processing. The improved model structure is as follows Figure 2 shown.

[0143] Specific improvements include:

[0144] The spatial transformer network STN is embedded in the image input and feature extraction stage of the YOLOv8 model to realize the combination of the spatial transformer network STN and the YOLOv8 model. The spatial transformer network STN performs feature transformation as follows Figure 3 shown.

[0145] The Spatial Transformer Network (STN) is a module that can learn geometric transformations to improve the ability of neural networks to cope with geometric changes in input images (such as rotation, scaling, and translation). The core advantage of STN is that it reduces the reliance on external data enhancement by actively adjusting the geometry of the input data, thereby improving the robustness and generalization of the model. First proposed by Jaderberg et al. in 2015, the introduction of STN solves the problem of unstable performance of neural networks when facing geometric changes in input images (such as rotation, scaling, and translation). By embedding STN, the neural network can actively learn to geometrically adjust the input data, thereby automatically aligning important information and improving the overall performance of the model.

[0146] The basic structure of STN consists of three key components: localization network, transformation network and sampler. Localization network: responsible for processing input features and generating transformation parameters, usually a small convolutional network or a fully connected layer network to predict the parameter matrix describing the geometric transformation. Transformation network (grid generator): performs transformations based on these parameters, such as affine transformation or perspective transformation, to perform geometric operations on the input feature map. Sampler: Samples the transformed feature map using an interpolation method (such as bilinear interpolation) to generate a feature map of the same size as the original input. This combination enables STN to be integrated into any deep learning model in an end-to-end manner, greatly enhancing the model's sensitivity to input changes.

[0147] The core advantage of STN is that it is very robust to geometric changes in input data. In traditional convolutional neural networks (CNNs), the model is sensitive to translation, rotation, or scaling of the input image, which usually requires a lot of data augmentation to compensate for the impact of geometric transformation on model performance. However, STN reduces the reliance on external data augmentation by learning to perform geometric transformations on input data, thereby improving the generalization ability of the model.

[0148] Since YOLOv8 is still sensitive to geometric transformations in the input image, especially in complex scenes such as drone images and satellite images, due to changes in factors such as angle and distance, the target object may be rotated, scaled or partially occluded in a large range, resulting in a decrease in detection performance. Combining STN with YOLOv8 can further optimize the model structure and enhance the robustness of the model to the translation, rotation or scaling of the input image, so that it has excellent performance in small target detection and large-scale target recognition tasks. Furthermore, combining STN with YOLOv8 can significantly improve the robustness of YOLOv8 in the face of complex geometric changes (feature transformation). In this combined architecture, the STN module is embedded in the feature extraction stage of YOLOv8, responsible for geometric alignment of the input image, so that YOLOv8 can more accurately capture the key information of the target in the subsequent feature extraction and target detection process. Especially in small target detection, the target often undergoes geometric deformation due to complex scenes, changes in perspective, etc. STN can enhance the model's detection ability for these small targets by actively adjusting the geometric structure of the input features.

[0149] In YOLOv8, the STN module is introduced into each stage of image input and backbone feature transformation. Since drone images are often accompanied by geometric changes such as rotation, scaling or partial occlusion, combining STN with YOLOv8 can automatically align the geometric structure in the input image, allowing the network to more accurately capture the key features of the target in small target detection and large-scale target recognition tasks, significantly improving the overall performance of the model. The introduction of STN is particularly important for the detection of targets such as drainage outlets and small infrastructure in drone images, which enhances the model's ability to recognize small targets in complex scenes.

[0150] By adding STN, the model can automatically adjust the position and shape of the target in the input image to ensure that it can maintain high detection accuracy under various geometric transformations. This is especially important for the detection of small targets. For small-scale targets such as drainage holes and road cracks in drone images, STN can enhance the detection effect through geometric alignment.

[0151] The GhostModule feature generation module replaces the C2f module in the YOLOv8 model to achieve the combination of the GhostModule feature generation module and the YOLOv8 model. The structure of the GhostModule feature generation module is as follows Figure 4 shown.

[0152] GhostModule is an efficient feature generation module proposed in recent years. It aims to reduce the amount of computation and parameter size in deep neural networks while maintaining excellent performance. It is designed specifically for resource-constrained devices such as mobile terminals and edge computing platforms. In a typical convolutional neural network, the convolution layer is responsible for extracting features from the input data, but this process is computationally expensive and redundant. GhostModule optimizes network performance by reducing redundant calculations and generating feature maps in a more efficient way. Its design concept makes GhostModule very suitable for the detection of small-target sewage outlets by drones, because the computing resources of drone systems are limited and the detection tasks require high real-time performance.

[0153] The working principle of GhostModule can be divided into two parts: first, it generates a part of the original feature map through regular convolution operations, called "main feature maps"; then, it uses a set of simple linear operations (such as depth-separable convolution or weighted addition) to generate additional feature maps, called "ghost feature maps". These ghost feature maps are derived from the main feature map, maintaining the semantic consistency of the features, but the computational cost is much lower than traditional convolution operations. The advantage of this feature generation mechanism is that it can produce richer feature representations with a small amount of calculation, while greatly reducing the number of parameters and calculations. This makes GhostModule particularly suitable for deployment on systems that require low power consumption and efficient computing.

[0154] In addition, the cheap linear operations in the GhostModule design can capture subtle feature changes in the input data, especially when dealing with small targets. Therefore, in UAV image analysis tasks, especially small target detection scenarios, such as detecting pests in farmland or cracks in ground facilities, the lightweight and efficient feature generation of GhostModule can significantly reduce computational overhead while maintaining high detection accuracy.

[0155] In YOLOv8, the C2f module (Cross Stage Partial Block with Fusion) is designed to improve the feature extraction capability of the model through cross-layer feature fusion. The C2f module adopts a partially connected strategy that combines cross-layer feature fusion with convolution operations, aiming to reduce information loss and improve computational efficiency. Although the C2f module performs well in processing features, it still relies on multiple convolution operations and cross-layer feature reuse, resulting in relatively large computational workloads, which may increase the computational burden and energy consumption of the model, especially when running on resource-constrained devices. Therefore, in application scenarios such as drones that require extremely high real-time performance, the C2f module may not be the best choice. In contrast, replacing the C2f module in YOLOv8 with the GhostModule can further reduce computational complexity and parameter quantity while maintaining detection accuracy, providing significant advantages for drone small target detection.

[0156] Replacing the C2f module with GhostModule has the following advantages:

[0157] (1) Significantly improved computing efficiency

[0158] The core advantage of GhostModule is that it greatly reduces the amount of computation by generating cheap "ghost feature maps". Compared with the C2f module, GhostModule generates additional feature maps through simple linear transformations while maintaining the same feature representation capabilities, without relying on additional complex convolution operations. Therefore, after replacing the C2f module, the overall computation of YOLOv8 will be significantly reduced, especially in the real-time small target detection scenario of drones. This improvement in computational efficiency can significantly speed up the inference speed and improve the response time and real-time processing capabilities of drones.

[0159] (2) Model parameters are reduced, making it suitable for edge computing

[0160] In drone systems, hardware resources are limited, especially computing power and storage space are relatively small. GhostModule makes the YOLOv8 model more lightweight by reducing unnecessary convolution operations and parameters. This is of great significance for deploying target detection models on drones. The reduced number of parameters not only means that the model takes up less memory, but also reduces the requirements for computing resources, allowing the model to run on more efficient edge devices. This lightweight design is especially beneficial for drones to perform long-term missions, such as farmland monitoring, disaster area detection, and other mission scenarios that require drones to fly for a long time.

[0161] (3) Improve the accuracy of small target detection

[0162] Small target detection tasks usually require the network to more accurately capture the detailed features in the input data, and these small targets are often difficult to detect due to long distances, occlusions, or noise. GhostModule effectively enhances the network's ability to capture detailed features by generating richer feature maps. Compared with the partial feature reuse strategy of the C2f module, GhostModule provides more ghost feature maps, which can effectively cover the slight changes of small targets, thereby improving YOLOv8's ability to detect small targets in drone images. For example, in high-altitude drone images, small infrastructure on the ground (such as drains, cracks, etc.) may be difficult to identify due to their small size. GhostModule can enhance the perception of these small targets through more efficient feature representation.

[0163] (4) Reduce energy consumption and improve drone endurance

[0164] Energy consumption is a key factor for drone missions. Long-term flight or continuous monitoring requires that the system power consumption be minimized as much as possible. GhostModule significantly reduces the energy consumption of the model by reducing the computational effort of convolution operations. Especially when performing complex detection tasks for a long time, using GhostModule can effectively extend the flight time of the drone. In contrast, the C2f module requires multiple cross-layer fusion and convolution operations, which has a large computational overhead and may accelerate battery consumption. Therefore, using GhostModule instead of C2f module can not only improve the detection performance of the model, but also reduce the overall energy consumption of the system, providing stronger support for drones to perform long-term tasks.

[0165] (5) Improve the speed and accuracy of real-time detection

[0166] The lightweight nature of GhostModule greatly improves the reasoning speed of YOLOv8, which is crucial for real-time detection of drones during flight. Especially on fast-moving drones, the real-time processing capability of images directly affects the reliability of detection results and the success rate of tasks. By using GhostModule, YOLOv8 can respond faster when dealing with complex backgrounds and small targets while ensuring high detection accuracy. This real-time advantage can significantly improve the execution efficiency and effectiveness of tasks when applied to small target detection tasks at drone drain outlets.

[0167] In the future, with the continuous development of drone technology and edge computing devices, GhostModule's efficient feature generation mechanism is expected to be applied in more scenarios, especially in small target detection tasks that require high precision and low energy consumption. GhostModule not only provides a new direction for lightweight network design, but also lays the foundation for efficient and intelligent detection of edge devices. In general, after GhostModule replaces the C2f module and combines with YOLOv8, it can not only greatly improve computing efficiency, reduce the number of parameters and reduce energy consumption, but also show better accuracy and real-time performance in small target detection. This provides a more efficient and flexible solution for drones to perform complex detection tasks in resource-constrained environments.

[0168] In general, by introducing STN and GhostModule, the detection performance of YOLOv8 has been comprehensively optimized, especially in small target detection, computational efficiency and model lightweight. These improvements enable it to better adapt to the real-time detection tasks of drones in complex scenes and significantly improve the robustness and application breadth of the model.

[0169] S103: Training a small target detection model for sewage outlets in aerial images through model training.

[0170] In order to improve the generalization ability of the model in different scenarios, the present invention adopts multi-scale training technology, that is, in the process of model training, images of different resolutions are used for training so that the model can adapt to input images of different scales. At the same time, data enhancement technologies such as random rotation, color enhancement, and blur processing are added to further improve the robustness of the model in complex environments. In this way, the improved YOLOv8 model can better cope with the task of sewage outlet detection under different weather and lighting conditions.

[0171] The present invention realizes accurate detection of small targets at sewage outlets in complex backgrounds through an improved YOLOv8 model. Experiments show that compared with traditional target detection algorithms, the improved YOLOv8 model has higher accuracy and recall rate in small target detection tasks, especially in complex scenes, the robustness and generalization ability of the model are significantly improved. The detection method of the present invention provides an efficient and reliable solution for sewage outlet detection in drone aerial images, which helps to improve the intelligent level of water environment monitoring.

[0172] The loss functions used in the small target detection model for sewage outlets in aerial images include:

[0173] GIoU, the formula is expressed as:

[0174]

[0175]

[0176] GIoU loss =1-GIoU

[0177] Among them, PR is the predicted box, GT is the real box, and C is the area of ​​the smallest enclosed rectangle between the predicted box and the real box;

[0178] Conf loss and Class loss , the formula is:

[0179]

[0180]

[0181] Among them, C i is the confidence of the predicted i-th target, is the confidence that the true target matches the prediction, is whether the object is in the grid cell, Indicates that the prediction is determined by the jth prediction result in the grid cell;

[0182] The total loss of the small target detection model for the sewage outlet in aerial images is defined as:

[0183] Loss = GIoU loss +Conf loss +CLass loss .

[0185] S104: The aerial image of the target water environment monitoring area acquired in real time is input into the trained aerial image sewage outlet small target detection model, and the output result is the sewage outlet small target detection result in the input aerial image.

[0186] like Figure 5-6 , Figure 5 It is an aerial image of the target water environment monitoring area taken in real time after preprocessing. Figure 6 yes Figure 5 The detection result of the image after model detection, in which the small target of the sewage outlet is marked with a box.

[0187] Based on the same inventive concept, the disclosed embodiment also provides a small target detection device for sewage outlets in aerial images based on improved YOLOv8. Figure 7 As shown, the device 500 includes:

[0188] An image acquisition module 510 is used to acquire a water environment monitoring aerial image dataset including at least sewage outlet features, and pre-process the water environment monitoring aerial image dataset to obtain a model training dataset for sewage outlet small target detection in aerial images;

[0189] A model building module 520 is used to improve the YOLOv8 model based on the spatial transformation network STN and the GhostModule feature generation module to build a small target detection model for the sewage outlet in the aerial image;

[0190] A model training module 530 is used to train the small target detection model of the sewage outlet in the aerial image through model training;

[0191] The detection module 540 is used to input the real-time acquired aerial images of the target water environment monitoring area into the trained aerial image sewage outlet small target detection model, and the output result is the sewage outlet small target detection result in the input aerial image.

[0192] The specific implementation method and technical effect of the device provided in the embodiment of the present disclosure are similar to those of the above-mentioned method embodiment, and will not be repeated here.

[0193] In addition, combined Figure 1-Figure 7 The method and device for detecting small targets at sewage outlets in aerial images based on improved YOLOv8 in the embodiments of the present application described can be implemented by an electronic device. Figure 8 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.

[0194] like Figure 8 As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 to a random access memory (RAM) 1003 to implement the battery capacity prediction method of the embodiment described in the present disclosure. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0195] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0196] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the voice control method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0197] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0198] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0199] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0200] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:

[0201] Acquire a water environment monitoring aerial image dataset that at least includes sewage outlet features, and preprocess the water environment monitoring aerial image dataset to obtain a model training dataset for sewage outlet small target detection in aerial images;

[0202] The YOLOv8 model is improved based on the spatial transformer network STN and the GhostModule feature generation module to build a small target detection model for sewage outlets in aerial images;

[0203] The aerial image sewage outlet small target detection model is trained through the model training;

[0204] The aerial image of the target water environment monitoring area acquired in real time is input into the trained aerial image sewage outlet small target detection model, and the output result is the sewage outlet small target detection result in the input aerial image.

[0205] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.

[0206] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0207] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0208] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0209] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0210] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0211] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0212] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0213] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0214] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0215] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0216] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for detecting small targets in sewage outlets in aerial images based on improved YOLOv8, characterized in that: include: Acquire a water environment monitoring aerial image dataset that at least includes sewage outlet features, and preprocess the water environment monitoring aerial image dataset to obtain a model training dataset for sewage outlet small target detection in aerial images; The YOLOv8 model is improved based on the spatial transformer network STN and the GhostModule feature generation module to build a small target detection model for sewage outlets in aerial images; The aerial image sewage outlet small target detection model is trained through the model training; The aerial image of the target water environment monitoring area acquired in real time is input into the trained aerial image sewage outlet small target detection model, and the output result is the sewage outlet small target detection result in the input aerial image.

2. The method for detecting small targets of sewage outlets in aerial images based on improved YOLOv8 according to claim 1, characterized in that: Obtain a water environment monitoring aerial image dataset that includes at least the features of the sewage outlet, including: Determine the target water environment monitoring area and the small target identification information contained in the area; wherein the small target identification information at least includes the water boundary information of the target water environment monitoring area, the building information and the vegetation information in the area; According to the terrain of the target water environment monitoring area, the flight mode of the drone aerial photography is set; wherein the flight mode includes the drone flight path mode and the drone aerial photography mode; Setting shooting parameters of the shooting device carried by the drone; According to the flight mode, the UAV is controlled to perform aerial photography of the target water environment monitoring area in multiple time periods and multiple weather conditions, and all images obtained by the aerial photography are sorted to obtain the water environment monitoring aerial image data set.

3. The method for detecting small targets of sewage outlets in aerial images based on improved YOLOv8 according to claim 2, characterized in that: The UAV flight path modes include a grid-based flight mode, a spiral flight mode and a return flight mode; The drone aerial photography mode adopts a multi-altitude aerial photography strategy to simultaneously obtain a panoramic view and local details of the target water environment monitoring area; wherein the multi-altitude aerial photography strategy includes: High-altitude aerial photography: setting the flight altitude of the drone to a first altitude, and taking a long-distance image of the target water environment monitoring area by a shooting device carried by the drone, so as to identify the overall distribution of potential sewage outlets in the target water environment monitoring area; Low-altitude aerial photography: after obtaining the overall distribution of the potential sewage outlets according to the long-range image recognition, the flight altitude is set at a second altitude to obtain a close-range image that captures the detailed features of the sewage outlets; Wherein, the first height is greater than the second height.

4. The method for detecting small targets of sewage outlets in aerial images based on improved YOLOv8 according to claim 2, characterized in that: Setting the shooting parameters of the shooting device carried by the drone includes: Image overlap and coverage control settings, including: Setting the image overlap rate during aerial photography to control the image overlap between adjacent aerial images to avoid shooting blind spots; Conduct real-time assessment of the coverage of the target water environment monitoring area through aerial photography to ensure effective coverage of all key sewage outlet areas; Shooting clarity and resolution settings, including: Set the shooting clarity during aerial photography to ensure that the drone remains stable during flight and avoid affecting the clarity of aerial images due to drone vibration or high-speed flight; Set the shooting resolution for aerial photography, using a 4K or higher resolution camera to capture the subtle features of the key sewage outlets; Data transmission and preliminary image processing, including: The real-time data feedback function of the drone is used to monitor the quality of aerial image acquisition during flight at any time; if it is found that the image quality is poor or key areas are not fully photographed, the flight path is adjusted in time or data is collected again; After the flight, all aerial images taken by the drone are preliminarily screened to remove blurry, too dark, too bright, or images with inappropriate angles to ensure that the image quality used for model training and testing meets the standards; Image data classification: the aerial images obtained by preliminary image processing are classified according to preset classification rules; wherein the preset classification rules include classification by time and classification by weather conditions; The classified aerial images are stored and backed up; The classified aerial images are stored in the original data format according to the initial image format; the classified aerial images that need to be quickly processed and transmitted are compressed to ensure the balance between image clarity and file size; To ensure data security, the collected data is backed up in multiple locations in a timely manner to obtain the water environment monitoring aerial image data set.

5. The method for detecting small targets of sewage outlets in aerial images based on improved YOLOv8 according to claim 1, characterized in that: The water environment monitoring aerial image data set is preprocessed, including: Image scaling: randomly adjusting the input image size in the water environment monitoring aerial image dataset, enlarging or reducing the input image to generate training samples with different resolutions; Adjust the network input size: Regularly change the size of the input image during the training phase so that the model can adapt to inputs of different scales and thus better handle multi-scale objects; Random rotation: randomly adjusting the azimuth angle of the input image in the water environment monitoring aerial image dataset; Color enhancement: adjust the brightness, contrast, saturation and random features of the input images in the water environment monitoring aerial image dataset.

6. The method for detecting small targets of sewage outlets in aerial images based on improved YOLOv8 according to claim 1, characterized in that: The YOLOv8 model is improved based on the spatial transformer network STN and the GhostModule feature generation module to build a small target detection model for sewage outlets in aerial images, including: Embedding the spatial transformer network STN into the image input and feature extraction stage of the YOLOv8 model to achieve the combination of the spatial transformer network STN and the YOLOv8 model; The GhostModule feature generation module replaces the C2f module in the YOLOv8 model to achieve the combination of the GhostModule feature generation module and the YOLOv8 model.

7. The method for detecting small targets of sewage outlets in aerial images based on improved YOLOv8 according to claim 6, characterized in that: The loss functions used in the aerial image sewage outlet small target detection model include: GIoU, the formula is expressed as: GIoU loss =1-GIoU Among them, PR is the predicted box, GT is the real box, and C is the area of ​​the smallest enclosed rectangle between the predicted box and the real box; Conf loss and The formula is: Among them, C i is the confidence of the predicted i-th target, is the confidence that the true target matches the prediction, is whether the object is in the grid cell, Indicates that the prediction is determined by the jth prediction result in the grid cell; Then the total loss of the small target detection model of the sewage outlet in the aerial image is defined as: Loss=GIoU loss +Conf loss +Class loss 。 8. A small target detection device for sewage outlets in aerial images based on improved YOLOv8, characterized in that: include: An image acquisition module is used to acquire a water environment monitoring aerial image dataset including at least sewage outlet features, and preprocess the water environment monitoring aerial image dataset to obtain a model training dataset for small target detection of sewage outlets in aerial images; The model building module is used to improve the YOLOv8 model based on the spatial transformation network STN and the GhostModule feature generation module to build a small target detection model for sewage outlets in aerial images; A model training module, used for training the aerial image sewage outlet small target detection model through the model training connection; The detection module is used to input the real-time acquired aerial image of the target water environment monitoring area into the trained aerial image sewage outlet small target detection model, and the output result is the sewage outlet small target detection result in the input aerial image.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the offline positioning method as described in any one of claims 1 to 7. 10 . A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the detection method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Real scene three-dimensional reconstruction method and system

    CN120580361A

  • Automatic sewage draining exit identification method and device under unmanned aerial vehicle low-altitude oblique photography

    CN121010904A

  • A river pollution outlet detection method, system and device

    CN122598005A

  • A river pollution outlet detection method, system and device

    CN122598005B