A lightweight meta-learning and edge cloud collaborative inference method
By employing a lightweight meta-learning and edge cloud collaborative reasoning method, we have solved the problems of target detection and semantic segmentation in complex environments with limited labeled samples, limited edge computing power, and complex environments. This method achieves a closed-loop mechanism with high accuracy, real-time reasoning, and continuous optimization, thereby improving the accuracy and adaptability of detection and segmentation.
Patent Information
- Application Number
- CN202611436734.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-11-20
AI Technical Summary
Existing technologies struggle to achieve collaborative, high-precision, real-time inference between object detection and semantic segmentation under conditions of extremely limited labeled samples, limited edge computing power, and interference from rain, fog, low light, and occlusion. Furthermore, cloud training and edge inference lack a closed-loop mechanism for sustainable updates.
We employ a lightweight meta-learning and edge-cloud collaborative inference method. We acquire video streams through image acquisition devices, periodically monitor state vectors in the edge inference layer, divide the network execution ratio by layer, and perform multi-task inference collaboratively between the edge and the cloud. By combining dynamic deformable convolution and feature distillation, we achieve edge deployment and cloud collaborative optimization of lightweight multi-task networks.
It significantly reduces annotation dependency, lowers the threshold for edge deployment, enhances robustness in complex environments, and forms a training and inference closed loop, improving the accuracy and real-time performance of detection and segmentation, and adapting to dynamic network environments.
Smart Images

Figure CN123142003A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and edge computing technology, and in particular to a lightweight meta-learning and edge cloud collaborative reasoning method. Background Technology
[0002] Deep convolutional neural networks can automatically extract multi-level features from large-scale labeled data and have been widely used in smart cities, autonomous driving, industrial inspection, mine safety monitoring, and traffic management. However, as application scenarios extend from standard laboratory datasets to real-world scenarios such as traffic rain and fog, underground high dust, low light at night, and dark environments in pipeline networks, existing technologies have revealed significant shortcomings in terms of data dependence, model size, collaborative mechanisms, environmental robustness, and multi-task processing.
[0003] Regarding meta-learning and few-shot learning, meta-learning has been introduced into the field of image recognition to alleviate the scarcity of labeled data. The shortcomings of existing methods are as follows: meta-learning frameworks, represented by MAML, are extremely sensitive to random sampling of the support set, resulting in large performance fluctuations; overfitting is serious when there are large differences in the distribution between tasks; in order to learn general knowledge on a large number of similar tasks, the feature space tends to be generalized, and the sample feature representation is insufficient; meta-training itself requires a large number of base class tasks, which is costly and difficult to tune parameters, and non-convergence is prone to occur when tasks are changed; and existing research is mostly focused on image classification, with insufficient research on few-shot adaptation for dense prediction tasks such as detection and segmentation.
[0004] Regarding model lightweighting and knowledge distillation, existing methods have the following shortcomings: pruning and post-training quantization decouple the compression process from the training process, impairing accuracy; when student models are extremely compact, the capacity gap between teachers and students hinders knowledge transfer; distillation methods are mostly designed for homogeneous architectures, making it difficult to bridge the difference between Transformer global attention and CNN local representations; ultra-compact networks generally suffer from degraded representation capabilities. Taking a typical backbone as an example, the number of parameters can reach 11.23M, and the computational cost reaches 3.16G FLOPs. Even with solutions such as MobileNetV3-Large, the computational complexity still reaches 0.35G FLOPs.
[0005] Regarding edge cloud collaborative inference, the shortcomings of existing solutions are as follows: static task partitioning cannot adapt to dynamically changing network environments and computing loads; concurrent deployment of multiple models and bandwidth competition on edge nodes render the static partitioning assumption invalid; centralized and heuristic offloading strategies are limited in scalability and adaptability; cloud training and edge inference are separated from each other and do not form a closed loop, making it difficult to continuously optimize the model after it goes online; traditional offloading requires the transmission of raw data or raw gradients, which poses a risk of being stolen or subjected to inference attacks.
[0006] The shortcomings of federated learning lie in its heterogeneous systems, high communication overhead, and low global model aggregation accuracy when data is not independently and identically distributed.
[0007] Regarding multi-task learning, its shortcomings are: an imbalance between feature sharing and task-specific needs, resulting in task conflicts and dominance during backpropagation; a lack of a mechanism to automatically adjust task weights based on scene complexity; building independent networks for each task leading to a significant increase in parameter quantity and memory consumption; and difficulty in unifying detection and segmentation modeling.
[0008] Regarding imaging in complex environments and deformable convolution, rain, fog, low light, and occlusion can lead to image blurring, decreased contrast, and loss of detail. Infrared and thermal imaging equipment is costly, has low resolution, and is limited by distance. Existing enhancement and detection processes are mostly two-stage separate processing, and enhancement algorithms are computationally intensive, making it difficult to meet real-time requirements. Deformable convolution's receptive field tends to exceed the target range when learning offsets, introducing irrelevant contextual information. Improvements such as DCNv2 have not completely solved this problem.
[0009] In summary, existing technologies suffer from drawbacks such as strong data dependence, large model size, lack of dynamic partitioning and global updates in the collaborative mechanism, significant decrease in accuracy under complex environments, and insufficient multi-task collaboration, which have become the main obstacles to the practical deployment of intelligent detection technology. Summary of the Invention
[0010] To address the challenge of achieving collaborative, high-precision, real-time reasoning between object detection and semantic segmentation under conditions of extremely limited labeled samples, restricted edge computing power, and interference from rain, fog, low light, and occlusion, and to establish a continuously updated closed loop between cloud training and edge reasoning, this invention proposes a lightweight meta-learning and edge-cloud collaborative reasoning method.
[0011] The present invention adopts the following technical solution: A lightweight meta-learning and edge cloud collaborative inference method, characterized by the following steps: S1, the video stream is acquired by the image acquisition device of the data acquisition layer, and transmitted to the edge inference layer after being encoded and compressed; S2, the edge inference layer periodically collects local computing load, network bandwidth and current inference task complexity to form a state vector, and outputs unloading actions based on the state vector. The components in the unloading actions represent the proportion of the corresponding layer in the lightweight multi-task network executed at the edge. The lightweight multi-task network is divided into edge execution part and cloud execution part by layer according to the unloading actions. S3, according to the division of S2, performs inference on the image obtained from S1: multi-scale features are extracted by the shared multi-scale feature pyramid backbone network. The multi-scale features are input into the detection branch and the segmentation branch respectively. The detection branch outputs bounding box coordinates, class confidence and bounding box confidence. The segmentation branch outputs semantic segmentation mask. The bounding box confidence output by the detection branch is mapped to an attention map through the feature distillation channel and then multiplied element-wise with the feature map of the segmentation branch to obtain the enhanced segmentation feature map and output the segmentation result. S4, the edge inference layer uses locally collected data to calculate the model gradient, and after cropping and adding noise to the gradient, it is uploaded to the cloud collaboration layer via an encrypted link; the cloud collaboration layer performs federated averaging on the gradients uploaded by each edge node to obtain the updated global model parameters and distributes them to each edge node; S5. When an edge node accesses a new scene, the labeled image of the new scene is input into the domain adaptive head network. The domain adaptive head network calculates the prototype vector of the new category and determines the category of the query sample according to the Euclidean distance between the query sample features and each prototype vector, thus completing the new scene adaptation.
[0012] Furthermore, to better implement the present invention, the unloading action output based on the state vector in S2 is implemented by an unloading decision module based on the TD3 algorithm. The unloading decision module includes one Actor network and two Critic networks: the Actor network outputs the unloading action based on the state vector s. t =[u cpu ,u mem ,u gpe ,b net ,c task [α1, α2, ..., α] is the input, and the output is the unloading action a=[α1, α2, ..., α] n ], where α i ∈[0,1] represents the proportion of the i-th layer network executed at the edge; two Critic networks Q1(s,a|θ^Q1) and Q2(s,a|θ^Q2) evaluate the value of the current state and action respectively and take the smaller value as the target Q value; its optimization objective is to minimize the weighted cost of system latency and energy consumption, as shown in the following formula: .
[0013] Furthermore, to better implement the present invention, S4 specifically involves: in the t-th round of communication, the cloud collaboration layer will transfer the current global model parameters. Distributed to all participating edge nodes, each edge node k has local data D k Press the formula above Calculate the gradient according to the formula. After cropping and adding noise to the gradient, it is uploaded. The cloud collaboration layer follows the formula. Executing the federal average yields And distribute.
[0014] Furthermore, in order to better realize the present invention, the shared multi-scale feature pyramid backbone network in S3 uses MobileNetV3 as the backbone, uses depthwise separable convolution to extract features, and fuses them through top-down and bottom-up paths, outputting three feature maps with scales of 1 / 8, 1 / 16, and 1 / 32 of the input image, respectively; the detection branch and the segmentation branch are each configured with independent channel attention modules and spatial attention modules.
[0015] Furthermore, to better implement the present invention, the feature distillation channel in S3 maps the bounding box confidence into an attention map via a 1×1 convolutional layer, and then processes it according to the formula... The feature map of the segmented branch is multiplied element-wise; S3 also includes: the scene complexity estimator outputs the scene complexity score, and the result is calculated according to the formula. Adjust the weights of detection loss and segmentation loss, where .
[0016] Furthermore, to better realize the present invention, a dynamic deformable context aggregation network is used when extracting multi-scale features in S3. The dynamic deformable context aggregation network includes deformable convolutional layers, channel attention embedding modules, and multi-level context fusion paths; the deformable convolutional layers add learnable offsets to the sampling grid of standard convolutions, and their output at position p0 is as shown in the formula. As shown; the channel attention embedding module is configured according to the formula The output features of deformable convolution are compressed into channel descriptors using global average pooling, according to the formula... Channel attention weights are generated through two fully connected layers, and the recalibrated output is obtained according to the formula; the multi-level context fusion path is calculated according to the formula. Fuse shallow features with deep features.
[0017] Furthermore, to better realize the present invention, the lightweight multi-task network in S3 is obtained by the cloud collaboration layer through online knowledge distillation: the same input image x is simultaneously input into the teacher network and the student network, and the teacher network and the student network respectively output the soft label probability distribution p. T and p S According to the formula Calculate the KL divergence between the two as the distillation loss, and then apply the formula... Calculate the total training loss; the model size of the student network obtained by distillation is less than 1MB.
[0018] Furthermore, to better realize the present invention, the feature extractor used in the domain adaptive head network in S5 is obtained by self-supervised contrastive pre-training: a spatiotemporal contrastive pre-trained encoder is constructed with a 3D convolutional neural network as the backbone, and a continuous T-frame video sequence is input, outputting feature f for different time segments of the same video. i and f j According to the formula Calculate the temporal consistency contrast loss; simultaneously, segment a single frame image into N×N image blocks, randomly shuffle them, and have the encoder predict the original position index of each image block, optimizing it with cross-entropy loss; the total pre-training loss is as follows: As shown.
[0019] Furthermore, to better implement the present invention, a meta-training step is included before S5: the input image x is input into the encoder E of the dual-path variational autoencoder, the encoder E maps the image to latent variables z through stacked convolutional layers, the latent variables z are input into the semantic decoder Ds and the label decoder Dl respectively, the semantic decoder Ds reconstructs z into scene style features s through deconvolutional layers, and the label decoder Dl maps z into discriminative features l through fully connected layers; the meta-training adopts a two-layer optimization mechanism, the inner loop adapts on the support set, and the outer loop calculates the loss and updates the meta-parameters on the query set, and its optimization objective function is as shown in the formula. As shown; in S5, according to the formula Determine the category to which the query sample belongs, where ck is the prototype vector of category k. The distance is Euclidean; the number of labeled images for the new scene in S5 is 10 to 50.
[0020] A lightweight meta-learning and edge-cloud collaborative inference architecture includes a data acquisition layer, an edge inference layer, and a cloud collaboration layer. The data acquisition layer includes an image acquisition device connected to the edge inference layer via an Ethernet, Wi-Fi, or 5G communication module. The edge inference layer includes an edge inference server, which houses a lightweight multi-task network inference engine, a hierarchical dynamic offloading decision module, and a federated learning local update module. The cloud collaboration layer includes a cloud server cluster, which houses a global model training and federated aggregation module, an online knowledge distillation module, and a global meta-model storage and distribution module. The edge inference layer and the cloud collaboration layer are connected via an encrypted communication link to implement the lightweight meta-learning and edge-cloud collaborative inference method.
[0021] The beneficial effects of this invention are as follows: The dependency on annotations is significantly reduced. By decoupling semantic style information and discriminative features through a dual-path variational autoencoder, and combining spatiotemporal contrastive pre-training on unlabeled video data with prototype network fine-tuning, adaptation for a single new category requires only 10 labeled images, and whole-scene migration requires only 50 labeled images. The annotation requirement is reduced by about 80%, and the deployment cycle for new scenes is shortened from several months to several days.
[0022] The barrier to edge deployment has been lowered. The student network, after online knowledge distillation, is less than 1MB in size, compressed to 1 / 10 the size of traditional methods, and achieves an inference speed of no less than 25 FPS on embedded AI computing platforms.
[0023] Detection and segmentation reinforce each other. The feature distillation channel injects bounding box confidence into the segmentation branch, and the pixel-level semantics of the segmentation branch further improves the detection and localization accuracy; the measured vehicle detection accuracy is 94.2%, and the lane line segmentation IoU reaches 91.5%.
[0024] Robustness in complex environments is enhanced. Deformable convolution and channel attention work together to suppress context-independent behavior, and multi-level fusion takes into account both small object details and large scene semantics. In street scenes, the IoU of small objects such as traffic lights and pedestrians reaches 87.3%, the semantic segmentation accuracy of mine panoramas is 94.8%, and the probability of misclassifying ore as background is reduced to 0.3%.
[0025] This forms a closed loop for training and inference. Hierarchical dynamic offloading dynamically adjusts edge cloud computing allocation when computing power and bandwidth change, while federated averaging continuously updates the global model without leaving the domain with the original data, solving the problem of the inability to continuously optimize the model after it goes live. Attached Figure Description
[0026] Figure 1 This is a diagram of the overall system architecture of the present invention; Figure 2 This is a diagram of the multi-task interactive pyramid network structure of the present invention; Figure 3 This is a schematic diagram of the dynamic deformable context aggregation network of the present invention. Detailed Implementation
[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0028] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0029] like Figure 1 As shown, the architecture of this embodiment consists of a data acquisition layer, an edge inference layer, and a cloud collaboration layer from bottom to top.
[0030] The data acquisition layer consists of image acquisition devices deployed in complex environments, including traffic monitoring cameras, explosion-proof underground cameras, drone-borne cameras, and cameras for pipeline inspection robots. The acquisition devices are industrial-grade RGB cameras with a resolution of at least 1920×1080 and a frame rate of at least 25fps. They are connected to the edge inference layer via Ethernet, Wi-Fi, or 5G communication modules, acquiring video streams in real-time at 25 frames per second and transmitting image data in JPEG or H.264 encoding format.
[0031] The edge inference layer consists of edge inference servers, which can utilize embedded AI computing platforms such as NVIDIA Jetson Orin NX, Huawei Atlas series, or Rockchip RK series chips, with a computing power of no less than 100 TOPS. Each edge inference server includes: a lightweight multi-task network inference engine with a model size of less than 1MB, running in an AI accelerator to perform forward inference; a hierarchical dynamic offloading decision module that monitors computing load, network bandwidth, and task complexity in real time and determines the allocation of tasks between the edge and the cloud; and a federated learning local update module that uses local data to calculate and temporarily store gradients. The edge inference layer is connected to the cloud collaboration layer via a TLS 1.3 encrypted link for uploading gradients, downloading the global model, and offloading inference tasks.
[0032] The cloud collaboration layer consists of a cloud server cluster, such as an NVIDIA A100×4 GPU cluster, with each card having at least 40GB of video memory. Internally, it includes: a global model training and federated aggregation module, which receives gradients from each edge node and performs federated averaging; an online knowledge distillation module, which uses a large-capacity teacher network to guide the training of a lightweight student network; and a global meta-model storage and distribution module, which stores the basic meta-model and distributes updated parameters to each edge node.
[0033] Cloud-based offline preparation phase (1) Self-supervised contrastive pre-training. A spatiotemporal contrastive pre-trained encoder was constructed using a 3D convolutional neural network as the backbone. The kernel size was 3×3×3, the stride was 2, and the input was a continuous T=16 frame unlabeled video sequence (v1,v2,…,vT). For different time segments of the same video, the encoder output features fi and fj. The temporal consistency constraint module was configured according to the formula. Calculate the contrast loss between the two. The spatial mosaic reconstruction module divides a single frame image into 4×4=16 image blocks, randomly shuffles them, and inputs them into the encoder. The network is required to predict the original position index of each image block, optimized using cross-entropy loss. The two losses are calculated according to the formula. The weighted average yields the total pre-training loss. This stage uses only readily available unlabeled videos to learn spatiotemporal and spatial structure representations of dynamic scenes and obtain features robust to occlusion.
[0034] (2) Task-decoupled meta-training. The encoder E of the dual-path variational autoencoder adopts the ResNet-18 backbone and maps the input image x∈R^(H×W×3) to the latent variable z∈R^D through stacked convolutional layers (3×3 kernels, stride 2, number of channels 64→128→256→512). z is fed into the semantic decoder Ds and the label decoder Dl respectively: Ds reconstructs z into scene style features s through deconvolutional layers, which are used to carry scene-related information such as lighting, weather, and texture; Dl maps z into discriminative features l through fully connected layers, which are used for detection and segmentation. This decouples style information from discriminative information, so that the discriminative features do not drift with scene style. Meta-training adopts a two-layer optimization similar to MAML: the inner loop completes task adaptation by updating gradients on the support set in a few steps, and the outer loop calculates the loss and updates the meta-parameters on the query set. The optimization objective function is shown in the formula. The task-independent feature extraction network outputs a general feature representation ftask, and the domain-adaptive head network is composed of a prototype network.
[0035] (3) Online knowledge distillation. The teacher network uses ResNet-101 with approximately 44M parameters and is deployed in the cloud; the student network is a lightweight micro-network with fewer than 1MB of parameters and is deployed at the edge. The same input image x is simultaneously fed into the teacher network T and the student network S to obtain the soft label probability distributions pT and pS, which are then processed according to the formula... Calculate the KL divergence distillation loss using the formula. The total training loss is obtained by weighting the task supervision loss, where the soft labels are adjusted by the temperature parameter τ. After training, the student network volume is compressed to less than 1 / 10 of that of traditional methods and distributed to each edge node by the global meta-model storage and distribution module.
[0036] Multi-task interactive pyramid network like Figure 2As shown, the shared backbone network uses MobileNetV3, extracting features through depthwise separable convolutions. The output is fused along top-down and bottom-up paths through a multi-scale feature pyramid to obtain three feature maps with scales of 1 / 8, 1 / 16, and 1 / 32 of the input image, respectively. These three scale features are simultaneously fed into the detection and segmentation branches.
[0037] The detection and segmentation branches are each configured with independent channel attention modules and spatial attention modules, forming a task-specific attention gating mechanism. This allows each branch to focus on its own sensitive feature regions, reducing mutual interference on shared features. The detection branch outputs bounding box coordinates, class confidence, and bounding box confidence; the segmentation branch upsamples the feature map and performs pixel-level classification, outputting a semantic segmentation mask M∈R^(H×W×C), where C is the number of classes.
[0038] The dynamic task weight allocation module is implemented using a scene complexity estimator composed of a lightweight classification network, outputting a scene complexity score and applying the formula... The weight ratio of detection loss to segmentation loss is dynamically adjusted. In simple scenarios, the focus is on segmentation accuracy, while in complex scenarios (such as rainy days or nighttime), the focus is on detection recall.
[0039] The feature distillation channel maps the bounding box confidence scores of the detection branch outputs to an attention map via a 1×1 convolutional layer, and then follows the formula... The feature map of the segmentation branch is multiplied element-wise. This operation injects the localization information learned from the detection task into the segmentation branch to enhance the segmentation accuracy at the target edges; conversely, the pixel-level semantics of the segmentation branch backpropagated on the shared backbone also improves the localization of the detection boxes, thus forming a bidirectional enhancement between the two tasks.
[0040] Dynamic Deformable Context Aggregation Network like Figure 3 As shown, the network consists of deformable convolutional layers, channel attention embedding modules, and multi-level context fusion paths, which are embedded in the mid- and deep feature extraction processes of the shared backbone network.
[0041] Deformable convolutional layers add learnable offsets to the sampling grid of standard convolutions, and their output at position p0 is shown in the formula. The offset is predicted from the input feature map by parallel convolutional branches, which makes the sampling position adaptively adjusted with the geometric deformation of the target.
[0042] The channel attention embedding module performs channel recalibration on the output features y of the deformable convolution: first, according to the formula... After being compressed into channel descriptors z∈R^C by global average pooling, it is then processed according to the formula Channel attention weights are generated through two fully connected layers, and finally calculated according to the formula. The output is obtained. The input of the offset prediction branch is taken from the recalibrated features. Therefore, the kernel offset and weights are dynamically adjusted with the channel importance. The sampling points are constrained to the target area with high response intensity, which suppresses the situation where the receptive field goes out of the target range and introduces background context.
[0043] The multi-level context fusion path uses skip connections to combine shallow features (high resolution, low semantics) with deep features (low resolution, high semantics) according to a formula. It integrates and takes into account both the details of small targets like traffic lights and the global semantics of large scenes like panoramic views of mines.
[0044] The hierarchical dynamic unloading decision module includes a status monitoring submodule, an unloading decision submodule, and a task splitting submodule.
[0045] The state monitoring submodule collects CPU utilization, memory usage, GPU utilization, network bandwidth, and current inference task complexity every 100ms to form a state vector s. t =[ucpu,umem,ugpe,bnet,ctask].
[0046] The unloading decision submodule employs the TD3 algorithm. The Actor network uses s t The input is processed through two fully connected layers of 256 neurons each, followed by a Tanh output layer, and the output is the unloading action a=[α1,α2,...,α]. n ], α i ∈[0,1] represents the proportion of the i-th layer network executed at the edge; two Critic networks Q1(s,a|θ^Q1) and Q2(s,a|θ^Q2) evaluate the state-action value respectively, and the smaller one is taken as the target Q value to suppress overestimation; the target network uses delayed updates and target policy smoothing; the optimization objective is to minimize the weighted cost of system latency and energy consumption, as shown in the formula. Training is conducted offline in the cloud using historical running trajectories, and the converged Actor network is then distributed to the edge for online inference.
[0047] The task segmentation submodule divides the network layer by layer based on 'a'. For example, α i When the efficiency is 0.6, the first 60% of the computation of the i-th layer network is performed at the edge, and the remaining 40% of the required intermediate features are transmitted to the cloud via an encrypted link for further execution. The results are then concatenated at the edge after being returned from the cloud. When computing power is sufficient, all inference is tended to be completed locally to reduce latency; when computing power is insufficient but bandwidth is sufficient, deep computation is offloaded to the cloud.
[0048] The federated learning local update module receives the global model parameters from the cloud in the t-th round of communication. Each edge node k is mapped to its local data Dk according to the formula. Calculate the gradient gk^t, then follow the formula right Noise is pruned and superimposed to meet differential privacy requirements, then uploaded via a TLS 1.3 link. The global model training and federated aggregation modules are performed according to the formula... Perform a federated average of the gradients at each node to obtain The global metamodel storage and distribution module then distributes the data to each node via an encrypted channel, completing one iteration. The communication cycle is configurable, defaulting to once every 1000 frames or once per hour. The original image is not transmitted beyond edge nodes; only the noise-added gradients are transmitted.
[0049] Taking traffic monitoring as an example, the complete workflow is as follows: Step 1: The intersection camera captures a video stream at 25 frames per second, which is then encoded with H.264 and transmitted to the edge inference server via 5G or Ethernet.
[0050] Step 2: The status monitoring submodule assesses the current device status, and the unloading decision submodule outputs the unloading action to determine the proportion of each layer executed at the edge.
[0051] Step 3: Assuming sufficient computing power, all inference is performed at the edge. The 1280×720×3 input image enters the shared backbone network, and after depthwise separable convolution and multi-scale feature pyramid, three-scale features are obtained; the detection branch outputs the vehicle bounding box coordinates and category (car / truck / bus / motorcycle), and the segmentation branch outputs lane lines and drivable area masks; the dynamic task weight allocation module adjusts the loss weights of the two branches according to the scene complexity; the feature distillation channel injects the bounding box confidence back into the segmentation branch to improve the lane line edge segmentation accuracy.
[0052] Step 4: During feature extraction, a dynamic deformable contextual aggregation network is introduced. When the target is a vehicle obscured by rain or fog, the sampling position of the deformable convolutional kernel is shifted to an area where the vehicle outline is clearer; when the target is a small traffic light, a multi-level contextual fusion path fuses shallow high-resolution features with deep semantic features to improve the detection rate of small targets.
[0053] Step 5: Output the detection results and segmentation mask, display them locally or upload them to the monitoring center; the federated learning local update module calculates the local gradient based on the current frame image and annotations, adds noise, and temporarily stores it.
[0054] Step 6: After the communication cycle is reached, the gradient is uploaded, the cloud performs federated averaging and back-divides the global model parameters to complete the closed-loop update.
[0055] Step 7: Adaptation to New Scenarios with Fewer Samples. When edge devices are deployed to new mining faces and need to identify new types of tunneling machines, there is no need to retrain the entire network. Ten labeled images of this machine model are collected on-site, input into the adaptive head network, and the pre-trained encoder parameters are frozen (or only the last layer is fine-tuned with a small learning rate). The prototype vector ck of this category in the feature space is calculated; features f(x) are extracted from the new sample x, according to the formula... The nearest prototype is selected based on Euclidean distance as the predicted category. When performing scene migration (involving multiple categories and changes in background distribution), 50 labeled images are used, and adaptation can be completed within minutes.
[0056] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A lightweight meta-learning and edge cloud collaborative reasoning method, characterized in that, Includes the following steps: S1, the video stream is acquired by the image acquisition device of the data acquisition layer, and transmitted to the edge inference layer after being encoded and compressed; S2, the edge inference layer periodically collects local computing load, network bandwidth and current inference task complexity to form a state vector, and outputs unloading actions based on the state vector. The components in the unloading actions represent the proportion of the corresponding layer in the lightweight multi-task network executed at the edge. The lightweight multi-task network is divided into edge execution part and cloud execution part by layer according to the unloading actions. S3, according to the division of S2, performs inference on the image obtained from S1: multi-scale features are extracted by the shared multi-scale feature pyramid backbone network. The multi-scale features are input into the detection branch and the segmentation branch respectively. The detection branch outputs bounding box coordinates, class confidence and bounding box confidence. The segmentation branch outputs semantic segmentation mask. The bounding box confidence output by the detection branch is mapped to an attention map through the feature distillation channel and then multiplied element-wise with the feature map of the segmentation branch to obtain the enhanced segmentation feature map and output the segmentation result. S4, the edge inference layer uses locally collected data to calculate the model gradient, and after the gradient is clipped and noise-added, it is uploaded to the cloud collaboration layer via an encrypted link; The cloud collaboration layer performs federated averaging on the gradients uploaded by each edge node to obtain updated global model parameters and distributes them to each edge node; S5. When an edge node accesses a new scene, the labeled image of the new scene is input into the domain adaptive head network. The domain adaptive head network calculates the prototype vector of the new category and determines the category of the query sample according to the Euclidean distance between the query sample features and each prototype vector, thus completing the new scene adaptation.
2. The lightweight meta-learning and edge cloud collaborative inference method according to claim 1, characterized in that, The unloading action output in S2 based on the state vector is implemented by the unloading decision module based on the TD3 algorithm. The unloading decision module includes one Actor network and two Critic networks: the Actor network outputs the unloading action based on the state vector s. t =[u cpu ,u mem ,u gpe ,b net ,c task [α1, α2, ..., α] is the input, and the output is the unloading action a=[α1, α2, ..., α] n ], where α i ∈[0,1] represents the proportion of the i-th layer network executed at the edge; Two Critic networks, Q1(s,a|θ^Q1) and Q2(s,a|θ^Q2), evaluate the value of the current state and action respectively and take the smaller value as the target Q value; Its optimization objective is to minimize the weighted cost of system latency and energy consumption, as shown in the following formula: .
3. The lightweight meta-learning and edge cloud collaborative reasoning method according to claim 1, characterized in that, Specifically, S4 involves the cloud collaboration layer transmitting the current global model parameters during the t-th round of communication. Distributed to all participating edge nodes, each edge node k has local data D k Press the formula above Calculate the gradient according to the formula. After cropping and adding noise to the gradient, it is uploaded. The cloud collaboration layer follows the formula. Executing the federal average yields And distribute.
4. The lightweight meta-learning and edge cloud collaborative inference method according to claim 1, characterized in that, The shared multi-scale feature pyramid backbone network in S3 uses MobileNetV3 as its backbone, employs depthwise separable convolution to extract features, and fuses them through top-down and bottom-up paths, outputting three feature maps at scales of 1 / 8, 1 / 16, and 1 / 32 of the input image, respectively; the detection branch and the segmentation branch are each configured with independent channel attention modules and spatial attention modules.
5. The lightweight meta-learning and edge cloud collaborative inference method according to claim 1, characterized in that, The feature distillation channel in S3 maps the bounding box confidence scores to an attention map via a 1×1 convolutional layer, and then follows the formula... The feature map of the segmented branch is multiplied element-wise; S3 also includes: the scene complexity estimator outputs the scene complexity score, and the result is calculated according to the formula. Adjust the weights of detection loss and segmentation loss, where .
6. The lightweight meta-learning and edge cloud collaborative inference method according to claim 1, characterized in that, When extracting multi-scale features in S3, a dynamic deformable context aggregation network is used. This network includes deformable convolutional layers, channel attention embedding modules, and multi-level context fusion paths. The deformable convolutional layers add learnable offsets to the sampling grid of standard convolutions, and their output at position p0 is as shown in the formula. As shown, R is the sampling grid of the convolution kernel, w(p n ) represents the kernel weights; The channel attention embedding module is according to the formula The output features of deformable convolution are compressed into channel descriptors using global average pooling, according to the formula... Channel attention weights are generated through two fully connected layers and then processed according to the formula. The recalibrated output is obtained, where δ is the ReLU activation function and σ is the Sigmoid activation function; the multi-level context fusion path is calculated according to the formula. Shallow features are fused with deep features, where [⋅,⋅] represents channel splicing and Up (⋅) is the upsampling operation.
7. The lightweight meta-learning and edge cloud collaborative inference method according to claim 1, characterized in that, The lightweight multi-task network in S3 is obtained by the cloud collaboration layer through online knowledge distillation: the same input image x is simultaneously input into the teacher network and the student network, and the teacher network and the student network respectively output soft label probability distributions p. T and p S According to the formula Calculate the KL divergence between the two as the distillation loss, and then apply the formula... Calculate the total training loss, where L CE λ is the hard-label cross-entropy loss, and λ is the weight coefficient of the distillation loss; the model size of the student network obtained by distillation is less than 1MB.
8. The lightweight meta-learning and edge cloud collaborative inference method according to claim 1, characterized in that, The feature extractor used in the domain adaptive head network in S5 is obtained through self-supervised contrastive pre-training: a spatiotemporal contrastive pre-trained encoder is constructed with a 3D convolutional neural network as the backbone, inputting a continuous T-frame video sequence, and outputting features f for different time segments of the same video. i and f j According to the formula Calculate the temporal consistency contrast loss; simultaneously, segment a single frame image into N×N image blocks, randomly shuffle them, and have the encoder predict the original position index of each image block, optimizing it with cross-entropy loss; the total pre-training loss is as follows: As shown.
9. The lightweight meta-learning and edge cloud collaborative reasoning method according to claim 1, characterized in that, Before S5, there is also a meta-training step: the input image x is input into the encoder E of the dual-path variational autoencoder, the encoder E maps the image into latent variable z through stacked convolutional layers, the latent variable z is input into the semantic decoder Ds and the label decoder Dl respectively, the semantic decoder Ds reconstructs z into scene style feature s through deconvolutional layers, and the label decoder Dl maps z into discriminative feature l through fully connected layers. Meta-training employs a two-layer optimization mechanism: the inner loop adapts on the support set, while the outer loop calculates the loss and updates the meta-parameters on the query set. Its objective function is shown in the formula. As shown; in S5, according to the formula Determine the category to which the query sample belongs, where c k Let be the prototype vector of category k, and be the Euclidean distance function; the number of labeled images of the new scene in S5 is 10 to 50.
10. A lightweight meta-learning and edge cloud collaborative inference architecture, characterized in that, The method comprises a data acquisition layer, an edge inference layer, and a cloud collaboration layer. The data acquisition layer includes an image acquisition device connected to the edge inference layer via an Ethernet, Wi-Fi, or 5G communication module. The edge inference layer includes an edge inference server, which houses a lightweight multi-task network inference engine, a hierarchical dynamic offloading decision module, and a federated learning local update module. The cloud collaboration layer includes a cloud server cluster, which houses a global model training and federated aggregation module, an online knowledge distillation module, and a global meta-model storage and distribution module. The edge inference layer and the cloud collaboration layer are connected via an encrypted communication link to implement the lightweight meta-learning and edge-cloud collaborative inference method as described in any one of claims 1 to 9.
