Image matching method, device, equipment and storage medium
By training the pairing model, extracting image features and retrieving them in the feature library, the problem of insufficient image pairing efficiency and accuracy in the existing technology is solved, fast and accurate image pairing is achieved, and the differentiated needs of users are met.
Patent Information
- Application Number
- CN202110695932.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-23
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-06-23
AI Technical Summary
The existing technology is difficult to meet the obviously differentiated user needs, and cannot effectively find matching images for images that meet specific scenarios, such as couple avatars.
By using the images in the image material library to train the initial network model, a pre-trained model is obtained, and then the image sets are obtained and paired, and these image sets are used to train the pre-trained model to obtain a paired model, which is used to extract features of the images to be paired. , and search in the pre-built paired feature database to obtain matching target paired images.
The efficiency and accuracy of image pairing are improved, and the target paired image that is successfully paired with the image to be paired can be quickly and accurately obtained, meeting the differentiated needs of users and improving the user experience.
Smart Images

Figure CN113360696B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence, specifically to the field of computer vision and deep learning technology, and in particular to image pairing methods, devices, equipment and storage media, which can be used in smart city scenarios. Background Art
[0002] With the continuous development of social networks, images play an increasingly important role in people's communication on social networks. People may want to find another image that can be paired with the current image based on various needs. For example, the new generation of young couples usually want to choose related images as couple avatars to indicate the relationship between the users.
[0003] In the prior art, the selection of paired images is usually based on groups or pairs of images found on an Internet platform, or paired images are obtained through manual creation, design, photography, etc. However, the existing paired images may not meet the significantly differentiated user needs. Summary of the invention
[0004] The present disclosure provides an image pairing method, apparatus, device and storage medium.
[0005] According to a first aspect of the present disclosure, a method for training a pairing model is provided, comprising: training an initial network model using images in an image material library to obtain a pre-trained model; acquiring a first image set and a first paired image set, wherein the first paired image set is obtained by pairing images in the first image set; and training the pre-trained model using the first image set and the first paired image set to obtain a pairing model.
[0006] According to a second aspect of the present disclosure, there is provided an image pairing method, comprising: obtaining an image to be paired; extracting features of the image to be paired using a pairing model to obtain pairing features of the image to be paired, wherein the pairing model is trained by a method as described in any implementation of the first aspect; and searching in a pre-constructed pairing feature library to obtain a target pairing image that matches the pairing features.
[0007] According to a third aspect of the present disclosure, a training device for a pairing model is provided, comprising: a first training module, configured to train an initial network model using images in an image material library to obtain a pre-trained model; a first acquisition module, configured to acquire a first image set and a first paired image set, wherein the first paired image set is obtained by pairing images in the first image set; and a second training module, configured to train the pre-trained model using the first image set and the first paired image set to obtain a pairing model.
[0008] According to a fourth aspect of the present disclosure, an image pairing device is provided, comprising: a second acquisition module, configured to acquire an image to be paired; a second extraction module, configured to extract features of the image to be paired using a pairing model to obtain pairing features of the image to be paired, wherein the pairing model is trained by a method as described in any implementation manner in the first aspect; and a retrieval module, configured to search in a pre-constructed pairing feature library to obtain a target pairing image that matches the pairing feature.
[0009] According to a fifth aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in any implementation manner of the first aspect or the second aspect.
[0010] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to cause a computer to execute the method described in any implementation manner of the first aspect or the second aspect.
[0011] According to a seventh aspect of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the computer program implements the method described in any implementation manner of the first aspect or the second aspect.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0014] Figure 1 is an exemplary system architecture diagram in which the present disclosure may be applied;
[0015] Figure 2 is a flowchart of an embodiment of a training method for a pairing model according to the present disclosure;
[0016] Figure 3 is a flowchart of another embodiment of a method for training a pairing model according to the present disclosure;
[0017] Figure 4 is a flowchart of another embodiment of a training method for a pairing model according to the present disclosure;
[0018] Figure 5 yes Figure 4A decomposed flow chart of the step of acquiring an image set of the training method of the pairing model shown;
[0019] Figure 6 is a flow chart of an embodiment of an image pairing method according to the present disclosure;
[0020] Figure 7 is a structural schematic diagram of an embodiment of a training device for a pairing model according to the present disclosure;
[0021] Figure 8 is a structural schematic diagram of an embodiment of an image pairing device according to the present disclosure;
[0022] Fig. 9 It is a block diagram of an electronic device used to implement the training method of the pairing model of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0024] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of the image pairing method or image pairing apparatus of the present disclosure can be applied.
[0026] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0027] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send information, etc. Various client applications can be installed on the terminal devices 101, 102, 103.
[0028] The terminal devices 101, 102, 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc. When the terminal devices 101, 102, 103 are software, they may be installed in the above electronic devices. They may be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made here.
[0029] The server 105 can provide various services. For example, the server 105 can analyze and process the to-be-paired images acquired from the terminal devices 101, 102, and 103, and generate a processing result (eg, a target paired image).
[0030] It should be noted that the server 105 can be hardware or software. When the server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server 105 is software, it can be implemented as multiple software or software modules (for example, for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0031] It should be noted that the image pairing method provided in the embodiments of the present disclosure is generally executed by the server 105 , and accordingly, the image pairing device is generally disposed in the server 105 .
[0032] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0033] Continue to refer Figure 2 , which shows a process 200 of an embodiment of a pairing model training method according to the present disclosure. The pairing model training method includes the following steps:
[0034] Step 201, train the initial network model using images in the image library to obtain a pre-trained model.
[0035] In this embodiment, the execution subject of the training method of the pairing model (for example Figure 1The server 105 shown in the figure can use the images in the image library to train the initial network model to obtain a pre-trained model. The image library can be pre-built, in which relevant material pictures on the Internet are stored. The above-mentioned execution subject can use the images in the image library to perform self-supervised learning training on the initial network model to obtain a pre-trained model. Self-supervised learning training refers to the process of automatically training a preset initial model using a large amount of sample data without manual annotation of the samples to obtain a pre-trained model. The specific method of self-supervised learning training is a prior art and will not be repeated here.
[0036] Among them, the initial network model can use the Res2net50 network with a depth of 50 layers. The Res2net50 network is an improved version of Resnet (Residual Network) 50. The residual block Bottleneckblock in Res2net is a multi-scale processing method. The number of parameters in the Bottleneck block is reduced, which reduces the computing power consumption. Of course, other initial network models can also be selected according to actual conditions, and the present disclosure does not make specific restrictions on this. In addition, the loss function in this step uses the cross entropy loss function (Cross Entropy Loss), and is trained on the image material library data set to obtain a pre-trained model.
[0037] It should be noted that the loss function is a function that maps the value of a random event or its related random variables into a non-negative real number to represent the loss of the random event, and is used for model parameter estimation in machine learning.
[0038] Step 202: Acquire a first image set and a first paired image set.
[0039] In this embodiment, the execution entity may obtain a first image set and a first paired image set, wherein the first paired image set is obtained by pairing images in the first image set.
[0040] It should be noted that the first image set may be a data set obtained by crawling images on a search engine based on a specific scenario, and the first paired image set is obtained by pairing images in the first image set, including each successfully paired image in the first image set.
[0041] For example, when the application scenario is a matching model training scenario for couple portraits, the first image set may include all pictures related to "couple portraits" on the search engine, and then all images in the first image set are paired, and all successfully paired images constitute the first paired image set.
[0042] Step 203: train the pre-trained model using the first image set and the first paired image set to obtain a paired model.
[0043] In this embodiment, the execution subject may use the first image set and the first paired image set obtained in step 202 to train the pre-trained model obtained in step 201, thereby obtaining a paired model.
[0044] Since the pre-trained model is trained using images in the image library, it does not involve specific business scenarios. The first image set and the first paired image set are image sets constructed based on specific scenarios. Therefore, the first image set and the first paired image set in the specific scenario can be used to specifically adjust and train the pre-trained model to obtain a trained pairing model, and then pair images based on the pairing model.
[0045] The training method of the pairing model provided in the embodiment of the present disclosure first uses images in an image material library to train an initial network model to obtain a pre-trained model; then obtains a first image set and a first paired image set obtained by pairing the images in the first image set; and then uses the first image set and the first paired image set to train the pre-trained model to obtain a pairing model. The pairing model trained by this method can quickly and accurately obtain a target paired image that is successfully paired with an image to be paired, thereby improving the efficiency and accuracy of image pairing.
[0046] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0047] Continue to refer Figure 3 , Figure 3 A process 300 of another embodiment of a method for training a pairing model according to the present disclosure is shown. The method for training a pairing model comprises the following steps:
[0048] Step 301, train the initial network model using images in the image material library to obtain a pre-trained model.
[0049] Step 302: Acquire a first image set and a first paired image set.
[0050] Steps 301-302 are basically consistent with steps 201-202 of the aforementioned embodiment. For specific implementation methods, reference may be made to the aforementioned description of steps 201-202, which will not be repeated here.
[0051] Step 303: fine-tune the pre-trained model using the first image set to obtain a fine-tuned model.
[0052] In this embodiment, the execution subject of the training method of the pairing model (for example Figure 1 The server 105 shown can use the first image set to fine-tune the pre-trained model to obtain a fine-tuned model.
[0053] In some optional implementations of the present embodiment, the pre-trained model is fine-tuned using the first image set to obtain a fine-tuned model, including: clustering the first image set to obtain a clustered image set; setting a loss function for the pre-trained model; and fine-tuning the parameters of the pre-trained model based on the clustered image set and the loss function to obtain a fine-tuned model.
[0054] In this implementation, N cluster centers may be selected, where N is an integer greater than 1; then, the images in the first image set are clustered based on the N cluster centers, and each cluster is used as a category, thereby constructing a clustered image set containing N categories. For example, assuming that N is 1000, the images in the first image set are clustered based on 1000 cluster centers, thereby constructing a clustered image set containing 1000 categories.
[0055] After that, Arcface (Additive Angular Margin) Loss is selected as the loss function. Arcface Loss is a loss function that uses margin to expand the distance between different classes. Then, the parameters of the pre-trained model are fine-tuned based on the clustered image set and Arcface Loss to obtain the fine-tuned model.
[0056] Step 304, adding a fully connected layer to the fine-tuned model to obtain a target model.
[0057] In this embodiment, the execution subject can add a fully connected layer to the fine-tuned model to obtain the target model. Specifically, the execution subject adds a 256-floating-dimensional embedding fully connected layer after the Res2net50 network to obtain the target model. The fully connected layer can map the learned "distributed feature representation" to the sample tag space.
[0058] Step 305: Take each pair of paired images in the first paired image set as input, train the target model, and obtain a paired model.
[0059] In this embodiment, the execution subject can use each pair of paired images in the first paired image set as input to train the target model, thereby obtaining the paired model. Specifically, a metric learning method is used, each pair of paired images in the first paired image set is used as input, and the estimated maximum loss is selected as the loss function to train the target model, thereby obtaining the paired model. The specific learning method of metric learning is a prior art and will not be described in detail here.
[0060] from Figure 3 It can be seen that Figure 2 Compared with the corresponding embodiment, the training method of the pairing model in this embodiment uses the first image set to fine-tune the pre-trained model to obtain a fine-tuned model, then adds a fully connected layer to the fine-tuned model to obtain a target model, and then uses each pair of paired images in the first paired image set as input to train the target model to obtain a pairing model. The image features extracted based on the pairing model are more accurate and vivid, thereby improving the accuracy of the pairing results.
[0061] Continue to refer Figure 4 , Figure 4 A process 400 of another embodiment of a pairing model training method according to the present disclosure is shown. The pairing model training method includes the following steps:
[0062] Step 401, train the initial network model using images in the image material library to obtain a pre-trained model.
[0063] Step 402: Acquire a first image set and a first paired image set.
[0064] Steps 401-402 are basically consistent with steps 301-302 of the aforementioned embodiment. For specific implementation methods, reference may be made to the aforementioned description of steps 301-302, which will not be repeated here.
[0065] Step 403 : performing data cleaning and deduplication on the first image set and the first paired image set respectively.
[0066] In this embodiment, the execution subject of the training method of the pairing model (for example Figure 1 The server 105 shown in the figure can clean and deduplicate the data in the first image set and the first paired image set respectively. Since low-quality images will affect user usage, it is necessary to clean the images in the first image set and the first paired image set, for example, images with image length values and / or width values less than preset values can be removed.
[0067] In addition, sensitive images are also not allowed to appear, so the existing sensitive classifier can be used to filter the sensitive images in the cleaned first image set and the first paired image set.
[0068] Finally, since images with the same content but different sizes may be downloaded repeatedly when acquiring images, deduplication technology may be used to deduplicate images in the first image set and the first paired image set.
[0069] Through the above operations, the images in the first image set and the first paired image set are both of high quality, thereby improving the user experience.
[0070] Step 404: fine-tune the pre-trained model using the first image set to obtain a fine-tuned model.
[0071] Step 405, adding a fully connected layer to the fine-tuned model to obtain a target model.
[0072] Step 406: Take each pair of paired images in the first paired image set as input, train the target model, and obtain a paired model.
[0073] Steps 404-406 are basically consistent with steps 303-305 of the aforementioned embodiment. For specific implementation methods, reference may be made to the aforementioned description of steps 303-305, which will not be repeated here.
[0074] Step 407: extract the pairing features of each pair of paired images in the first paired image set using the pairing model to obtain a pairing feature library.
[0075] In this embodiment, the execution subject can use the pairing model to extract the pairing features of each pair of paired images in the first pairing image set to obtain a pairing feature library. After the pairing model is trained, the features corresponding to the last 256 floating dimension embedding fully connected layer of the pairing model are the couple portrait pairing features that need to be obtained. Therefore, in this embodiment, the pairing model can be used to extract the pairing features of each pair of paired images in the first pairing data set to obtain a pairing feature library.
[0076] from Figure 4 It can be seen that Figure 3 Compared with the corresponding embodiments, the training method of the pairing model in this embodiment highlights the steps of data cleaning and deduplication for the first image set and the first paired image set, so that the images in the first image set and the first paired image set are of high quality, thereby improving the user experience; in addition, the pairing model is used to extract the pairing features of each pair of paired images in the first paired image set, so as to obtain a pairing feature library, so as to perform pairing retrieval based on the pairing feature library, thereby improving the accuracy and efficiency of the pairing results.
[0077] Continue to refer Figure 5 , Figure 5 Shows Figure 4 The decomposition process 500 of the step of obtaining an image set of the training method of the pairing model is shown. The step of obtaining an image set is decomposed as follows:
[0078] Step 501: based on the user's search behavior, obtain a second image set downloaded by the user.
[0079] In this embodiment, the second image set downloaded by the user can be obtained based on the user's search behavior. For example, when the user uses the search function of the search engine to search for relevant keywords such as "couple portraits", browses the image search results under the image tab, and clicks to download, the above-mentioned execution entity will record the user's above-mentioned behavior process as a search behavior. Then, based on the user's above-mentioned search behavior, the above-mentioned execution entity can download the couple portraits downloaded by the user, thereby obtaining the second image set.
[0080] Step 502: Acquire a third image set matching a preset keyword from a designated data source.
[0081] In this embodiment, a third image set matching a preset keyword can be obtained from a specified data source. For example, a keyword can be preset based on a usage scenario, such as "couple portraits". Then, the execution subject can crawl some articles or messages containing preset keywords that are pushed by editors on existing websites or edited and sent by users on the website, and download all the accompanying pictures in the articles or messages, thereby obtaining the third image set.
[0082] Step 503: merge the second image set and the third image set to obtain a first image set.
[0083] In this embodiment, the second image set obtained in step 501 and the third image set obtained in step 502 may be merged to obtain a first image set. The merged first image set includes all relevant images obtained based on user behavior and existing website resources.
[0084] Step 504 : annotate and pair the images in the second image set and the third image set respectively to obtain a paired second paired image set and a paired third paired image set.
[0085] In this embodiment, the images in the second image set obtained in step 501 and the images in the third image set obtained in step 502 can be annotated and paired respectively, so as to obtain a corresponding second paired image set including all successfully paired images in the second image set, and a third paired image set including all successfully paired images in the third image set, wherein the above-mentioned annotation method can be manual annotation.
[0086] Step 505: merge the second paired image set and the third paired image set to obtain a first paired image set.
[0087] In this embodiment, the second paired image set and the third paired image set obtained in step 504 may be merged to obtain a first paired image set.
[0088] It should be noted that the present disclosure does not specifically limit the execution order of step 503 and steps 504-505, that is, step 503 can be executed before steps 504-505, can be executed after steps 504-505, and can even be executed simultaneously with steps 504-505.
[0089] from Figure 5 It can be seen that the method for obtaining an image set can obtain a first data set based on the user's search behavior and existing website resources, and then obtain a first paired image set containing paired images in the first data set. Through the above data capture and processing method, the richness of the images in the image set is guaranteed.
[0090] Continue to refer Figure 6 , which shows a process 600 of an embodiment of an image pairing method according to the present disclosure. The image pairing method comprises the following steps:
[0091] Step 601: Obtain an image to be paired.
[0092] In this embodiment, the execution subject of the image pairing method (eg Figure 1 The server 105 shown can obtain the image to be paired.
[0093] The image to be paired may be an image that the user inputs in a search engine and wants to pair.
[0094] Step 602: extract features of the images to be paired using the pairing model to obtain pairing features of the images to be paired.
[0095] In this embodiment, the execution subject can use the pairing model to extract the features of the image to be paired, and obtain the pairing features of the image to be paired. The pairing model can be trained by the method described in the above embodiment. The image to be paired obtained in step 601 is input into the pairing model, and the pairing model is used to extract the features of the image to be paired, so as to obtain the pairing features of the image to be paired.
[0096] Step 603: Search in a pre-built pairing feature library to obtain a target pairing image that matches the pairing feature.
[0097] In this embodiment, the execution subject may search in a pre-built pairing feature library to obtain a target pairing image that matches the pairing feature obtained in step 602. Since the pairing feature library stores the features of all the pairing images in the acquired pairing image set, the pre-built pairing feature library may be searched to obtain a target pairing image that matches the pairing feature.
[0098] Optionally, a positive index may be established in advance for the pairing feature library, thereby improving the retrieval efficiency when searching in the pairing feature library.
[0099] The image pairing method provided by the embodiment of the present disclosure extracts the features of the image to be paired through a pairing model to obtain the pairing features of the image to be paired; then searches in a pre-built pairing feature library to obtain a target pairing image that matches the pairing features, thereby improving the efficiency and accuracy of image pairing, thereby improving the user's satisfaction and enhancing the user's experience.
[0100] Further references Figure 7 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a training device for a pairing model. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0101] like Figure 7 As shown, the training device 700 of the pairing model of this embodiment may include: a first training module 701, a first acquisition module 702 and a second training module 703. The first training module 701 is configured to train the initial network model using images in the image material library to obtain a pre-trained model; the first acquisition module 702 is configured to obtain a first image set and a first paired image set, wherein the first paired image set is obtained by pairing the images in the first image set; the second training module 703 is configured to train the pre-trained model using the first image set and the first paired image set to obtain a pairing model.
[0102] In the training device 700 of the pairing model, the specific processing of the first training module 701, the first acquisition module 702 and the second training module 703 and the technical effects thereof can be referred to in Figure 2 The relevant descriptions of steps 201 - 203 in the corresponding embodiment are not repeated here.
[0103] In some optional implementations of this embodiment, the second training module includes: a fine-tuning submodule, configured to use the first image set to fine-tune the pre-trained model to obtain a fine-tuned model; a adding submodule, configured to add a fully connected layer to the fine-tuned model to obtain a target model; and a training submodule, configured to take each pair of paired images in the first paired image set as input, train the target model, and obtain a paired model.
[0104] In some optional implementations of the present embodiment, the fine-tuning submodule includes: a clustering unit, configured to cluster the first image set to obtain a clustered image set; a setting unit, configured to set a loss function for the pre-trained model; and a fine-tuning unit, configured to fine-tune the parameters of the pre-trained model based on the clustered image set and the loss function to obtain a fine-tuned model.
[0105] In some optional implementations of this embodiment, the first acquisition module includes: an acquisition submodule, configured to obtain a second image set downloaded by a user based on the user's search behavior; an acquisition submodule, configured to obtain a third image set matching a preset keyword from a designated data source; and a first merging submodule, configured to merge the second image set and the third image set to obtain a first image set.
[0106] In some optional implementations of the present embodiment, the first acquisition module further includes: a pairing submodule, configured to annotate and pair the images in the second image set and the third image set, respectively, to obtain a paired second paired image set and a third paired image set; and a second merging submodule, configured to merge the second paired image set and the third paired image set to obtain a first paired image set.
[0107] In some optional implementations of this embodiment, the training device for the pairing model further includes: a deduplication module configured to perform data cleaning and deduplication on the first image set and the first pairing image set respectively.
[0108] In some optional implementations of this embodiment, the training device for the pairing model further includes: a first extraction module configured to extract pairing features of each pair of pairing images in the first pairing image set using the pairing model to obtain a pairing feature library.
[0109] Further references Figure 8 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an image pairing device, and the device embodiment is Figure 6 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0110] like Figure 8As shown, the image pairing device 800 of this embodiment may include: a second acquisition module 801, a second extraction module 802 and a retrieval module 803. The second acquisition module 801 is configured to acquire the image to be paired; the second extraction module 802 is configured to extract the features of the image to be paired using the pairing model to obtain the pairing features of the image to be paired; the retrieval module 803 is configured to search in a pre-built pairing feature library to obtain a target pairing image that matches the pairing features.
[0111] In this embodiment, in the image pairing device 800, the specific processing of the second acquisition module 801, the second extraction module 802 and the retrieval module 803 and the technical effects thereof can be referred to in Figure 6 The relevant descriptions of steps 601-603 in the corresponding embodiment are not repeated here.
[0112] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0113] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure 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 processing, cellular phones, smart phones, wearable devices, 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 disclosure described and / or required herein.
[0114] like Fig. 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0115] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as a trainer of various types of pairing models, a speaker, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0116] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as a training method for a pairing model or an image pairing method. For example, in some embodiments, the training method for a pairing model or an image pairing method may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the training method for the pairing model or the image pairing method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute the pairing model training method or the image pairing method in any other appropriate manner (eg, by means of firmware).
[0117] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0118] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable pairing model training device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0119] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0120] To provide interaction with a user, the systems and techniques described herein may be implemented on a computer having: a training device for pairing models (e.g., a CRT (cathode ray tube) or LCD (liquid crystal pairing model trainer) monitor) for providing training information of the pairing models to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with a user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0121] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0122] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0123] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0124] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A training method for a pairing model, comprising: Use the images in the image library to perform self-supervised learning training on the initial network model to obtain a pre-trained model; Acquire a first image set and a first paired image set, wherein the first paired image set is obtained by pairing images in the first image set; Clustering the first image set to obtain a clustered image set; Setting a loss function for the pre-trained model; Fine-tuning the parameters of the pre-trained model based on the clustered image set and the loss function to obtain a fine-tuned model; Adding a fully connected layer to the fine-tuned model to obtain a target model; Using a metric learning method, each pair of paired images in the first paired image set is taken as input, and the estimated maximum loss is selected as a loss function to train the target model to obtain the pairing model.
2. The method according to claim 1, wherein: The acquiring of the first image set and the first paired image set comprises: Based on the search behavior of the user, obtaining a second image set downloaded by the user; Acquire a third image set matching a preset keyword from a specified data source; The second image set and the third image set are combined to obtain the first image set.
3. The method according to claim 2, wherein: The acquiring of the first image set and the first paired image set further includes: Annotating and pairing the images in the second image set and the images in the third image set respectively to obtain a second paired image set and a third paired image set after pairing; The second paired image set and the third paired image set are combined to obtain the first paired image set.
4. The method according to any one of claims 1 to 3, wherein: Before training the pre-trained model using the first image set and the first paired image set, the method further includes: Data cleaning and deduplication are performed on the first image set and the first paired image set respectively.
5. The method according to claim 4, further comprising: The pairing model is used to extract pairing features of each pair of pairing images in the first pairing image set to obtain a pairing feature library.
6. An image pairing method, comprising: Get the image to be paired; Extracting features of the image to be paired using a pairing model to obtain pairing features of the image to be paired, wherein the pairing model is trained by the method according to any one of claims 1 to 5; A search is performed in a pre-built pairing feature library to obtain a target pairing image that matches the pairing feature.
7. A training device for a pairing model, comprising: A first training module is configured to perform self-supervised learning training on the initial network model using images in the image material library to obtain a pre-trained model; A first acquisition module is configured to acquire a first image set and a first paired image set, wherein the first paired image set is obtained by pairing images in the first image set; The second training module is configured to cluster the first image set to obtain a clustered image set; set a loss function for the pre-trained model; fine-tune the parameters of the pre-trained model based on the clustered image set and the loss function to obtain a fine-tuned model; add a fully connected layer to the fine-tuned model to obtain a target model; use a metric learning method, take each pair of paired images in the first paired image set as input, select the estimated maximum loss as the loss function, train the target model, and obtain the paired model.
8. The device according to claim 7, wherein: The first acquisition module includes: An obtaining submodule configured to obtain a second image set downloaded by the user based on the user's search behavior; An acquisition submodule is configured to acquire a third image set matching a preset keyword from a designated data source; The first merging submodule is configured to merge the second image set and the third image set to obtain the first image set.
9. The device according to claim 8, wherein: The first acquisition module also includes: a pairing submodule, configured to annotate and pair the images in the second image set and the images in the third image set, respectively, to obtain a second paired image set and a third paired image set after pairing; The second merging submodule is configured to merge the second paired image set and the third paired image set to obtain the first paired image set.
10. The device according to any one of claims 7 to 9, further comprising: The deduplication module is configured to perform data cleaning and deduplication on the first image set and the first paired image set respectively.
11. The device according to claim 10, further comprising: The first extraction module is configured to extract pairing features of each pair of paired images in the first paired image set using the pairing model to obtain a pairing feature library.
12. An image pairing device, comprising: A second acquisition module is configured to acquire an image to be paired; A second extraction module is configured to extract features of the image to be paired using a pairing model to obtain pairing features of the image to be paired, wherein the pairing model is trained by the method according to any one of claims 1 to 5; The retrieval module is configured to search in a pre-built pairing feature library to obtain a target pairing image that matches the pairing feature.
13. A terminal device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method of any one of claims 1 to 6.
15. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
