Contraband identification method based on meta-learning
Through meta-learning technology, the adversarial samples are generated using ResNet-101 and Transformer, and the detection threshold is dynamically adjusted, which solves the problem of rare target samples and insufficient generalization capabilities in X-ray security inspection, and improves the accuracy and adaptability of contraband detection.
Patent Information
- Application Number
- CN202510278143.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-08-01
AI Technical Summary
The prior art has rare problems in X-ray security inspection, limited model generalization ability, limited data enhancement effect and poor performance indicators, resulting in low detection accuracy of contraband products.
Using a meta-learning-based method, features are extracted through the ResNet-101 backbone network, feature aggregation is performed using Correlational Aggregation Module, and adversarial samples are generated by combining Transformer and adversarial learning, and detection thresholds are dynamically adjusted to improve the generalization ability and recognition accuracy of the model.
The recognition accuracy and generalization ability of the contraband detection model are improved in the case of a small number of samples, the recognition ability of rare targets is enhanced, and the flexibility to adapt to different detection tasks is enhanced.
Smart Images

Figure CN120411718A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of security inspection and contraband identification, and particularly to a contraband identification method based on meta-learning. Background Art
[0002] Object Detection is a core technology in the field of computer vision, which aims to enable a computer to identify and locate objects in an image just like the human eye. Specifically, it not only needs to identify what objects are in the image, but also determine their positions in the image (usually represented in the form of bounding boxes) and their categories. The essence of object detection is to analyze visual information so that the computer can understand the content in the image. This involves multiple levels such as image processing, feature extraction, pattern recognition, and machine learning. At the technical level, the problems to be solved by object detection include but are not limited to: object classification, position estimation, size variation, occlusion handling, background interference, and real-time processing ability, etc. The application of object detection is extremely extensive, covering multiple fields such as security monitoring, autonomous driving, industrial automation, medical image analysis, retail analysis, and intelligent video analysis. For example, in the retail industry, object detection can be used to track customer behavior and manage inventory. In the medical field, it can help identify disease markers, such as tumors in X-ray films. In autonomous driving technology, it is a key technology for vehicles to understand the surrounding environment, used to identify road signs, pedestrians, and other vehicles, etc.
[0003] Meta-learning is to learn the feature representation in a task so as to generalize on new tasks. In specific real-world situations, it is usually difficult to obtain a large amount of data, and few-shot learning is one of the problems currently being studied in the field of machine learning; in addition, the model only contacts data samples related to a specific task during the training process, and its adaptability and generalization ability are weak when facing new tasks. On the contrary, the human learning method is not only to learn a certain task, but more importantly, to have the learning ability to use the knowledge learned in the past to guide the learning of new tasks. How to design a learning model that can adapt to new tasks through the training of a small number of samples is the target problem solved by meta-learning. Therefore, meta-learning can be applied to any scenario with a small number of samples but requiring an improvement in model accuracy.
[0004] In public places and transportation hubs, X-ray security inspection equipment is widely used to detect and identify personal items carried by individuals with prohibited items. However, due to the limitations of manual operation and the impact of visual fatigue, traditional X-ray security inspection systems have problems of missed detection and false alarms. Therefore, developing an efficient and accurate X-ray security inspection prohibited item detection and early warning system is of great significance for improving security and reducing labor costs. Deep learning technology has made remarkable progress in the field of computer vision, especially in object detection tasks. The proposal of security inspection prohibited item object detection technology based on X-ray imaging technology is to solve the problems of missed detection and false alarms in manual operation, improve the detection accuracy and efficiency, and reduce the detection cost.
[0005] With the development of deep learning, intelligent security inspection has also developed rapidly. In the field of prohibited item object detection, the Faster-RCNN algorithm has been widely used due to its high efficiency and accuracy. Especially in the detection of X-ray prohibited items, the Faster-RCNN algorithm can be improved according to the characteristics of different sizes of prohibited items and mutual occlusion between items. For example, by introducing the ResNeXt network to replace the original VGG16 network to obtain better image feature extraction characteristics; introducing the FPN network to adapt to prohibited items of various scales; using the CIoU loss function to replace the original Smooth L1 loss function, etc. These improvements have significantly increased the mAP value of the Faster-RCNN algorithm in prohibited item object detection, even exceeding the current mainstream object detection frameworks such as YOLOv5 and YOLOX.
[0006] The disadvantages of object detection technology based on X-ray imaging are that for the recognition of a rare object, there are not enough samples to conduct model training to achieve the recognition effect. More specifically, it can be divided into the following points:
[0007] Sample scarcity: In real industrial scenarios, such as X-ray security inspection scenarios, the occurrence frequency of some dangerous categories is relatively low, resulting in great difficulty in obtaining samples. This is a typical small sample detection problem, where the scarcity of samples directly affects the training effect of the model.
[0008] Model generalization ability: Due to the insufficient number of samples, it is difficult for the model to learn sufficient feature representations, resulting in limited generalization ability of the model. In the detection of rare objects, this problem is particularly prominent because it is difficult for the model to learn sufficient and representative features from limited samples.
[0009] Data augmentation effect: Although data augmentation techniques can alleviate the problem of insufficient sample quantity to a certain extent, for rare objects, its effect may not be significant. Because data augmentation is usually based on existing samples for transformation, and for rare objects, the number of existing samples is small itself, so the space for data augmentation is limited.
[0010] Performance metrics: In the case of insufficient sample size, the performance metrics of the model (such as accuracy, recall, etc.) may be severely affected. For example, a model trained without enough samples may exhibit poor performance on the test set, especially in the detection of rare targets. Summary of the Invention
[0011] The present invention provides a method for identifying contraband based on meta-learning. In the case where the sample size of some contraband is scarce, meta-learning is used to solve a series of problems related to deep learning, such as solving the problems of poor training effect and low detection model accuracy caused by the small sample size of some security inspection contraband in daily life, and improving the recognition accuracy and generalization ability of the security inspection contraband detection model.
[0012] A series of problems related to deep learning are as follows:
[0013] Problem 1: Poor training effect due to insufficient sample size
[0014] Reason:
[0015] Data scarcity: Due to the rarity of rare targets, they appear very rarely in the real world. Therefore, it is very difficult to collect enough labeled samples for model training.
[0016] Limited model generalization ability: Deep learning models usually require a large amount of data to learn generalization ability. The small number of samples of rare targets limits the model's ability to learn diverse enough feature representations, resulting in poor recognition ability of the model for new samples during testing.
[0017] Solution:
[0018] Meta-learning techniques can be used to improve the model's generalization ability without relying on a large number of samples by training the model on how to quickly adapt to new tasks. Meta-learning can extract and update learning strategies, helping the model abstract general knowledge and patterns from historical learning experiences, which is applicable to rare target detection.
[0019] Problem 2: Low recognition accuracy of the model for rare targets
[0020] Reason:
[0021] Insufficient feature representation: Due to the limited number of samples of rare targets, it is difficult for the model to learn sufficiently representative feature representations, which leads to confusion or misjudgment of the model when identifying rare targets.
[0022] Class imbalance: In the dataset, the number of samples of common targets is much larger than that of rare targets. This class imbalance affects the training of the model, causing the model to be more inclined to recognize common targets and ignore rare targets.
[0023] Solution:
[0024] The meta - learning algorithm, combined with techniques such as data augmentation and transfer learning, can help the model learn more effective feature representations from limited samples. At the same time, meta - learning can also help the model automatically adjust weights during training to balance the impact of different category samples on the model and improve the recognition accuracy of the model for rare targets.
[0025] Problem 3: Poor adaptability of the model to new tasks
[0026] Reason:
[0027] Large task differences: There may be significant differences between rare target detection tasks, such as changes in features like target shape, size, texture, etc. These differences make it difficult for the model to quickly adapt to new tasks.
[0028] Insufficient model adaptability: Existing models usually need to be trained on a large amount of labeled data to adapt to new tasks, which limits the flexibility and scalability of the model in practical applications.
[0029] Solution:
[0030] Techniques such as meta - optimization and meta - memory in meta - learning can be utilized to enable the model to quickly extract knowledge and strategies for adapting to new tasks from historical learning experiences, thereby achieving quick adaptation and efficient learning on new tasks. This ability makes the model more flexible and scalable in practical applications.
[0031] To achieve the above - mentioned objectives, the present invention adopts the following technical solutions:
[0032] A contraband identification method based on meta - learning, comprising:
[0033] S1. Obtain a query image containing the object to be detected and support images of multiple categories for detecting rare or novel objects;
[0034] S2. Input the query image and support images into the ResNet - 101 backbone network to extract features and generate query features and support features;
[0035] S3. Input the query features, support features, and task encoding into the Correlational Aggregation Module, and use the shared multi - head attention mechanism to transform the query features and support features into the same embedding space for feature aggregation; by calculating the similarity between the query features and support features, generate an attention matrix to highlight the query features related to the support categories, and finally output the enhanced feature representation;
[0036] S4. Input the enhanced feature representation into the encoder-decoder structure of the Transformer, generate object queries through the decoder, and refine the object detection results;
[0037] S5. Feed the output of the Transformer into the adversarial learning module to generate adversarial samples; use the FastGradient Sign Method to add small perturbations to the original input image to generate challenging samples, forcing the model to learn more robust feature representations;
[0038] S6. The output of the adversarial learning module enters the dynamic adaptation module to modify the object queries and detection thresholds to improve the detection performance for novel and rare objects, and finally output the object detection results.
[0039] In this specification, task encodings are generated through predefined mathematical functions, and the task encodings match the dimensions of the query features and support features.
[0040] In this specification, in the adversarial learning module, the Fast Gradient Sign Method is used to generate adversarial samples, and the generation formula for the adversarial samples is:
[0041]
[0042] x' is the adversarial sample, x is the original input, y is the label, ∈ is the magnitude of the perturbation, Sign is the sign function, is the gradient of x, and L(x, y, θ) is with respect to the input image x, label y, and model parameters, where θ is the model parameter.
[0043] In this specification, in the adversarial learning module, during the training process, a comprehensive loss function is defined to combine the normal detection loss and the adversarial loss. The loss function L adv is:
[0044] L adυ = L normal + λ · L adυersarial ;
[0045] where, L normal is the standard object detection loss, L adversarial is the adversarial sample loss, and λ is the hyperparameter that balances the two losses.
[0046] In this specification, a dynamic few-shot adaptation mechanism is applied in the dynamic adaptation module, and the dynamic few-shot adaptation mechanism includes dynamic query adjustment and adaptation algorithms.
[0047] In this specification, dynamic adjustment of queries includes: during the inference stage, the model dynamically adjusts the detection threshold according to the complexity of the input image and the difficulty of the detection task. By adjusting the query features, the model can reduce the detection threshold for low-confidence predictions, thereby improving the recall rate for rare objects.
[0048] In this specification, the adaptation algorithm includes:
[0049] Initializing queries: generating object queries through the transformer decoder;
[0050] Calculating task complexity: evaluating the task complexity based on the number of detected objects and the confidence scores;
[0051] Adjusting the threshold: if the task complexity is high, reducing the detection threshold to capture more potential objects;
[0052] Updating queries: adjusting the queries according to the dynamic adaptation function to ensure the flexibility of the model during inference.
[0053] In summary, the present invention has at least the following beneficial effects:
[0054] In the case where the sample size of some contraband items is scarce, the present invention uses meta-learning to solve a series of problems related to deep learning, such as solving the problems of poor training effect and low detection model accuracy caused by the small sample size of some security inspection contraband items in daily life, and improving the recognition accuracy and generalization ability of the security inspection contraband detection model. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0056] Figure 1 It is a schematic diagram of the contraband recognition method based on meta-learning involved in the present invention.
[0057] Figure 2 It is a schematic diagram of the CAM architecture involved in the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0058] In the following, only some exemplary embodiments are briefly described. As those skilled in the art can recognize, the described embodiments can be modified in various different ways without departing from the spirit or scope of the embodiments of the present invention. Therefore, the drawings and the description are considered to be exemplary in nature rather than restrictive.
[0059] The following disclosure provides many different embodiments or examples for implementing different structures of the embodiments of the present invention. To simplify the disclosure of the embodiments of the present invention, the components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the embodiments of the present invention. In addition, the embodiments of the present invention may repeat reference numerals and / or reference letters in different examples. This repetition is for the purpose of simplification and clarity and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0060] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0061] As Figure 1 shown, this embodiment provides a contraband identification method based on meta-learning, including:
[0062] S1. Obtain a query image and support images.
[0063] Input a query image (Query Image) containing the object to be detected and support images (Support Images) of multiple categories. These images are used to detect rare or novel objects.
[0064] S2. Extract features through the ResNet-101 backbone network.
[0065] Input the query image and support images into the ResNet-101 backbone network to extract features and generate query features (Query Features) and support features (Support Features). This step ensures that effective feature representations are extracted from the images.
[0066] S3. Input the query features, support features, and task encoding into the CAM.
[0067] The query features and support features are input into the Correlational Aggregation Module (CAM) together with the task encodings (Task Encodings).
[0068] In the CAM, a shared multi-head attention mechanism is used to transform the query and support features into the same embedding space for feature aggregation.
[0069] The CAM generates an attention matrix by calculating the similarity between the query features and support features, thereby highlighting the query features related to the support categories and finally outputting an enhanced feature representation.
[0070] S4. The output of the CAM enters the Transformer.
[0071] The output features of the CAM are input into the encoder-decoder structure of the Transformer.
[0072] The Transformer further processes these features, generates Object Queries through the decoder, and refines the object detection results.
[0073] This process utilizes the self-attention mechanism of the Transformer, enhancing the model's ability to understand and recognize objects.
[0074] S5. The output of the Transformer enters the adversarial learning.
[0075] The output of the Transformer is fed into the adversarial learning module to generate Adversarial Examples.
[0076] The Fast Gradient Sign Method (FGSM) is used to add small perturbations to the original input image to generate challenging samples, forcing the model to learn more robust feature representations.
[0077] In this way, the model enhances its resistance to noise and incompleteness in the input data.
[0078] S6. The output of the adversarial learning enters the dynamic adaptation module.
[0079] In the dynamic adaptation module, the model evaluates the complexity of the detection task in real time and adjusts the parameters as needed.
[0080] Specifically, the model modifies the object queries and the Detection Threshold to improve the detection performance for novel and rare objects.
[0081] The final output is the dynamically adjusted object detection results, which enhance the applicability and accuracy of the model in various detection tasks.
[0082] Experimental principle
[0083] Meta-DETR is a meta-learning-based object detection framework aimed at solving the problem of detecting prohibited items in data-scarce environments. Its main principles include:
[0084] 1. Adversarial learning:
[0085] By generating synthetic samples (adversarial examples) to simulate difficult-to-detect prohibited items, the feature representation ability of the model is enhanced.
[0086] The goal of adversarial learning is to improve the robustness of the model so that it can better handle noise and incomplete data.
[0087] 2. Dynamic few-shot adaptation mechanism:
[0088] During the inference process, the model can dynamically adjust parameters according to task complexity to optimize detection performance.
[0089] This mechanism ensures that the model can flexibly adapt to different detection tasks when dealing with rare objects.
[0090] 3. Correlation Aggregation Module (CAM):
[0091] CAM reduces the dependence on traditional region proposals by capturing the inter-class relationships between the query image and the support classes.
[0092] This module uses the shared multi-head attention mechanism to transform the query features and support class features into the same embedding space, thus improving the model's detection ability in few-shot scenarios.
[0093] Implementation process
[0094] 1. Overall architecture
[0095] 1) Feature extraction:
[0096] The query image and the support image extract features through the shared ResNet-101 backbone network to generate query features and support features.
[0097] 2) Task encoding acquisition:
[0098] Task encodings are generated through predefined mathematical functions (such as the sine function), and these encodings match the dimensions of the query features and support features.
[0099] The task encodings provide additional context information for the model to consider the requirements of specific tasks during feature aggregation.
[0100] 3) Feature aggregation:
[0101] The query features, support features, and task encodings are input into CAM together, and CAM improves detection performance by aggregating features.
[0102] CAM can process the features of multiple support classes simultaneously, capture inter-class correlations, and reduce the risk of misclassification.
[0103] 4) Detection module:
[0104] The output of CAM is passed to the Transformer encoder-decoder module to further optimize object queries.
[0105] This module generates the final detection results by optimizing the query.
[0106] 2. Correlation Aggregation Module (CAM)
[0107] 1) Feature matching:
[0108] CAM first transforms the query features and support class features into the same feature space and calculates the similarity between the query features and the support class prototypes using a shared linear transformation.
[0109] Generate an attention matrix through the Softmax function to highlight the query features related to the support class.
[0110] 2) Encoding matching:
[0111] CAM also introduces encoding matching to align the query features with the predefined task encodings. This method makes the model's prediction no longer depend on specific class labels but focus on task-related features.
[0112] Such as Figure 2 As shown, the implementation process of the Correlation Aggregation Module (CAM) is as follows:
[0113] Input and output:
[0114] Input: Query image query_image, array of support images support_images[], and task encodings task_encodings.
[0115] Output: Aggregated features aggregated_features.
[0116] Initialization:
[0117] Initialize the model model.
[0118] Set the number of training epochs epochs to 50.
[0119] Set the learning rate learning_rate to 0.001.
[0120] Training process:
[0121] Loop through the training epochs: For each training epoch (from 0 to 49):
[0122] For each pair of query image and support image:
[0123] Extract the features of the query image and support image, and store them as query_features and support_features respectively.
[0124] Calculate the similarity between the query features and the support features to generate the attention matrix attention_matrix.
[0125] Use the attention matrix to filter the query features to obtain filtered_query_features.
[0126] Generate the prototypes of the support classes support_prototypes.
[0127] Apply encoding matching to combine the attention matrix with the task encoding to generate task-specific features task_specific_features.
[0128] Aggregate the features, combine the filtered query features and the task-specific features to generate the final aggregated features aggregated_features.
[0129] Calculate the loss and use this loss to update the model weights.
[0130] Output the current training progress, including the epoch and the loss value.
[0131] Evaluation process:
[0132] After training is completed, use the validation set for evaluation:
[0133] For each pair of validation query images and support images, extract features and calculate the attention matrix.
[0134] Filter the query features and generate the prototypes of the support classes.
[0135] Calculate the task-specific features and aggregate these features.
[0136] Evaluate the model performance by comparing the aggregated features with the true labels val_ground_truth.
[0137] End:
[0138] Output the message "Model training and evaluation completed".
[0139] 3. Adversarial learning
[0140] 1) Adversarial sample generation:
[0141] Generate adversarial samples using the Fast Gradient Sign Method (FGSM). Adversarial samples are generated by adding small perturbations to the original input images, aiming to affect the model's predictions.
[0142] The generation formula for adversarial samples is:
[0143]
[0144] Here, x is the original input, y is the label, θ is the model parameter, and ∈ is the magnitude of the perturbation.
[0145] 2) Adversarial loss function:
[0146] During the training process, a combined loss function is defined, which combines the normal detection loss and the adversarial loss:
[0147] L adυ = L normal + λ · L adυersarial ;
[0148] where Lnormal is the standard object detection loss, Ladversarial is the adversarial sample loss, and λ is the hyperparameter that balances the two losses.
[0149] 4. Dynamic few-shot adaptation mechanism
[0150] 1) Dynamic adjustment of queries:
[0151] During the inference stage, the model dynamically adjusts the detection threshold according to the complexity of the input image and the difficulty of the detection task.
[0152] By adjusting the query features, the model can lower the detection threshold for low-confidence predictions, thereby improving the recall rate for rare objects.
[0153] 2) Adaptation algorithm:
[0154] Initializing queries: Generate object queries through the transformer decoder.
[0155] Calculating task complexity: Evaluate the task complexity based on the number of detected objects and the confidence scores.
[0156] Adjusting the threshold: If the task complexity is high, lower the detection threshold to capture more potential objects.
[0157] Updating queries: Adjust the queries according to the dynamic adaptation function to ensure the flexibility of the model during inference.
[0158] Differences from the prior art:
[0159] The present invention is a method for identifying contraband based on meta-learning. By introducing meta-learning strategies and training methods, it has better generalization ability and adaptability in the few-shot learning scenario. While Faster-RCNN focuses more on efficient and accurate object detection on large-scale datasets.
[0160] Application fields of the present invention:
[0161] (1) Security inspection field: Airport and station security inspections: Currently, this technology has been applied to X-ray security inspection machines to identify dangerous items such as guns, explosives, and knives. In the future, the algorithm can be further optimized to improve the recognition accuracy and efficiency to meet the needs of high-traffic security inspection sites; Border inspection: Conduct X-ray inspections on goods and vehicles at border ports to identify hidden contraband such as drugs and smuggled goods; Security for large-scale events: Conduct rapid security inspections on items carried by audiences during large-scale sports events, concerts, etc. to ensure the safety of the events.
[0162] (2) Medical field: Medical image analysis: Apply meta-learning technology to medical X-ray image analysis to assist doctors in diagnosing lung diseases, fractures, etc. Due to the scarcity of medical image data, meta-learning technology can make full use of limited labeled data to improve the diagnostic accuracy.
[0163] (3) Logistics field: Goods inspection: During the logistics process, conduct X-ray inspections on goods to identify possible contraband or dangerous goods to ensure logistics safety.
[0164] The present invention applies meta-learning and has the following advantages.
[0165] In terms of processing few-shot learning tasks, meta-learning performs well in dealing with few-shot learning tasks because it has been trained to quickly extract and learn features from limited data. This method provides good results in few-shot classification tasks, especially in applications such as metric learning and convolutional siamese neural networks.
[0166] In terms of reducing the requirement for training data volume for new tasks, meta-learning enables the machine to quickly adapt to new tasks and environments by leveraging existing experience and knowledge, thus reducing the dependence on a large amount of labeled data. Common meta-learning methods such as MAML (Model-Agnostic Meta-Learning) find a model initialization such that the model can quickly achieve good performance on new tasks after a small number of gradient updates.
[0167] In terms of improving the generalization ability of the model, meta-learning trains a "meta-model", that is, a model that learns how to learn, to observe and learn the features and patterns of a large number of different tasks. This meta-model can extract general learning rules and strategies and apply them to new tasks, thereby improving the generalization ability of the model. For example, in natural language processing, meta-learning can help the model quickly adapt to new languages or dialects because it learns how to extract and learn general features from previous tasks.
[0168] In terms of achieving rapid adaptation to new tasks, in the meta-training stage of meta-learning, a model with learning ability is constructed by observing and learning data from a series of different tasks. When this model is applied to a new task in the meta-test stage, it can utilize the general features and strategies learned previously to quickly adapt to the new task and learn. For example, in the field of robotics, meta-learning can help a robot quickly adapt to new motion tasks, such as grasping objects of different shapes, because it has learned how to quickly learn new tasks.
[0169] Glossary of terms:
[0170] RCNN: RCNN (Region-based Convolutional Neural Network) is a deep learning algorithm for object detection. It is one of the important algorithms in the field of object detection. By dividing an image into multiple candidate regions and then classifying and performing bounding box regression on each candidate region, it realizes the detection and localization of objects in the image.
[0171] PRN: PRN is an abbreviation in the Faster-RCNN algorithm, which stands for Pro[pos]al Region of Interest Network, and its Chinese meaning is "Candidate Region of Interest Network". In Faster-RCNN, PRN is the network used to extract features from candidate boxes.
[0172] RPN: RPN (Region Proposal Network) is a network used to generate candidate regions. It is a part of deep learning object detection algorithms and is commonly used in models such as Faster R-CNN.
[0173] ROI feature: ROI feature refers to the fixed-size feature extracted from the feature map through the ROIPooling operation in object detection algorithms. ROI is the abbreviation of Region of Interest, indicating the region of interest on the feature map. ROI features play a key role in the Faster-RCNN algorithm.
[0174] The above-described embodiments are used to illustrate the present invention, not to limit the present invention. Therefore, changes in the exemplified numerical values or replacement of equivalent elements still belong to the scope of the present invention.
[0175] From the above detailed description, those of ordinary skill in the art can clearly understand that the present invention can indeed achieve the aforementioned objectives and actually meets the requirements of the patent law.
[0176] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications falling within the scope of the present invention. The above description is only the preferred embodiments of the present invention and is not intended to limit the present invention. It should be noted that any modifications, equivalent replacements, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0177] It should be noted that the above description of the process is only for illustration and explanation and does not limit the scope of application of this specification. For those skilled in the art, various corrections and changes can be made to the process under the guidance of this specification. However, these corrections and changes are still within the scope of this specification.
[0178] The basic concept has been described above. Obviously, for those of ordinary skill in the art after reading this application, the above invention disclosure is only for illustration and does not constitute a limitation to this application. Although not explicitly stated here, those of ordinary skill in the art may make various modifications, improvements, and corrections to this application. Such modifications, improvements, and corrections are suggested in this application, so such modifications, improvements, and corrections still fall within the spirit and scope of the exemplary embodiments of this application.
[0179] Meanwhile, this application uses specific terms to describe the embodiments of this application. For example, "one embodiment", "an embodiment", and / or "some embodiments" mean a certain feature, structure, or characteristic related to at least one embodiment of this application. Therefore, it should be emphasized and noted that the "an embodiment" or "one embodiment" or "an alternative embodiment" mentioned two or more times in different positions in this specification does not necessarily refer to the same embodiment. In addition, certain features, structures, or characteristics in one or more embodiments of this application can be appropriately combined.
[0180] In addition, those of ordinary skill in the art can understand that various aspects of this application can be described and illustrated by several patentable types or situations, including any new and useful process, machine, product, or combination of substances, or any new and useful improvement thereof. Therefore, various aspects of this application can be implemented entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software can all be referred to as "units", "modules", or "systems". In addition, various aspects of this application can take the form of a computer program product embodied in one or more computer-readable media, in which computer-readable program code is included.
[0181] The computer program code required for the operations of various parts of this application can be written in any one or more programming languages, including object-oriented programming languages such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB.NET, Python, etc., conventional procedural programming languages such as C programming language, VisualBasic, Fortran2103, Perl, COBOL2102, PHP, ABAP, dynamic programming languages such as Python, Ruby, and Groovy, or other programming languages. This program code can run entirely on the user's computer, or run as an independent software package on the user's computer, or run partially on the user's computer and partially on a remote computer, or run entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer through any network form, such as a local area network (LAN) or a wide area network (WAN), or connected to an external computer (for example, through the Internet), or in a cloud computing environment, or used as a service such as software as a service (SaaS).
[0182] In addition, unless clearly stated in the claims, the order of the processing elements and sequences, the use of numbers and letters, or the use of other names in this application are not used to limit the order of the processes and methods of this application. Although some currently considered useful embodiments of the invention are discussed through various examples in the above disclosure, it should be understood that such details only serve the purpose of illustration, and the appended claims are not limited to the disclosed embodiments. On the contrary, the claims are intended to cover all modifications and equivalent combinations that conform to the essence and scope of the embodiments of this application. For example, although the implementation of the above various components can be embodied in a hardware device, it can also be implemented as a pure software solution, for example, installed on an existing server or mobile device.
[0183] Similarly, it should be noted that, in order to simplify the description of this application disclosure and thus help the understanding of one or more embodiments of the invention, in the previous description of the embodiments of this application, sometimes multiple features are merged into one embodiment, drawing, or description thereof. However, this method of this application should not be construed as reflecting the intention that the claimed subject matter requires more features than those clearly recited in each claim. On the contrary, the subject matter of the invention should have fewer features than the above single embodiment.
Claims
1. A method for identifying contraband based on meta - learning, characterized in that: S1. Obtain a query image containing the object to be detected and support images of multiple categories for detecting rare or novel objects; S2. Input the query image and support images into the ResNet - 101 backbone network to extract features and generate query features and support features; S3. Input the query features, support features, and task encoding into the Correlational Aggregation Module, and use a shared multi - head attention mechanism to transform the query features and support features into the same embedding space for feature aggregation; By calculating the similarity between the query features and support features, generate an attention matrix to highlight the query features related to the support categories, and finally output an enhanced feature representation; S4. Input the enhanced feature representation into the encoder - decoder structure of the Transformer, and generate object queries through the decoder to refine the object detection results; S5. Input the output of the Transformer into the adversarial learning module to generate adversarial samples; Use the FastGradientSign Method to add small perturbations to the original input image to generate challenging samples, forcing the model to learn more robust feature representations; S6. The output of the adversarial learning module enters the dynamic adaptation module to modify the object queries and detection thresholds to improve the detection performance for novel and rare objects, and finally output the object detection results.
2. The method for identifying contraband based on meta-learning according to claim 1, wherein Generate task encoding through a predefined mathematical function, and the task encoding matches the dimensions of the query features and support features.
3. The method for identifying contraband based on meta-learning according to claim 1, wherein, In the adversarial learning module, use the fast gradient sign method to generate adversarial samples, and the generation formula of the adversarial samples is: x' is the adversarial sample, x is the original input, y is the label, ∈ is the size of the perturbation, Sign is the sign function, ▽x is the gradient of x, and L(x, y, θ) is with respect to the input image x, label y, and model parameters, where θ is the model parameter.
4. The method for identifying contraband based on meta-learning according to claim 3, wherein, In the adversarial learning module, during the training process, a comprehensive loss function is defined, which combines the normal detection loss and the adversarial loss. The loss function L adv is as follows: L adv = L normal + λ·L adversarial ; Among them, L normal is the standard object detection loss, and L adversarial is the adversarial sample loss, and λ is the hyperparameter for balancing the two losses.
5. The method for identifying contraband based on meta-learning according to claim 1, wherein Apply a dynamic few - shot adaptation mechanism in the dynamic adaptation module, and the dynamic few - shot adaptation mechanism includes dynamic query adjustment and adaptation algorithms.
6. The method for identifying contraband based on meta-learning according to claim 5, wherein Dynamic query adjustment includes: In the inference stage, the model dynamically adjusts the detection threshold according to the complexity of the input image and the difficulty of the detection task. By adjusting the query features, the model can lower the detection threshold during low - confidence predictions, thereby improving the recall rate for rare objects. The method for identifying contraband based on meta-learning according to claim 5, characterized in that, The adaptation algorithm includes: Initial query: Generate object queries through the Transformer decoder; Calculate task complexity: Evaluate the task complexity according to the number of detected objects and confidence scores; Adjust the threshold: If the task complexity is high, lower the detection threshold to capture more potential objects; Update the query: Adjust the query according to the dynamic adaptation function to ensure the flexibility of the model during inference.
Citation Information
Cited By
Language and frequency prior fused few-sample contraband image recognition method
CN121278639A
A few-shot contraband image recognition method fusing language and frequency prior
CN121278639B