Image processing method, device, apparatus and storage medium
By optimizing the image processing model through adaptive adjustment of the loss function and cross-batch data augmentation techniques, the problem of inaccurate image similarity determination is solved, and higher accuracy image processing results are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-05-05
- Publication Date
- 2026-05-19
AI Technical Summary
Existing image processing methods cannot accurately determine image similarity, resulting in inaccurate image processing results.
Image processing models are used to obtain feature similarity of image feature pairs, and loss values are calculated through adaptively adjusted loss functions. The image processing models are optimized to improve accuracy, and cross-batch data augmentation and temporal dimension information are used for image processing.
It improves the accuracy and precision of image processing results, especially in image filtering and deduplication processes, where it can achieve higher accuracy.
Smart Images

Figure CN117078968B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an image processing method, apparatus, device, and storage medium. Background Technology
[0002] The development of computer technology gave birth to image processing technology. This, in turn, led to a diverse array of image processing methods. Relying on these methods, computer devices can perform more intelligent image processing tasks, bringing greater convenience to people's daily lives. It is well known that image similarity is frequently used in completing certain image processing tasks (such as image classification and image filtering). However, current image processing methods often cannot determine highly accurate image similarity, resulting in inaccurate image processing results. Therefore, improving the accuracy of image processing results has become a current research hotspot. Summary of the Invention
[0003] This application provides an image processing method, apparatus, device, and storage medium that can improve the accuracy of image processing results.
[0004] On one hand, embodiments of this application provide an image processing method, including:
[0005] Multiple image feature pairs are traversed, and an image processing model is used to obtain the feature similarity between the first image feature and the second image feature in the currently traversed target image feature pair, as well as the image category label associated with each image feature. The image category label is used to indicate the image category of the image to which the corresponding image feature belongs.
[0006] When the image category labels associated with each image feature in the target image feature pair are the same, the loss function used to calculate the loss value of the target image feature pair is determined to be the first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function;
[0007] When the image category labels associated with each image feature in the target image feature pair are different, the loss function used to calculate the loss value of the target image feature pair is determined to be the second loss function. The loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function.
[0008] After the traversal is completed, the target loss value of the image processing model is determined based on the loss value of each image feature pair, and the image processing model is optimized in the direction of reducing the target loss value to obtain the optimized image processing model.
[0009] The optimized image processing model is used to perform image filtering on the target image set, which includes multiple images.
[0010] On the one hand, embodiments of this application provide yet another image processing method, including:
[0011] In response to an image deduplication request for a target image set, for any image contained in the target image set, an optimized image processing model is used to obtain the image feature similarity between the image features of the given image and the image features of other images in the target image set besides the given image. The optimized image processing model is obtained based on the loss values of multiple image feature pairs. Each image feature pair includes a first image feature and a second image feature. When the image category labels associated with the two image features in the given image feature pair are the same, the loss value of the given image feature pair is calculated using a first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function. When the image category labels associated with the two image features in the given image feature pair are different, the loss value of the given image feature pair is calculated using a second loss function, and the loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function.
[0012] When there is another target image whose image feature similarity to any of the images is greater than a preset similarity threshold, the other target image is regarded as a duplicate image of any of the images.
[0013] On one hand, embodiments of this application provide an image processing apparatus, including:
[0014] The traversal unit is used to traverse multiple image feature pairs and use an image processing model to obtain the feature similarity between the first image feature and the second image feature in the currently traversed target image feature pair, as well as the image category label associated with each image feature. The image category label is used to indicate the image category of the image to which the corresponding image feature belongs.
[0015] The determining unit is configured to determine that the loss function used to calculate the loss value of the target image feature pair is a first loss function when the image category label associated with each image feature in the target image feature pair is the same, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function;
[0016] The determining unit is used to determine that the loss function used to calculate the loss value of the target image feature pair is a second loss function when the image category labels associated with each image feature in the target image feature pair are different. The loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function.
[0017] An optimization unit is used to determine the target loss value of the image processing model based on the loss value of each image feature pair after traversal, and to optimize the image processing model in the direction of reducing the target loss value to obtain an optimized image processing model.
[0018] The first processing unit is used to perform image filtering processing on the target image set using the optimized image processing model, wherein the target image set includes multiple images.
[0019] On the one hand, embodiments of this application provide yet another image processing apparatus, including:
[0020] A request-response unit is configured to respond to an image deduplication request for a target image set. For any image included in the target image set, an optimized image processing model is used to obtain the image feature similarity between the image features of the given image and the image features of other images in the target image set besides the given image. The optimized image processing model is obtained based on the loss values of multiple image feature pairs. Each image feature pair includes a first image feature and a second image feature. When the image category labels associated with the two image features in the given image feature pair are the same, the loss value of the given image feature pair is calculated using a first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function. When the image category labels associated with the two image features in the given image feature pair are different, the loss value of the given image feature pair is calculated using a second loss function, and the loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function.
[0021] The second processing unit is used to treat other target images as duplicate images of any given image when there is a target image whose image feature similarity to the image features of any given image is greater than a preset similarity threshold.
[0022] On one hand, embodiments of this application provide a computer device, including:
[0023] A processor for implementing one or more computer programs;
[0024] A computer storage medium storing one or more computer programs adapted to be loaded by the processor and executed by the image processing method of the first aspect described above.
[0025] On one hand, embodiments of this application provide an image processing apparatus, including:
[0026] A processor for implementing one or more computer programs;
[0027] A computer storage medium storing one or more computer programs adapted to be loaded by the processor and executed by the image processing method of the second aspect described above.
[0028] On one hand, embodiments of this application provide a computer storage medium storing one or more computer programs, which are adapted to be loaded by a processor and executed by the image processing method of the first aspect described above.
[0029] On the one hand, embodiments of this application provide yet another computer storage medium storing one or more computer programs adapted for loading by a processor and executing the image processing method of the second aspect described above.
[0030] On one hand, embodiments of this application provide a computer product, the computer product including a computer program, the computer program being adapted to be loaded by a processor and to execute the image processing method of the first aspect described above.
[0031] On the one hand, embodiments of this application provide yet another computer product, the computer product including a computer program, the computer program being adapted to be loaded by a processor and to execute the image processing method of the second aspect described above.
[0032] In this embodiment, the loss value of an image feature pair depends on whether the image processing model accurately identifies that pair. Specifically, accurately identified image feature pairs (or "easy samples") have smaller loss values, while inaccurately identified image feature pairs (or "difficult samples") have larger loss values; that is, the loss value of easy samples is less than that of difficult samples. Since in practical applications, image processing models are typically optimized when the target loss value exceeds a threshold, and the target loss value in this embodiment is calculated based on the loss values of multiple image feature pairs, it's easy to understand that when inaccurately identified image features exist among these pairs, the target loss value determined by the computer device will be larger, and the computer device is more likely to optimize the image processing model. Therefore, this approach allows the computer device to focus primarily on the processing results of inaccurately identified image feature pairs when optimizing the image processing model. When the computer device optimizes the image processing model based on these results, it is more beneficial for the model to learn more comprehensive image processing knowledge, thereby improving the processing accuracy and achieving better optimization results. Therefore, when using the optimized image processing model for image processing related to feature similarity, more accurate image processing results can be obtained. Specifically, when using the optimized image processing model in this embodiment for image filtering, more accurate image filtering results can be obtained. Attached Figure Description
[0033] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a schematic diagram of the structure of an image processing model provided in an embodiment of this application;
[0035] Figure 2 This is a schematic flowchart of an image processing method provided in an embodiment of this application;
[0036] Figure 3 This is a schematic flowchart of another image processing method provided in an embodiment of this application;
[0037] Figure 4a This is a schematic diagram of a process for determining the first duplicate image and similar image of the i-th captured image, provided in an embodiment of this application;
[0038] Figure 4bThis is a schematic flowchart illustrating a process for determining a second duplicate image of the i-th captured image from similar images, as provided in an embodiment of this application.
[0039] Figure 5 This is a schematic flowchart of an image processing method provided in an embodiment of this application;
[0040] Figure 6 This is a schematic diagram of the structure of an image processing device provided in an embodiment of this application;
[0041] Figure 7 This is a schematic diagram of the structure of another image processing device provided in the embodiments of this application;
[0042] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application;
[0043] Figure 9 This is a schematic diagram of the structure of an image processing device provided in an embodiment of this application. Detailed Implementation
[0044] To enable those skilled in the art to better understand the methods provided in the embodiments of this application, the technical methods in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be noted that the specific embodiments described in this application are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the various embodiments of this application without creative effort are within the scope of protection of this application.
[0045] To obtain more accurate image processing results, this application proposes an image processing scheme. This scheme utilizes the principle of metric learning to optimize the image processing model, enabling the optimized model to acquire more accurate feature similarity between any two images. Metric learning can be understood as using a neural network to learn a mapping from the original data space (e.g., images, text) to a high-dimensional space, resulting in a high-dimensional feature. The goal of metric learning is to increase the feature similarity (or Euclidean distance) of image features of the same category and decrease the feature similarity (or Euclidean distance) of image features of different categories. To improve the effectiveness of metric learning and thus enhance the accuracy of the processing results obtained by the optimized image processing model, this application employs a cross-batch (i.e., cross-training batch) data augmentation method to enhance the training data (e.g., increase the number of image feature pairs). This allows the image processing model to learn more image processing knowledge, thereby improving the performance of the optimized model. The cross-batch data augmentation method will be described in detail in subsequent embodiments of step S301, and will not be elaborated here. Furthermore, in the subsequent application of this image processing scheme, embodiments of this application also introduce image information in the time dimension (such as the shooting time of the captured image mentioned later) to obtain more refined image similarity based on feature similarity and image information in the time dimension. Embodiments of this application also propose a robust image aggregation strategy based on refined image similarity to process multiple images, achieving the purpose of image filtering or image deduplication.
[0046] To facilitate a clearer explanation of the image processing methods and application scenarios related to the embodiments of this application, the general principles of the image processing scheme proposed in the embodiments of this application are first described below. In practical applications, this image processing scheme can be executed by a computer device. Specifically, in the image processing scheme provided in the embodiments of this application, when the computer device uses multiple image feature pairs to optimize the image processing model, it uses a loss function that can adaptively adjust the loss value based on feature similarity to determine the loss value of each image feature pair. This allows the loss value corresponding to the image feature pairs that the image processing model accurately identifies to be calculated to be larger, while the loss value corresponding to the image feature pairs that the image processing model inaccurately identifies to be calculated to be smaller. Furthermore, the computer device can determine the target loss value referenced by the computer device when optimizing the image processing model based on the loss value of each image feature pair, and perform model optimization processing on the image processing model with reference to the target loss value. Specifically, for image feature pairs constructed from the image features of two similar images, if the image processing model calculates a high feature similarity, it indicates that the image processing model accurately identifies the image feature pair; for image feature pairs constructed from the image features of two dissimilar images, if the image processing model calculates a low feature similarity, it indicates that the image processing model accurately identifies the image feature pair; otherwise, it indicates that the image processing model does not accurately identify the image feature pair.
[0047] Furthermore, when optimizing an image processing model, the target loss value is usually calculated based on the loss values of multiple image feature pairs. When the target loss value is large (e.g., greater than a loss threshold), the computer needs to optimize the image processing model in a direction that reduces the target loss value. In this embodiment, the less accurate the feature similarity calculated by the computer device when using the image processing model to perform feature similarity calculation on image feature pairs, the larger the loss value corresponding to that image feature pair will be, resulting in a larger target loss value. Therefore, it is easy to see that whether the target loss value is large depends on whether there are image feature pairs that the image processing model has processed inaccurately among the multiple image feature pairs. Thus, it can be considered that during the model optimization process based on the target loss value, the computer device mainly focuses on the processing results of image feature pairs that the image processing model has processed inaccurately. This allows the image processing model to refer to these processing results during model optimization to learn more feature processing methods, thereby improving the accuracy of the processing results obtained by the image processing model.
[0048] Based on the above description, it is easy to understand that adaptively adjusting the loss value can be interpreted as the magnitude of the loss value being determined by the computer device after adaptively amplifying or reducing the feature similarity between two included image features based on image features. Specifically, when two images belong to the same image category, the higher the feature similarity between the image features of these two images, the smaller the loss value of the image feature pair formed by these two image features calculated by the computer device using the adaptively adjusted loss function based on feature similarity. For example, the loss function used by the computer device in this case can be the first loss function. Correspondingly, when two images belong to different image categories, the lower the feature similarity between the image features of these two images calculated by the computer device using the adaptively adjusted loss function based on feature similarity, the smaller the loss value corresponding to the image feature pair formed by these two image features. For example, the loss function used by the computer device in this case can be the second loss function.
[0049] To facilitate understanding, the following example illustrates the concept: If an image feature pair includes image feature A and image feature B, where image feature A is an image feature of image a and image feature B is an image feature of image b, then in this case, if image a and image b belong to the same image category (e.g., both belong to image category 1), the greater the feature similarity between image feature A and image feature B, the smaller the loss value calculated by the computer using the first loss function for this image feature pair. Conversely, if image a and image b belong to different image categories (e.g., image a belongs to image category 1 and image b belongs to image category 2), the smaller the feature similarity between image feature A and image feature B, the smaller the loss value calculated by the computer using the second loss function for this image feature pair.
[0050] The structure of the image processing model in this application embodiment can be as follows: Figure 1As shown. The feature similarity calculation module is used to calculate the feature similarity between any two image features. This module can be built based on any feature extraction network, such as Inception network (a deep convolutional neural network), Xception (a feature extraction network improved from Inception network), SENet (Squeeze-and-Excitation Networks), or MobileNet V2 (a lightweight deep convolutional network). This construction method can effectively improve the feature extraction speed. The first loss function calculation module is used to calculate the loss value corresponding to the two image features using a first loss function. The loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function. The second loss function calculation module is used to calculate the loss value corresponding to the two image features using a second loss function. The loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function. Specifically, the first loss function calculation module is mainly used to calculate the corresponding loss value when the two image features belong to the same image category, while the second loss function calculation module is mainly used to calculate the corresponding loss value when the two image features belong to different image categories. The target loss calculation module is mainly used to calculate the target loss value required for model optimization of the image processing model based on each loss value. The model parameter optimization module is mainly used to optimize and adjust the model parameters of the image processing model based on the target loss value obtained from the target loss calculation module, so as to obtain the optimized image processing model.
[0051] Furthermore, in specific implementations of this application's embodiments, the computer device used to execute the image processing scheme may include, but is not limited to, terminal devices and servers. Specifically, the computer device may be a terminal device, a server, or a computing system composed of terminal devices and servers; this application's embodiments do not impose such limitations. Specifically, in this application's embodiments, the terminal device may include, but is not limited to: smartphones, tablets, laptops, desktop computers, in-vehicle terminals, intelligent voice interaction devices, smart home appliances, aircraft, etc. In specific embodiments, the terminal device may also run various applications (APPs) and / or clients, such as: multimedia playback clients, social clients, browser clients, information flow clients, educational clients, and image processing clients, etc. The aforementioned servers may include, but are not limited to: independent physical servers, server clusters or distributed systems composed of multiple physical servers, and cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, etc. It is understood that the computer equipment used in the implementation of the image processing scheme is not specifically limited in the embodiments of this application. In specific applications, the relevant equipment mentioned above can be flexibly combined and used according to the actual application scenario.
[0052] Based on the general principles of the image processing schemes described above, this application provides an image processing method that can be executed by the aforementioned computer device. Please refer to... Figure 2 , Figure 2 This is a schematic diagram of the execution flow of the image processing method. For example... Figure 2 As shown, the method includes steps S201-S205:
[0053] S201, traverse multiple image feature pairs and use an image processing model to obtain the feature similarity between the first and second image features in the currently traversed target image feature pair, as well as the image category label associated with each image feature.
[0054] Traversal refers to a computer device visiting each node in a tree once and only once along a search path. In this embodiment, traversal mainly refers to the computer device sequentially accessing multiple image feature pairs, and the computer device accesses only one image feature pair at a time. Each of the multiple image feature pairs can consist of any two image features. In this embodiment, any image feature pair can be called a target image feature pair, and the two image features included in the target image feature pair can be called the first image feature and the second image feature, respectively. In practical applications, the currently traversed image feature pair in the traversal process can be used as the target image feature pair. The first image feature and the second image feature can be two different image features or two identical image features. An image feature can be associated with an image category label, which indicates the image category to which the corresponding image feature belongs. For example, assuming the image category label associated with the first image feature is an animal label, it can be said that the image category to which the first image feature belongs is the animal category, or it can be understood that the first image feature is obtained by the computer device after extracting features from an image containing an animal pattern.
[0055] S202, when the image category labels associated with each image feature in the target image feature pair are the same, the loss function used to calculate the loss value of the target image feature pair is determined to be the first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function.
[0056] In this embodiment, if two image features in a target image feature pair are associated with the same image category label, it indicates that the two images corresponding to these two image features belong to the same category. Therefore, these two images typically have a high degree of similarity. Thus, it can be understood that the higher the feature similarity between the two image features obtained by the computer device using the image processing model, the higher the accuracy of the image processing model in processing the target image feature pair, and consequently, the smaller the loss value when the image processing model processes the target image feature pair. Therefore, the loss value calculated by the computer device using the first loss function can be negatively correlated with the feature similarity input to the first loss function.
[0057] It should be noted that, in this embodiment, the loss value (hereinafter referred to as the loss value of the target image feature pair) calculated by the computer device using the first loss function when processing the target image feature pair is only related to the feature similarity between the two image features in the target image feature pair. Furthermore, the greater the feature similarity between the two image features in the target image feature pair, the smaller the calculated loss value will be. In other words, the computer device does not need to pre-determine and calculate a reference feature similarity between the two image features in the target image feature pair; it can adaptively adjust the loss value based on the actually calculated feature similarity to determine the loss value of the target image feature pair. Specifically, this adaptive adjustment can be: calculating the smallest possible loss value when the calculated feature similarity is large, and calculating the largest possible loss value when the calculated feature similarity is small. That is, in this embodiment, the change between feature similarity and loss value may not be linear.
[0058] Since feature similarity can be used to measure the processing performance of an image processing model on target image feature pairs, and higher feature similarity indicates more accurate processing results, the loss value of the target image feature pair calculated by the computer using the first loss function is smaller. Similarly, lower feature similarity indicates less accurate processing results, leading to a larger loss value. Specifically, a smaller loss value indicates a smaller contribution of the target image feature pair to the model optimization process (i.e., a smaller role in model optimization). Conversely, a larger loss value indicates a larger contribution of the target image feature pair to the model optimization process (i.e., a larger role in model optimization). Based on the above description, it is easy to understand that in practical applications, when a computer device optimizes an image processing model, in order to achieve better optimization results, when the two image features of a target image feature pair are associated with the same image category, the computer device should make use of the loss value corresponding to the target image feature pair with lower feature similarity as much as possible. The specific utilization method will be explained in detail in step S204, and will not be described in this embodiment.
[0059] S203, when the image category labels associated with each image feature in the target image feature pair are different, the loss function used to calculate the loss value of the target image feature pair is determined to be the second loss function, and the loss value calculated by the second loss function is negatively correlated with the feature similarity input to the second loss function.
[0060] In this embodiment, if two image features in a target image feature pair are associated with different image category labels, it indicates that the two images corresponding to these two image features belong to different categories. Typically, the image similarity between these two images is low. Therefore, it can be understood that the lower the feature similarity between the two image features obtained by the computer device using the image processing model, the higher the image processing model's performance in processing the target image feature pair, and consequently, the smaller the loss value when the image processing model processes the target image feature pair. Therefore, the loss value calculated by the computer device using the second loss function needs to be positively correlated with the feature similarity input to the second loss function. The second loss function is also an adaptively adjustable loss function. Specifically, the magnitude of the loss value calculated by the second loss function is only related to the feature similarity; when the feature similarity is higher, the loss value calculated by the computer device using the second loss function will be as large as possible, while when the feature similarity is lower, the loss value calculated by the computer device using the second loss function will be as small as possible. Furthermore, based on the description of step S203, it can be understood that in practical applications, when a computer device optimizes an image processing model, in order to achieve better optimization results, when the image categories associated with the two image features in a target image feature pair are different, the computer device should, as far as possible, utilize the loss value corresponding to the target image feature pair with higher feature similarity. Similarly, the specific utilization method will be described in detail in step S204, and will not be elaborated here in the embodiments of this application.
[0061] S204 After the traversal is completed, the target loss value of the image processing model is determined based on the loss value of each image feature pair, and the image processing model is optimized in the direction of reducing the target loss value to obtain the optimized image processing model.
[0062] In this embodiment, "traversal completion" can be understood as follows: the computer device uses an image processing model to perform corresponding image processing on each of multiple image feature pairs and calculates the loss value for each image feature pair. The target loss value refers to the loss value used by the computer device when optimizing the image processing model. Typically, the computer device adjusts certain model parameters in the image processing model in a direction that reduces the target loss value to complete one optimization of the image processing model. In specific implementations, the target loss value can be the total loss value obtained by weighted summation of the loss values for each image feature pair, or it can be the average loss value obtained by weighted averaging of the loss values for multiple image feature pairs. The weight of the loss value for each image feature pair can be determined by the computer device based on the image similarity between the two image features in the pair, or it can be determined by the computer device based on the two image category labels corresponding to the two image features. The specific determination method is not limited in this embodiment.
[0063] For ease of explanation, the following embodiments use the example of each loss value having the same weight (e.g., all being 1) and the target loss value being the sum of multiple loss values to illustrate the relevant steps and effects of this application embodiment. Based on the descriptions of steps S203 and S204 above, it can be seen that in this application embodiment, the more accurate the feature similarity between two image features in the target image feature pair (e.g., when the image category labels associated with the image features are the same, the higher the feature similarity, the more accurate; when the image category labels associated with the image features are different, the lower the feature similarity, the more accurate), the smaller the loss value of the target image feature. Since the target loss value is the sum of the loss values of each image feature, it is easy to understand that the larger target loss value in this application embodiment is usually due to the existence of image feature pairs with larger loss values among multiple image feature pairs. In this application embodiment, the larger the target loss value, the more the image processing model needs model optimization, and the large target loss value is due to the existence of image feature pairs with larger loss values. Therefore, it is easy to understand that when the computer device optimizes the image processing model, it mainly refers to image feature pairs with larger loss values (such image feature pairs are usually called hard samples). In a specific embodiment, when optimizing an image processing model, the computer device needs to adjust the model parameters in a way that reduces the target loss value. Specifically, when the target loss value is the sum of the loss values of multiple image feature pairs, the computer device can reduce the target loss value by decreasing the loss value of any one or more of these image feature pairs. Since the space for reducing the loss value of image feature pairs with smaller loss values is smaller, in order to achieve the target optimization effect, the computer device can usually reduce the target loss value by adjusting the model parameters that can reduce the loss value of larger loss values. Based on this, it can be seen that when optimizing an image processing model, the computer device pays more attention to the loss values corresponding to image feature pairs with low feature similarity accuracy (i.e., hard samples). The optimized image processing model obtained by optimizing the model in this way has a better image processing effect, such as obtaining image processing results with higher accuracy.
[0064] S205, the optimized image processing model is used to perform image filtering processing on the target image set.
[0065] In a specific embodiment, the computer device, using an optimized image processing model, can obtain a relatively accurate feature similarity between any two image features. In practical applications, feature similarity can be used for scenarios such as image classification or image filtering. Therefore, in this embodiment, the computer device can use the optimized image processing model to perform image filtering processing on multiple images in a target image set to obtain highly accurate image filtering results.
[0066] In this embodiment, the computer device employs an adaptive loss function to calculate the loss value for each image feature pair based on the magnitude of feature similarity. Furthermore, during the calculation, when the image category labels associated with the two image features in any image feature pair are the same, the computer device uses a first loss function, and the loss value calculated using the first loss function is negatively correlated with the feature similarity between the two image features in the corresponding image feature pair. Conversely, when the image category labels associated with the two image features in any image feature pair are different, the computer device uses a second loss function, and the loss value calculated using the second loss function is positively correlated with the feature similarity between the two image features in the corresponding image feature pair. This method of calculating the loss value ensures that the loss value corresponding to image feature pairs with more accurate feature similarity is as close to the minimum value (e.g., 0), while the loss value corresponding to image feature pairs with less accurate feature similarity is as large as possible (e.g., 1). In this scenario, if the target loss value of the image processing model is determined based on the loss value of each image feature pair, then the computer device typically optimizes the image processing model because among the multiple image feature pairs used, there are image feature pairs with large loss values. In other words, in this embodiment, the computer device focuses on the processing results of hard samples during the image processing model optimization process. This allows the image processing model to learn previously unlearned knowledge based on these processing results, resulting in a more accurate optimized image processing model. Consequently, the computer device can obtain more accurate image processing results after using the image processing method provided in this embodiment.
[0067] Based on the above Figure 2 The image processing method shown in this application is supplemented by another image processing method. Please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic flowchart of another image processing method provided in an embodiment of this application. Figure 3 As shown, the method may include steps S301-S307:
[0068] S301, traverse multiple image feature pairs and use an image processing model to obtain the feature similarity between the first and second image features in the currently traversed target image feature pair, as well as the image category label associated with each image feature.
[0069] In a specific implementation, the multiple image feature pairs used by the computer device can be constructed by the computer device based on multiple image features. In one embodiment, the multiple image features used to construct the image feature pairs can be obtained by the computer device after extracting features from multiple image samples. In this case, the computer device can construct multiple image feature pairs based on multiple image features as follows: The computer device first obtains the image features of each image sample in the multiple image samples to obtain multiple image features. Then, the computer device can combine the image features of any image sample with the image features of each other image sample to obtain at least one image feature pair. After performing the above combination based on the image features of each image sample, the computer device can obtain multiple image feature pairs.
[0070] In another embodiment, the multiple image features used to construct image feature pairs may include image features obtained by the computer device after feature extraction from at least one image sample, as well as image features in an image feature queue. The source of the image features in the image feature queue may be image features from image samples used in the historical process of the computer device optimizing the image processing model. For example, if the current optimization process is the 11th iteration of the image processing model (i.e., the 11th training batch), then, exemplarily, the image feature queue used in the current optimization process may include image features generated in the 2nd to 10th optimization processes. This can be understood as the computer device utilizing training data across batches; therefore, this model optimization method can be called a cross-batch model optimization method. In this case, the computer device can construct multiple image feature pairs based on multiple image features as follows: The computer device first obtains at least one image sample and an image feature queue, which includes multiple image features. Then, the computer device can extract the image features of each image sample from the at least one image sample and update the image feature queue using the image features of each image sample, resulting in an updated image feature queue.
[0071] In this system, image features from one image sample are used to update an image feature in the image feature queue. For example, a computer device can add an image feature to the head of the image feature queue while keeping the number of image features in the queue constant, thereby removing an image feature from the tail of the queue. This updates the image feature queue, ensuring that the image features are continuously updated, which helps the image processing model learn more image information. It's easy to understand that by sequentially combining the image features of each image sample from at least one image sample with each image feature in the updated image feature queue, multiple image feature pairs can be obtained. Optionally, an image feature pair can be obtained by combining the image features of one image sample with the image features in the updated image feature queue. The image feature queue used in the first training batch can be the image features generated by the computer device during the pre-training process of the image processing model. Pre-training can be understood as the process of optimizing the image processing model before using a cross-batch model optimization method. Therefore, the multiple image feature pairs used by the computer device in pre-training can be obtained by combining the multiple image features obtained after the computer device extracts features from multiple image samples. For example, in the embodiments of this application, the computer device can first perform 10 epochs of pre-training on the image processing model, and then randomly select multiple image features generated in these 10 epochs to construct an image feature queue.
[0072] It should be noted that in other embodiments, the image features in the image feature queue can also be all image features generated during the historical optimization process. The main purpose of the computer device using an image feature queue in this embodiment is to utilize data generated during other model optimization processes, enabling the image processing model to learn more features during optimization, thereby improving the optimization effect. This model optimization method can quickly construct a large number of image feature pairs based on a small number of image features. Through cross-batch model optimization, more image features can be obtained in each training batch, effectively augmenting the training data (i.e., image feature pairs) required for model optimization, thus improving the optimization speed to some extent. Furthermore, since the more image feature pairs used for model optimization, the better the optimization effect of the image processing model, this method of constructing image feature pairs can also effectively improve the model optimization effect.
[0073] S302, when the image category labels associated with each image feature in the target image feature pair are the same, the loss function used to calculate the loss value of the target image feature pair is determined to be the first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function.
[0074] The first loss function is primarily used to calculate a sufficiently small loss value when the feature similarity is high, and a sufficiently large loss value when the feature similarity is low. In one implementation, when the computer device calculates the loss value of the target image feature pair using the first loss function, it can first calculate the feature distance between the first image feature and the second image feature. Examples include Euclidean distance and Mahalanobis distance (for ease of explanation, Euclidean distance will be used as an example below). The feature distance can also represent the feature similarity between the first image feature and the second image feature; specifically, a larger feature distance indicates a lower feature similarity between the first image feature and the second image feature. That is, in this embodiment, feature distance and feature similarity can be negatively correlated. After obtaining the feature similarity and feature distance, the computer device can use the first loss function to calculate the loss value of the target image feature pair based on the feature similarity and feature distance.
[0075] Specifically, when calculating the loss value of a target image feature pair using a first loss value, the computer device can first obtain the difference between the first loss parameter and the feature similarity. For example, the first loss parameter can be a constant, such as 1. Then, the computer device can use the result of multiplying the calculated difference by the feature distance as the loss value of the target feature pair. Based on this, for example, the first loss function can be as shown in Equation 1:
[0076]
[0077] Where loss1 is the loss value calculated by the first loss function, and 1 represents the first loss parameter; f i f represents the first image feature. j represents the second image feature; sim represents the feature similarity between the first and second image features; Let 1 represent the feature distance (e.g., Euclidean distance) between the first image feature and the second image feature. Based on Equation 1, it can be seen that the loss value calculated by the first loss function is negatively correlated with feature similarity. Furthermore, when feature similarity is low, 1-sim is large, and the feature distance... The loss value will also be relatively large, so the overall calculated loss1 will be relatively large. Therefore, the loss value of hard samples calculated by the computer equipment will be large enough, which makes the loss value of hard samples have a greater impact on the target loss value of the image processing model.
[0078] The computer device can calculate the feature similarity between the first image feature and the second image feature in the manner shown in Equation 2.
[0079]
[0080] Among them, ||f i || indicates that the first image features are normalized, ||f j || indicates that the second image feature is normalized. In this case, The value can be 2(1-sim). Therefore, when the computer device calculates the loss value of the target image feature pair using the first loss function, it can also directly calculate it based on feature similarity. It should be noted that the first loss function proposed in this embodiment mainly aims to amplify the loss value of difficult samples and reduce the loss value of easy samples based on feature similarity. This further makes it possible that the direct cause of a larger target loss value is the existence of difficult samples, allowing the computer device to focus on the processing results of difficult samples during the model optimization process of the image processing model, which is beneficial for obtaining a more accurate optimized image processing model. Therefore, in other implementations, the first loss function can also be in other forms, as long as it can calculate the largest possible loss value for difficult samples while minimizing the loss value for easy samples. For example, the first loss function can also be as shown in Equation 3:
[0081]
[0082] Based on the first loss function in this embodiment, it is easy to see that the loss value of an image feature pair is strongly correlated with the feature similarity between the two image features in the pair. Changes in image feature similarity can cause a corresponding significant change in the loss value (e.g., a significant increase or decrease). In practical applications, this can help computer devices more accurately distinguish hard samples during model optimization. For example, suppose the first loss function is used to calculate the loss value of an image feature pair composed of feature image A and feature image B. Then, there will be a significant difference between the loss value calculated when the feature similarity is 80% and the loss value calculated when the feature similarity is 75%. Specifically, the loss value corresponding to 75% will be significantly higher than the loss value corresponding to 80%. Therefore, the loss value corresponding to an image feature pair with a feature similarity of 75% is more likely to exceed the corresponding threshold than the loss value corresponding to a feature similarity of 80%. Computer devices can then more easily determine whether the image feature pair is a hard sample based on the corresponding threshold.
[0083] S303, when the image category labels associated with each image feature in the target image feature pair are different, the loss function used to calculate the loss value of the target image feature pair is determined to be the second loss function, and the loss value calculated by the second loss function is negatively correlated with the feature similarity input to the second loss function.
[0084] The second loss function is primarily used to calculate a sufficiently small loss value when the feature similarity is high, and a sufficiently large loss value when the feature similarity is low. When the computer device uses the second loss function to calculate the loss value of the target image feature pair, it can also calculate it after obtaining the feature similarity and feature distance. Specifically, the computer device can first obtain the result of the division operation between the feature distance and the feature similarity, and then use the difference between the second loss parameter and the division result as a reference loss value. Further, the computer device can use the larger loss value between the reference loss value and the preset loss value as the loss value of the target image feature pair. The preset loss value can be pre-set by the computer device; for example, the preset loss value can be 0. Based on this, the second loss function can be, for example, as shown in Equation 4:
[0085]
[0086] Where loss2 is the loss value calculated by the first loss function, 0 represents the preset loss value; m represents the second loss parameter, for example, m = 1; f i f represents the first image feature. j represents the second image feature; sim represents the feature similarity between the first and second image features; This represents the feature distance between the first image feature and the second image feature. Therefore, based on Equation 4, it can be seen that the loss value calculated by the computer device using the second loss function is positively correlated with the feature similarity, and, when the feature similarity is low... Larger, and feature distance The loss function will also be relatively large, resulting in a smaller overall calculated loss². Consequently, the loss value calculated by the computer will be sufficiently large for easy samples, making it unlikely that the loss value of easy samples will cause the target loss value to be too large. This can be understood as reducing the impact of easy samples on the target loss value of the image processing model. Conversely, using a second loss function can increase the impact of hard samples on the target loss value of the image processing model.
[0087] It should be noted that, similar to step S303, in other implementations of this application embodiment, the second loss function used by the computer device can also be in other forms, as long as it can minimize the loss value of easy samples while calculating the largest possible loss value for difficult samples. For example, the second loss function can also be as shown in Equation 5:
[0088]
[0089] S304 After the traversal is completed, the target loss value of the image processing model is determined based on the loss value of each image feature pair, and the image processing model is optimized in the direction of reducing the target loss value to obtain the optimized image processing model.
[0090] Based on the description of the relevant embodiments in steps S302 to S303 above, it is easy to see that in this embodiment, the presence of hard samples can cause the target loss value to be greater than the loss value threshold with a high probability. This can solve the common problem of imbalance between easy and hard samples in existing model optimization processes. Imbalance between easy and hard samples typically refers to a situation where, during model optimization, the number of training samples that the image processing model can accurately process (i.e., the number of easy samples) in the training data is greater than the number of training samples that the image processing model cannot accurately process (i.e., the number of hard samples). Since the loss value corresponding to easy samples is usually small, when the number of easy samples is greater than the number of hard samples, the target loss value is calculated from a large number of small loss values, resulting in a smaller target loss value. If the difference in loss values between easy and hard samples is not increased, when the number of easy samples is greater than the number of hard samples, the target loss value is unlikely to exceed the loss value threshold, making it difficult to trigger model optimization of the image processing model. In other words, when the number of easy samples is greater than the number of hard samples, if the difference between the loss values of easy and hard samples is not large enough, the computer device will be influenced by the loss values of the easy samples and mistakenly believe that the image processing model has reached the accurate training objective, thus terminating the model optimization. However, in reality, the image processing model only has the ability to accurately process a portion of the training samples, while it still cannot accurately process the remaining training samples. In this case, if such an image processing model is applied to a real-world scenario, inaccurate image processing results are highly likely. Based on this, it is easy to understand that since the loss values of hard samples calculated in this embodiment are much greater than the loss values of easy samples, when the number of easy samples is much greater than the number of hard samples, the loss values of hard samples can also account for a large proportion when calculating the target loss value, thus easily affecting the target loss value to exceed the loss threshold. This makes it easier to trigger model optimization. Therefore, the image processing method of this embodiment can also balance the imbalance between easy and hard samples, allowing the optimized image processing model to have better performance.
[0091] It should be noted that, in specific embodiments, other related implementations of step S304 can be found in the embodiment of step S204, and will not be repeated here.
[0092] S305, The optimized image processing model is used to obtain the target feature similarity between the image features of the first captured image and the image features of the second captured image.
[0093] In this context, "captured image" can be understood as an image with a specific capture time, such as photos stored in a device's photo album. The first and second captured images can be two photos captured at different times. That is, both the first and second captured images are associated with their respective capture times. Target feature similarity can be understood as the feature similarity calculated by the computer device using an optimized image processing model based on the image features of the first and second captured images. These image features mainly include, but are not limited to, texture features, color features, and spatial relationship features. When performing deduplication or filtering on photos in the album, the computer device can increase the accuracy of the deduplication or filtering results by appropriately utilizing the capture time of the photos.
[0094] S306, obtain the time difference between the shooting time of the first image and the shooting time of the second image, and use a time similarity algorithm to calculate the time similarity between the first image and the second image based on the time difference.
[0095] In a specific implementation, the computer device can first obtain the time difference between the shooting time of the first image and the shooting time of the second image. This time difference is used to assist the computer device in determining a more accurate image similarity between the first and second images. To ensure high accuracy of the image similarity, the determining factor for the image similarity in this embodiment is primarily the similarity between image features. Therefore, in practical applications, it is necessary to avoid the time difference excessively influencing the image similarity when used to assist in determining image similarity. Based on this, this embodiment first determines the time similarity based on the time difference, using this time similarity to assist the computer device in determining a refined image similarity. In real life, when two images are shot at similar times, they are likely taken of the same object, or they are likely to have many identical image features (e.g., including the same object, small differences in shooting angles, or high similarity in color distribution). Therefore, when the time difference is large, the time similarity determined by the computer device can be small, while when the time difference is small, the time similarity determined by the computer device can be large.
[0096] For example, a computer device can determine the temporal similarity between a first captured image and a second captured image based on a temporal similarity algorithm according to their time difference. The temporal similarity algorithm can be as shown in Equation 6:
[0097]
[0098] Where T represents the temporal similarity between the first and second captured images, α represents the weighting coefficient, which can be set according to the actual application scenario, such as α = 0.001. Time_dif represents the time difference, and for example, the time difference threshold can be 1 (unit: seconds).
[0099] S307, perform a weighted calculation on the temporal similarity and target feature similarity to obtain the image similarity between the first captured image and the second captured image.
[0100] In a specific embodiment, after the computer device determines the target feature similarity and temporal similarity of the first captured image and the second captured image, the computer device can perform a weighted summation calculation on the target image similarity and temporal similarity to obtain the image similarity between the first captured image and the second captured image. For example, the computer device can perform the weighted summation calculation as shown in Equation 7:
[0101] S1 = a*S0 + b*T (Equation 7)
[0102] Where S1 represents image similarity, a represents the weight of target feature similarity, S0 represents target feature similarity, b represents the weight of temporal similarity, and T represents temporal similarity. In practical applications, a and b can be determined by the computer device during image processing of the first and second captured images, or they can be preset within the computer device by relevant personnel. Furthermore, a and b are allocated according to the magnitude of target feature similarity and temporal similarity, which will not be described in detail in this application. To reduce the computational burden on the computer device, a = b = 1 is exemplarily used. Since the computer device in this embodiment utilizes both the similarity in the image feature dimension and the similarity in the temporal dimension when calculating image similarity, the image similarity determined by the computer device can have high accuracy.
[0103] Based on the above description of steps S301 to S307, it is easy to understand that the image processing method provided in this application embodiment can be applied to filter multiple captured images in a target image set. The following, in conjunction with... Figure 4a as well as Figure 4b The filtering process shown is used to determine the i-th captured image in the target image set by the computer device (e.g., ...). Figure 4a The method of repeating images of Img_i in the text will be explained in detail.
[0104] Specifically, the computer device can first use the principles of steps S305 to S307 to obtain the i-th captured image and other captured images in the target image set (e.g., ...). Figure 4aThe computer device can then determine the first duplicate image of the i-th captured image as the image in the target image set whose image similarity to the i-th captured image is greater than a first similarity threshold (e.g., 0.88). Furthermore, the computer device can determine the images in the target image set whose image similarity to the i-th captured image is less than the first similarity threshold but greater than a second similarity threshold (e.g., 0.85) as similar images of the i-th captured image. For example, to facilitate the subsequent determination of the second duplicate image of the i-th captured image from the similar images, the computer device can store the determined similar images in Temp (i.e., a temporary folder). Then, further, the computer device can acquire any similar image (e.g., ... Figure 4b The image similarity between Img_k and each first repeated image is calculated, and if the number of first repeated images with an image similarity greater than a third similarity threshold is greater than a quantity threshold (e.g., half the number of first repeated images), then that first repeated image is identified as a second repeated image of the i-th captured image. Based on this, the computer device can consider both the first and second repeated images as repeated images of the i-th similar image.
[0105] In practical applications, after identifying duplicate images of the i-th captured image, the computer device can determine the target captured image with the highest image quality from the identified duplicate images, and delete other duplicate images of the i-th captured image in the target image set to update the target image set. For example, the computer device can determine the quality score of each duplicate image by performing image quality evaluation on each duplicate image, and determine the duplicate image with the highest quality score as the target duplicate image of the i-th captured image based on the quality score of each duplicate image. Based on the above description, it can be seen that the embodiments of this application can be applied to photo filtering (or deduplication) scenarios in smart albums and smart album creation scenarios, etc. Specifically, when the embodiments of this application are applied to the photo filtering scenario in a smart album, the computer device can delete highly similar photos in the album according to the above method and retain the highest quality photo among the same type, which can effectively save the storage resources consumed by the terminal device for storing photos. In addition, the computer device can also classify the photos in the album and aggregate photos with high similarity (e.g., divide them into the same folder), which can facilitate the organization of the album by relevant users. When the embodiments of this application are applied to the creation of smart photo albums, the computer device can periodically scan photos in the album within a certain period of time and perform deduplication on the corresponding photos so as to create a photo album or video of the deduplicated photos for relevant objects to browse.
[0106] In this embodiment, when filtering or deduplicating a target image set (e.g., a photo album), images that are significantly similar to a certain image (e.g., image A) can be directly identified as duplicate images of image A (i.e., the first duplicate image). For images that are relatively similar to image A (i.e., similar images), to ensure the accuracy of image filtering or deduplication, this embodiment does not directly identify them as duplicate or non-duplicate images. Instead, it further determines whether to identify similar images as duplicate images of image A based on the image similarity between these similar images and the first duplicate image. It is easy to understand that this approach allows for partial correction of the relevant processing results in the second processing stage if the first processing result is inaccurate, thereby improving the overall accuracy of image processing. Taking image filtering as an example, suppose image A and image B should be identified as duplicate images. If the computer device miscalculates the image similarity between image A and image B, it is highly likely that the computer device will identify image B as an image similar to but not duplicate of image A, resulting in duplicate images still existing in the filtered target image set. In this application, for images that the computer device cannot determine on the first attempt whether to classify as duplicate images, the computer device will make a second determination. This greatly improves the robustness of the computer device when performing image filtering processing. Furthermore, the second determination takes into account the similarity between duplicate and similar images, allowing the computer device to refer to more data in the process of determining whether image A is a duplicate, thereby improving the accuracy of the image filtering results.
[0107] It should be noted that when the embodiments of this application or related products are applied in specific scenarios, the computer device needs to obtain authorization from the relevant parties to obtain photos from the album, and the photos obtained by the computer device need to comply with the requirements of relevant laws and regulations.
[0108] In this embodiment, the computer device calculates a larger loss value for difficult samples and a smaller loss value for easy samples using a first loss function and a second loss function. This means that the larger target loss value may be due to the presence of difficult samples during model optimization, indicating that the target loss value is significantly affected by these difficult samples. The image processing model optimized in this way can achieve higher accuracy in image processing. Furthermore, in this embodiment, after calculating the feature similarity between two images using the optimized image processing model, the computer device also combines the feature similarity and temporal similarity between the two images to determine their overall image similarity. Therefore, the computer device utilizes more comprehensive image information when determining image similarity, resulting in higher accuracy in the image similarity determined by the computer device in this embodiment.
[0109] Based on the above Figure 2 and Figure 3 In addition to the principles of the image processing method described above, this application also proposes another image processing method. This method can be executed by the aforementioned computer device or by other devices (such as image processing devices). To facilitate a clear understanding of the embodiments of this application, the following uses an image processing device as an example. Figure 5 The image processing methods shown are explained in detail. Please refer to [link / reference]. Figure 5 The method includes steps S501-S502:
[0110] S501, in response to the image deduplication request for the target image set, for any image contained in the target image set, using the optimized image processing model, obtain the image feature similarity between the image features of any image and the image features of other images in the target image set excluding any image.
[0111] The image deduplication request can be automatically generated by the image processing device after detecting a new image in the target image set, or it can be generated by the image processing device after detecting that a related object has initiated an image deduplication operation on the target image set, or it can be automatically generated by the image processing device after a preset time period. This embodiment of the application does not impose any limitations on this. The target image set may include multiple images. In practical applications, the target image set may be a folder containing images on any terminal device, or a photo album on a mobile device (such as a mobile phone, tablet, etc.). The optimized image processing model can be obtained by the image processing device based on the loss values of multiple image feature pairs. Any one of these multiple image feature pairs may include a first image feature and a second image feature. Furthermore, when two image features in any image feature pair are associated with the same image category label, the loss value of any image feature pair can be calculated using the first loss function, and the loss value calculated using the first loss function is negatively correlated with the feature similarity input to the first loss function; when two image features in any image feature pair are associated with different image category labels, the loss value of any image feature pair can be calculated using the second loss function, and the loss value calculated using the second loss function is positively correlated with the feature similarity input to the second loss function. Specifically, the specific expressions of the first and second loss functions, and the specific method for optimizing the image processing model to obtain the optimized image processing model in step S501, can be found in the embodiments of this application regarding... Figure 2 For steps S201 to S204, please also refer to the section on Figure 3 The relevant descriptions of steps S301 to S304 are not repeated here in the embodiments of this application.
[0112] S502, when there is another target image whose image feature similarity with any image feature is greater than a preset similarity threshold, the other target image is treated as a duplicate image of any image.
[0113] In one embodiment, for any image in the target image set (e.g., image A), if the image processing device determines that there exists another target image in the target image set (e.g., image B) with an image feature similarity greater than a preset similarity threshold, then the image processing device can treat images A and B as duplicate images. In practical applications, the image processing device can further retain one of the two duplicate images and delete the other, which can effectively save storage resources in the image processing device. It should be noted that, in this embodiment, the image processing device can first perform quality assessments on the two duplicate images separately, that is, the image processing device can first perform image quality assessments on the other target images and any image to obtain a first image quality score for the other target images and a second image quality score for any image. For example, the quality score can be represented by a specific numerical value, or it can be represented by a grade (e.g., excellent, good, etc.), and this embodiment does not limit this. Based on this, the target image deleted by the image processing device can be the image with the lowest quality score among the duplicate images. For example, when the quality score of image A is lower than the quality score of image B, the image processing device can retain image B and delete image A. Of course, in other embodiments, the target image to be deleted by the image processing device may also be selected by the relevant object. Specifically, after detecting that there are multiple duplicate images in the target image set, the image processing device may display a prompt message to prompt the relevant object to select the target image.
[0114] In another embodiment, the images in the target image set can also be associated with time information, which can be used to indicate the generation time of the corresponding image, such as the shooting time, storage time, etc. Based on this, after determining the image feature similarity between two images, the image processing device can further obtain the time difference between the generation times of the two images, and then use a time similarity algorithm to determine the time similarity between the two images based on the time difference. Furthermore, the image processing device can comprehensively determine the image similarity between two images based on image feature similarity and time similarity, so that if the image similarity is greater than the image similarity threshold, the two images are identified as duplicate images. Specifically, the specific methods by which the image processing device calculates the time similarity and image similarity between images can be found in the section on... Figure 3 The relevant embodiments of steps S305-S307 are not described in detail here.
[0115] In this embodiment, when responding to an image deduplication request for a target image set, the image processing device employs an optimized image processing model obtained by optimizing the loss values of multiple image feature pairs for relevant image processing. Specifically, the larger the loss value of these multiple image feature pairs, the more the image processing model needs to be optimized. The loss value of each image feature pair mainly depends on the accuracy of the image processing model in recognizing the image feature pairs. For example, the less accurately the image feature pair is recognized, the larger its corresponding loss value. Therefore, it is easy to understand that when there are inaccurately recognized image features among these multiple image feature pairs, the computer device is more likely to optimize the image processing model. In other words, when optimizing the image processing model, the computer device mainly focuses on the processing results of inaccurately recognized image feature pairs. After optimizing the image processing model based on these results, the computer device can enable the image processing model to learn more comprehensive image processing knowledge, thereby improving the processing accuracy of the image processing model and further improving the accuracy of the image processing results.
[0116] Based on the foregoing description of image processing methods, this application also discloses an image processing apparatus. This image processing apparatus may be a computer program (including program code) running on the aforementioned computer device. The image processing apparatus can perform actions such as... Figure 2 as well as Figure 3 The image processing method shown. Please refer to [link / reference]. Figure 6 , Figure 6 The image processing apparatus 60 shown may include at least: a traversal unit 601, a determination unit 602, an optimization unit 603, a first processing unit 604, and an acquisition unit 605.
[0117] The traversal unit 601 is used to traverse multiple image feature pairs and use an image processing model to obtain the feature similarity between the first image feature and the second image feature in the currently traversed target image feature pair, as well as the image category label associated with each image feature. The image category label is used to indicate the image category of the image to which the corresponding image feature belongs.
[0118] The determining unit 602 is used to determine that the loss function used to calculate the loss value of the target image feature pair is a first loss function when the image category label associated with each image feature in the target image feature pair is the same. The loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function.
[0119] The determining unit 602 is used to determine that the loss function used to calculate the loss value of the target image feature pair is a second loss function when the image category labels associated with each image feature in the target image feature pair are different. The loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function.
[0120] The optimization unit 603 is used to determine the target loss value of the image processing model based on the loss value of each image feature pair after traversal, and to optimize the image processing model in the direction of reducing the target loss value to obtain the optimized image processing model.
[0121] The first processing unit 604 is used to perform image filtering processing on the target image set using the optimized image processing model, wherein the target image set includes multiple images.
[0122] In one implementation, the determining unit 602 may specifically be used to perform:
[0123] Calculate the feature distance between the first image feature and the second image feature;
[0124] The loss value of the target image feature pair is calculated using the determined loss function based on the feature similarity and the feature distance.
[0125] In another embodiment, the determining unit 602 may also be specifically used to perform:
[0126] When the determined loss function is the first loss function, the difference between the first loss parameter and the feature similarity is obtained;
[0127] The result of multiplying the difference with the feature distance is used as the loss value of the target image feature pair, wherein the feature similarity is negatively correlated with the feature distance.
[0128] In another embodiment, the determining unit 602 may also be specifically used to perform:
[0129] When the determined loss function is the second loss function, the result of the division operation between the feature distance and the feature similarity is obtained;
[0130] The difference between the second loss parameter and the result of the division operation is used as the reference loss value, and the largest loss value between the reference loss value and the preset loss value is used as the loss value of the target image feature pair.
[0131] In another embodiment, the image processing apparatus 60 may further include an acquisition unit 605, which may be used to perform:
[0132] Acquire at least one image sample and an image feature queue, wherein the image feature queue includes multiple image features;
[0133] Extract image features from each image sample in the at least one image sample, and update the image feature queue using the image features of each image sample to obtain an updated image feature queue; wherein, the image features of one image sample are used to update one image feature in the image feature queue;
[0134] The image features of each image sample in the at least one image sample are sequentially combined with each image feature in the updated image feature queue to obtain the plurality of image feature pairs.
[0135] In another embodiment, the first processing unit 604 may specifically be used to perform:
[0136] The optimized image processing model is used to obtain the target feature similarity between the image features of the first captured image and the image features of the second captured image;
[0137] The time difference between the shooting time of the first captured image and the shooting time of the second captured image is obtained, and a time similarity algorithm is used to calculate the time similarity between the first captured image and the second captured image based on the time difference;
[0138] The image similarity between the first captured image and the second captured image is obtained by weighting the temporal similarity and the target feature similarity.
[0139] In another embodiment, the first processing unit 604 can also be used to perform:
[0140] For the i-th captured image among the plurality of images, obtain the image similarity between the i-th captured image and other captured images in the target image set, where i is a positive integer and i is less than the number of captured images in the target image set;
[0141] Images in the target image set whose image similarity to the i-th captured image is greater than a first similarity threshold are identified as the first duplicate images of the i-th captured image;
[0142] Images in the target image set whose image similarity to the i-th captured image is less than the first similarity threshold and greater than the second similarity threshold are determined as similar images to the i-th captured image.
[0143] Obtain the image similarity between any similar image of the i-th captured image and each first repeated image;
[0144] If the number of first duplicate images with an image similarity greater than a third similarity threshold is greater than a number threshold, then any similar image is taken as the second duplicate image of the i-th captured image;
[0145] The first duplicate image of the i-th captured image and the second duplicate image of the i-th captured image are used as the duplicate images of the i-th captured image.
[0146] In another embodiment, the first processing unit 604 can also be used to perform:
[0147] Image quality is evaluated for each duplicate image to obtain a quality score for each duplicate image;
[0148] The target image with the highest quality score is identified from the plurality of duplicate images, and all duplicate images in the target image set except for the target image are deleted to update the target image set.
[0149] According to one embodiment of this application, Figure 2 and Figure 3 The steps involved in the method shown can be derived from... Figure 6 This is performed by each unit in the image processing apparatus 60 shown. For example, Figure 2 The step S201 shown can be performed by Figure 6 The traversal unit 601 in the image processing apparatus 60 shown is responsible for executing steps S202 and S203; both steps S202 and S203 can be performed by... Figure 6 The determination unit 602 in the image processing apparatus 60 shown is responsible for executing step S204; step S204 can be performed by... Figure 6 The optimization unit 603 in the image processing apparatus 60 shown is responsible for executing step S205; step S205 can be performed by... Figure 6 The first processing unit 604 in the image processing apparatus 60 shown performs the operation. For example, Figure 3 The step S301 shown can be performed by Figure 6 The traversal unit 601 in the image processing apparatus 60 shown is responsible for executing steps S302 and S303; both steps S302 and S303 can be performed by... Figure 6 The determination unit 602 in the image processing apparatus 60 shown is responsible for executing step S304; step S304 can be performed by... Figure 6 The optimization unit 603 in the image processing apparatus 60 shown is responsible for executing steps S305 to S307; each step can be performed by... Figure 6 The first processing unit 604 in the image processing apparatus 60 shown performs the operation.
[0150] According to another embodiment of this application, Figure 6 The units in the image processing apparatus 60 shown are divided based on logical functions. These units can be individually or entirely merged into one or more other units, or some of these units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. In other embodiments of this application, the image processing apparatus 60 may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0151] According to another embodiment of this application, the following can be achieved by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), a device capable of performing operations such as... Figure 2 or Figure 3 The computer program (including program code) involved in each step of the method shown is used to construct, for example... Figure 6 The image processing apparatus 60 shown herein, and the image processing method for implementing the embodiments of this application, are described. The computer program may be recorded on, for example, a computer storage medium, loaded onto the aforementioned computer device via the computer storage medium, and run therein.
[0152] In this embodiment, the image processing device determines the loss value of each image feature pair by employing a loss function that adaptively adjusts the loss value based on feature similarity. This allows the image processing model to calculate a larger loss value for image feature pairs with less accurate feature similarity, and a smaller loss value for image feature pairs with more accurate feature similarity. Therefore, the existence of hard samples contributes to the larger target loss value. Since the image processing device needs to optimize the image processing model when the target loss value is large, it can be understood that the model optimization in this embodiment focuses on the loss values of hard samples. This allows the image processing model to learn more comprehensive image processing knowledge, resulting in better optimization (e.g., higher accuracy of the processing results). Consequently, when the optimized image processing model is used for image processing related to feature similarity, more accurate image processing results can be obtained. Specifically, when the optimized image processing model in this embodiment is used for image filtering, the accuracy of the obtained image filtering results is higher.
[0153] Based on the above regarding Figure 5The image processing method described herein is illustrated in the accompanying description. This application also discloses an image processing apparatus. This image processing apparatus may be a computer program (including program code) running in conjunction with the aforementioned image processing device. The image processing apparatus can perform actions such as... Figure 5 The image processing method shown. Please refer to [link / reference]. Figure 7 , Figure 7 The image processing apparatus 70 shown may include at least a request response unit 701 and a second processing unit 702.
[0154] The request response unit 701 is configured to respond to an image deduplication request for a target image set. For any image included in the target image set, an optimized image processing model is used to obtain the image feature similarity between the image features of the image of the image and the image features of other images in the target image set besides the image of the image of the image. The optimized image processing model is obtained by optimizing the loss values of multiple image feature pairs. Each image feature pair includes a first image feature and a second image feature. When the image category labels associated with the two image features in the image feature pair are the same, the loss value of the image feature pair is calculated by a first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function. When the image category labels associated with the two image features in the image feature pair are different, the loss value of the image feature pair is calculated by a second loss function, and the loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function.
[0155] The second processing unit 702 is used to treat other target images as duplicate images of any image when there are other target images whose image feature similarity with the image features of any image is greater than a preset similarity threshold.
[0156] In one embodiment, the second processing unit 702 can also be used to perform:
[0157] Image quality assessments are performed on the other images of the target and any one of the images to obtain a first image quality score for the other images of the target and a second image quality score for any one of the images.
[0158] Delete the target image from the target image set, wherein the target image is the image with the lowest quality score between the first image quality score and the second image quality score.
[0159] According to another embodiment of this application, Figure 7The units in the image processing apparatus 70 shown are divided based on logical functions. These units can be individually or entirely merged into one or more other units, or some of these units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. In other embodiments of this application, the image processing apparatus 70 may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0160] According to another embodiment of this application, the following can be achieved by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), a device capable of performing operations such as... Figure 5 The computer program (including program code) involved in each step of the method shown is used to construct, for example... Figure 7 The image processing apparatus 70 shown herein, and the image processing method for implementing the embodiments of this application, are described. The computer program may be recorded on, for example, a computer storage medium, loaded onto the aforementioned image processing apparatus via the computer storage medium, and run therein.
[0161] In this embodiment, when responding to an image deduplication request for a target image set, the image processing device employs an optimized image processing model obtained by optimizing the loss values of multiple image feature pairs for relevant image processing. Specifically, the larger the loss value of these multiple image feature pairs, the more the image processing model needs to be optimized. The loss value of each image feature pair mainly depends on the accuracy of the image processing model in recognizing the image feature pairs. For example, the less accurately a feature pair is recognized, the larger its corresponding loss value. Therefore, it is easy to understand that when there are inaccurately recognized image features among these multiple image feature pairs, the computer device is more likely to optimize the image processing model. In other words, when optimizing the image processing model, the computer device mainly focuses on the processing results of inaccurately recognized image feature pairs. After optimizing the image processing model based on these results, the computer device can enable the image processing model to learn more comprehensive image processing knowledge, thereby improving the processing accuracy of the image processing model and further improving the accuracy of the image processing results.
[0162] Based on the descriptions of the above method and device embodiments, this application also discloses a computer device. Please refer to... Figure 8 The computer device 80 includes at least a processor 801 and a computer storage medium 802, and the processor 801 and the computer storage medium 802 can be connected by a bus or other means.
[0163] The computer storage medium 802 is a memory device in the computer device 80, used to store programs and data. It is understood that the computer storage medium 802 can include the built-in storage medium of the computer device 80, or it can include extended storage media supported by the computer device 80. The computer storage medium 802 provides storage space, which stores the operating system of the computer device 80. Furthermore, this storage space also stores one or more instructions suitable for loading and execution by the processor 801. These instructions can be one or more computer programs (including program code). It should be noted that the computer storage medium can be high-speed RAM, or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer storage medium located remotely from the aforementioned processor. The processor 801 (or CPU (Central Processing Unit)) is the computing and control core of the computer device 80, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to achieve corresponding method flows or corresponding functions.
[0164] In one embodiment, processor 801 may load and execute one or more computer programs stored in computer storage medium 802 to achieve the aforementioned... Figure 2 as well as Figure 3 The corresponding steps in the illustrated method embodiment. In a specific implementation, one or more computer programs in the computer storage medium 802 are loaded by the processor 801 and executed as follows:
[0165] Multiple image feature pairs are traversed, and an image processing model is used to obtain the feature similarity between the first image feature and the second image feature in the currently traversed target image feature pair, as well as the image category label associated with each image feature. The image category label is used to indicate the image category of the image to which the corresponding image feature belongs.
[0166] When the image category labels associated with each image feature in the target image feature pair are the same, the loss function used to calculate the loss value of the target image feature pair is determined to be the first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function;
[0167] When the image category labels associated with each image feature in the target image feature pair are different, the loss function used to calculate the loss value of the target image feature pair is determined to be the second loss function. The loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function.
[0168] After the traversal is completed, the target loss value of the image processing model is determined based on the loss value of each image feature pair, and the image processing model is optimized in the direction of reducing the target loss value to obtain the optimized image processing model.
[0169] The optimized image processing model is used to perform image filtering on the target image set, which includes multiple images.
[0170] In one implementation, the processor 801 may specifically be used to load and execute:
[0171] Calculate the feature distance between the first image feature and the second image feature;
[0172] The loss value of the target image feature pair is calculated using the determined loss function based on the feature similarity and the feature distance.
[0173] In yet another embodiment, the processor 801 may specifically be used to load and execute:
[0174] When the determined loss function is the first loss function, the difference between the first loss parameter and the feature similarity is obtained;
[0175] The result of multiplying the difference with the feature distance is used as the loss value of the target image feature pair, wherein the feature similarity is negatively correlated with the feature distance.
[0176] In yet another embodiment, the processor 801 may specifically be used to load and execute:
[0177] When the determined loss function is the second loss function, the result of the division operation between the feature distance and the feature similarity is obtained;
[0178] The difference between the second loss parameter and the result of the division operation is used as the reference loss value, and the largest loss value between the reference loss value and the preset loss value is used as the loss value of the target image feature pair.
[0179] In yet another embodiment, the processor 801 may specifically be used to load and execute:
[0180] Acquire at least one image sample and an image feature queue, wherein the image feature queue includes multiple image features;
[0181] Extract image features from each image sample in the at least one image sample, and update the image feature queue using the image features of each image sample to obtain an updated image feature queue; wherein, the image features of one image sample are used to update one image feature in the image feature queue;
[0182] The image features of each image sample in the at least one image sample are sequentially combined with each image feature in the updated image feature queue to obtain the plurality of image feature pairs.
[0183] In yet another embodiment, the processor 801 may specifically be used to load and execute:
[0184] The optimized image processing model is used to obtain the target feature similarity between the image features of the first captured image and the image features of the second captured image;
[0185] The time difference between the shooting time of the first captured image and the shooting time of the second captured image is obtained, and a time similarity algorithm is used to calculate the time similarity between the first captured image and the second captured image based on the time difference;
[0186] The image similarity between the first captured image and the second captured image is obtained by weighting the temporal similarity and the target feature similarity.
[0187] In yet another embodiment, the processor 801 may specifically be used to load and execute:
[0188] For the i-th captured image among the plurality of images, obtain the image similarity between the i-th captured image and other captured images in the target image set, where i is a positive integer and i is less than the number of captured images in the target image set;
[0189] Images in the target image set whose image similarity to the i-th captured image is greater than a first similarity threshold are identified as the first duplicate images of the i-th captured image;
[0190] Images in the target image set whose image similarity to the i-th captured image is less than the first similarity threshold and greater than the second similarity threshold are determined as similar images to the i-th captured image.
[0191] Obtain the image similarity between any similar image of the i-th captured image and each first repeated image;
[0192] If the number of first duplicate images with an image similarity greater than a third similarity threshold is greater than a number threshold, then any similar image is taken as the second duplicate image of the i-th captured image;
[0193] The first duplicate image of the i-th captured image and the second duplicate image of the i-th captured image are used as the duplicate images of the i-th captured image.
[0194] In yet another embodiment, the processor 801 may specifically be used to load and execute:
[0195] Image quality is evaluated for each duplicate image to obtain a quality score for each duplicate image;
[0196] The target image with the highest quality score is identified from the plurality of duplicate images, and all duplicate images in the target image set except for the target image are deleted to update the target image set.
[0197] In this embodiment, the computer device determines the loss value for each image feature pair by employing a loss function that adaptively adjusts the loss value based on feature similarity. This allows the image processing model to calculate a larger loss value for image feature pairs with less accurate feature similarity, and a smaller loss value for image feature pairs with more accurate feature similarity. Therefore, the existence of hard samples contributes to the larger target loss value. Since the computer device needs to optimize the image processing model when the target loss value is large, it can be understood that the model optimization in this embodiment focuses on the loss values of hard samples, resulting in better optimization performance. Consequently, when the optimized image processing model is used for image processing related to feature similarity, more accurate image processing results can be obtained. Specifically, when the optimized image processing model in this embodiment is used for image filtering, the accuracy of the obtained image filtering results is higher.
[0198] Based on the above and Figure 5 The related method and apparatus embodiments are described in detail in the accompanying descriptions. This application also discloses an image processing device. Please refer to... Figure 9 The image processing device 90 includes at least a processor 901 and a computer storage medium 902, and the processor 901 and the computer storage medium 902 can be connected by a bus or other means.
[0199] The computer storage medium 902 is a memory device in the image processing device 90, used to store programs and data. It is understood that the computer storage medium 902 here can include the built-in storage medium of the image processing device 90, or it can include extended storage media supported by the image processing device 90. The computer storage medium 902 provides storage space, which stores the operating system of the image processing device 90. Furthermore, this storage space also stores one or more instructions suitable for loading and execution by the processor 901. These instructions can be one or more computer programs (including program code). It should be noted that the computer storage medium here can be high-speed RAM, or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer storage medium located remotely from the aforementioned processor. The processor 901 (or CPU (Central Processing Unit)) is the computing and control core of the image processing device 90, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to implement corresponding method flows or corresponding functions.
[0200] In one embodiment, processor 901 may load and execute one or more computer programs stored in computer storage medium 902 to achieve the aforementioned... Figure 5 The corresponding steps in the illustrated method embodiment. In a specific implementation, one or more computer programs in the computer storage medium 902 are loaded and executed by the processor 901 as follows:
[0201] In response to an image deduplication request for a target image set, for any image contained in the target image set, an optimized image processing model is used to obtain the image feature similarity between the image features of the given image and the image features of other images in the target image set besides the given image. The optimized image processing model is obtained based on the loss values of multiple image feature pairs. Each image feature pair includes a first image feature and a second image feature. When the image category labels associated with the two image features in the given image feature pair are the same, the loss value of the given image feature pair is calculated using a first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function. When the image category labels associated with the two image features in the given image feature pair are different, the loss value of the given image feature pair is calculated using a second loss function, and the loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function.
[0202] When there is another target image whose image feature similarity to any of the images is greater than a preset similarity threshold, the other target image is regarded as a duplicate image of any of the images.
[0203] In one implementation, the processor 901 may specifically be used to load and execute:
[0204] Image quality assessments are performed on the other images of the target and any one of the images to obtain a first image quality score for the other images of the target and a second image quality score for any one of the images.
[0205] Delete the target image from the target image set, wherein the target image is the image with the lowest quality score between the first image quality score and the second image quality score.
[0206] In this embodiment, when responding to an image deduplication request for a target image set, the image processing device employs an optimized image processing model obtained by optimizing the loss values of multiple image feature pairs for relevant image processing. Specifically, the larger the loss value of these multiple image feature pairs, the more the image processing model needs to be optimized. The loss value of each image feature pair mainly depends on the accuracy of the image processing model in recognizing the image feature pairs. For example, the less accurately the image feature pair is recognized, the larger its corresponding loss value. Therefore, it is easy to understand that when there are inaccurately recognized image features among these multiple image feature pairs, the computer device is more likely to optimize the image processing model. In other words, when optimizing the image processing model, the computer device mainly focuses on the processing results of inaccurately recognized image feature pairs. After optimizing the image processing model based on these results, the computer device can enable the image processing model to learn more comprehensive image processing knowledge, thereby improving the processing accuracy of the image processing model and further improving the accuracy of the image processing results.
[0207] This application embodiment also provides a computer storage medium storing the above-mentioned... Figure 2 , Figure 3 as well as Figure 5 The image processing methods shown in any one or more schematic flowcharts can be implemented by one or more computer programs. When one or more processors load and execute these computer programs, the image processing methods described in the above embodiments can be realized, and will not be repeated here. The beneficial effects of using the same methods will also not be repeated here. It is understood that the computer programs can be deployed on one or more devices capable of communicating with each other.
[0208] It should be noted that, according to one aspect of this application, a computer product or computer program is also provided. The computer product includes a computer program stored in a computer storage medium. A processor in the computer device reads the computer program from the computer storage medium and then executes the computer program, thereby enabling the computer device to perform the aforementioned... Figure 2 as well as Figure 3 The methods provided in various alternative embodiments of the image processing method shown are examples of the methods provided.
[0209] According to another aspect of this application, a further computer product or computer program is provided, the computer product including a computer program stored in a computer storage medium. A processor in the computer device reads the computer program from the computer storage medium and then executes the computer program, thereby enabling the computer device to perform the aforementioned... Figure 5 The methods provided in various alternative embodiments of the image processing method shown are examples of the methods provided.
[0210] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer storage medium, and when executed, it can include the processes of the above-described image processing method embodiments. The computer storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. It should be particularly noted that when the above embodiments are applied to specific products or technologies, if the acquisition of data related to a relevant object (e.g., the photographer taking the image) is involved, the relevant product or technology needs to obtain the object's permission or consent, and the data acquired by the relevant product or technology must comply with the laws, regulations, and standards of the relevant country or region.
[0211] It is understood that the above-disclosed embodiments are only partial embodiments of this application and should not be construed as limiting the scope of this application. Those skilled in the art will understand that all or part of the processes for implementing the above embodiments and equivalent changes made in accordance with the claims of this application are still within the scope of the invention.
Claims
1. An image processing method, characterized in that, include: Multiple image feature pairs are traversed, and an image processing model is used to obtain the feature similarity between the first image feature and the second image feature in the currently traversed target image feature pair, as well as the image category label associated with each image feature. The image category label is used to indicate the image category of the image to which the corresponding image feature belongs. When the image category labels associated with each image feature in the target image feature pair are the same, the loss function used to calculate the loss value of the target image feature pair is determined to be the first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function; When the image category labels associated with each image feature in the target image feature pair are different, the loss function used to calculate the loss value of the target image feature pair is determined to be the second loss function. The loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function. After the traversal is completed, the target loss value of the image processing model is determined based on the loss value of each image feature pair, and the image processing model is optimized in the direction of reducing the target loss value to obtain the optimized image processing model. The optimized image processing model is used to perform image filtering on a target image set, which includes multiple images. The methods for calculating the loss value of the target image feature pairs using the determined loss function include: Calculate the feature distance between the first image feature and the second image feature; When the determined loss function is the first loss function, the difference between the first loss parameter and the feature similarity is obtained; the result of multiplying the difference with the feature distance is used as the loss value of the target image feature pair, and the feature similarity is negatively correlated with the feature distance; When the determined loss function is the second loss function, the result of the division operation between the feature distance and the feature similarity is obtained; the difference between the second loss parameter and the division operation result is used as the reference loss value, and the largest loss value among the reference loss value and the preset loss value is used as the loss value of the target image feature pair.
2. The method according to claim 1, characterized in that, The method further includes: Acquire at least one image sample and an image feature queue, wherein the image feature queue includes multiple image features; Extract image features from each image sample in the at least one image sample, and update the image feature queue using the image features of each image sample to obtain an updated image feature queue; wherein, the image features of one image sample are used to update one image feature in the image feature queue; The image features of each image sample in the at least one image sample are sequentially combined with each image feature in the updated image feature queue to obtain the plurality of image feature pairs.
3. The method according to claim 1, characterized in that, The plurality of images includes at least a first captured image and a second captured image, and each captured image is associated with a capture time; the image filtering process of the target image set using the optimized image processing model includes: The optimized image processing model is used to obtain the target feature similarity between the image features of the first captured image and the image features of the second captured image; The time difference between the shooting time of the first captured image and the shooting time of the second captured image is obtained, and a time similarity algorithm is used to calculate the time similarity between the first captured image and the second captured image based on the time difference; The image similarity between the first captured image and the second captured image is obtained by weighting the temporal similarity and the target feature similarity.
4. The method according to claim 3, characterized in that, The method further includes: For the i-th captured image among the plurality of images, obtain the image similarity between the i-th captured image and other captured images in the target image set, where i is a positive integer and i is less than the number of captured images in the target image set; Images in the target image set whose image similarity to the i-th captured image is greater than a first similarity threshold are identified as the first duplicate images of the i-th captured image; Images in the target image set whose image similarity to the i-th captured image is less than the first similarity threshold and greater than the second similarity threshold are determined as similar images to the i-th captured image. Obtain the image similarity between any similar image of the i-th captured image and each first repeated image; If the number of first duplicate images with an image similarity greater than a third similarity threshold is greater than a number threshold, then any similar image is taken as the second duplicate image of the i-th captured image; The first duplicate image of the i-th captured image and the second duplicate image of the i-th captured image are used as the duplicate images of the i-th captured image.
5. The method according to claim 4, characterized in that, The number of repeated images is multiple; the method further includes: Image quality is evaluated for each duplicate image to obtain a quality score for each duplicate image; The target image with the highest quality score is identified from the plurality of duplicate images, and all duplicate images in the target image set except for the target image are deleted to update the target image set.
6. An image processing method, characterized in that, include: In response to an image deduplication request for a target image set, for any image contained in the target image set, an optimized image processing model is used to obtain the image feature similarity between the image features of that image and the image features of other images in the target image set besides that image. The optimized image processing model is obtained based on the loss values of multiple image feature pairs. Each image feature pair includes a first image feature and a second image feature. When the image category labels associated with the two image features in the first image feature pair are the same, the loss value of the first image feature pair is calculated using a first loss function, and the loss value calculated using the first loss function is negatively correlated with the feature similarity input to the first loss function. When the image category labels associated with the two image features in the first image feature pair are different, the loss value of the first image feature pair is calculated using a second loss function, and the loss value calculated using the second loss function is negatively correlated with the feature similarity input to the first loss function. The feature similarity input to the second loss function is positively correlated; wherein, the method of calculating the loss value of the image feature pair using the determined loss function includes: calculating the feature distance between the first image feature and the second image feature in the image feature pair; when the determined loss function is the first loss function, obtaining the difference between the first loss parameter and the feature similarity; taking the result of multiplying the difference and the feature distance as the loss value of the image feature pair, wherein the feature similarity is negatively correlated with the feature distance, and the feature similarity is the feature similarity between the first image feature and the second image feature in the image feature pair; when the determined loss function is the second loss function, obtaining the result of dividing the feature distance and the feature similarity; taking the difference between the second loss parameter and the result of the division as a reference loss value, and taking the largest loss value among the reference loss value and the preset loss value as the loss value of the image feature pair; When there is another target image whose image feature similarity to any of the images is greater than a preset similarity threshold, the other target image is regarded as a duplicate image of any of the images.
7. The method according to claim 6, characterized in that, The method further includes: Image quality assessments are performed on the other images of the target and any one of the images to obtain a first image quality score for the other images of the target and a second image quality score for any one of the images. Delete the target image from the target image set, wherein the target image is the image with the lowest quality score between the first image quality score and the second image quality score.
8. An image processing apparatus, characterized in that, include: The traversal unit is used to traverse multiple image feature pairs and use an image processing model to obtain the feature similarity between the first image feature and the second image feature in the currently traversed target image feature pair, as well as the image category label associated with each image feature. The image category label is used to indicate the image category of the image to which the corresponding image feature belongs. The determining unit is configured to determine that the loss function used to calculate the loss value of the target image feature pair is a first loss function when the image category label associated with each image feature in the target image feature pair is the same, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function; The determining unit is used to determine that the loss function used to calculate the loss value of the target image feature pair is a second loss function when the image category labels associated with each image feature in the target image feature pair are different. The loss value calculated by the second loss function is positively correlated with the feature similarity input to the second loss function. An optimization unit is used to determine the target loss value of the image processing model based on the loss value of each image feature pair after traversal, and to optimize the image processing model in the direction of reducing the target loss value to obtain an optimized image processing model. The first processing unit is used to perform image filtering processing on the target image set using the optimized image processing model, wherein the target image set includes multiple images; The method by which the determining unit calculates the loss value of the target image feature pair using the determined loss function includes: Calculate the feature distance between the first image feature and the second image feature; When the determined loss function is the first loss function, the difference between the first loss parameter and the feature similarity is obtained; the result of multiplying the difference with the feature distance is used as the loss value of the target image feature pair, and the feature similarity is negatively correlated with the feature distance; When the determined loss function is the second loss function, the result of the division operation between the feature distance and the feature similarity is obtained; the difference between the second loss parameter and the division operation result is used as the reference loss value, and the largest loss value among the reference loss value and the preset loss value is used as the loss value of the target image feature pair.
9. An image processing apparatus, characterized in that, include: A request-response unit is configured to respond to an image deduplication request for a target image set. For any image included in the target image set, an optimized image processing model is used to obtain the image feature similarity between the image features of the given image and the image features of other images in the target image set besides the given image. The optimized image processing model is obtained based on the loss values of multiple image feature pairs. Each image feature pair includes a first image feature and a second image feature. When the image category labels associated with the two image features in the given image feature pair are the same, the loss value of the given image feature pair is calculated using a first loss function, and the loss value calculated by the first loss function is negatively correlated with the feature similarity input to the first loss function. When the image category labels associated with the two image features in the given image feature pair are different, the loss value of the given image feature pair is calculated using a second loss function, and the loss value calculated by the second loss function is negatively correlated with the feature similarity input to the first loss function. The loss value is positively correlated with the feature similarity input to the second loss function; wherein, the method of calculating the loss value of the image feature pair using the determined loss function includes: calculating the feature distance between the first image feature and the second image feature in the image feature pair; when the determined loss function is the first loss function, obtaining the difference between the first loss parameter and the feature similarity; taking the result of multiplying the difference and the feature distance as the loss value of the image feature pair, wherein the feature similarity is negatively correlated with the feature distance, and the feature similarity is the feature similarity between the first image feature and the second image feature in the image feature pair; when the determined loss function is the second loss function, obtaining the result of dividing the feature distance and the feature similarity; taking the difference between the second loss parameter and the result of the division as a reference loss value, and taking the largest loss value among the reference loss value and the preset loss value as the loss value of the image feature pair; The second processing unit is used to treat other target images as duplicate images of any given image when there is a target image whose image feature similarity to the image features of any given image is greater than a preset similarity threshold.
10. A computer device, characterized in that, include: A processor for implementing one or more computer programs; A computer storage medium storing one or more computer programs adapted to be loaded by the processor and executed as described in any one of claims 1-5.
11. An image processing device, characterized in that, include: A processor for implementing one or more computer programs; A computer storage medium storing one or more computer programs adapted to be loaded by the processor and executed as described in claim 6 or 7.
12. A computer storage medium, characterized in that, The computer storage medium stores one or more computer programs, which are adapted to be loaded by a processor and executed by the image processing method as described in any one of claims 1-5, or the one or more computer programs are adapted to be loaded by a processor and executed by the image processing method as described in claim 6 or 7.
13. A computer product, characterized in that, The computer product includes a computer program adapted to be loaded by a processor and execute the image processing method as described in any one of claims 1-5, or the computer program adapted to be loaded by a processor and execute the image processing method as described in claim 6 or 7.