Training method of image recognition model, image recognition method and related equipment

By employing an image recognition method that utilizes iterative training from multiple data sources and optimization of the loss function, the problem of low annotation accuracy has been solved, improving the training effect and recognition accuracy of the image recognition model and shortening the processing time for auto insurance claims.

CN116958787BActive Publication Date: 2025-11-04PEOPLE'S INSURANCE COMPANY OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311041565.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-17
Publication Date
2025-11-04
Estimated Expiration
2043-08-17

AI Technical Summary

Technical Problem

In existing image recognition methods, the annotation accuracy is not high, resulting in unsatisfactory training effects of image recognition network models. This is especially true in the application scenario of auto insurance claims, where image review caused by misoperation or malicious behavior increases unnecessary workload and prolongs the claims processing cycle.

Method used

The contrastive learning model is iteratively trained using image data samples from multiple data sources. Positive sample images are obtained through data augmentation, and a loss function is constructed based on the distance between sample feature vectors. The model is then trained using a multilayer perceptron, reducing the number of manually labeled samples.

Benefits of technology

It improves the image recognition model's ability to represent features in different scenarios, ensures image recognition accuracy, shortens the business processing cycle, reduces the accuracy problem of manual annotation, and improves the model training effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116958787B_ABST
    Figure CN116958787B_ABST
Patent Text Reader

Abstract

The application discloses a training method of an image recognition model, an image recognition method and related equipment, and belongs to the technical field of image recognition. The method comprises the following steps: acquiring an image data sample set, iteratively training a contrast learning model by using the image data sample set, and obtaining an image recognition model; performing data enhancement processing on image data samples in the image data sample set to obtain positive sample images; determining a first distance between a sample feature vector corresponding to the image data sample and a positive sample feature vector corresponding to the positive sample image, and a second distance between a negative sample feature vector corresponding to a negative sample image; and determining a loss function of the contrast learning model according to the first distance and the second distance. In this way, the model is trained by using only a small amount of labeled samples under the premise of ensuring the image recognition accuracy, the problem of low accuracy of manually labeled data is avoided, and the training effect of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image recognition technology, and in particular to a training method for an image recognition model, an image recognition method, and related equipment. Background Technology

[0002] In the field of image recognition, image classification is typically based on neural network models. For example, in auto insurance claims, when a user uploads photos of a vehicle accident, due to misoperation or malicious behavior, the uploaded photo may not actually be an accident photo. This adds unnecessary workload to subsequent damage assessment and review. Furthermore, because the review fails, the process is returned to the user to re-upload the photo, extending the claims processing cycle. Therefore, it is crucial to determine whether the user's uploaded image meets the claims requirements as early as possible.

[0003] Most existing image recognition methods involve annotating a large number of positive and negative sample images, then training convolutional neural networks using these annotated images to recognize user-uploaded images. However, due to the complexity of the scenes in which vehicles are located in the images, a large number of samples (usually hundreds of thousands or millions) are typically required to ensure image recognition accuracy. This incurs significant manpower costs, and the annotation work is complex and arduous, resulting in low overall annotation accuracy and impacting the training performance of the image recognition model. Summary of the Invention

[0004] This application provides a training method for an image recognition model, an image recognition method, and related equipment to solve the problems of low annotation accuracy and unsatisfactory training effect of image recognition network models in the prior art.

[0005] To solve the above-mentioned technical problems, this application is implemented as follows:

[0006] In a first aspect, embodiments of this application provide a method for training an image recognition model, comprising:

[0007] Obtain an image data sample set, which includes image data samples from multiple data sources;

[0008] The contrastive learning model is iteratively trained using the image data sample set. During each iteration, data augmentation is performed on the image data samples in the image data sample set to obtain positive sample images. A first distance is determined between the sample feature vector corresponding to the image data sample and the positive sample feature vector corresponding to the positive sample image, and a second distance is determined between the sample feature vector and the negative sample feature vector corresponding to the negative sample image. The negative sample images are images represented by other image data samples in the image data sample set besides the image data samples mentioned above.

[0009] Based on the first distance and the second distance, determine the loss function of the contrastive learning model;

[0010] The first model parameters of the contrastive learning model are adjusted according to the sample feature vector corresponding to the image data sample and the loss function of the contrastive learning model until the set convergence condition is met, and the image recognition model is determined based on the trained contrastive learning model.

[0011] In one possible implementation, the image data samples from the plurality of data sources include: a first image data sample containing the target object in a preset database, a second image data sample containing road condition information in the target website, and a third image data sample containing scene information in the target website.

[0012] In one possible implementation, the negative sample images include multiple images, and determining the second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image includes:

[0013] Obtain the candidate distance between the sample feature vector and the negative sample feature vectors corresponding to multiple negative sample images;

[0014] The candidate distances are sorted according to a preset rule, and the candidate distance corresponding to the preset sorting position among the candidate distances is selected as the second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image.

[0015] In one possible implementation, determining the loss function of the contrastive learning model based on the first distance and the second distance includes:

[0016] Obtain the distance difference between the first distance and the second distance;

[0017] The loss function of the contrastive learning model is constructed based on the degree of deviation between the distance difference and the preset value.

[0018] In one possible implementation, determining the image recognition model based on the trained contrastive learning model includes:

[0019] A predetermined number of image data samples in the image data sample set are labeled to obtain a labeled dataset;

[0020] Based on the trained contrastive learning model and the pre-set multilayer perceptron, construct a neural network model;

[0021] The neural network model is iteratively trained using the labeled dataset. The second model parameters of the multilayer perceptron are adjusted according to the cross-entropy loss function of the neural network model until the set convergence condition is met. The image recognition model is then determined based on the trained neural network model.

[0022] Secondly, embodiments of this application provide an image recognition method, including:

[0023] Obtain the target image uploaded by the user;

[0024] The target feature vector corresponding to the target image is input into an image recognition model for classification processing, and a classification result is output; the image recognition model is trained according to the image recognition model training method described in the first aspect above;

[0025] Based on the classification results, the image category corresponding to the target image is determined.

[0026] Thirdly, embodiments of this application provide a training apparatus for an image recognition model, comprising:

[0027] The data acquisition module is used to acquire an image data sample set, which includes image data samples from multiple data sources;

[0028] The model training module is used to iteratively train the contrastive learning model using the image data sample set. During each iteration, data augmentation is performed on the image data samples in the image data sample set to obtain positive sample images. A first distance is determined between the sample feature vector corresponding to the image data sample and the positive sample feature vector corresponding to the positive sample image, and a second distance is determined between the sample feature vector and the negative sample feature vector corresponding to the negative sample image. The negative sample images are images represented by other image data samples in the image data sample set besides the image data samples mentioned above.

[0029] Based on the first distance and the second distance, determine the loss function of the contrastive learning model;

[0030] The first model parameters of the contrastive learning model are adjusted according to the sample feature vector corresponding to the image data sample and the loss function of the contrastive learning model until the set convergence condition is met, and the image recognition model is determined based on the trained contrastive learning model.

[0031] Fourthly, embodiments of this application provide an image recognition device, including:

[0032] The image acquisition module is used to acquire target images uploaded by users;

[0033] The image classification module is used to classify the target image by inputting the target feature vector corresponding to the target image into the image recognition model and output the classification result; the image recognition model is trained according to the training device of the image recognition model described in the third aspect above;

[0034] The category determination module is used to determine the image category corresponding to the target image based on the classification result.

[0035] Fifthly, embodiments of this application provide an electronic device, which includes a processor and a memory. The memory stores programs or instructions that can run on the processor, and when the programs or instructions are executed by the processor, they implement the steps of the above-described method.

[0036] In a sixth aspect, embodiments of this application provide a computer-readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the above-described method.

[0037] This application provides a method for training an image recognition model, comprising: acquiring an image data sample set including image data samples from multiple data sources; iteratively training a contrastive learning model using the image data sample set to obtain an image recognition model; wherein, in each iteration of training, data augmentation processing is performed on the image data samples in the image data sample set to obtain positive sample images; determining a first distance between the sample feature vector corresponding to the image data sample and the positive sample feature vector corresponding to the positive sample image, and determining a second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image; and determining the loss function of the contrastive learning model based on the first and second distances.

[0038] In this way, training the model with image data samples from multiple data sources can improve the contrastive learning model's ability to represent image features in different scenarios. Furthermore, by constructing the loss function of the contrastive learning model through the first distance between the sample feature vector and the positive sample feature vector, and the second distance between the sample feature vector and the negative sample feature vector, the sample feature vector of the image data sample gradually approaches the positive sample feature vector and moves away from the negative sample feature vector during multiple iterations of training. The contrastive learning model can fully learn the effective features in the image data sample, thereby using only a small number of labeled samples for model training while ensuring image recognition accuracy. This avoids the problem of low accuracy of manually labeled data and improves the training effect of the model. Attached Figure Description

[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0040] Figure 1 A flowchart illustrating a training method for an image recognition model provided in an embodiment of this application is shown.

[0041] Figure 2 The diagram shows a network structure of a contrastive learning model provided in an embodiment of this application.

[0042] Figure 3 A flowchart illustrating an image recognition method provided in an embodiment of this application is shown.

[0043] Figure 4 A schematic diagram of the structure of a training device for an image recognition model provided in an embodiment of this application is shown;

[0044] Figure 5 This paper shows a schematic diagram of the structure of an image recognition device provided in an embodiment of this application;

[0045] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0046] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0047] Figure 1 This illustration shows a flowchart of a training method for an image recognition model provided in an embodiment of this application. The execution subject of this method can be a terminal device or a server. The terminal device can be a personal computer, a mobile terminal device such as a mobile phone or tablet computer, or a user-used terminal device. The server can be a standalone server or a server cluster composed of multiple servers. Furthermore, the server can be a backend server for a specific service or a backend server for a system (such as an image recognition system). This embodiment uses a server as the execution subject for illustration. For the case of a terminal device, the relevant content below can be used, and it will not be repeated here. As shown in the figure, the training method 100 for the image recognition model may include the following steps:

[0048] S101: Obtain an image data sample set, which includes image data samples from multiple data sources.

[0049] In practice, image data samples are obtained from multiple data sources to form an image data sample set. For example, image data samples can be crawled from a target website or obtained from a preset target database.

[0050] This allows the image data sample set to contain richer image data sample information. Using this image data sample set to iteratively train the contrastive learning model is beneficial to improving the contrastive learning model's ability to represent image features in different scenarios.

[0051] In one possible implementation, the image data samples from multiple data sources include: a first image data sample containing the target object in a preset database, a second image data sample containing road condition information within the target website, and a third image data sample containing scene information within the target website.

[0052] In practice, a first image data sample d1 containing damaged vehicles is obtained from historical cases stored in the database, a second image data sample d2 containing road condition information (such as road and road condition related images) is obtained from the Internet, and a third image data sample d3 containing scene information is obtained from the Internet. The image data samples can be real photographed images or two-dimensional or three-dimensional images generated by simulating real scenes.

[0053] The first image data sample d1, the second image data sample d2, and the third image data sample d3 are merged into an image data sample set, and their combination order is changed to avoid the model shifting to a certain type of image data sample during training.

[0054] S102: Use the image data sample set to iteratively train the contrastive learning model to obtain an image recognition model.

[0055] In each iteration of training, data augmentation processing is performed on the image data samples in the image data sample set to obtain positive sample images corresponding to the image data samples; a first distance is determined between the sample feature vector corresponding to the image data sample and the positive sample feature vector corresponding to the positive sample image, and a second distance is determined between the sample feature vector and the negative sample feature vector corresponding to the negative sample image; the negative sample image is an image represented by other image data samples in the image data sample set besides the image data samples mentioned above.

[0056] Based on the first distance and the second distance, construct the loss function of the contrastive learning model;

[0057] The first model parameters of the contrastive learning model are adjusted according to the sample feature vector corresponding to the image data sample and the loss function of the contrastive learning model until the set convergence condition is met, and the image recognition model is determined based on the trained contrastive learning model.

[0058] In practice, during iterative training, the image data samples in the image data sample set are first subjected to data augmentation processing. Data augmentation methods include cropping, flipping, adding Gaussian noise, and color transformation. Thus, assuming the number of image data samples in each batch is N, after data augmentation, the number of image data samples becomes 2N. Since the original image data sample and the augmented image data sample come from the same image, the augmented image data sample becomes a positive sample image, while the images represented by other image data samples in the same batch are negative sample images.

[0059] Furthermore, the sample feature vector x corresponding to the image data sample and the positive sample feature vector x corresponding to the positive sample image are determined. + The first distance between them, and the determination of the negative sample feature vector x and the negative sample feature vector x corresponding to the negative sample image. - The second distance between the first and second distances is determined; the loss function of the contrastive learning model is determined based on the first and second distances; the first model parameters of the contrastive learning model are adjusted according to the sample feature vectors corresponding to the image data samples and the loss function of the contrastive learning model until the set convergence condition is met; and the image recognition model is determined based on the trained contrastive learning model.

[0060] The first distance and / or the second distance can be determined based on the similarity between the two feature vectors; the convergence condition can be that the total number of iterations reaches a preset threshold, or that the loss value determined by the loss function stabilizes within a preset numerical range.

[0061] In practice, the contrastive learning model includes a data augmentation transformer, a backbone image feature extractor, and a multilayer perceptron. The sample feature vector x is processed by a custom data augmentation transformer (augmentation methods include cropping, flipping, Gaussian noise, color transformation, etc.), and then by the backbone image feature extractor, which here utilizes the Vision Transform. Its network structure is as follows: Figure 2 As shown, the feature representation h of the obtained positive sample image is passed through a multilayer perceptron (MLP) mapping layer to obtain a lower-dimensional feature vector y.

[0062] Since image data samples undergo data augmentation to obtain positive sample images, while the images represented by other image data samples in the same batch are negative sample images, there can be multiple negative sample images. The loss function of existing contrastive learning models is usually infoNCE, which treats all other samples in the training batch as negative samples and compares the positive samples with all other negative samples to obtain a loss function. This training method has two problems: first, it selects similar samples as negative samples, increasing the perplexity of the model; second, it requires comparing all negative samples, resulting in low training efficiency.

[0063] In one possible implementation, determining the second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image includes:

[0064] Obtain candidate distances between the sample feature vector and the negative sample feature vectors corresponding to multiple negative sample images; sort the multiple candidate distances according to a preset rule (e.g., in descending or ascending order of candidate distances), and select the candidate distance corresponding to a preset sorting position among the multiple candidate distances as the second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image. In practical applications, the candidate distance located at the middle sorting position is usually selected as the second distance, which can be expressed as...

[0065] In this way, every two (positive and negative sample images) form a comparison group. The corresponding loss is then calculated by the comparison learning model. The loss of the entire batch can be the average of the loss of each pair of comparison groups. This avoids treating similar image data samples as negative samples for calculation, greatly reducing the computational load of the model and thus improving the training efficiency of the model.

[0066] In one possible implementation, the loss function of the contrastive learning model can be determined in the following way:

[0067] Obtain the distance difference between the first distance and the second distance;

[0068] The loss function of the contrastive learning model is constructed based on the degree of deviation between the distance difference and the preset value.

[0069] In practical implementation, the loss function Loss can be defined as follows:

[0070]

[0071] Here, the max() function returns the maximum value of the given parameters; γ is the weight, usually chosen empirically; x is the sample feature vector; x + These are the feature vectors of positive samples; is the feature vector of the negative sample; C is a constant.

[0072] As can be seen from the formula of the loss function above, during the iterative training process of the contrastive learning model, the distance difference between the first distance and the second distance gradually approaches C. In this way, the feature vector of the image data sample gradually approaches the feature vector of the positive sample and moves away from the feature vector of the negative sample. This enables the contrastive learning model to fully learn the effective features in the image data sample, which is beneficial to improving the accuracy of image recognition.

[0073] In one possible implementation, determining an image recognition model based on a trained contrastive learning model includes:

[0074] A predetermined number of image data samples in the image data sample set are labeled to obtain a labeled dataset; a neural network model is constructed based on the trained contrastive learning model and a predetermined multilayer perceptron; the neural network model is iteratively trained using the labeled dataset, and the second model parameters of the multilayer perceptron are adjusted according to the cross-entropy loss function of the neural network model until the set convergence condition is met; the image recognition model is determined based on the trained neural network model.

[0075] In practice, a small number of image data samples are randomly and equally drawn from the image data sample set for manual annotation, resulting in an annotated dataset (DL). The image recognition model is then fine-tuned using the annotated dataset DL, such as... Figure 2 As shown, the data augmenter and MLP in the training network are removed, and a new MLP is added as the classification head. The model parameters of the new multilayer perceptron MLP are adjusted using the cross-entropy loss function until the set convergence condition is met. The image recognition model is determined based on the trained neural network model.

[0076] The convergence condition can be set by the total number of iterations reaching a preset threshold, or by the loss value determined by the loss function stabilizing within a preset numerical range.

[0077] This application provides a method for training an image recognition model. The method involves acquiring an image data sample set, which includes image data samples from multiple data sources. The image data sample set is then used to iteratively train a contrastive learning model to obtain the image recognition model. This approach, using image data samples from multiple data sources for model training, improves the contrastive learning model's ability to represent image features in different scenarios. Furthermore, by constructing the loss function of the contrastive learning model using a first distance between the sample feature vector and the positive sample feature vector, and a second distance between the sample feature vector and the negative sample feature vector, the sample feature vectors of the image data samples gradually approach the positive sample feature vectors and move away from the negative sample feature vectors during multiple iterations of training. This allows the contrastive learning model to fully learn the effective features in the image data samples. Thus, while ensuring image recognition accuracy, only a small number of labeled samples are used for model training, avoiding the problem of low accuracy in manually labeled data and improving the model's training effect.

[0078] Figure 3 The figure shows a flowchart of an image recognition method according to an embodiment of this application. As shown in the figure, the image recognition method 300 may include the following steps:

[0079] S301: Obtain the target image uploaded by the user;

[0080] S302: The target feature vector corresponding to the target image is input into an image recognition model for classification processing, and the classification result is output; the image recognition model is trained according to the above-described image recognition model training method;

[0081] S303: Based on the classification results, determine the image category corresponding to the target image.

[0082] In practical implementation, after training the image recognition model using the aforementioned training method, the model can be deployed online. When a target image uploaded by a user is obtained, the target feature vector corresponding to the target image is input into the image recognition model for classification processing to obtain classification results, such as "1", "0", "YES", "NO", etc., used to characterize the image category. Based on the classification results, the image category corresponding to the target image is determined. For example, "YES" indicates that the target image meets the requirements for reporting a car insurance claim, while "NO" indicates that the target image does not meet the requirements for reporting a car insurance claim.

[0083] This application provides an image recognition method that acquires a target image uploaded by a user; it inputs the target feature vector corresponding to the target image into an image recognition model for classification processing, outputting a classification result; and it determines the image category corresponding to the target image based on the classification result. This allows for timely review of target images uploaded by users, shortening the business processing cycle and improving user satisfaction.

[0084] Figure 4 This illustration shows a schematic diagram of a training device for an image recognition model provided in an embodiment of this application. This motion state recognition device can achieve, for example... Figure 1 , Figure 3 The training device 400 includes all or part of the features shown in any of the embodiments:

[0085] Data acquisition module 410 is used to acquire an image data sample set, which includes image data samples from multiple data sources;

[0086] The model training module 420 is used to iteratively train the contrastive learning model using the image data sample set. During each iteration, data augmentation processing is performed on the image data samples in the image data sample set to obtain positive sample images. A first distance is determined between the sample feature vector corresponding to the image data sample and the positive sample feature vector corresponding to the positive sample image, and a second distance is determined between the sample feature vector and the negative sample feature vector corresponding to the negative sample image. The negative sample image is an image represented by image data samples other than the image data samples in the image data sample set.

[0087] Based on the first distance and the second distance, determine the loss function of the contrastive learning model;

[0088] The first model parameters of the contrastive learning model are adjusted according to the sample feature vector corresponding to the image data sample and the loss function of the contrastive learning model until the set convergence condition is met, and the image recognition model is determined based on the trained contrastive learning model.

[0089] In one possible implementation, the image data samples from the multiple data sources include: a first image data sample containing the target object in a preset database, a second image data sample containing road condition information in the target website, and a third image data sample containing scene information in the target website.

[0090] In one possible implementation, the negative sample images include multiple images, and the model training module 420, when determining the second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image, specifically performs the following:

[0091] Obtain the candidate distance between the sample feature vector and the negative sample feature vectors corresponding to multiple negative sample images;

[0092] The candidate distances are sorted according to a preset rule, and the candidate distance corresponding to the preset sorting position among the candidate distances is selected as the second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image.

[0093] In one possible implementation, when the model training module 420 is used to determine the loss function of the contrastive learning model based on the first distance and the second distance, it is specifically used for:

[0094] Obtain the distance difference between the first distance and the second distance;

[0095] The loss function of the contrastive learning model is constructed based on the degree of deviation between the distance difference and the preset value.

[0096] In one possible implementation, the model training module 420, when determining an image recognition model based on the trained contrastive learning model, specifically performs the following:

[0097] A predetermined number of image data samples in the image data sample set are labeled to obtain a labeled dataset;

[0098] Based on the trained contrastive learning model and the pre-set multilayer perceptron, construct a neural network model;

[0099] The neural network model is iteratively trained using the labeled dataset. The second model parameters of the multilayer perceptron are adjusted according to the cross-entropy loss function of the neural network model until the set convergence condition is met. The image recognition model is then determined based on the trained neural network model.

[0100] This application provides a training device for an image recognition model, including a data acquisition module and a model training module. The data acquisition module acquires an image data sample set, which includes image data samples from multiple data sources. Then, the model training module uses the image data sample set to iteratively train a contrastive learning model to obtain an image recognition model.

[0101] By using image data samples from multiple data sources for model training in the above manner, the ability of the contrastive learning model to represent image features in different scenarios can be improved. Furthermore, by constructing the loss function of the contrastive learning model through the first distance between the sample feature vector and the positive sample feature vector, and the second distance between the sample feature vector and the negative sample feature vector, the sample feature vector of the image data sample can gradually approach the positive sample feature vector and move away from the negative sample feature vector during multiple iterations of training. The contrastive learning model can fully learn the effective features in the image data sample, thereby using only a small number of labeled samples for model training while ensuring image recognition accuracy. This avoids the problem of low accuracy of manually labeled data and improves the training effect of the model.

[0102] Figure 5 This illustration shows a structural schematic diagram of an image recognition device provided in an embodiment of this application. This image recognition device can achieve the following: Figure 3 The image recognition device 500, as shown in the embodiments, includes all or part of the following:

[0103] Image acquisition module 510 is used to acquire target images uploaded by users;

[0104] The image classification module 520 is used to input the target feature vector corresponding to the target image into the image recognition model for classification processing and output the classification result; the image recognition model is trained according to the above-mentioned image recognition model training device;

[0105] The category determination module 530 is used to determine the image category corresponding to the target image based on the classification result.

[0106] This application provides an image recognition device, including an image acquisition module, an image classification module, and a category determination module. The image acquisition module acquires a target image uploaded by a user. The image classification module inputs the target feature vector corresponding to the target image into an image recognition model for classification processing and outputs a classification result. Then, the category determination module determines the image category corresponding to the target image based on the classification result. This allows for timely review of target images uploaded by users, shortening the processing cycle and improving user satisfaction.

[0107] Figure 6This diagram illustrates the hardware structure of an electronic device implementing the embodiments of this application. Referring to the diagram, at the hardware level, the electronic device includes a processor and optionally, an internal bus, a network interface, and a memory. The memory may include RAM, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk storage device. Of course, the electronic device may also include other hardware required for other services.

[0108] The processor, network interface, and memory can be interconnected via an internal bus, which can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be categorized as an address bus, data bus, control bus, etc. For ease of illustration, only a single bidirectional arrow is used in this diagram, but this does not imply that there is only one bus or one type of bus.

[0109] The memory stores the message notification device, which includes one or more programs. Specifically, the program may include program code, which includes computer operation instructions. The memory may include main memory and non-volatile memory, and provides instructions and data to the processor.

[0110] The processor reads the corresponding computer program from non-volatile memory into main memory and then runs it, logically forming a device that locates the target user. The processor executes the program stored in memory and specifically performs the following: Figure 1 or Figure 3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.

[0111] The above is as stated in this application. Figure 1 or Figure 3The methods disclosed in the illustrated embodiments can be implemented in or by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0112] The electronic device can also execute the methods described in the preceding method embodiments and achieve the functions and beneficial effects of the methods described in the preceding method embodiments, which will not be repeated here.

[0113] Of course, in addition to software implementation, the electronic device of this application does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0114] This application also proposes a computer-readable storage medium that stores one or more programs, which, when executed by an electronic device including multiple applications, cause the electronic device to perform... Figure 1 or Figure 3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.

[0115] The computer-readable storage medium includes read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, etc.

[0116] Furthermore, embodiments of this application also provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, implement the following process: Figure 1 or Figure 3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.

[0117] In summary, the above description is merely a preferred embodiment of this application and does not limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

[0118] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0119] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can store information accessible to a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0120] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0121] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

Claims

1. A training method for an image recognition model, characterized in that, include: Obtain an image data sample set, which includes image data samples from multiple data sources; The image data samples from the multiple data sources include: a first image data sample containing damaged vehicles in a preset database, a second image data sample containing road condition information in the target website, and a third image data sample containing scene information in the target website; The contrastive learning model is iteratively trained using the image data sample set. During each iteration, data augmentation is performed on the image data samples in the image data sample set to obtain positive sample images. A first distance is determined between the sample feature vector corresponding to the image data sample and the positive sample feature vector corresponding to the positive sample image, and a second distance is determined between the sample feature vector and the negative sample feature vector corresponding to the negative sample image. The negative sample images are images represented by other image data samples in the image data sample set besides the image data samples mentioned above. Based on the first distance and the second distance, construct the loss function of the contrastive learning model; The first model parameters of the contrastive learning model are adjusted according to the sample feature vector corresponding to the image data sample and the loss function of the contrastive learning model until the set convergence condition is met, and the image recognition model is determined based on the trained contrastive learning model.

2. The method according to claim 1, characterized in that, The negative sample images include multiple images, and determining the second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image includes: Obtain the candidate distance between the sample feature vector and the negative sample feature vectors corresponding to multiple negative sample images; The candidate distances are sorted according to a preset rule, and the candidate distance corresponding to the preset sorting position among the candidate distances is selected as the second distance between the sample feature vector and the negative sample feature vector corresponding to the negative sample image.

3. The method according to claim 1, characterized in that, Determining the loss function of the contrastive learning model based on the first distance and the second distance includes: Obtain the distance difference between the first distance and the second distance; The loss function of the contrastive learning model is constructed based on the degree of deviation between the distance difference and the preset value.

4. The method according to claim 1, characterized in that, The method for determining the image recognition model based on the trained contrastive learning model includes: A predetermined number of image data samples in the image data sample set are labeled to obtain a labeled dataset; Based on the trained contrastive learning model and the pre-set multilayer perceptron, construct a neural network model; The neural network model is iteratively trained using the labeled dataset. The second model parameters of the multilayer perceptron are adjusted according to the cross-entropy loss function of the neural network model until the set convergence condition is met. The image recognition model is then determined based on the trained neural network model.

5. An image recognition method, characterized in that, include: Obtain the target image uploaded by the user; The target feature vector corresponding to the target image is input into an image recognition model for classification processing, and the classification result is output. The image recognition model is trained using the image recognition model training method according to any one of claims 1 to 4; Based on the classification results, the image category corresponding to the target image is determined.

6. A training device for an image recognition model, characterized in that, include: The data acquisition module is used to acquire an image data sample set, which includes image data samples from multiple data sources; The image data samples from the multiple data sources include: a first image data sample containing damaged vehicles in a preset database, a second image data sample containing road condition information in the target website, and a third image data sample containing scene information in the target website; the image data samples are captured images or images produced by simulating real scenes; The model training module is used to iteratively train the contrastive learning model using the image data sample set. During each iteration, data augmentation is performed on the image data samples in the image data sample set to obtain positive sample images. A first distance is determined between the sample feature vector corresponding to the image data sample and the positive sample feature vector corresponding to the positive sample image, and a second distance is determined between the sample feature vector and the negative sample feature vector corresponding to the negative sample image. The negative sample images are images represented by other image data samples in the image data sample set besides the image data samples mentioned above. Based on the first distance and the second distance, determine the loss function of the contrastive learning model; The first model parameters of the contrastive learning model are adjusted according to the sample feature vector corresponding to the image data sample and the loss function of the contrastive learning model until the set convergence condition is met, and the image recognition model is determined based on the trained contrastive learning model.

7. An image recognition device, characterized in that, include: The image acquisition module is used to acquire target images uploaded by users; The image classification module is used to input the target feature vector corresponding to the target image into the image recognition model for classification processing and output the classification result; the image recognition model is trained by the training device of the image recognition model according to claim 6; The category determination module is used to determine the image category corresponding to the target image based on the classification result.

8. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing programs or instructions that can run on the processor, the programs or instructions being executed by the processor to implement the steps of the method as described in any one of claims 1 to 5.

9. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Target classification method, target classification device and computer readable storage medium

    CN112560880A

  • Target recognition model training method and device and electronic equipment

    CN112990432A