Lightweight multi-task target perception method for remote sensing images
By designing a lightweight multi-task perception method on the Rockchip 3588 chip, and employing an improved neural network architecture and edge collaborative inference tools, the problem of multi-task perception of UAV image perception algorithms on domestic computing platforms was solved, achieving efficient target detection and image segmentation, and improving the real-time perception capability of UAVs.
Patent Information
- Application Number
- CN202510022299.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2045-01-07
AI Technical Summary
Existing UAV image perception algorithms do not perform well on domestic computing platforms for perceiving small and dense targets, and cannot efficiently achieve multi-task perception, especially on the Rockchip 3588 chip, where it is difficult to perform target detection and image segmentation simultaneously.
A lightweight remote sensing image multi-task target perception method was designed. It adopts an improved Shufflenetv2 backbone network, an inverted pyramid neck structure and a lightweight detection head, and combines edge collaborative inference tools to realize the deployment and real-time inference of the multi-task perception model on the Rockchip 3588 chip.
The Rockchip 3588 chip enables efficient multi-task perception, achieving a target detection accuracy of 91.3% and an image segmentation accuracy of 71%, and is able to perceive the environment accurately in real time during drone flight.
Smart Images

Figure CN119964050B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of deep learning and computer vision, and in particular to a lightweight, multi-task unmanned aerial vehicle (UAV) real-time image perception method. Background Technology
[0002] Currently, it is common for drones to be equipped with sensing devices and intelligent computing processing boards, and their running intelligent algorithms provide effective support for maritime traffic, fisheries management, fire supervision, and hazard perception. However, the intelligent algorithms used for different tasks generally run independently, and most of them run on foreign computing platforms. Moreover, drone image perception presents some unique challenges compared to natural scene image perception, including high resolution of drone high-altitude images, large target scale variations, challenging natural environments, complex target shapes, diverse target attitudes, and severe background interference.
[0003] Current perception algorithms often suffer from poor performance with small and dense targets, are sensitive to target scale and shape, and lack optimization for deployment devices. For example, existing technologies often require multiple models to perform target detection for key targets such as people and vehicles, and image segmentation for buildings and bridges.
[0004] Therefore, how to achieve high-sensitivity perception of small and dense targets on a domestic computing platform (using Rockchip 3588 as the computing chip) has become a technical problem that builders of domestic computing platforms urgently need to solve. Summary of the Invention
[0005] This invention addresses the above-mentioned technical problems by providing a lightweight remote sensing image multi-task target perception method. It can detect key targets such as people and vehicles, perform image segmentation tasks on buildings and bridges, and optimize for UAV image data and Rockchip 3588 airborne edge device deployment. It innovatively designs a lightweight multi-task UAV real-time perception algorithm, reducing hardware computing power requirements while improving the target detection capability of high-altitude long-endurance UAVs. Furthermore, it utilizes an edge collaborative inference deployment tool to achieve rapid deployment and iteration of the edge-side algorithm model.
[0006] The technical solution of this invention is: a lightweight remote sensing image multi-task target perception method, including a board with a Rockchip 3588 chip deployed with an inference program, comprising the following steps:
[0007] S1. Acquire remote sensing images, and perform detection and segmentation annotations.
[0008] Remote sensing image data is collected by drone flight, and the remote sensing images are detected, labeled and segmented to obtain training set, test set and validation set;
[0009] S2. Train the multi-task perception model.
[0010] The multi-task perception model was trained using a constructed neural network, which includes a backbone network, a neck structure, a head structure, and a segmentation structure.
[0011] The training set obtained in step S1 and appropriate training parameters are then used to train the multi-task perception model to obtain the optimal perception model in pt format. The optimal perception model in pt format is then converted and optimized to obtain the ONNX model.
[0012] S3. Use an edge collaborative inference tool to convert the ONNX model obtained from the training conversion into a Rockchip 3588 model to obtain an RKNN model, and deploy the RKNN model and inference program to the board of the Rockchip 3588 chip.
[0013] S4. When the inference program runs on the UAV, the data input uses the mpp module to decode the input data from the visible light camera, and calls the multi-core NPU to perform inference on the input video to obtain the inference result. Then, the inference result is post-processed.
[0014] S5: The detection and segmentation results are displayed in an overlay.
[0015] The detection and segmentation results in S45 are drawn and labeled on the current frame using OpenCV to obtain automatically superimposed result data. Specifically, the detection results are labeled with rectangular boxes and target categories, and the segmentation results are labeled with different colors for the regions.
[0016] S6, push the output of the overlay video.
[0017] The automatic overlay result data obtained in step S5 is used to create a pipeline using the Gstream library. The pipeline reads the automatic overlay result data in a loop, overlays the images, and creates an RTSP stream to obtain the video stream.
[0018] Further, in step S1, creating a dataset from the remote sensing images and performing data augmentation on it specifically involves: creating a dataset from the remote sensing images and performing data augmentation on it, including the following steps:
[0019] S11. The remote sensing images include public datasets, flight data, and map data. High-altitude image data with four types of targets—people, vehicles, bridges, and roads—are acquired from the remote sensing images at different angles and altitudes of 100m-800m.
[0020] S12. Use annotation software to annotate the people and vehicles in the high-altitude image data with rectangular boxes, and indicate the category of each target to achieve the detection annotation. Perform segmentation annotation on roads and bridges to achieve the segmentation annotation, and obtain training data.
[0021] S13. The training data is augmented by rotation, cropping, and data augmentation to obtain a training dataset;
[0022] S14. Divide the training dataset into a training set, a test set, and a validation set in a ratio of 8:1:1. The training set is used to train the model, and the test set is used to evaluate the model.
[0023] Furthermore, in step S13, an enhancement method involving scaling and stitching is introduced to further detect small targets.
[0024] Furthermore, the backbone network adopts an improved Shufflenetv2 as the backbone network. Specifically, at the beginning of input downsampling, a convolutional network with a 6×6 large convolutional kernel and a stride of 2 is used for downsampling, which has a slight improvement in detection accuracy. The activation function in the entire network is changed to ReLU6. After the output stage5 module, an SPPF module is added to form a new feature extraction network. The downsampling in Shufflenetv2 and the 1×1 convolutional structure in the ordinary convolutional block structure are pruned. A smaller hidden layer channel and a modified SPPF module for spatial pyramid pooling are used.
[0025] The neck structure adopts an inverted pyramid structure, which splices and fuses features of different scales from bottom to top. The feature map generated after passing through the SPP module is then updimensionalized and connected to the CBR module of convolution + BN + ReLU after passing through the stage3 and stage5 feature maps for dimensionality reduction. Finally, it is spliced with the final feature map. The backbone and neck enhance the model's representation ability and improve the model's inference speed. In order to accelerate the inference speed, different convolution modes are used in their blocks during training and inference.
[0026] The head structure is designed to be more lightweight. The structure contains three detection heads and uses 3×3 convolution to calculate the target box loss, class loss and confidence loss.
[0027] The segmentation structure is as follows: In the segmentation module, after obtaining the features output by FPN, a segmentation head is constructed, using a 3×3 convolutional layer, and a 1×1 convolutional layer is used in the last layer, with mask coefficients added.
[0028] Further, the multi-task perception model in step S2 is trained, including the following steps:
[0029] S21. Train the object detection network using PyTorch as the training framework, employing stochastic gradient descent and Adam as the optimizer.
[0030] S22. The training batch size is 32, the learning rate is 0.0001, and the learning rate is dynamically updated using the cosine annealing function;
[0031] S23. Use Dropout in the backbone network architecture, specifically by using 10% for all layers except the first convolutional layer.
[0032] S24. Regarding the loss function for detection, classification loss and regression loss use Varifocal Loss and GIou Loss. Adding DFL Loss allows the network to quickly focus on values near the labeled location, increasing the probability. Varifocal Loss:
[0033]
[0034] p is the predicted IACS score, q is the target IoU score. For positive samples during training, q is set to the IoU between the generated bounding box and the ground truth box. For negative samples during training, the training target q is 0 for all classes. α is a variable parameter; in this project, α is set to 0.75.
[0035] DFL Loss:
[0036]
[0037] Where y is the regression label;
[0038] In the discrete range [y0, y n ] within {y0, y1,...,y n}, estimated value for
[0039]
[0040] Where P is the probability distribution.
[0041] The DFL loss can then be expressed as follows:
[0042] DFL(P(y i ),P(y i+1 ))=-((y i+1 -y)log(P(y i ))+(yy i )log(P(y i+1 )))
[0043] i is any integer.
[0044] The total loss is a weighted average of the three losses, as shown below:
[0045]
[0046] α is 0.001, β is 0.0005, γ is 0.001, t, N~j, e, For the normalization of the target score,
[0047] In the segmentation task, the cross-entropy loss function is used, as shown below.
[0048]
[0049] Where x is the activation value, N is the feature dimension, and label is the label corresponding to the segmentation task, ranging from (0 to C-1), where C is the number of categories;
[0050] S25. Convert the optimal pt model file trained by the PyTorch framework into an onnx file;
[0051] S26. After processing the detection and segmentation tasks in ONNX, trim the ONNX model and use ONNXSim to perform merging and optimization on the trimmed ONNX model.
[0052] S27. Use onnx-simplifier to perform identity-free operator reduction on the obtained onnx model.
[0053] Furthermore, in step S3, the specific steps for using an edge collaborative inference tool to convert the optimal detection ONNX model into a Rockchip 3588 model, and then deploying the converted model and inference program to the edge device are as follows:
[0054] S31, the edge collaborative reasoning tool consists of two parts: an edge-side intelligent agent and a client.
[0055] The edge-side intelligent agent includes inference deployment package receiving and decompression services and inference program start / stop control service components, and is mainly deployed in the RK3588 embedded edge device;
[0056] The client includes functions for model quantization and conversion, model publishing and updating, inference service start and stop, and model evaluation, as well as model repository, inference program repository, and data repository, and is mainly deployed on PCs or servers;
[0057] S32. The optimal detection ONNX model is converted into a RKNN format model using the model quantization and conversion module. During the conversion process, quantization mode is enabled, and the ONNX model file is finally converted into an INT8 RKNN file. The model quantization and conversion encapsulates the export_rknn interface of the RKNN-Toolkit2 tool. RKNN-Toolkit2 is a development kit for users to perform model conversion, inference, and performance evaluation.
[0058] S33. Store the converted RKNN model file in the model repository;
[0059] S34. Store the inference program in the inference program repository. The inference program must contain a service startup script.
[0060] S35. When the model is published or updated, select the RKNN model file and inference program to be deployed. The model publication and model update module packages the RKNN model file and inference program and sends the model publication request to the inference deployment service. After receiving the deployment package, the inference deployment service decompresses it and sends the inference program start request to the inference program start / stop control service.
[0061] S36. After receiving the request, the inference service start-stop control service starts the model inference program and generates a new model inference service.
[0062] S37. The startup and shutdown of deployed model inference services can be controlled in the inference service startup module;
[0063] S38. In the model evaluation module, evaluation image data and the corresponding real labels of the images can be selected from the data warehouse and sent to the model inference service for inference to obtain annotation information. The model evaluation module can obtain the accuracy evaluation index of the model by comparing the real labels and the annotation information generated by the model inference. The model performance evaluation index can be obtained based on the inference time returned by the model inference service.
[0064] Further, in step S4, when the model is running on the drone, the MPP module is used to decode the input data from the visible light camera, and the multi-core NPU is called to perform inference on the input video to obtain the inference result. Subsequently, the inference result is post-processed, including the following steps:
[0065] S41. Read the video stream from the camera and decode it using the hardware decoding MPP module of the embedded end device;
[0066] S42. Perform scaling, normalization, and channel conversion preprocessing on the MPP decoded data, and store it in the post-data preprocessing queue;
[0067] S43. Based on the hardware characteristics of RK3588, create 3 inference threads, schedule one NPU core in each thread, and each inference thread sequentially obtains data from the preprocessing thread for model inference;
[0068] S44. The data post-processing module obtains the inference results of each inference thread and restores them to the segmented regions and annotation boxes of the corresponding original image size.
[0069] S45. The detection and segmentation results include object category, location, and confidence information, which are then superimposed onto the video image.
[0070] This invention primarily addresses the high-precision and high-efficiency deployment of multi-task perception tasks for unmanned aerial vehicles (UAVs) on the airborne Rockchip 3588 chip. Due to computational resource limitations, unlike perception methods that involve multiple models performing multiple tasks, this invention optimizes the three-layer architecture (backbone network, neck structure, and head structure) of the target detection algorithm, tailored to the characteristics of the Rockchip 3588 chip. This results in a lightweight, multi-task real-time image perception network for UAVs, capable of simultaneously performing target detection, building and bridge segmentation tasks. A shared backbone network feature module is used for segmentation, accelerating the segmentation process. A new neck network is designed, replacing upsampling in the RepBi-PAN structure with convolution and changing the activation function to ReLU, suitable for both detection and segmentation tasks. Leveraging the 3-core NPU of the Rockchip 3588, a multi-core inference acceleration program is designed. Input video frames are queued and distributed to each core for parallel processing, significantly improving resource utilization and processing speed. Finally, the output is pushed sequentially. This achieves real-time and accurate environmental perception during UAV flight. An edge collaborative inference deployment tool was designed, forming functional modules for model quantification and conversion, model deployment, and model evaluation, realizing the management of edge model deployment process and the management of model and inference program results. Attached Figure Description
[0071] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0072] Figure 1 This is a flowchart of the present invention.
[0073] Figure 2 This is a network structure diagram of the present invention.
[0074] Figure 3 This is a flowchart of the multi-threaded inference acceleration process in this invention.
[0075] Figure 4 This is a schematic diagram illustrating the working principle of the edge collaborative reasoning deployment tool of this invention;
[0076] Figure 2 The asterisk (*) indicates the number of repetitions, and the ⊕ symbol indicates that the characters are pieced together. Detailed Implementation
[0077] The following is in conjunction with the appendix Figure 1-4 The technical solution of the present invention will be further illustrated through specific embodiments.
[0078] A lightweight remote sensing image multi-task target perception method, including a board with a Rockchip 3588 chip deployed with an inference program, includes the following steps:
[0079] S1. Acquire remote sensing images, and perform detection and segmentation annotations.
[0080] Using drones to collect remote sensing image data, detection and segmentation annotations are performed on the remote sensing images to obtain training, testing, and validation sets. The two tasks of detection and segmentation annotation are explained as follows: Detection annotation: Identify targets (people, vehicles, etc.) in the remote sensing images and annotate them with rectangular boxes; Segmentation annotation: Draw lines to annotate bridges and roads.
[0081] In step S1, creating a dataset from the remote sensing images and performing data augmentation on it specifically involves: creating a dataset from the remote sensing images and performing data augmentation on it, including the following steps:
[0082] S11. Remote sensing images include public datasets, flight data, and map data. High-altitude image data with four types of targets—people, vehicles, bridges, and roads—are acquired from different angles and at altitudes of 100m-800m.
[0083] S12. Use annotation software (labelme software) to annotate the bounding boxes of people and vehicles in the high-altitude image data, and indicate the category of each target to achieve detection annotation. Perform segmentation annotation on roads and bridges to achieve segmentation annotation and obtain training data.
[0084] S13. Augment the training data using rotation, cropping, and data augmentation to obtain the training dataset.
[0085] In addition, the enhancement methods of scaling and stitching have better detection results for small targets;
[0086] S14. Divide the training dataset into training, testing, and validation sets in an 8:1:1 ratio. The training set is used to train the model, the testing set is used to evaluate the model, and the validation set is used for validation. It should be noted that the above division method reserves a certain proportion for subsequent testing and validation, and a large number of image materials are used for training.
[0087] S2. Train the multi-task perception model.
[0088] A multi-task perception model was trained using a constructed neural network, which included a backbone network, a neck structure, a head structure, and a segmentation structure.
[0089] Then, using the training set obtained in step S1 and appropriate training parameters, the multi-task perception model is trained to obtain the optimal perception model in pt format, and the optimal perception model in pt format is converted and optimized to obtain the ONNX model.
[0090] The aforementioned backbone network employs an improved ShuffleNetv2. Specifically, it uses a 6×6 convolutional network with a stride of 2 at the beginning of input downsampling, resulting in a slight improvement in detection accuracy. The activation function throughout the network is changed to ReLU6. An SPPF module is added after the output stage5 module to form a new feature extraction network. The downsampling in ShuffleNetv2 and the 1×1 convolutional structure in the ordinary convolutional block structure are pruned. A reduced number of hidden layer channels and a modified SPPF module with spatial pyramid pooling are used.
[0091] Neck Structure: The neck structure employs an inverted pyramid structure, fusing features of different scales from bottom to top. The resulting feature map, after passing through the SPP module, undergoes dimensionality upscaling and is then combined with the stage3 and stage5 feature maps before being processed by a convolutional + BN + ReLU (CBR) module for dimensionality reduction. This combined feature map is then concatenated with the final feature map. The backbone and neck enhance the model's representational capabilities while improving inference speed. Furthermore, to accelerate inference, different convolutional modes are used in their blocks during training and inference.
[0092] Head structure: A lighter detection head is designed, which consists of three detection heads. The target box loss, class loss and confidence loss are calculated using 3×3 convolution.
[0093] Segmentation structure: In the segmentation module, after obtaining the features output by FPN, a segmentation head is constructed using a 3×3 convolutional layer, and a 1×1 convolutional layer is used in the last layer, with masking coefficients added.
[0094] This step involves training the multi-task perception model, including the following steps:
[0095] S21. Train the object detection network using PyTorch as the training framework, employing stochastic gradient descent and the Adam optimizer.
[0096] S22. The training batch size is 32, the learning rate is 0.0001, and the learning rate is dynamically updated using a cosine annealing function.
[0097] S23. Use Dropout in the backbone network architecture, specifically by using 10% for all layers except the first convolutional layer.
[0098] S24. Regarding the loss function for detection, classification loss and regression loss use Variational Loss (VFL) and GiouLoss. Adding DFL Loss allows the network to quickly focus on values near the labeled location, improving the probability.
[0099] Varifocal Loss:
[0100]
[0101] p is the predicted IACS score, q is the target IoU score. For positive samples during training, q is set to the IoU (gt IoU) between the generated bounding box and the ground truth box. For negative samples during training, the training target q is 0 for all classes. α is a variable parameter; in this project, α is set to 0.75.
[0102] DFL Loss:
[0103]
[0104] Where y is the regression label;
[0105] In the discrete range [y0, y n ] within {y0, y1,...,y n}, estimated value for
[0106]
[0107] Where P is the probability distribution.
[0108] The DFL loss can then be expressed as follows:
[0109] DFL(P(y i ),P(y i+1 ))=-((y i+1 -y)log(P(y i ))+(yy i )log(P(y i+1 )))
[0110] i is any integer.
[0111] The total loss is a weighted average of the three losses, as shown below:
[0112]
[0113] α is 0.001, β is 0.0005, γ is 0.001, t, N~j, e To normalize the target score, the cross-entropy loss function is used in the segmentation task, as shown below.
[0114]
[0115] Where x is the activation value, N is the feature dimension, and label is the label corresponding to the segmentation task, ranging from (0 to C-1), where C is the number of categories;
[0116] S25. Convert the optimal pt model file trained by the PyTorch framework into an onnx file.
[0117] S26. After post-processing the detection and segmentation tasks in ONNX, trim the ONNX models and use ONNXSim to perform merging and optimization on the trimmed ONNX models.
[0118] S27. Use onnx-simplifier to perform identity-free operator reduction on the obtained onnx model.
[0119] S3. Use an edge collaborative inference tool to convert the ONNX model obtained from the training conversion into a Rockchip 3588 model to obtain an RKNN model, and deploy the RKNN model and inference program to the board (edge device) of the Rockchip 3588 chip.
[0120] Furthermore, in step S3, the specific steps for using an edge collaborative inference tool to convert the optimal detection ONNX model into a Rockchip 3588 model, and then deploying the converted model and inference program to the edge device are as follows:
[0121] S31, the edge collaborative reasoning tool consists of two parts: an edge-side intelligent agent and a client, such as... Figure 4 ,
[0122] The edge-side intelligent agent includes inference deployment package receiving and decompression services and inference program start / stop control service components, and is mainly deployed in the RK3588 embedded edge device;
[0123] The client includes functions for model quantization and conversion, model publishing and updating, inference service start and stop, and model evaluation, as well as model repository, inference program repository, and data repository, and is mainly deployed on PCs or servers;
[0124] S32. The optimal detection ONNX model is converted into a RKNN format model using the model quantization and conversion module. During the conversion process, quantization mode is enabled, and the ONNX model file is finally converted into an INT8 RKNN file. The model quantization and conversion encapsulates the export_rknn interface of the RKNN-Toolkit2 tool. RKNN-Toolkit2 is a development kit for users to perform model conversion, inference, and performance evaluation.
[0125] S33. Store the converted RKNN model file in the model repository;
[0126] S34. Store the inference program in the inference program repository. The inference program must contain a service startup script.
[0127] S35. When the model is published or updated, select the RKNN model file and inference program to be deployed. The model publication and model update module packages the RKNN model file and inference program and sends the model publication request to the inference deployment service. After receiving the deployment package, the inference deployment service decompresses it and sends the inference program start request to the inference program start / stop control service.
[0128] S36. After receiving the request, the inference service start-stop control service starts the model inference program and generates a new model inference service.
[0129] S37. The startup and shutdown of deployed model inference services can be controlled in the inference service startup module;
[0130] S38. In the model evaluation module, evaluation image data and the corresponding real labels of the images can be selected from the data warehouse and sent to the model inference service for inference to obtain annotation information. The model evaluation module can obtain the accuracy evaluation index of the model by comparing the real labels and the annotation information generated by the model inference. The model performance evaluation index can be obtained based on the inference time returned by the model inference service.
[0131] S4. The inference program runs on the drone, such as Figure 3 As shown, the data input uses the mpp module to decode the input data from the visible light camera, and calls the multi-core NPU (neural network processor) to perform inference on the input video to obtain the inference result, and then performs post-processing on the inference result;
[0132] Further, in step S4, when the model is running on the drone, the MPP module is used to decode the input data from the visible light camera, and the multi-core NPU is called to perform inference on the input video to obtain the inference result. Subsequently, the inference result is post-processed, including the following steps:
[0133] S41. Read the video stream from the camera and decode it using the hardware decoding MPP module of the embedded end device;
[0134] S42. Perform scaling, normalization, and channel conversion preprocessing on the MPP decoded data, and store it in the post-data preprocessing queue;
[0135] S43. Based on the hardware characteristics of RK3588, three inference threads are created, with one NPU core scheduled in each thread. Each inference thread sequentially obtains data from the preprocessing thread for model inference. This invention adopts a multi-core scheduling measure to achieve real-time algorithm operation under the limited computing power resources of domestic chips.
[0136] S44. The data post-processing module obtains the inference results of each inference thread and restores them to the segmented regions and annotation boxes of the corresponding original image size.
[0137] S45. The detection and segmentation results include object category, location, and confidence information, which are then superimposed onto the video image.
[0138] S5: The detection and segmentation results are displayed in an overlay.
[0139] The detection and segmentation results in S45 are drawn and labeled on the current frame using OpenCV to obtain automatically superimposed result data. Specifically, the detection results are labeled with rectangular boxes and target categories, and the segmentation results are labeled with different colors for the regions.
[0140] S6, push the output of the overlay video result;
[0141] The automatic overlay result data obtained in step S5 is used to create a pipeline using the Gstream library. The pipeline reads the automatic overlay result data in a loop, overlays the images, and creates an RTSP stream to obtain the video stream.
[0142] This invention relates to a lightweight, multi-task UAV real-time image perception network for Rockchip 3588 devices. The backbone network employs a pruned ShuffleNetv2 network. To accommodate the embedded device's operator operation mode, time-consuming network layers are pruned, and an improved SPP module is added to compensate for accuracy loss. A lightweight detection module is designed using an inverted pyramid model, employing inverse convolution as the upsampling module and convolution + BN + ReLU as the dimensionality reduction module for feature fusion. An integrated segmentation head is designed, which, after obtaining the features output by FPN, uses a 3*3 convolutional layer, with a 1*1 convolutional layer at the last layer, and adds masking coefficients to obtain the segmentation result. An edge-collaborative inference deployment tool is designed, forming functional modules for model quantization and conversion, model deployment, and model evaluation, realizing edge-side model deployment process management and model and inference program result management. On the Rockchip 3588, the overall efficiency reaches 31fps, with a detection accuracy of 91.3% and a segmentation accuracy of 71%.
[0143] Ultimately, the method of this invention enables data transmission to the control terminal, allowing the data acquisition device (such as an unmanned aerial vehicle or vehicle) to simultaneously operate, capture images, and intelligently sense data while in motion, thereby generating a data stream and efficiently transmitting data to the user terminal.
[0144] It should be stated that the above-described specific embodiments are merely preferred embodiments of the present invention and the technical principles employed. Those skilled in the art should understand that various modifications, equivalent substitutions, and variations can be made to the present invention based on the technical content disclosed in this application. However, such variations, as long as they do not depart from the spirit of the present invention, should be within the protection scope of the present invention. Furthermore, some terminology used in this specification and claims is not limiting but merely for ease of description.
Claims
1. A lightweight multi-task target perception method for remote sensing images, characterized in that, Includes the following steps: S1. Acquire remote sensing images, and perform detection and segmentation annotations. Remote sensing image data is collected by drone flight, and the remote sensing images are detected, labeled and segmented to obtain training set, test set and validation set; S2. Train the multi-task perception model. The multi-task perception model was trained using a constructed neural network, which includes a backbone network, a neck structure, a head structure, and a segmentation structure. The backbone network adopts an improved Shufflenetv2 as the backbone network. Specifically, at the beginning of input downsampling, a convolutional network with a 6×6 large convolutional kernel and a stride of 2 is used for downsampling. The activation function in the entire network is changed to ReLU6. An SPP module is added after the output stage5 module to form a new feature extraction network. The downsampling in Shufflenetv2 and the 1×1 convolutional structure in the ordinary convolutional block structure are pruned. A smaller hidden layer channel and a modified SPPF module for spatial pyramid pooling are used. The neck structure employs an inverted pyramid structure, fusing feature maps of different scales from bottom to top. The feature map generated after the SPP module is up-dimensioned, then concatenated with the stage3 and stage5 feature maps, followed by dimensionality reduction processing using a CBR module (convolution + BN + ReLU), and finally concatenated with the final neck feature map. The backbone and neck enhance the model's representational capabilities while improving its inference speed. Furthermore, to accelerate inference, different convolution modes are used in their blocks during training and inference. The head structure is designed to be more lightweight. The structure contains three detection heads and uses 3×3 convolution to calculate the target box loss, class loss and confidence loss. The segmentation structure is as follows: In the segmentation module, after obtaining the features output by FPN, a segmentation head is constructed, using a 3×3 convolutional layer, and a 1×1 convolutional layer is used in the last layer, and masking coefficients are added. The training set obtained in step S1 and appropriate training parameters are then used to train the multi-task perception model to obtain the optimal perception model in pt format. The optimal perception model in pt format is then converted and optimized to obtain the ONNX model. S3. The board with the Rockchip 3588 chip deployed with the inference program is used to perform format conversion on the ONNX model obtained by training and conversion using an edge collaborative inference tool, converting it into a format adapted to the Rockchip 3588 chip to obtain the RKNN model, and then deploying the RKNN model and the inference program to the board with the Rockchip 3588 chip. S4. When the inference program runs on the UAV, the data input uses the mpp module to decode the input data from the visible light camera, and calls the multi-core NPU to perform inference on the input video to obtain the inference result. Then, the inference result is post-processed. S5: The detection and segmentation results are displayed in an overlay. The detection and segmentation results in S4 are drawn and labeled on the current frame using OpenCV to obtain automatically superimposed result data. Specifically, the detection results are labeled with rectangular boxes and target categories, and the segmentation results are labeled with different colors for the regions. S6, push the output of the overlay video. The automatic overlay result data obtained in step S5 is used to create a pipeline using the Gstream library. The pipeline reads the automatic overlay result data in a loop, overlays the images, and creates an RTSP stream to obtain the video stream.
2. The lightweight remote sensing image multi-task target perception method according to claim 1, characterized in that, In step S1, creating a dataset from the remote sensing images and performing data augmentation on it specifically involves the following steps: S11. The remote sensing images include public datasets, flight data, and map data. High-altitude image data with four types of targets—people, vehicles, bridges, and roads—are acquired from the remote sensing images at different angles and altitudes of 100m-800m. S12. Use annotation software to annotate the people and vehicles in the high-altitude image data with rectangular boxes, and indicate the category of each target to achieve the detection annotation. Perform segmentation annotation on roads and bridges to achieve the segmentation annotation, and obtain training data. S13. The training data is augmented by rotation, cropping, and data augmentation to obtain a training dataset; S14. Divide the training dataset into a training set, a test set, and a validation set in a ratio of 8:1:
1. The training set is used to train the model, and the test set is used to evaluate the model.
3. The lightweight remote sensing image multi-task target perception method according to claim 2, characterized in that, In step S13, an enhanced method of scaling and stitching is introduced to further detect small targets.
4. The lightweight remote sensing image multi-task target perception method according to claim 1, characterized in that, The multi-task perception model training in step S2 includes the following steps: S21. Train the object detection network using PyTorch as the training framework, employing stochastic gradient descent and Adam as the optimizer. S22. The training batch size is 32, the learning rate is 0.0001, and the learning rate is dynamically updated using the cosine annealing function; S23. Use Dropout in the backbone network architecture, specifically by using 10% for all layers except the first convolutional layer; S24. Regarding the loss function for detection, classification loss and regression loss use Variational Loss and GIou Loss. Adding DFL Loss allows the network to quickly focus on values near the labeled location, improving the probability. Varifocal Loss: , p is the predicted IACS score, q is the target IoU score. For positive samples during training, q is set to the IoU between the generated bounding box and the ground truth box. For negative samples during training, the training target q is 0 for all classes. θ is a variable parameter, and θ is set to 0.
75. DFL Loss: , Where y is the regression label; In the discrete range [ , ]Inside, Estimated value for , Where P is the probability distribution. ; The DFL loss can then be expressed as follows: , i is any integer. The total loss is a weighted average of the three losses, as shown below: , α is 0.001, β is 0.0005, γ is 0.001, N is the feature dimension, and i is any integer. For the normalization of the target score, In the segmentation task, the cross-entropy loss function is used, as shown below. , in It is the activation value. It is the feature dimension, and j is the category index. To segment the tags corresponding to the tasks, the range is ,in It is the number of categories; S25. Convert the optimal pt model file trained by the PyTorch framework into an onnx file; S26. Prune the post-processing operators for detection and segmentation tasks in ONNX, and use ONNXSim to perform merging and optimization on the pruned ONNX model; S27. Use onnx-simplifier to perform identity-free operator reduction on the obtained onnx model.
5. A lightweight remote sensing image multi-task target perception method according to claim 1, characterized in that, In step S3, the ONNX model is converted to the Rockchip 3588 model using an edge collaborative inference tool, and the converted model and inference program are deployed to the edge device. The specific steps are as follows: S31, the edge collaborative reasoning tool consists of two parts: an edge-side intelligent agent and a client. The edge-side intelligent agent includes inference deployment package receiving and decompression services, and inference program start / stop control service components, and is mainly deployed in Rockchip 3588 embedded edge devices; The client includes functions for model quantization and conversion, model publishing and updating, inference service start and stop, and model evaluation, as well as model repository, inference program repository, and data repository, and is mainly deployed on PCs or servers; S32. The optimal detection ONNX model is converted into a RKNN format model using the model quantization and conversion module. During the conversion process, quantization mode is enabled, and the ONNX model file is finally converted into an INT8 RKNN file. The model quantization and conversion encapsulates the export_rknn interface of the RKNN-Toolkit2 tool. RKNN-Toolkit2 is a development kit for users to perform model conversion, inference, and performance evaluation. S33. Store the converted RKNN model file in the model repository; S34. Store the inference program in the inference program repository. The inference program must contain a service startup script. S35. When the model is published or updated, select the RKNN model file and inference program to be deployed. The model publication and model update module packages the RKNN model file and inference program and sends the model publication request to the inference deployment service. After receiving the deployment package, the inference deployment service decompresses it and sends the inference program start request to the inference program start / stop control service. S36. After receiving the request, the inference service start-stop control service starts the model inference program and generates a new model inference service. S37. The startup and shutdown of deployed model inference services can be controlled in the inference service startup module; S38. In the model evaluation module, evaluation image data and the corresponding real labels of the images can be selected from the data warehouse and sent to the model inference service for inference to obtain annotation information. The model evaluation module can obtain the accuracy evaluation index of the model by comparing the real labels and the annotation information generated by the model inference. The model performance evaluation index can be obtained based on the inference time returned by the model inference service.
6. A lightweight remote sensing image multi-task target perception method according to claim 1, characterized in that, In step S4, when the model is running on the drone, the MPP module is used to decode the input data from the visible light camera, and the multi-core NPU is called to perform inference on the input video to obtain the inference result. The inference result is then post-processed, including the following steps: S41. Read the video stream from the camera and decode it using the hardware decoding MPP module of the embedded end device; S42. Perform scaling, normalization, and channel conversion preprocessing on the MPP decoded data, and store it in the post-data preprocessing queue; S43. Based on the hardware characteristics of Rockchip 3588, create 3 inference threads, each thread schedules one NPU core, and each inference thread sequentially obtains data from the preprocessing thread for model inference; S44. The data post-processing module obtains the inference results of each inference thread and restores them to the segmented regions and annotation boxes of the corresponding original image size. S45. The detection and segmentation results include object category, location, and confidence information, which are then superimposed onto the video image.
Citation Information
Patent Citations
Lightweight multi-task video stream real-time reasoning method and system
CN115661712A
SAR (Synthetic Aperture Radar) ship detection method and system based on space-ground synchronous neural network
CN118053080A
