Model training method and device, industrial target detection method and device, equipment and storage medium

Through model-independent meta-learning algorithm and small sample learning method, combined with sample comparison loss and classification loss, the problem of low detection accuracy caused by insufficient sample number in traditional industrial target detection is solved, and efficient training and accurate identification under limited data is achieved.

CN120411477APending Publication Date: 2025-08-01EAST CHINA BRANCH OF THE FIFTH INSTITUTE OF ELECTRONICS MINISTRY OF IND & INFORMATION TECHNOLOGY (CHINA SAIBAO (EAST CHINA) LABORATORY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510501801.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

Traditional industrial target detection methods based on deep learning require a large amount of labeled data, resulting in low detection accuracy of rare industrial targets, especially when the sample size is small, it is easy to overfit.

Method used

The model-independent meta-learning algorithm is used for pre-training, combining sample comparison loss and classification loss, and training the industrial object detection model through small sample learning method, using the internal and external circulation mechanism of the meta-learning algorithm to quickly adapt to new tasks, and increasing self-supervised information to improve model accuracy.

Benefits of technology

In the case of limited data, the detection accuracy of the model is significantly improved, the training cost and data acquisition and labeling cost are reduced, and the problem of insufficient feature extraction caused by insufficient sample number is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120411477A_ABST
    Figure CN120411477A_ABST
Patent Text Reader

Abstract

The invention discloses a model training method and device, an industrial target detection method and device, equipment and a storage medium. The method comprises the steps that a training sample set is acquired, a pre-training sample set is extracted from the training sample set, and the training sample set comprises training samples containing industrial targets; based on a model-independent meta-learning algorithm, pre-training the pre-training model by using the pre-training sample set to obtain pre-training model parameters; and determining the sample comparison loss of the initial detection model and the classification loss of the pre-training model parameters by using the training sample set and the pre-training model parameters, and determining an industrial target detection model according to the classification loss and the sample comparison loss. According to the technical scheme provided by the embodiment of the invention, the model precision is greatly improved by utilizing the model-independent meta learning algorithm and the contrast loss under the condition of only utilizing self limited data, and the problem that the accuracy of a detection result is low due to the fact that the model cannot fully extract features due to few industrial target training samples is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of object detection, and particularly to a model training method, an industrial object detection method, a device, a device and a storage medium. Background Art

[0002] In recent years, China has vigorously developed intelligent manufacturing to promote the digital transformation and upgrading of the manufacturing industry, thereby improving the production efficiency and product quality of enterprises and enhancing the core competitiveness of enterprises. Object detection has a wide range of applications in intelligent manufacturing, such as security monitoring, automatic control, quality inspection, production scheduling, etc., which can reduce manual intervention and effectively improve work efficiency. With the development of artificial intelligence technology, many object detection models have been proposed one after another, such as Faster R-CNN, YOLO, SSD, R-FCN and RetinaNet, etc., and remarkable results have been achieved on public data sets such as PASCAL VOC, MS COCO and ImageNet.

[0003] Currently, traditional deep learning-based industrial object detection methods usually require a large amount of labeled data for training. If the model wants to achieve high accuracy, usually at least thousands or even tens of thousands of samples need to be collected and labeled, which will consume a large amount of time, manpower and financial costs.

[0004] However, for some special industrial objects, such as rare defects or non-standard parts, the number of their own samples is small, which makes it impossible for the model to fully extract features during training and is prone to overfitting and other phenomena, resulting in low object detection accuracy. Summary of the Invention

[0005] The present invention provides a model training method, an industrial object detection method, a device, a device and a storage medium to solve the problem of low industrial object detection accuracy.

[0006] In a first aspect, the present invention provides a model training method, including:

[0007] Obtain a training sample set, and extract a pre-training sample set from the training sample set, wherein the training sample set includes training samples containing industrial objects;

[0008] Based on a model-agnostic meta-learning algorithm, use the pre-training sample set to pre-train a pre-training model to obtain pre-training model parameters;

[0009] Use the training sample set and the pre-training model parameters to determine the sample contrast loss of the initial detection model and the classification loss of the pre-training model parameters, and determine an industrial object detection model according to the classification loss and the sample contrast loss, wherein the sample contrast loss is used to characterize the similarity between training samples.

[0010] In a second aspect, the present invention provides an industrial target detection method, including:

[0011] Obtaining an image to be detected;

[0012] Using an industrial target detection model to detect industrial targets in the image to be detected, and obtaining an industrial target detection result, wherein the industrial target detection model is obtained by the model training method of the above first aspect.

[0013] In a third aspect, the present invention provides a model training device, including:

[0014] A training sample determination module, configured to obtain a training sample set and extract a pre-training sample set from the training sample set, wherein the training sample set includes training samples containing industrial targets;

[0015] A pre-training module, configured to pre-train a pre-training model based on a model-agnostic meta-learning algorithm by using the pre-training sample set to obtain pre-training model parameters;

[0016] A detection model determination module, configured to determine a sample contrast loss of an initial detection model and a classification loss of the pre-training model parameters by using the training sample set and the pre-training model parameters, and determine an industrial target detection model according to the classification loss and the sample contrast loss, wherein the sample contrast loss is used to characterize the similarity between training samples.

[0017] In a fourth aspect, the present invention provides an industrial target detection device, including:

[0018] An image acquisition module, configured to obtain an image to be detected;

[0019] An industrial target detection module, configured to detect industrial targets in the image to be detected by using an industrial target detection model, and obtain an industrial target detection result, wherein the industrial target detection model is obtained by the model training method of the above first aspect.

[0020] In a fifth aspect, the present invention provides an electronic device, which includes:

[0021] At least one processor;

[0022] And a memory communicatively connected to at least one processor;

[0023] Wherein, the memory stores a computer program executable by at least one processor, and the computer program is executed by at least one processor so that at least one processor can execute the model training method of the above first aspect and / or the industrial target detection method of the above second aspect.

[0024] In a sixth aspect, the present invention provides a computer-readable storage medium storing computer instructions for causing a processor to implement the model training method of the first aspect and / or the industrial target detection method of the second aspect when executed.

[0025] Traditional deep learning algorithms require a large number of training samples and a large training model to achieve high accuracy. The model training solution provided by the present invention is a small-sample learning solution that does not require a large training model, effectively reducing the training cost. By using the model-agnostic meta-learning algorithm, the number of training samples is effectively reduced, and the data collection and annotation costs are reduced. During training, more attention is paid to the characteristics of the samples themselves. The contrast loss value adds additional self-supervised information to the model training, enabling a significant improvement in the model's accuracy when only using its own limited data, and solving the problem that the model cannot fully extract features due to the small number of industrial target training samples, resulting in a low accuracy of the detection results. The industrial target detection solution provided by the present invention can quickly and accurately identify industrial targets.

[0026] It should be understood that the content described in this part is not intended to identify the key or important features of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.

[0028] Figure 1 is a flowchart of a model training method provided in Embodiment 1 of the present invention;

[0029] Figure 2 is a flowchart of a model training method provided in Embodiment 2 of the present invention;

[0030] Figure 3 is a schematic diagram of the logical architecture of a model-agnostic meta-learning algorithm provided in Embodiment 2 of the present invention;

[0031] Figure 4 is a schematic diagram of a loss value determination process provided in Embodiment Ⅱ of the present invention;

[0032] Figure 5 is a flowchart of an industrial target detection method provided in Embodiment 3 of the present invention;

[0033] Figure 6It is a schematic structural diagram of a model training device provided according to Embodiment 4 of the present invention;

[0034] Figure 7 It is a schematic structural diagram of an industrial target detection device provided according to Embodiment 5 of the present invention;

[0035] Figure 8 It is a schematic structural diagram of an electronic device provided according to Embodiment 6 of the present invention. Detailed implementation manners

[0036] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0037] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In the description of the present invention, unless otherwise stated, "a plurality of" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0038] Embodiment 1

[0039] Figure 1 3]A flowchart of a model training method is provided for Embodiment 1 of the present invention. This embodiment is applicable to the situation of training an industrial target detection model. This method can be executed by a model training device, which can be implemented in the form of hardware and / or software. The model training device can be configured in an electronic device, which can be composed of two or more physical entities or one physical entity.

[0040] AsFigure 1 As shown, a model training method provided in the first embodiment of the present invention specifically includes the following steps:

[0041] S101. Obtain a training sample set, and extract a pre-training sample set from the training sample set, where the training sample set includes training samples containing industrial targets.

[0042] In this embodiment, a training sample set composed of industrial target data in the field can be obtained first. A part of the samples can be randomly extracted from the training sample set to obtain the pre-training sample set. Among them, the samples in the training sample set can include pictures containing industrial targets.

[0043] S102. Based on the model-agnostic meta-learning algorithm, use the pre-training sample set to pre-train the pre-training model to obtain pre-training model parameters.

[0044] In this embodiment, the pre-training model can be pre-trained using the model-agnostic meta-learning algorithm (Model-agnostic Meta-learning, MAML). Using MAML can enable the basic network to learn a pre-training model that is sensitive to all tasks, and then it can quickly adapt to new tasks through fine-tuning. MAML is implemented through continuous cycling of two layers, the inner loop calculates the loss value of each task in each batch, and the outer loop uses the sum of the losses of all tasks in each batch to update the parameters of the model. Among them, each task can include multiple types of training samples, and each type can include multiple training samples.

[0045] S103. Use the training sample set and the pre-training model parameters to determine the sample contrast loss of the initial detection model and the classification loss of the pre-training model parameters, and determine the industrial target detection model according to the classification loss and the sample contrast loss, where the sample contrast loss is used to characterize the similarity between training samples.

[0046] In this embodiment, after the pre-training is completed, during the formal training, all the data in the training sample set and the pre-trained model parameters obtained from the pre-training can be used to fine-tune the initial detection model, so that the initial detection model learns features different from those during the pre-training, making the final generalization ability of the model stronger and enabling the model to quickly reach the optimal state. Herein, the initial detection model is the pre-trained model of the industrial target detection model. At the same time, to solve the problem of insufficient feature extraction caused by insufficient training samples, a sample contrast loss is introduced, and more attention is paid to the characteristics of the samples themselves during training. The industrial target detection model is determined according to the classification loss and the sample contrast loss. For example, a preset operation (such as weighted summation, etc.) can be performed on the classification loss and the sample contrast loss, and the obtained operation value is determined as the total loss value of the initial detection model. The industrial target detection model can be determined according to this value. Such a setting can make similar samples closer in the feature space and dissimilar samples farther away from each other, adding additional self-supervised information during model training and improving the accuracy of the model.

[0047] The technical solution of the embodiment of the present invention is a small-sample learning solution, which does not require a large training model, effectively reduces the training cost, uses the model-agnostic meta-learning algorithm, effectively reduces the number of training samples, reduces the data acquisition and annotation costs, and pays more attention to the characteristics of the samples themselves during training. Using the contrast loss value makes similar samples closer in the feature space and dissimilar samples farther away from each other, adding additional self-supervised information during model training, and can greatly improve the accuracy of the model when only using its own limited data, solving the problem that the model cannot fully extract features due to few industrial target training samples, resulting in low accuracy of the detection results.

[0048] Optionally, for the model-agnostic meta-learning algorithm, the pre-training of the pre-trained model using the pre-training sample set to obtain the pre-trained model parameters includes: based on the inner loop of the model-agnostic meta-learning algorithm, using each first preset task to pre-train the pre-trained model to obtain the task loss value corresponding to each first preset task. Herein, the pre-training sample set includes a support set and a query set, and each first preset task includes multiple types of training samples in the support set; based on the outer loop of the model-agnostic meta-learning algorithm and the task loss value, using a second preset task to update the pre-trained model to obtain the pre-trained model parameters. Herein, each second preset task includes multiple types of training samples in the query set.

[0049] Specifically, the idea of meta - learning is to enable the model to learn how to learn, quickly learn new tasks based on the existing experience, and is widely used to handle small - sample problems. MAML is model - agnostic and can be combined with gradient - descent - based algorithms, so it has strong scalability. The traditional deep - learning training unit is sample data, while meta - learning training is task - based, that is, the training set and test set of MAML are composed of different tasks. Each task contains many categories, and there are multiple training samples in each category. The set used for training is called the support set, and the set used for testing is called the query set. MAML consists of two stages: meta - training and meta - testing. In the meta - training stage (i.e., the inner loop), randomly select N categories (K training samples for each category) from the pre - training sample set as the support set of the model. Each training will draw different tasks from the sample set, aiming to enable the pre - trained model to learn the common knowledge in different tasks and obtain a parameter that is sensitive to all tasks.

[0050] In the meta - testing stage (i.e., the outer loop), use the parameters learned from the support set and the new tasks in the query set for training, and use the experience obtained in the meta - training stage to quickly learn new tasks. Through the outer loop, use the (second) preset task and the task loss value obtained in the meta - training stage to fine - tune the initial detection model to obtain the pre - trained model parameters.

[0051] Embodiment 2

[0052] Figure 2 The figure is a flowchart of a model training method provided by Embodiment 2 of the present invention. The technical solution of the embodiment of the present invention is further optimized on the basis of the above - mentioned optional technical solutions, and a specific method for training a detection model for industrial targets is given.

[0053] Optionally, using the outer loop of the model - agnostic meta - learning algorithm and the task loss value to update the pre - trained model with a second preset task to obtain pre - trained model parameters includes: using the outer loop of the model - agnostic meta - learning algorithm to determine the model loss value of the pre - trained model with a second preset task; updating the pre - trained model according to the model loss value and the task loss value to obtain pre - trained model parameters.

[0054] Optionally, using the training sample set and the pre - trained model parameters to determine the sample contrast loss of the initial detection model includes: using the pre - trained model parameters to update the initial detection model to obtain an updated initial detection model; performing feature extraction on the training samples in the training sample set to obtain feature vectors, and extracting at least two target vectors from the feature vectors; determining the Euclidean distance between the target vectors, and determining the sample contrast loss of the updated initial detection model according to the Euclidean distance.

[0055] Optionally, determining the industrial target detection model according to the classification loss and the sample contrast loss includes: determining the sum value of the classification loss and the sample contrast loss as the comprehensive loss value; determining the industrial target detection model according to the comprehensive loss value.

[0056] As Figure 2 shown, a model training method provided in Embodiment 2 of the present invention specifically includes the following steps:

[0057] S201. Obtain a training sample set, and extract a pre-training sample set from the training sample set, where the training sample set includes training samples containing industrial targets.

[0058] S202. Based on the inner loop of the model-agnostic meta-learning algorithm, use each first preset task to pre-train the pre-trained model to obtain the task loss value corresponding to each first preset task, where the pre-training sample set includes a support set and a query set, and each first preset task includes multiple types of training samples in the support set.

[0059] Specifically, Figure 3 is a schematic diagram of the logical architecture of a model-agnostic meta-learning algorithm. As Figure 3 shown, the basic network is the feature extraction network of MAML, which is different from the target detection model during formal training. The basic network (i.e., the pre-trained model) can be composed of 4 basic modules with the same structure, where the basic module is sequentially composed of a convolutional layer, an activation layer, a batch normalization layer, and a max pooling layer, and is used to extract features during the pre-training stage. The specific process of using the model-agnostic meta-learning algorithm to perform inner loop pre-training on the model is as follows:

[0060] First, randomly initialize the parameters of the pre-trained model, and randomly sample from the support set to form a batch, and use each task in the batch to determine the model loss respectively. Update the task loss value corresponding to this task. The inner loop process can be expressed as follows:

[0061]

[0062] where α here is the inner loop learning rate. θ i is the weight parameter of the basic network updated i times for a certain task in this batch.

[0063] S203. Based on the outer loop of the model-agnostic meta-learning algorithm, use the second preset task to determine the model loss value of the pre-trained model.

[0064] S204. Update the pre-trained model according to the model loss value and the task loss value to obtain the pre-trained model parameters.

[0065] Specifically, as Figure 3 shown, after the inner loop ends, the outer loop process is entered. The model loss value and task loss value obtained according to the query set are summed to obtain the loss value of all tasks within the batch, and the original model (i.e., the pre-trained model) parameters θ are truly updated according to this loss value. The outer loop process can be expressed by the following formula:

[0066]

[0067] where β is the outer loop learning rate. The above formula means to find a set of model parameters θ to minimize the sum of the losses after all tasks are updated K times.

[0068] Subsequently, the model training for this batch is ended, and the training for the next batch is continued. This process needs to be repeatedly executed and looped multiple times until the model converges. The core idea of model-agnostic meta-learning is to first train a parameter that is most sensitive to all tasks. When facing a new task, by fine-tuning the parameter, the optimal state can be quickly reached, thus solving the problem of few training samples. Traditional machine learning algorithms directly update the initialized parameters after each gradient descent. The actual parameter update of MAML is not within each task in the inner loop. The loss obtained from each task training is the loss for the current task. The sum of the losses of all tasks in a batch in the outer loop is the true gradient update direction of the model.

[0069] S205. Update the initial detection model using the pre-trained model parameters to obtain an updated initial detection model; extract features from the training samples in the training sample set to obtain feature vectors, and extract at least two target vectors from the feature vectors.

[0070] Specifically, the pre-trained model parameters obtained by pre-training can be updated to the initial detection model first to obtain an updated initial detection model. Then, the updated initial detection model is formally trained.

[0071] Exemplarily, Figure 4 is a schematic diagram of a loss value determination process. As Figure 4 shown, all the training samples in the training sample set can be subjected to feature extraction to obtain feature vectors. A storage space can be set in the pre-trained model parameters to store the feature vectors of all the training samples in the training sample set after passing through the feature extraction network. 2 feature vectors can be randomly extracted from the storage space (i.e., the memory in Figure 4 ).

[0072] S206. Determine the Euclidean distance between the target vectors, and determine the sample contrast loss of the updated initial detection model according to the Euclidean distance.

[0073] Exemplarily, the Euclidean distance between two feature vectors in the feature space can be directly calculated, and this distance can represent the matching degree between the two feature vectors. The determination method of the sample contrast loss CL can be as follows:

[0074]

[0075] The above sample contrast loss function can prompt samples of the same category to approach each other in the feature space, and samples of different categories to move away from each other. Among them, A and B are feature vectors, D = ‖A - B‖2 represents the Euclidean distance between A and B, and Y represents whether the two samples are of the same category. Y = 1 indicates that the two samples are of the same category, Y = 0 indicates that the two samples are not of the same category, and N is the number of categories of training samples in the training sample set.

[0076] When Y = 1, that is, when the two samples are of the same category, If the Euclidean distance between samples of the same category in the feature space is large (it should be small originally), then the value of CL will increase. Through the backpropagation of the error of the neural network, the value of CL will decrease, thereby reducing the distance between samples of the same category.

[0077] When Y = 0, that is, when the two samples are of different categories, If the Euclidean distance between samples of different categories in the feature space is small (it should be large originally), the value of CL will also increase. Through the reverse error propagation, the value of CL will decrease, thereby increasing the distance between samples of different categories.

[0078] Therefore, the sample contrast loss can represent the similarity degree between two feature vectors, and can be used as additional self-supervised information to prompt samples of the same category to approach each other in the feature space, and samples of different categories to move away from each other.

[0079] S207. Determine the classification loss of the pre-trained model parameters by using the training sample set.

[0080] Specifically, as Figure 4 shown, the softmax function can be used to determine the classification loss of the pre-trained model parameters.

[0081] S208. Determine the sum value of the classification loss and the sample contrast loss as the comprehensive loss value.

[0082] S209. Determine the industrial target detection model according to the comprehensive loss value.

[0083] The model training method provided by the embodiment of the present invention uses a model-agnostic meta-learning algorithm for pre-training before formal training, making the initialized model sensitive to various tasks. When formally training, it can quickly adapt to new tasks through fine-tuning, thereby reducing training data. When formally training, by increasing the contrast loss value, the model obtains additional self-supervised information, thereby obtaining more feature information and increasing the accuracy of the model under the condition of limited samples.

[0084] Embodiment III

[0085] Figure 5 The flowchart of an industrial target detection method provided by Embodiment III of the present invention is applicable to the situation of training an industrial target detection model. This method can be executed by an industrial target detection device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. The electronic device can be composed of two or more physical entities or one physical entity.

[0086] As Figure 5 shown, the industrial target detection method provided by Embodiment III of the present invention specifically includes the following steps: [[ID=

[14]

[0087] S301. Obtain the image to be detected.

[0088] S302. Use the industrial target detection model to detect the industrial target in the image to be detected, and obtain the industrial target detection result, where the industrial target detection model is obtained through the model training method described above.

[0089] In this embodiment, the image to be detected can be input into the industrial target detection model, which can detect the industrial target in the image to be detected and output the industrial target detection result, such as whether there is an industrial target, whether the industrial target has defects and the type of defects, etc.

[0090] The technical solution of the embodiment of the present invention can quickly and accurately identify industrial targets.

[0091] Embodiment IV

[0092] Figure 6 The structural schematic diagram of a model training device provided by Embodiment IV of the present invention. As Figure 6 shown, the device includes: a training sample determination module 401, a pre-training module 402, and a detection model determination module 403, where:

[0093] The training sample determination module is used to obtain a training sample set and extract a pre-training sample set from the training sample set, where the training sample set includes training samples containing industrial targets;

[0094] A pre-training module, which is used to pre-train a pre-training model based on a model-agnostic meta-learning algorithm by using the pre-training sample set to obtain pre-training model parameters;

[0095] A detection model determination module, which is used to determine the sample contrast loss of the initial detection model and the classification loss of the pre-training model parameters by using the training sample set and the pre-training model parameters, and determine an industrial target detection model according to the classification loss and the sample contrast loss, wherein the sample contrast loss is used to characterize the similarity between training samples.

[0096] The model training device provided by the embodiments of the present invention does not require a large training model, effectively reduces the training cost, uses a model-agnostic meta-learning algorithm, effectively reduces the number of training samples, reduces the data collection and annotation costs, and pays more attention to the characteristics of the samples themselves during training. By using the contrast loss value, similar samples are closer in the feature space, and dissimilar samples are farther away from each other, adding additional self-supervised information during model training. It can greatly improve the accuracy of the model when only using its own limited data, and solves the problem that the model cannot fully extract features due to the small number of industrial target training samples, resulting in low accuracy of the detection results.

[0097] Optionally, the pre-training module includes:

[0098] A model parameter determination unit, which is used to pre-train the pre-training model based on the inner loop of the model-agnostic meta-learning algorithm by using each first preset task to obtain the task loss value corresponding to each first preset task, wherein the pre-training sample set includes a support set and a query set, and each first preset task includes multiple types of training samples in the support set;

[0099] A pre-training model update unit, which is used to update the pre-training model based on the outer loop of the model-agnostic meta-learning algorithm and the task loss value by using a second preset task to obtain pre-training model parameters, wherein each second preset task includes multiple types of training samples in the query set.

[0100] Further, updating the pre-training model based on the outer loop of the model-agnostic meta-learning algorithm and the task loss value by using a second preset task to obtain pre-training model parameters includes: determining the model loss value of the pre-training model based on the outer loop of the model-agnostic meta-learning algorithm by using the second preset task; updating the pre-training model according to the model loss value and the task loss value to obtain pre-training model parameters.

[0101] Optionally, the detection model determination module includes:

[0102] A detection model update unit, configured to update the initial detection model by using the pre-trained model parameters to obtain an updated initial detection model;

[0103] A vector extraction unit, configured to perform feature extraction on the training samples in the training sample set to obtain feature vectors, and extract at least two target vectors from the feature vectors;

[0104] A contrast loss determination unit, configured to determine the Euclidean distance between the target vectors, and determine the sample contrast loss of the updated initial detection model according to the Euclidean distance.

[0105] Optionally, the detection model determination module includes:

[0106] An integrated loss value determination unit, configured to determine the sum of the classification loss and the sample contrast loss as an integrated loss value;

[0107] A model determination unit, configured to determine an industrial target detection model according to the integrated loss value.

[0108] The model training device provided by the embodiments of the present invention can execute the model training method provided by any embodiment of the present invention, and has corresponding function modules and beneficial effects for executing the method.

[0109] Embodiment 5

[0110] Figure 7 The following is a schematic structural diagram of an industrial target detection device provided by Embodiment 5 of the present invention. As Figure 7 shown, the device includes: an image acquisition module 501 and an industrial target detection module 502, where:

[0111] The image acquisition module is configured to acquire an image to be detected;

[0112] The industrial target detection module is configured to detect industrial targets in the image to be detected by using an industrial target detection model to obtain an industrial target detection result, where the industrial target detection model is obtained by the model training method described above.

[0113] The industrial target detection device provided by the embodiments of the present invention can quickly and accurately identify industrial targets.

[0114] The industrial target detection device provided by the embodiments of the present invention can execute the industrial target detection method provided by any embodiment of the present invention, and has corresponding function modules and beneficial effects for executing the method.

[0115] Embodiment 6

[0116] Figure 8The schematic structural diagram of an electronic device 60 that can be used to implement the embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0117] As Figure 8 shown, the electronic device 60 includes at least one processor 61, and a memory communicatively connected to the at least one processor 61, such as a read-only memory (ROM) 62, a random access memory (RAM) 63, etc. The memory stores a computer program executable by the at least one processor. The processor 61 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 62 or the computer program loaded from the storage unit 68 into the random access memory (RAM) 63. Various programs and data required for the operation of the electronic device 60 can also be stored in the RAM 63. The processor 61, the ROM 62, and the RAM 63 are connected to each other through a bus 64. The input / output (I / O) interface 65 is also connected to the bus 64.

[0118] Multiple components in the electronic device 60 are connected to the I / O interface 65, including: an input unit 66, such as a keyboard, a mouse, etc.; an output unit 67, such as various types of displays, speakers, etc.; a storage unit 68, such as a magnetic disk, an optical disc, etc.; and a communication unit 69, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 69 allows the electronic device 60 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0119] The processor 61 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 61 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 61 executes the various methods and processes described above, such as the model training method and / or the industrial target detection method.

[0120] In some embodiments, the model training method and / or the industrial target detection method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 68. In some embodiments, part or all of the computer program may be loaded and / or installed onto the electronic device 60 via the ROM 62 and / or the communication unit 69. When the computer program is loaded into the RAM 63 and executed by the processor 61, one or more steps of the model training method and / or the industrial target detection method described above may be executed. Alternatively, in other embodiments, the processor 61 may be configured to execute the model training method and / or the industrial target detection method by any other suitable means (e.g., by means of firmware).

[0121] The various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuitry, integrated circuit systems, field-programmable gate arrays (FPGA), application-specific integrated circuits (ASIC), application-specific standard products (ASSP), systems-on-chip (SOC) of systems-on-chip, complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0122] The computer program for implementing the method of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to the processor of a general-purpose computer, a dedicated computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowchart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0123] The computer device provided above may be used to execute the model training method and / or the industrial target detection method provided in any of the above embodiments, and has the corresponding functions and beneficial effects.

[0124] Embodiment VII

[0125] In the context of the present invention, a computer-readable storage medium may be a tangible medium, and the computer-executable instructions are used to execute the model training method and / or the industrial target detection method when executed by a computer processor. The model training method includes:

[0126] Obtain a training sample set, and extract a pre-training sample set from the training sample set, where the training sample set includes training samples containing industrial targets;

[0127] Based on a model-agnostic meta-learning algorithm, use the pre-training sample set to pre-train a pre-training model to obtain pre-training model parameters;

[0128] Use the training sample set and the pre-training model parameters to determine the sample contrast loss of the initial detection model and the classification loss of the pre-training model parameters, and determine an industrial target detection model according to the classification loss and the sample contrast loss, where the sample contrast loss is used to characterize the similarity between training samples.

[0129] The industrial target detection method includes:

[0130] Obtain an image to be detected;

[0131] Use the industrial target detection model to detect industrial targets in the image to be detected to obtain an industrial target detection result, where the industrial target detection model is obtained by the model training method described above.

[0132] In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium may be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0133] The computer device provided above can be used to execute the model training method and / or the industrial target detection method provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0134] It should be noted that in the above embodiments of the model training method and / or the industrial object detection device, the included units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of mutual distinction and do not limit the protection scope of the present invention.

[0135] Note that the above is only a preferred embodiment of the present invention and the technical principles applied. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, re-adjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments only. Without departing from the concept of the present invention, more other equivalent embodiments can be included, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A model training method, characterized in that, Including: Obtain a training sample set, and extract a pre-training sample set from the training sample set, where the training sample set includes training samples containing industrial targets; Based on a model-agnostic meta-learning algorithm, use the pre-training sample set to pre-train a pre-training model to obtain pre-training model parameters; Use the training sample set and the pre-training model parameters to determine the sample contrast loss and classification loss of an initial detection model, and determine an industrial target detection model according to the classification loss and the sample contrast loss, where the sample contrast loss is used to characterize the similarity between training samples.

2. The method according to claim 1, wherein The step of using the pre-training sample set to pre-train a pre-training model based on a model-agnostic meta-learning algorithm to obtain pre-training model parameters includes: Based on the inner loop of a model-agnostic meta-learning algorithm, use each first preset task to pre-train a pre-training model to obtain a task loss value corresponding to each first preset task, where the pre-training sample set includes a support set and a query set, and each first preset task includes multiple types of training samples in the support set; Based on the outer loop of a model-agnostic meta-learning algorithm and the task loss value, use a second preset task to update the pre-training model to obtain pre-training model parameters, where each second preset task includes multiple types of training samples in the query set.

3. The method according to claim 2, wherein The step of using the outer loop of a model-agnostic meta-learning algorithm and the task loss value to update the pre-training model to obtain pre-training model parameters includes: Based on the outer loop of a model-agnostic meta-learning algorithm, use a second preset task to determine the model loss value of the pre-training model; Update the pre-training model according to the model loss value and the task loss value to obtain pre-training model parameters.

4. The method according to any one of claims 1-3, characterized in that The step of using the training sample set and the pre-training model parameters to determine the sample contrast loss of an initial detection model includes: Update the initial detection model using the pre-training model parameters to obtain an updated initial detection model; Extract feature vectors from the training samples in the training sample set, and extract at least two target vectors from the feature vectors; Determine the Euclidean distance between the target vectors, and determine the sample contrast loss of the updated initial detection model according to the Euclidean distance.

5. The method according to claim 1, characterized in that, The step of determining an industrial target detection model according to the classification loss and the sample contrast loss includes: Determine the sum value of the classification loss and the sample contrast loss as a comprehensive loss value; Determine an industrial target detection model according to the comprehensive loss value.

6. An industrial target detection method, characterized in that, Including: Obtain an image to be detected; Use an industrial target detection model to detect industrial targets in the image to be detected to obtain an industrial target detection result, where the industrial target detection model is obtained by the model training method described in any one of claims 1-5.

7. A model training device, characterized in that, Including: A training sample determination module, configured to obtain a training sample set, and extract a pre-training sample set from the training sample set, where the training sample set includes training samples containing industrial targets; A pre-training module, configured to pre-train a pre-training model based on a model-agnostic meta-learning algorithm by using the pre-training sample set, so as to obtain pre-training model parameters; A detection model determination module, configured to determine a sample contrast loss of an initial detection model and a classification loss of the pre-training model parameters by using the training sample set and the pre-training model parameters, and determine an industrial target detection model according to the classification loss and the sample contrast loss, wherein the sample contrast loss is used to characterize the similarity between training samples.

8. An industrial target detection device, characterized in that, including: An image acquisition module, configured to acquire an image to be detected; An industrial target detection module, configured to detect an industrial target in the image to be detected by using the industrial target detection model, so as to obtain an industrial target detection result, wherein the industrial target detection model is obtained by using the model training method according to any one of claims 1-5.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor, so that the at least one processor can execute the model training method according to any one of claims 1-5 and / or the industrial target detection method according to claim 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the model training method according to any one of claims 1-5 and / or the industrial target detection method according to claim 6 when executed by a processor.

Citation Information

Cited By

  • Optical fiber dynamic fatigue parameter testing device and method

    CN121068176A