Image similarity model training method, image capture method and electronic device

By utilizing the autocorrelation between video frames to automatically annotate similarity labels and adopting a decision tree model, the problem of high manual annotation cost and large amount of calculation in the existing technology is solved, and the recognition accuracy and training efficiency of the image similarity model are improved. , reducing the power consumption of electronic equipment.

CN117726836BActive Publication Date: 2024-10-15HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311129359.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2024-10-15
Estimated Expiration
2043-08-31

AI Technical Summary

Technical Problem

The existing technology requires a large amount of manual annotation of similarity labels when training an image similarity model, resulting in high labor costs and a large amount of calculation, which affects efficiency.

Method used

By obtaining a video data set of preset duration, we use the autocorrelation between video frames to perform self-supervised learning, automatically label similarity labels, train image similarity models, and use decision tree models to reduce the amount of calculation and power consumption.

Benefits of technology

It reduces the cost of manual annotation, improves the recognition accuracy and training efficiency of the image similarity model, and reduces the power consumption of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117726836B_ABST
    Figure CN117726836B_ABST
Patent Text Reader

Abstract

The present application discloses a training method for an image similarity model, an image capturing method, and an electronic device, and relates to the field of data processing technology. The method comprises: obtaining a first video data set, the first video data set comprising a plurality of videos of preset duration; wherein the videos of preset duration comprise N groups of images, each group of images comprises M frames of images, and the M frames of images are multiple frames of images taken continuously; annotating similarity labels for multiple groups of two-frame images in the first video data set to obtain a second video data set annotated with similarity labels; training an image similarity model based on the second video data set annotated with similarity labels; wherein the image similarity model is used to identify the similarity between images. In this way, the present application can directly obtain similarity labels between images in a large number of images and other images based on the image frame similarity characteristics, and does not require manual similarity labeling of images in a large number of images and other images, thereby reducing the cost of manual labeling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a training method for an image similarity model, an image capturing method, and an electronic device. Background Art

[0002] In daily life and work, electronic devices may encounter some needs to compare the similarity of different images, or quickly find similar images from a large number of images. With the development of machine learning and artificial intelligence technology, this is generally achieved with the help of corresponding image similarity models.

[0003] At present, in the process of training image similarity models in electronic devices, a large number of images are generally annotated with manual similarity labels. For example, the human eye is used to compare the similarity between an image in a large number of images and other images, and similarity labels are annotated for them. However, when using the above scheme to train the image similarity model, when preparing training samples, it is necessary to use the human eye to compare the similarity between an image in a large number of images and other images. The amount of similarity labeling is very large, and the labor cost is high. Summary of the invention

[0004] The present application provides a method for training an image similarity model, a method for capturing images, and an electronic device. Using the present solution to train an image similarity model can not only improve the accuracy of the image similarity model in identifying image similarities, but also reduce the amount of calculation of the electronic device and reduce the power consumption of the electronic device.

[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a method for training an image similarity model is provided, comprising: obtaining a first video data set, the first video data set comprising a plurality of videos of a preset length; wherein the videos of the preset length comprise N groups of images, each group of images comprises M frames of images, and the M frames of images are a plurality of frames of images taken continuously; annotating similarity labels for a plurality of groups of two frames of images in the first video data set to obtain a second video data set annotated with similarity labels; wherein the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or dissimilar; and training an image similarity model based on the second video data set annotated with similarity labels; wherein the image similarity model is used to identify the similarity between images.

[0007] In conventional technology, it is necessary to use human eyes to compare the similarity between images in a large number of images and other images, and the amount of similarity labeling is very large, and the labor cost is high. However, the present application can directly obtain the similarity labels between images in a large number of images and other images based on the similarity characteristics of image frames, and does not need to manually label the similarity labels between images in a large number of images and other images. In this way, the cost of manual labeling is reduced.

[0008] In another possible implementation manner of the first aspect, the preset duration is less than a time threshold.

[0009] In the present application, shorter videos are collected because the autocorrelation between frames of short videos is higher, which facilitates self-supervised learning of the model, for example, to obtain similarity labels.

[0010] In another possible implementation of the first aspect, the number M corresponding to M frame images is obtained by the following formula: M=f*n; wherein f represents the frame rate of the video of the preset duration, n represents the preset duration, and * represents a multiplication operation.

[0011] In another possible implementation of the first aspect, training an image similarity model based on a second video data set annotated with similarity labels includes: determining preset semantic information of each image in the first video data set, the preset semantic information including multiple preset similarity parameter information; performing similarity feature value calculations on multiple preset similarity parameter information of multiple groups of two-frame images in the first video data set to obtain multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set; using the multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set as input samples and the similarity labels in the second video data set as output samples to train the image similarity model; wherein the multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the input samples and the similarity labels in the output samples correspond one-to-one.

[0012] In another possible implementation of the first aspect, the preset similarity parameters include any one or more of the number of target objects, surface properties of the target objects, the scene type in which the target objects are located, the clarity of the image, the composition score of the image, and the mean hash of the image.

[0013] In another possible implementation of the first aspect, the number of target objects includes at least one of the number of human bodies, the number of animals, and the number of faces; the surface attributes of the target objects include at least one of whether the person is smiling, whether the person is a child, and whether the person has eyes open.

[0014] In another possible implementation of the first aspect, the multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set include: any one or more of the difference results of the preset similarity parameter information of the multiple groups of two-frame images, the comparison results of whether they are equal, and the calculation results of the Hamming distance.

[0015] In another possible implementation of the first aspect, the method further includes: receiving a capture operation, the capture operation being used to trigger the electronic device to capture an image to obtain a photo; in response to the capture operation, capturing multiple frames of images; determining preset semantic information of each image in the multiple frames of images, the preset semantic information including multiple preset similarity parameter information; performing similarity feature value calculation on multiple preset similarity parameter information of multiple groups of two-frame images in the multiple frames of images, and obtaining multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the multiple frames of images; inputting the multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images into an image similarity model, and obtaining similarity labels of the multiple groups of two-frame images, the similarity labels being used to indicate whether each two frames of images are similar or dissimilar; if there are similar images in the multiple groups of two-frame images, generating target photos based on the similar images in the multiple groups of two-frame images.

[0016] In another possible implementation of the first aspect, training an image similarity model based on a second video data set annotated with similarity labels includes: taking each group of two frames of images in the second video data set as input samples, and similarity labels corresponding to the two frames of images in the second video data set as output samples, to train the image similarity model.

[0017] In another possible implementation of the first aspect, the method also includes: receiving a capture operation, the capture operation is used to trigger the electronic device to capture an image to obtain a photo; in response to the capture operation, capturing multiple frames of images; inputting every two frames of images in the multiple frames of images into an image similarity model to obtain a similarity label for every two frames of images, the similarity label is used to indicate whether every two frames of images are similar or dissimilar; if there are multiple frames of similar images in the multiple frames of images, generating a target photo based on the multiple frames of similar images.

[0018] In another possible implementation manner of the first aspect, the image similarity model includes a decision tree.

[0019] It can be understood that the decision tree model basically does not contain time-consuming calculations such as matrix multiplication, and is mainly composed of decision branches, with extremely high reasoning efficiency. The decision tree model can improve the training efficiency and reasoning efficiency of image similarity.

[0020] In another possible implementation manner of the first aspect, acquiring the first video data set includes: receiving the first video data set from at least one first electronic device.

[0021] In another possible implementation manner of the first aspect, after training the image similarity model based on the second video data set annotated with similarity tags, the method further includes: sending the trained image similarity model to at least one second electronic device.

[0022] In a second aspect, a method for training an image similarity model is provided, comprising: a first electronic device obtains a first video data set, and sends the first video data set including multiple videos of preset duration to a server; wherein the videos of preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously; the server receives the first video data set, annotates similarity labels for multiple groups of two frames of images in the first video data set, and obtains a second video data set annotated with similarity labels; wherein the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or dissimilar; and trains an image similarity model based on the second video data set annotated with similarity labels; wherein the image similarity model is used to identify the similarity between images.

[0023] In a third aspect, an image processing method is provided, comprising: acquiring a first image and a second image; determining preset semantic information of the first image and the second image, the preset semantic information comprising a plurality of preset similarity parameter information; performing similarity feature value calculation on the plurality of preset similarity parameter information of the first image and the second image to obtain a plurality of preset similarity parameter comparison results of the first image and the second image; inputting the plurality of preset similarity parameter comparison results of the first image and the second image into an image similarity model, and determining similarity labels of a plurality of groups of two-frame images, the similarity labels being used to indicate whether each two-frame image is similar or not similar; wherein the image similarity model is obtained by training a second video data set annotated with similarity labels; the second video data set is obtained by annotating similarity labels for a plurality of groups of two-frame images in the first video data set; the first video data set comprises a plurality of videos of a preset duration; wherein the videos of the preset duration comprise N groups of images, each group of images comprises M-frame images, and the M-frame images are a plurality of frames of images taken continuously; the similarity labels of any two frames of images in the M-frame images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or not.

[0024] It is understandable that in conventional technology, the similarity between images is compared at the pixel level, that is, the pixels in the image are used for comparison. However, the present application uses multiple preset similarity parameter comparison results representing image features, such as real number comparison results, which greatly reduces the amount of calculation in the image recognition process and improves the efficiency of image recognition.

[0025] In a fourth aspect, an image processing method is provided, comprising: taking an image to be identified as an input, the image to be identified comprising a first image and a second image, running an image similarity model, and outputting a similarity label of the first image and the second image, wherein the similarity label is used to indicate whether the first image and the second image are similar or not. The image similarity model is obtained by training a second video data set labeled with similarity labels; the second video data set is obtained by labeling similarity labels for multiple groups of two-frame images in the first video data set; the first video data set comprises multiple videos of preset duration; the videos of preset duration comprise N groups of images, each group of images comprises M frames of images, and the M frames of images are multiple frames of images taken continuously; the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or not.

[0026] In a fifth aspect, a method for capturing images is provided, comprising: receiving a capture operation, the capture operation being used to trigger an electronic device to capture an image to obtain a photo; in response to the capture operation, capturing multiple frames of images; using an image similarity model to determine a similarity label for every two frames of images in the multiple frames of images, the similarity label being used to indicate whether every two frames of images are similar or dissimilar; wherein the image similarity model is trained using a second video data set labeled with similarity labels; the second video data set is obtained by labeling similarity labels for multiple groups of two frames of images in a first video data set; the first video data set includes multiple videos of a preset duration; wherein the videos of the preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously; the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or dissimilar; if there are similar images in the multiple frames of images, a target photo is generated based on the similar images.

[0027] In this application, if there are multiple similar images in the captured image, a partial image (for example, one frame of image) is selected from the similar multiple frames as the target image, and the target image is saved to obtain the target photo, so as to automatically delete redundant pictures when capturing, thereby improving the user experience.

[0028] In a sixth aspect, a method for capturing an image is provided, comprising: receiving a capture operation, the capture operation being used to trigger an electronic device to capture an image to obtain a photo; in response to the capture operation, capturing multiple frames of images; determining preset semantic information of each image in the multiple frames of images, the preset semantic information comprising multiple preset similarity parameter information; performing similarity feature value calculation on multiple preset similarity parameter information of multiple groups of two frames of images in the multiple frames of images, and obtaining multiple preset similarity parameter comparison results corresponding to the multiple groups of two frames of images in the multiple frames of images; inputting the multiple preset similarity parameter comparison results corresponding to the multiple groups of two frames of images into an image similarity model, and obtaining similarity labels for the multiple groups of two frames of images, the similarity labels being used to indicate the similarity of each two frames of images. frame images are similar or dissimilar; wherein, the image similarity model is trained using a second video data set annotated with similarity labels; the second video data set is obtained by annotating similarity labels for multiple groups of two-frame images in the first video data set; the first video data set includes multiple videos of preset duration; wherein, the video of preset duration includes N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously; the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or dissimilar; if there are similar images in the multiple groups of two-frame images, a target photo is generated based on the similar images in the multiple groups of two-frame images.

[0029] In this application, if there are multiple similar images in the captured image, a partial image (for example, one frame of image) is selected from the similar multiple frames as the target image, and the target image is saved to obtain the target photo, so as to automatically delete redundant pictures when capturing, thereby improving the user experience.

[0030] In the seventh aspect, a server is provided, comprising: a memory and one or more processors, the memory being coupled to the processor; wherein computer program code is stored in the memory, the computer program code comprising computer instructions, and when the computer instructions are executed by the processor, the server executes a method in any possible design manner in the first aspect and the second aspect.

[0031] In an eighth aspect, an electronic device is provided, comprising: a memory and one or more processors, the memory being coupled to the processor; wherein computer program code is stored in the memory, the computer program code comprising computer instructions, and when the computer instructions are executed by the processor, the electronic device executes a method in any possible design manner as in the third aspect, the fourth aspect, the fifth aspect and the sixth aspect.

[0032] In the ninth aspect, a computer-readable storage medium is provided, comprising computer instructions, which, when executed on a server, causes the server to execute a method in any possible design manner as in the first aspect and the second aspect; or, when executed on an electronic device, causes the electronic device to execute a method in any possible design manner as in the third aspect, the fourth aspect, the fifth aspect and the sixth aspect.

[0033] In the tenth aspect, a computer program product is provided, comprising a computer program / instruction, which, when executed by a processor, implements a method in any possible design mode in the first to sixth aspects.

[0034] Among them, the technical effects brought about by any design method in the seventh to tenth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram showing the comparison of the computational complexity of similarity labeling in the conventional technology and in the embodiment of the present application is shown;

[0036] Figure 2 A schematic diagram of a scene for training an image similarity model is shown;

[0037] Figure 3 A schematic diagram of a process flow of a training method for an image similarity model is shown;

[0038] Figure 4 A schematic diagram showing a sliding window sliding on multiple frames of images in a video;

[0039] Figure 5 A schematic diagram of an image similarity model application scenario is shown;

[0040] Figure 6 A schematic diagram of a process flow of a training method for an image similarity model is shown;

[0041] Figure 7 A schematic diagram showing the principle of an image similarity model for identifying image similarity;

[0042] Figure 8 A schematic diagram of the structure of a decision tree is shown;

[0043] Fig. 9 A schematic diagram of the process of obtaining training samples to train an image similarity model is shown;

[0044] Fig.10 A schematic flow chart of an image processing method is shown;

[0045] Fig.11A schematic flow chart of a method for capturing an image in a video is shown;

[0046] Fig.12 A schematic diagram of a camera interface is shown;

[0047] Fig.13 A schematic diagram showing a continuous shooting of two similar pictures is shown;

[0048] Fig.14 A schematic diagram of a camera interface is shown;

[0049] Fig.15 A schematic diagram of an album list interface is shown;

[0050] Fig.16 A schematic diagram of a camera interface is shown;

[0051] Fig.17 A schematic flow chart of another method for capturing images in a video is shown;

[0052] Fig.18 A schematic structural diagram of a chip system is shown. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in a "or" relationship.

[0054] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0055] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.

[0056] As described in the background technology above, when using the above scheme to train the image similarity model, when preparing training samples, it is necessary to use human eyes to compare the similarity between images in a large number of images and other images. The amount of similarity label annotation is very large and the labor cost is high.

[0057] In order to solve the above problems, an embodiment of the present application provides a method for training an image similarity model. Using this method, the trained image similarity model can be used to identify the similarity between any two frames of images. The recognition result of the image similarity model identifying the similarity between any two frames of images can be: similar or dissimilar. For example, if the recognition result is similar, the output of the image similarity model can be 1; if the recognition result is dissimilar, the output of the image similarity model can be 0.

[0058] It can be understood that a video is composed of continuous images. In the method provided in the embodiment of the present application, the picture content of multiple frames of continuous images (i.e., continuous frames) within a certain length of time in a video changes little, and each frame of the continuous frame has a high similarity with other images in the continuous frame. The electronic device can determine that each frame of the continuous frame is similar to other images, mark it with similar labels, and obtain similar training samples. However, the picture content between different videos is different, and each frame of the image in one video has a low similarity with other images in other videos. The electronic device can determine that each frame of the image in a video is not similar to the images in other videos, mark it with dissimilar labels, and obtain dissimilar training samples. Then, the electronic device can train the image similarity model based on the training samples marked with similarity labels.

[0059] The difference from model training in conventional technology is that:

[0060] First: In the solution provided by the embodiment of the present application, the training samples of the image similarity model are derived from the frames of images in multiple short videos. The correlation between consecutive frames in the same short video is high, and the similarity is high; the correlation between images in different short videos is low, and the similarity is not high. Using this feature (image similarity feature) is conducive to obtaining training samples with high similarity (i.e., positive samples) and training samples with low similarity (i.e., negative samples).

[0061] Second: In the solution provided in the embodiment of the present application, there is no need to manually mark the similarity between every two frames of images, but the image similarity characteristics are used to obtain similar training samples and dissimilar training samples.

[0062] In conventional technology, it is necessary to use human eyes to compare the similarity between images in a large number of images and other images, and the amount of similarity labeling is very large, and the labor cost is high. However, the present application can directly obtain the similarity labels between images in a large number of images and other images based on the similarity characteristics of image frames, and does not need to manually label the similarity labels between images in a large number of images and other images. In this way, the cost of manual labeling is reduced.

[0063] For example, Figure 1 A schematic diagram showing the comparison of the computational complexity of similarity labeling in the conventional technology and in the embodiment of the present application is shown. Figure 1 As shown, in conventional technology, for any 10 frames of images (i.e., the 1st to the 10th frames), the human eye can be used to perform a similarity comparison on any two frames of the 10 frames. If 5 similar training samples are required, at least 5 similarity comparisons need to be performed using the human eye. For example, the similarity between the 1st frame and the 2nd frame is compared, the similarity between the 2nd frame and the 3rd frame is compared, the similarity between the 3rd frame and the 4th frame is compared, the similarity between the 5th frame and the 6th frame is compared, and the similarity between the 6th frame and the 7th frame is calculated.

[0064] Continue to refer Figure 1 In the embodiment of the present application, video 1 includes 10 frames of images, namely, the 1'th frame to the 10'th frame, the 1'th frame to the 5'th frame constitute continuous frame 1, and the 6'th frame to the 10'th frame constitute continuous frame 2. Video 2 includes 10 frames of images, namely, the 1"th frame to the 10"th frame, the 1"th frame to the 5"th frame constitute continuous frame 3, and the 6"th frame to the 10"th frame constitute continuous frame 4.

[0065] Instead of using the human eye to compare the similarity between images, similarity training samples can be directly obtained based on the aforementioned image similarity characteristics. For the 10 frames of images in video 1, the similarity results of any two frames of images in continuous frame 1 and continuous frame 2 can be directly obtained based on the image frame similarity characteristics. There is no need to use the human eye to compare the similarity of any two frames of images in continuous frame 1 and continuous frame 2, that is, the similarity comparison amount is 0. If 5 similar training samples are needed, based on the image similarity characteristics in continuous frames, similar labels can be directly annotated for the 1'th frame image and the 2'th frame image in continuous frame 1 to obtain a similar training sample; similarly, similar labels can be annotated for the 6'th frame image and the 7'th frame image in continuous frame 2 to obtain a similar training sample; similarly, similar labels can be annotated for the 1"th frame image and the 2"th frame image in continuous frame 3 to obtain a similar training sample; similarly, similar labels can be annotated for the 6"th frame image and the 7"th frame image in continuous frame 5 to obtain a similar training sample; similarly, similar labels can be annotated for the 7"th frame image and the 8"th frame image in continuous frame 5 to obtain a similar training sample, so as to obtain 5 similar training samples, and no manual similarity calculation is required in this process.

[0066] It can be understood that self-supervised learning refers to a machine learning method that directly mines self-supervised information from large-scale unsupervised data for supervised learning and training (it can be regarded as a special case of unsupervised learning). Self-supervised learning requires labels, but these labels do not come from manual annotations, but from the characteristics of the data itself. Self-supervised learning methods can be based on the characteristics of the data itself, such as context, time series, and comparison.

[0067] The similarity labels in the embodiments of the present application are determined based on the similarity attributes between images, are derived from the data itself, and are self-supervised learning.

[0068] It can be understood that the training samples annotated with similarity labels can be obtained from the video data set. The video data set can be collected by the data acquisition device as the original sample. The image similarity model can be trained by the training device. The data acquisition device and the training device can be the same or different devices. If the data acquisition device and the training device are different devices, the data acquisition device can send the video data set to the training device, and the training device can obtain the training samples annotated with similarity labels based on the aforementioned image frame similarity characteristics. Then, the training device trains the image similarity model using the training samples annotated with similarity labels. Alternatively, the data acquisition device can collect the video data set and obtain the training samples annotated with similarity labels based on the aforementioned image frame similarity characteristics. Then, the training samples are sent to the training device, and the training device trains the image similarity model using the training samples annotated with similarity labels. If the data acquisition device and the training device are the same device, both are electronic devices, then the electronic device must not only obtain the video data set and annotate the similarity labels for the video data set, but also train the image similarity model using the training samples annotated with similarity labels.

[0069] If the data acquisition device and the training device are different devices, for example, the data acquisition device in the embodiments of the present application can be a mobile phone, a tablet computer, a smart watch, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, an augmented reality (AR) device, a virtual reality (VR) device, or other device with data acquisition function. The embodiments of the present application do not impose any special restrictions on the specific form of the data acquisition device.

[0070] Exemplarily, the training device in the embodiment of the present application can be a tablet computer, a laptop computer, an ultra-mobile personal computer (UMPC), a server, or other device with model training function. The embodiment of the present application does not impose any special restrictions on the specific form of the training device.

[0071] If the data collection device and the training device are the same device, they are both electronic devices. The electronic device in the embodiment of the present application can be a mobile phone, tablet computer, smart watch, desktop, laptop, handheld computer, notebook computer, UMPC and other devices with data collection function and model training function, and the embodiment of the present application does not impose any special restrictions on the specific form of the electronic device.

[0072] The following uses the example that the data acquisition device and the training device are different devices, the data acquisition device is a mobile phone, and the training device is a server to illustrate the image similarity model solution in the embodiment of the present application.

[0073] Figure 2 A schematic diagram of a scene for training an image similarity model is shown. Figure 2 As shown, the scenario includes a server 100 and a mobile phone 200. It can be understood that the video data set can also be referred to as an original sample, and the mobile phone 200 can obtain the original sample and send the original sample to the server 100. In this way, the server 100 can obtain the original sample from the mobile phone 200, annotate the original sample with a similarity label, and train the image similarity model using the training sample annotated with the similarity label. It should be understood that the server 100 can receive the original sample from more than one mobile phone 200, and the server 100 can receive the original sample sent by multiple electronic devices (i.e., multiple first electronic devices) for generating training samples of the image similarity model.

[0074] The following is an introduction to the training method of the image similarity model with the help of a flowchart. Figure 3 A flow chart of a training method for an image similarity model is shown, such as Figure 3 As shown, the process includes the following steps:

[0075] Step 301: the mobile phone 200 obtains a first video data set, which includes multiple videos of preset duration; wherein the videos of preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously.

[0076] The mobile phone 200 can collect a first video data set, which is also called a short first video data set. The short videos in the first video data set are videos of shorter duration. Specifically, the videos in the first video data set are videos of preset duration, and the preset duration is less than or equal to a duration threshold. For example, the duration threshold is 10s.

[0077] It should be noted that shorter videos are collected because the autocorrelation between frames of short videos is higher, which facilitates self-supervised learning of the model, for example, it is easier to obtain similarity labels.

[0078] The short video in the embodiment of the present application may refer to a video whose content does not have many scene switches, that is, the picture similarity is high. This type of video has high autocorrelation, which is conducive to model learning.

[0079] Specifically, the picture includes two important picture elements, the target object and the environment. A high picture similarity may refer to a high similarity of the picture elements. For example, the target object and the environment content of multiple frames of images in a short video are the same, but the postures of the target object are different, and the environment content is basically the same.

[0080] The first video data set can be obtained in a variety of ways. For example, the mobile phone 200 can use the Internet to download videos from the platform, or the mobile phone 200 can obtain short videos by shooting.

[0081] Step 302 : the mobile phone 200 sends a first video data set to the server 100 .

[0082] Step 303: The server 100 receives a first video data set.

[0083] Step 304: The server 100 annotates similarity labels for multiple groups of two-frame images in the first video data set to obtain a second video data set annotated with similarity labels; wherein, the similarity labels of any two frames of images in the M frames of images in each group of images in the above-mentioned second video data set can be similar labels, and the similarity labels of any two frames of images in different videos can be dissimilar labels.

[0084] After acquiring the short video dataset, the server 100 may use the aforementioned image frame similarity characteristics to label the video dataset with similarity tags.

[0085] M frames of images can be obtained by sliding windows. Specifically, the sliding window of the mobile phone 200 slides in each video of a preset length, and the M frames of images in the sliding window are similar, while the frames of images in different short videos are not similar. In this way, a similarity data set is constructed, and the similarity data set includes similar sample pairs and dissimilar sample pairs.

[0086] It can be understood that the larger the sliding window length M is, the richer the perceived semantic information is, but the greater the possibility of recognition errors; the smaller M is, the less semantic information it contains, and the smaller the possibility of recognition errors is.

[0087] The number M corresponding to M frame images is obtained by the following formula:

[0088] M = f*n;

[0089] Wherein, f represents the frame rate of the video of the preset duration, n represents the preset duration, and * represents a multiplication operation.

[0090] Assuming the frame rate is f, multiple frames within n seconds can be considered similar, M = f*n, n can be set according to the actual situation, for example, when the frame rate is 30, set n = 2, that is, M = 60. For example, Figure 4 FIG. 1 shows a schematic diagram of a sliding window sliding on multiple frames of images in a video. Figure 4 As shown, the M frame images within the sliding window are similar.

[0091] Step 305: The server 100 trains an image similarity model based on the second video data set annotated with similarity tags; wherein the image similarity model is used to identify the similarity between images.

[0092] It can be understood that the second video data set can be used as an input sample of the model, and the similarity labels in the second video data set can be used as output samples of the model. The server 100 can input the input sample and the output sample into the image similarity model for classification for training. During this training process, the server 100 can adjust the model parameters of the image similarity model based on the error between the actual output of the image similarity model and the output sample, until the error between the actual output of the image similarity model and the output sample is less than the first preset error value, and then the training is terminated. The image similarity model obtained at the end of the training is the recognition model of image similarity.

[0093] A training scheme for an image similarity model is introduced above. The trained image similarity model is deployed into a corresponding device (i.e., a second electronic device, such as a mobile phone). For example, the server 100 sends a trained image similarity model to at least one second electronic device, the second electronic device receives the trained image similarity model, and the trained image similarity model is deployed in the second electronic device. The mobile phone that has deployed the trained image similarity model can use the image similarity model to perform image similarity recognition. This will be described in detail below.

[0094] Figure 5 A schematic diagram of an image similarity model application scenario is shown. Figure 5 , the mobile phone can use the similarity model obtained by the previous training to identify the similarity of the image. Specifically, the mobile phone can input the image to be identified into the image similarity model, and the image to be identified includes two frames of images: the first image and the second image. The similarity model is run, and the similarity model can output the similarity labels of the two frames of images, such as outputting similarity label 2, thereby obtaining the similarity of the two frames of images.

[0095] Taking the similarity label 2 corresponding to the similarity “similar” as an example, the similarity model outputs the similarity label 2, and the mobile phone can determine that the similarity between the two frames of images is similar based on the similarity label 2.

[0096] It can be understood that the semantic information of an image refers to the content information in the image. For example, for an image of a puppy, the semantic information of the image may be that the image includes a puppy and the puppy's skin is yellow. Therefore, it can be seen that the semantic information of an image can reflect the content features in the image, and serve as an important parameter for judging image similarity, and further serve as an important sample for the image similarity model. Figure 6 A flow chart of a training method for an image similarity model is shown, such as Figure 6 As shown, the process includes the following steps:

[0097] Step 601: the mobile phone 300 obtains a first video data set, which includes multiple videos of preset duration, wherein the videos of preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously.

[0098] It should be understood that the mobile phone 200 can receive original samples sent by multiple electronic devices (ie, multiple first electronic devices) for generating training samples for the image similarity model.

[0099] It can be understood that the video in the first video data set can come from one or more other electronic devices. The technical solution for the other one or more electronic devices to obtain the video described in the embodiment of the present application is the same as the technical solution of step 301 and will not be repeated here.

[0100] The mobile phone 200 may obtain the first video data set by shooting.

[0101] The first video data set in this step may be the same as the first video data set described in the previous step, and will not be described in detail here.

[0102] Step 602: The mobile phone 200 determines preset semantic information of each frame of the first video data set, where the preset semantic information includes a plurality of preset similarity parameter information.

[0103] It can be understood that a predefined semantic information (i.e., preset semantic information) detection module is set in the mobile phone 200, and the mobile phone 200 can use the preset semantic information detection module to obtain the semantic information of each frame image in the first video data set and save it in a log. In this way, the mobile phone 200 can determine the preset semantic information of each frame image in the first video data set from the log. Specifically, in some embodiments, the mobile phone 200 can shoot the video in the first video data set played by the mobile phone 300, and use the preset semantic information detection module to obtain the semantic information of each frame image in the first video data set, and save it in a log.

[0104] In other embodiments, a semantic information detection module is provided in the mobile phone 200. The mobile phone 200 can use the semantic information detection module to obtain the semantic information of each frame image in the first video data set, and save it in a log. It can be understood that the preset semantic information includes multiple similarity parameter information, not all similarity parameter information is required for training the similarity model, and the similarity parameter information required for training the similarity model may be part of the parameter information. A preset semantic information acquisition program can be provided in the mobile phone 200. In this way, the mobile phone 200 can use the preset semantic information acquisition program to determine the preset semantic information of each frame image in the first video data set from the log to determine the parameter information required for training the similarity model.

[0105] It can be understood that the preset semantic information includes a plurality of preset similarity parameter information. The preset similarity parameters may include any one or more of the number of target objects, surface attributes corresponding to the target (e.g., face detection information), scene information where the target object is located (e.g., scene type and the number of corresponding scene types), image clarity, image composition score, and image mean hash, but are not limited thereto.

[0106] The number of target objects may include the number of human bodies, the number of animals, and the number of faces. The surface attributes of the target objects may include whether a person is smiling, whether there are children, and whether the person has eyes open. The scene information where the target object is located may include the scene type and the number of corresponding scene types. The following uses the preset similarity parameters including the number of human bodies, the number of animals, the number of faces, whether a person is smiling, whether there are children, whether a person has eyes open, the scene detection results, the scene type and the number of corresponding scene types (the number of transition types), the image clarity score, the image composition score, and the mean hash of the image as an example to illustrate the present application scheme.

[0107] After semantic information detection, each frame of image has corresponding 11 similarity parameter information (feature information), as shown in Table 1.

[0108] Table 1

[0109]

[0110] As shown in Table 1, the number of human bodies may represent the number of detected human subjects.

[0111] The number of animals may represent the number of cat and dog subjects detected.

[0112] The number of faces may indicate the number of faces obtained by face detection.

[0113] Whether a person is smiling can indicate whether the face contains a smiling expression.

[0114] Whether there is a child may indicate whether there is a child face.

[0115] Whether a person has eyes open can indicate whether the face has eyes open.

[0116] The scene detection result may represent a scene detection result, such as a flower, a blue sky, etc.

[0117] The number of scenes detected by scene detection may indicate the number of scenes obtained by scene detection.

[0118] The clarity score of the image may represent a score obtained by the image clarity model.

[0119] The composition score of an image may represent a score calculated based on the aesthetics of the image composition.

[0120] Mean hashing of an image may represent computing a hash value using mean hashing.

[0121] Except for the mean hash of the image, all other features above use the output of existing modules.

[0122] The mean hash algorithm is often used for similar image recognition. Specifically, the role of the mean hash of an image is to generate a "fingerprint" string for each image, and the "fingerprint" string is used to compare the image similarity of different images.

[0123] The mean hash of an image can be obtained using the average hashing algorithm (aHash), which is based on comparing each pixel of the grayscale image with the average value. The specific steps are as follows:

[0124] Step 1: Scale the image to a preset size, that is, reduce the base image to a smaller size image. It can be understood that in order to retain the image structure, details are removed, such as removing differences in size and aspect ratio. For example, the image is uniformly scaled to 12*12, with a total of 144 pixels. Another example is to uniformly scale the image to 8*8, with a total of 64 pixels.

[0125] Step 2: Convert to grayscale: Convert the scaled image to a 256-level grayscale image.

[0126] The following is the grayscale image correlation algorithm (R = red, G = green, B = blue) formula:

[0127] 1. Floating point algorithm formula: Gray = R*0.3+G*0.59+B*0.11.

[0128] 2. Integer method formula: Gray = (R*30+G*59+B*11) / 100.

[0129] 3. Shift method formula: Gray = (R*76+G*151+B*28)>>8.

[0130] 4. Average value method formula: Gray = (R + G + B) / 3.

[0131] 5. Take only the green formula: Gray=G.

[0132] Step 3: Calculate the average value of all pixels in the grayscale processed image. For example, calculate the average grayscale value of a 12x12 image. For another example, calculate the average grayscale value of an 8x8 image.

[0133] Step 4: Compare pixel grayscale values: Traverse each pixel of the grayscale image. If each element point is compared with the average pixel value and is greater than or equal to the mean, it is recorded as bit 1, and if it is less than the mean, it is recorded as bit 0, and a string of hash values ​​is obtained.

[0134] Step 5: Get the mean hash of the image, or the "fingerprint" string, the information fingerprint. For example, for a 12x12 image, 144 hash values ​​are obtained, that is, each image is represented by a hash code of length 144. For another example, for an 8x8 image, 64 hash values ​​are obtained, that is, each image is represented by a hash code of length 64.

[0135] Step 603: the mobile phone 200 sends the first video data set and preset semantic information of each frame of the image in the first video data set to the server 100.

[0136] Step 604: The server 100 receives the first video data set and preset semantic information of each frame of the image in the first video data set.

[0137] Step 605: the server 100 calculates similarity feature values ​​for multiple preset similarity parameter information of multiple groups of two-frame images in the first video data set, and obtains multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set.

[0138] The mobile phone 200 calculates similarity feature values ​​for multiple preset similarity parameter information of multiple groups of two-frame images in the first video data set, and obtains multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set. The multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set can be used as training samples for training the image similarity model, or are called training data sets.

[0139] For the 11 similarity parameter information (features) obtained above, different types of data need to be processed differently to obtain similarity parameter comparison results (similarity features), as shown in Table 2.

[0140] Table 2

[0141]

[0142] As shown in Table 2, real number data other than hash (such as the number of human bodies, animals, and faces in Table 2) are subtracted to obtain absolute values ​​(i.e., difference results), and discrete data (such as whether a person is smiling, whether there are children, whether a person has eyes open, and scene detection results in Table 2) are classified, i.e., equal is 1, and unequal is 0. The Hamming distance is calculated for the mean hash.

[0143] The Hamming distance can be calculated using the mean hash of two frames of images. The Hamming distance represents the number of different characters in the corresponding positions of two equal-length strings. The Hamming distance between strings x and y is represented by d(x,y). The Hamming distance measures the minimum number of replacements required to change string x into y by replacing characters, that is, how many times the mean hash of one frame of image changes to the mean hash of another frame of image. The larger the Hamming distance, the more inconsistent the images are. Conversely, the smaller the Hamming distance, the more similar the images are.

[0144] For example, when the Hamming distance is 0, it means that the two frames of images are very similar, or exactly the same. If the Hamming distance is greater than 0 and less than or equal to 5, it means that they are somewhat different, but relatively close. If the Hamming distance is greater than 5 and less than or equal to 10, it means that they are less similar. If the Hamming distance is greater than 10, it means that the two frames of images are completely different.

[0145] Step 606: The server 100 annotates similarity labels for multiple groups of two-frame images in the first video data set to obtain a second video data set annotated with similarity labels; wherein the similarity labels for multiple groups of two-frame images in the M frame images in each group of images in the above-mentioned second video data set may be similar labels, and the similarity labels for multiple groups of two-frame images in different videos may be dissimilar labels.

[0146] The technical solution of step 606 is the same as that of step 304 and will not be described in detail here.

[0147] Step 607: The server 100 trains an image similarity model using the second video data set labeled with similarity tags and multiple preset similarity parameter comparison results corresponding to multiple groups of two-frame images in the first video data set; wherein the image similarity model is used to identify the similarity between images.

[0148] The image similarity model can be various types of models, for example, the image similarity model can be a decision tree model. It can be understood that the decision tree model basically does not contain time-consuming calculations such as matrix multiplication, and is mainly composed of decision branches, and has extremely high reasoning efficiency. The decision tree model can improve the training efficiency and reasoning efficiency of image similarity.

[0149] The server 100 can use a decision tree model for classification learning, and the learning goal is the "similar / dissimilar" classification. It can be understood that the decision tree includes multiple leaf nodes, and each leaf node represents a classification result. In some embodiments, the leaf nodes correspond one-to-one to the similarity classification confidence, and the similarity classification confidence is used to divide similarity and dissimilarity. Specifically, in some embodiments, the server 100 can set a similarity threshold. If the similarity classification confidence is greater than or equal to the similarity threshold, it is determined to be similar. If the similarity classification confidence is less than the similarity threshold, it is determined to be dissimilar.

[0150] For example, Figure 7 FIG. 1 shows a schematic diagram of the principle of an image similarity model for identifying image similarity. Figure 7 As shown, the decision tree includes 10 leaf nodes: leaf node 1, leaf node 2, leaf node 3, leaf node 4, leaf node 5, leaf node 6, leaf node 7, leaf node 8, leaf node 9 and leaf node 10.

[0151] The leaf nodes of the decision tree may correspond to similarity classification confidences of different values, for example, the similarity classification confidence corresponding to leaf node 1 is 0.1, the similarity classification confidence corresponding to leaf node 2 is 0.2, the similarity classification confidence corresponding to leaf node 3 is 0.3, the similarity classification confidence corresponding to leaf node 4 is 0.4, the similarity classification confidence corresponding to leaf node 5 is 0.5, the similarity classification confidence corresponding to leaf node 6 is 0.6, the similarity classification confidence corresponding to leaf node 7 is 0.7, the similarity classification confidence corresponding to leaf node 8 is 0.8, the similarity classification confidence corresponding to leaf node 9 is 0.9, and the similarity classification confidence corresponding to leaf node 10 is 1.0. If the similarity threshold is set to 0.9 and the similarity classification confidence is greater than or equal to 0.9, it is determined to be similar, and if the similarity classification confidence is less than 0.9, it is determined to be dissimilar.

[0152] In order to briefly introduce the training content of the image similarity model, the basic concept of the decision tree is introduced below. The decision tree consists of multiple nodes. The nodes of the decision tree can be divided into three types: leaf nodes, root nodes, and intermediate nodes. Each node has its own unique function and role. Leaf nodes are nodes in the decision tree that have no child nodes. They are usually the end nodes of the decision tree, also known as terminal nodes. The root node is the top node of the decision tree. It has no parent node. The main function of the root node is to provide an entry point for the decision tree. The intermediate nodes are all nodes in the decision tree except the leaf nodes and the root node. The main function of the intermediate nodes is to connect the various parts of the decision tree. Leaf nodes, root nodes, and intermediate nodes are very important nodes in the decision tree. They store data, provide entry points, and connect various parts respectively.

[0153] Figure 8 A schematic diagram of the structure of a decision tree is shown. Figure 8 As shown, each internal node of the decision tree represents a judgment on an attribute (or feature and similarity parameter information), each branch represents the output of a judgment result, and finally each leaf node represents a classification result (also called a cluster).

[0154] It can be understood that the decision tree can perform multi-level classification and judgment according to different characteristics of the data, and finally decide the classification result to be predicted. The construction of the decision tree mainly lies in the details such as which dimensions need to be divided at each decision point of the decision tree and which threshold nodes of these dimensions are divided. In the embodiment of the present application, the training image similarity model can be training including the node position of each similarity parameter in the preset similarity parameter in the decision tree, and the judgment condition of the bifurcation.

[0155] The decision tree is expressed as a tree structure, which represents a mapping relationship between object attributes (i.e., similarity parameters) and object values ​​(i.e., similarity parameter comparison results). Each node in the tree represents an object, each forked path represents a possible attribute value, and each leaf node corresponds to the value of the object represented by the path from the root node to the leaf node. When testing the training samples, you only need to start from the root node, test at each branch node, recursively enter the subtree along the corresponding branch and test again until you reach the leaf node. The category represented by the leaf node is the predicted category of the current test sample, such as the similarity classification confidence.

[0156] The training process of a decision tree model can include the following steps:

[0157] 1. Select the partition attribute: The partition attribute means to select a feature attribute from the many features of the training sample (preset similarity parameters) as the splitting criterion for the current node. Then split according to the attribute, and generate child nodes from top to bottom until the data set is indivisible to form a complete decision tree. From all the feature attributes, select the feature with the most distinguishing ability for classification as the partition attribute. Commonly used indicators include information gain, gain rate, etc.

[0158] 2. Create a decision node (root node): Split the training data into child nodes of the decision node according to the value of the partition attribute. Each decision node corresponds to an attribute test condition.

[0159] 3. Generate child nodes: Recursively divide the data of child nodes and build a decision tree. Set termination conditions, such as no attributes remaining, the number of node samples is less than the threshold, etc.

[0160] 4. Post-pruning: Perform post-pruning optimization on the decision tree to remove nodes that are prone to overfitting and simplify the complexity of the tree.

[0161] Compared with other classification algorithms, the decision tree classification algorithm is relatively simple. As long as the training sample set can be represented by feature vectors and categories, the decision tree classification algorithm can be considered. When inferring and predicting, its complexity is only related to the number of layers of the decision tree, which is linear and basically does not contain time-consuming calculations such as matrix multiplication. The data processing efficiency is very high, which is suitable for real-time computing scenarios.

[0162] The embodiment of the present application relates to a method for calculating the similarity between frames in a video sequence. By rationally utilizing the self-similarity between video frames and the corresponding semantic information to train a decision model, the similarity between frames can be calculated under higher performance constraints and better results can be obtained. The algorithm is simple and robust, does not require labeling, and has high performance.

[0163] Fig. 9 The schematic diagram of the process of obtaining training samples and training image similarity model is shown. Fig. 9 As shown in Figure 1, the scheme of using the semantic information of the image to train the image similarity model mainly includes the following steps:

[0164] Step 1: Obtain the first video dataset.

[0165] The first video data set in this step may be the same as the first video data set described in the previous step, and will not be described in detail here.

[0166] Step 2: Determine preset semantic information of each image in the first video data set, where the preset semantic information includes a plurality of preset similarity parameter information.

[0167] The preset semantic information determination scheme in step 2 may be the same as the preset semantic information determination scheme in step 602, and will not be described in detail here.

[0168] Step 3: Determine multiple preset similarity parameter comparison results. Specifically, perform similarity feature value calculation on multiple preset similarity parameter information of multiple groups of two-frame images in the first video data set to obtain multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set, and use the multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set as input samples.

[0169] The preset similarity parameter comparison result determination scheme in step 3 may be the same as the preset similarity parameter comparison result determination scheme in step 605 , and will not be described in detail here.

[0170] Step 4: Determine a plurality of groups of two-frame image annotated similarity labels in the first video data set, obtain a second video data set annotated with similarity labels, and use the similarity labels in the second video data set as output samples.

[0171] The similarity tag determination scheme in step 4 may be the same as the similarity tag determination scheme in step 606 , and will not be described in detail here.

[0172] Step 5: Use the multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set as input samples, and the similarity labels in the second video data set as output samples to train the image similarity model; wherein the multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the input samples and the similarity labels in the output samples correspond one to one.

[0173] The image similarity model training scheme in step 5 may be the same as the image similarity model training scheme in step 607 , and will not be described in detail here.

[0174] It can be understood that the above step 1 can be performed by a data acquisition device. The above step 2 can be performed by other electronic devices other than the data acquisition device, and other electronic devices other than the data acquisition device can perform step 2 based on the first video data set acquired by the data acquisition device. Steps 3, 4 and 5 can be performed by a training device. The training device can be the same as or different from the execution device of step 2.

[0175] The above is an introduction to the training method of the image similarity model by taking the data acquisition device as a mobile phone (such as mobile phone 300), the execution device of step 2 as a mobile phone (such as mobile phone 200), and the training device as a server as an example, but it is not limited to this.

[0176] Another image similarity model training scheme is introduced above in the mobile phone 200. The above-mentioned trained image similarity model is deployed into the corresponding device (i.e., the second electronic device, for example, the mobile phone 400). For example, the server 100 sends the trained image similarity model to at least one second electronic device, the second electronic device receives the trained image similarity model, and the trained image similarity model is deployed in the second electronic device. The mobile phone 400 that has deployed the trained image similarity model can use the image similarity model to perform image similarity recognition. This will be described in detail below.

[0177] Fig.10 A schematic diagram of a process of image processing is shown. The process includes the following steps:

[0178] Step 1001: The mobile phone 400 acquires a first image and a second image.

[0179] Step 1002: The mobile phone 400 determines preset semantic information of the first image and the second image, where the preset semantic information includes a plurality of preset similarity parameter information.

[0180] The preset semantic information determination scheme in step 1002 may be the same as the preset semantic information determination scheme in step 602, and will not be described in detail here.

[0181] Step 1003: the mobile phone 400 calculates similarity feature values ​​for a plurality of preset similarity parameter information of the first image and the second image, and obtains a plurality of preset similarity parameter comparison results of the first image and the second image.

[0182] The preset similarity parameter comparison result determination scheme in step 1003 may be the same as the preset similarity parameter comparison result determination scheme in step 605 , and will not be described in detail here.

[0183] Step 1004: the mobile phone 400 inputs the comparison results of multiple preset similarity parameters of the first image and the second image into the image similarity model to determine similarity labels of multiple groups of two frames of images, where the similarity labels are used to indicate whether each two frames of images are similar or not.

[0184] Among them, the image similarity model is trained using a second video data set marked with similarity labels; the second video data set is obtained by marking similarity labels for multiple groups of two-frame images in the first video data set; the first video data set includes multiple videos of preset length; wherein the videos of preset length include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously; the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or dissimilar.

[0185] It is understandable that in conventional technology, the similarity between images is compared at the pixel level, that is, the pixels in the image are used for comparison. However, the embodiment of the present application uses a plurality of preset similarity parameter comparison results representing image features, such as real number comparison results, which greatly reduces the amount of calculation in the image recognition process and improves the efficiency of image recognition.

[0186] The above introduces the image similarity model training stage and the image similarity model use stage. The following will introduce how to use the image similarity model in the video capture scenario.

[0187] Mobile phones generally have photo and video recording functions. More and more people use mobile phones to take photos and videos to record every bit of life. Among them, some wonderful pictures may be collected during the process of recording videos (i.e., recording). During the process of recording with a mobile phone, the user may hope that the mobile phone can capture the above-mentioned wonderful pictures and save them as photos to show to the user. If the mobile phone captures multiple photos continuously and the similarity of these photos is high, redundant captures will be generated, and the user experience will be poor.

[0188] In order to solve this problem, a method for capturing images is introduced below. If there are multiple similar frames in the captured image, some images (such as one frame of image) are selected from the similar multiple frames as the target image, and the target image is saved to obtain the target photo, so as to automatically delete redundant pictures when capturing, thereby improving the user experience.

[0189] Specifically, the embodiment of the present application provides a method for capturing an image in a video recording, which can be applied to a camera device (such as a mobile phone 400), wherein the camera device includes a camera. For the image similarity model obtained by using the training samples annotated with similarity labels, Fig.11 FIG. 2 shows a flow chart of a method for capturing an image in a video. Fig.11 As shown, the method may include steps 1101 to 1103.

[0190] Step 1101: the mobile phone 400 receives a first operation from a user, where the first operation is used to trigger the mobile phone 400 to start recording a video.

[0191] For example, Fig.12 A schematic diagram of a camera interface is shown. Fig.12 As shown, the mobile phone 400 can display Fig.12 The video framing interface 201 shown in FIG. (a) is a framing interface before the mobile phone 400 starts recording. The video framing interface 201 includes a "start recording" button 202. The first operation may be a user clicking the "start recording" button 202 to trigger the mobile phone 400 to start recording a video.

[0192] Step 1102: In response to the first operation, the camera of the mobile phone 400 captures the first image, and the mobile phone 400 displays the first interface. The first interface is a viewfinder interface of the mobile phone 400 recording a video, and the first interface includes a preview image obtained from the first image, and the preview image is used to generate a video. The first interface also includes a snapshot shutter, and the snapshot shutter is used to trigger the mobile phone 400 to capture an image to obtain a photo.

[0193] For example, Fig.12 As shown in FIG. 2( a ), the first operation is a user clicking the “start recording” button 202 as an example. In response to the user clicking the “start recording” button 202, the camera of the mobile phone 400 may start to collect an image (i.e., the first image), and the display screen of the mobile phone 400 may display Fig.12 The first interface 203 shown in FIG. (b) is a viewfinder interface of the mobile phone 400 when recording a video. Fig.12 As shown in FIG. 2( b ), the first interface 203 includes a preview image 204 obtained from the first image.

[0194] It should be emphasized that if Fig.12 As shown in Figure (b), the first interface 203 also includes a snapshot shutter 205. The snapshot shutter 205 is used to trigger the mobile phone 400 to capture images and obtain photos. Specifically, the snapshot shutter 205 is used to trigger the mobile phone 400 to capture images and obtain photos during the video recording process. It is conceivable that some wonderful pictures may be collected during the process of the mobile phone 400 recording a video (i.e., recording a video). During the process of the mobile phone 400 recording a video, the user may hope that the mobile phone 400 can capture the above-mentioned wonderful pictures and save them as photos to show to the user. In the embodiment of the present application, the user clicks the above-mentioned snapshot shutter 205 to realize the function of capturing wonderful pictures during the video recording process.

[0195] In order to ensure that the mobile phone 400 responds to the user's capture operation (such as the user's click operation on the capture shutter 205), the image actually required by the user can be captured.

[0196] Step 1103: The mobile phone 400 receives a capture operation, captures multiple frames of images, and uses an image similarity model to determine similarity labels between every two frames of images in the multiple frames of images. If there are similar images in the multiple frames of images, a target photo is generated based on the similar images; the similarity label is used to indicate whether every two frames of images are similar or dissimilar.

[0197] Exemplarily, the mobile phone 400 determines that the snapshot operation is received in response to the user's second operation on the snapshot shutter. The second operation may be a single click operation of the user on the snapshot shutter. For example, the second operation may be a single click operation of the user on the snapshot shutter. Fig.12 The second operation may be a single click operation of the snapshot shutter as shown in FIG. (b). Alternatively, the second operation may be a continuous click operation of the snapshot shutter by the user. Each single click operation of the snapshot shutter is used to trigger the mobile phone 400 to perform a snapshot operation, that is, the single click operation of the snapshot shutter is used to trigger the mobile phone 400 to capture a photo. The continuous click operation of the snapshot shutter is used to trigger the mobile phone 400 to capture multiple photos.

[0198] Continuous clicks on the snapshot shutter can be used to trigger the mobile phone 400 to capture multiple photos, and if the photos are highly similar, redundant snapshots will occur, resulting in a poor user experience. In order to solve this problem, the mobile phone 400 can use an image similarity model to identify the similarity between two adjacent frames of captured images, obtain multiple frames of captured images, use an image similarity model to identify the similarity between two adjacent frames of captured images, select a portion of the image (for example, one frame of image) from the similar multiple frames of images as the target image, save the target image to obtain the target photo. Taking the capture of two frames of images as an example, if the two adjacent frames of captured images are similar, select any one frame of image from the similar images as the target image, and save the target image. For example, Fig.13FIG. 1 shows a schematic diagram of continuously shooting two similar pictures. Fig.13 As shown, the captured photo 1102A is similar to the captured photo 1102. After determining that the captured photo 1102A is similar to the captured photo 1102, the mobile phone 400 can only save any one of the captured photo 1102A and the captured photo 1102, such as the captured photo 1102.

[0199] Exemplarily, in response to a user's Fig.12 In the continuous click operation (i.e., the second operation) of the snapshot shutter shown in FIG. (b), the mobile phone 400 can generate and save the snapshot photo. However, the user cannot view the snapshot photo during the recording process of the mobile phone 400. The user can view the snapshot photo in the album after the recording is completed.

[0200] For example, the mobile phone 400 responds to the user's Fig.12 Clicking the "End Recording" button 206 shown in FIG. (b) can display Fig.14 The video framing interface 1001 is shown. The video framing interface 1001 is the framing interface for the mobile phone 400 to end the video. Fig.12 Compared with the video viewfinder interface 201 shown in FIG. (a), the photos in the photo option in the viewfinder interface of the mobile phone 400 are Fig.12 The 208 shown in Figure (a) is updated to Fig.14 1002 shown.

[0201] The mobile phone 400 may display the photo album application in response to the user's start operation. Fig.15 The album list interface 1101 shown includes multiple photos and videos stored in the mobile phone 400. For example, Fig.15 As shown, the album list interface 1101 includes a video 1103 recorded by the mobile phone 400 , and photos 1102 captured by the mobile phone 400 during the process of recording the video 1103 .

[0202] It can be understood that in addition to the snapshots in the video, continuous clicks in the photo mode can also be considered as snapshots, and continuous clicks in the photo mode can also use the above steps to obtain multiple frames of snapshot images, use the image similarity model to identify the similarity between two adjacent frames of snapshot images, select part of the image (for example, one frame of image) from the similar multiple frames of images as the target image, and save the target image to obtain the target photo.

[0203] It is understood that the camera application in the mobile phone 400 may include a snapshot function. When the mobile phone 400 turns on the snapshot function, the mobile phone 400 may periodically capture images. The duration and frequency of the captured images may be set in the settings of the camera application. It may also be determined by clicking the capture start button and the capture end button corresponding to the capture function.

[0204] For example, Fig.16 As shown, the viewfinder interface 201 in the mobile phone 400 includes a snapshot mode E option. In the snapshot mode E, in response to the user's Fig.16 The mobile phone 400 starts to periodically capture photos by performing a single click operation of the snapshot shutter as shown in FIG. (a) (i.e., the second operation). Fig.16 As shown in FIG. (b) of FIG. 1 , the mobile phone 400 responds to the user's Fig.16 Clicking the "End Snapshot" button G shown in Figure (b) can display Fig.16 The captured viewfinder interface 1001 shown in FIG. (c) is a viewfinder interface when the mobile phone 400 finishes capturing the captured image.

[0205] It can be understood that during the drone shooting process, if the capture mode is turned on for the drone and the capture cycle and capture duration in the capture mode are set, the capture scheme is the same as the above scheme and will not be repeated here.

[0206] For the image similarity model obtained by using the training samples of the comparison results of multiple preset similarity parameters corresponding to multiple groups of two frames of images, Fig.17 FIG. 2 shows a flow chart of another method for capturing an image. Fig.17 As shown, the method may include steps 1701 to 1703.

[0207] Step 1701: The mobile phone 400 receives a capture operation, where the capture operation is used to trigger an electronic device to capture an image to obtain a photo.

[0208] Step 1702: The mobile phone 400 captures multiple frames of images in response to the capture operation.

[0209] The technical solution of steps 1701 to 1702 is the same as the technical solution of the aforementioned step 1101 and will not be repeated here.

[0210] Step 1703: the mobile phone 400 determines preset semantic information of each image in the multiple frames of images, where the preset semantic information includes a plurality of preset similarity parameter information.

[0211] The method for determining the preset semantic information of each image in this step is the same as the above-mentioned solution, which will not be repeated here.

[0212] Step 1704: the mobile phone 400 calculates similarity feature values ​​for multiple preset similarity parameter information of multiple groups of two frames of images in the multiple frames of images, and obtains multiple preset similarity parameter comparison results corresponding to the multiple groups of two frames of images in the multiple frames of images.

[0213] The method for determining the preset similarity parameter comparison result in this step is the same as the above-mentioned scheme, and will not be repeated here.

[0214] Step 1705: The mobile phone 400 inputs the comparison results of multiple preset similarity parameters corresponding to the multiple groups of two-frame images into the image similarity model to obtain similarity labels of the multiple groups of two-frame images. If there are similar images in the multiple groups of two-frame images, a target photo is generated based on the similar images in the multiple groups of two-frame images; wherein the similarity label is used to indicate whether each two frames of images are similar or dissimilar.

[0215] The method for determining the target photo in this step 1705 is the same as the technical solution of step 1103, and will not be repeated here.

[0216] The technical solutions in this step 1705 except for the method of determining the target photo have been described in the previous text and will not be repeated here.

[0217] Some other embodiments of the present application provide an electronic device, which may include: the above-mentioned display screen, camera, memory and one or more processors. The display screen, camera, memory and processor are coupled. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can execute the various functions or steps executed by the mobile phone in the above-mentioned method embodiment. The structure of the electronic device can refer to the structure of the mobile phone 200.

[0218] The present application also provides a server, which may include: a memory and one or more processors. The memory is coupled to the processor. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the server may execute the various functions or steps executed by the server in the above method embodiment.

[0219] The embodiment of the present application also provides a chip system, Fig.18 A schematic diagram of the structure of a chip system is shown. Fig.18As shown, the chip system 1400 includes at least one processor 1401 and at least one interface circuit 1402. The processor 1401 and the interface circuit 1402 can be interconnected via lines. For example, the interface circuit 1402 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 1402 can be used to send signals to other devices (such as processor 1401). Exemplarily, the interface circuit 1402 can read instructions stored in the memory and send the instructions to the processor 1401. When the instructions are executed by the processor 1401, the electronic device or server can perform the various steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0220] This embodiment also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device or the server executes each function or step in the above method embodiment.

[0221] This embodiment also provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute each function or step in the above method embodiment.

[0222] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes each function or step performed by the mobile phone in the above method embodiment.

[0223] Among them, the electronic device, communication system, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.

[0224] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0225] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0226] The unit described as a separate component may or may not be physically separated, and the component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.

[0227] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0228] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0229] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.

Claims

1. A training method for an image similarity model, It is characterized in that include: Acquire a first video data set, the first video data set including a plurality of videos of a preset duration; wherein the videos of the preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously; Labeling similarity labels for multiple groups of two-frame images in the first video data set to obtain a second video data set labeled with similarity labels; wherein the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or not; An image similarity model is trained based on comparison results of multiple preset similarity parameters corresponding to multiple groups of two-frame images in the second video data set annotated with similarity tags and the first video data set; wherein the image similarity model is used to identify the similarity between images; the comparison results of multiple preset similarity parameters corresponding to the multiple groups of two-frame images are obtained by calculating similarity feature values ​​of multiple preset similarity parameter information of the multiple groups of two-frame images; the preset similarity parameters include any one or more of the number of target objects, surface properties of the target objects, the type of scene in which the target objects are located, image clarity, image composition score, and image mean hash.

2. The method according to claim 1, It is characterized in that The preset duration is less than the time threshold.

3. The method according to claim 1 or 2, It is characterized in that The number M corresponding to the M frames of image is obtained by the following formula: M = f*n; Wherein, f represents the frame rate of the video of the preset duration, n represents the preset duration, and * represents a multiplication operation.

4. The method according to claim 1, It is characterized in that The training of the image similarity model based on the comparison results of multiple preset similarity parameters corresponding to multiple groups of two-frame images in the second video data set annotated with similarity tags and the first video data set includes: Using the comparison results of multiple preset similarity parameters corresponding to multiple groups of two-frame images in the first video data set as input samples and the similarity labels in the second video data set as output samples, training the image similarity model; wherein the comparison results of multiple preset similarity parameters corresponding to multiple groups of two-frame images in the input samples and the similarity labels in the output samples correspond one to one; Wherein, during the training process, the model parameters of the image similarity model are adjusted based on the error between the actual output of the image similarity model and the output sample.

5. The method according to any one of claims 1, 2 or 4, It is characterized in that The number of target objects includes at least one of the number of human bodies, the number of animals, and the number of human faces; the surface attributes of the target objects include at least one of whether the person is smiling, whether the person is a child, and whether the person has open eyes.

6. The method according to claim 5, It is characterized in that The multiple preset similarity parameter comparison results corresponding to the multiple groups of two-frame images in the first video data set include: any one or more of the difference results of the preset similarity parameter information of the multiple groups of two-frame images, the comparison results of whether they are equal, and the calculation results of the Hamming distance.

7. The method according to any one of claims 1, 2 or 4, It is characterized in that The method further comprises: Receiving a capture operation, wherein the capture operation is used to trigger an electronic device to capture an image to obtain a photo; In response to a capture operation, capturing multiple frames of images; Determining preset semantic information of each image in the multiple frames of images, wherein the preset semantic information includes a plurality of preset similarity parameter information; Performing similarity feature value calculation on the plurality of preset similarity parameter information of the plurality of groups of two frames of images in the plurality of frames of images to obtain a plurality of preset similarity parameter comparison results corresponding to the plurality of groups of two frames of images in the plurality of frames of images; Inputting comparison results of a plurality of preset similarity parameters corresponding to a plurality of groups of two frames of images into the image similarity model to obtain similarity labels of the plurality of groups of two frames of images, wherein the similarity labels are used to indicate whether each two frames of images are similar or dissimilar; If there are similar images in the multiple groups of two-frame images, a target photo is generated based on the similar images in the multiple groups of two-frame images.

8. The method according to any one of claims 1, 2 or 4, It is characterized in that The image similarity model includes a decision tree.

9. The method according to any one of claims 1, 2 or 4, It is characterized in that The obtaining of the first video data set includes: A first video data set is received from at least one first electronic device.

10. The method according to any one of claims 1, 2 or 4, It is characterized in that After training the image similarity model based on the comparison results of the plurality of preset similarity parameters corresponding to the plurality of groups of two-frame images in the second video data set annotated with similarity tags and the first video data set, the method further includes: The trained image similarity model is sent to at least one second electronic device.

11. A training method for an image similarity model, It is characterized in that include: The first electronic device acquires a first video data set, and sends the first video data set to a server, wherein the first video data set includes a plurality of videos of preset duration; wherein the videos of preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously; The server receives the first video data set, and annotates similarity labels for multiple groups of two frames of images in the first video data set to obtain a second video data set annotated with similarity labels; wherein the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or dissimilar; An image similarity model is trained based on comparison results of multiple preset similarity parameters corresponding to multiple groups of two-frame images in the second video data set annotated with similarity tags and the first video data set; wherein the image similarity model is used to identify the similarity between images; the comparison results of multiple preset similarity parameters corresponding to the multiple groups of two-frame images are obtained by calculating similarity feature values ​​of multiple preset similarity parameter information of the multiple groups of two-frame images; the preset similarity parameters include any one or more of the number of target objects, surface properties of the target objects, the type of scene in which the target objects are located, image clarity, image composition score, and image mean hash.

12. An image processing method, It is characterized in that include: Acquire a first image and a second image; Determining preset semantic information of the first image and the second image, the preset semantic information comprising a plurality of preset similarity parameter information; The preset similarity parameters include any one or more of the number of target objects, surface properties of the target objects, the type of scene where the target objects are located, image clarity, image composition score, and mean hash of the image; Performing similarity feature value calculation on the plurality of preset similarity parameter information of the first image and the second image to obtain a plurality of preset similarity parameter comparison results of the first image and the second image; Inputting comparison results of a plurality of preset similarity parameters of the first image and the second image into an image similarity model to determine similarity labels of a plurality of groups of two frames of images, wherein the similarity labels are used to indicate whether each two frames of images are similar or dissimilar; Among them, the image similarity model is trained by comparing multiple preset similarity parameters corresponding to multiple groups of two-frame images in a second video data set marked with similarity labels and a first video data set; the second video data set is obtained by marking similarity labels for multiple groups of two-frame images in the first video data set; the first video data set includes multiple videos of preset duration; wherein the videos of preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously; the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or dissimilar.

13. A method for capturing an image, It is characterized in that include: Receiving a capture operation, wherein the capture operation is used to trigger an electronic device to capture an image to obtain a photo; In response to a capture operation, capturing multiple frames of images; Determine the similarity label of each two frames of the multiple frames of images by using an image similarity model, wherein the similarity label is used to indicate whether each two frames of images are similar or not; wherein the image similarity model is trained by using a comparison result of a plurality of preset similarity parameters corresponding to a second video data set annotated with similarity labels and a plurality of groups of two frames of images in the first video data set; the second video data set is obtained by annotating similarity labels for a plurality of groups of two frames of images in the first video data set; the first video data set includes a plurality of videos of a preset duration; wherein the videos of the preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are a plurality of frames of images taken continuously; the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or not; the comparison results of the plurality of preset similarity parameters corresponding to the plurality of groups of two frames of images are obtained by calculating similarity feature values ​​of the plurality of preset similarity parameter information of the plurality of groups of two frames of images; the preset similarity parameters include any one or more of the number of target objects, the surface attributes of the target objects, the scene type where the target objects are located, the clarity of the image, the composition score of the image, and the mean hash of the image; If similar images exist in the multiple frames of images, a target photo is generated based on the similar images.

14. A method for capturing an image, It is characterized in that include: Receiving a capture operation, wherein the capture operation is used to trigger an electronic device to capture an image to obtain a photo; In response to a capture operation, capturing multiple frames of images; Determining preset semantic information of each image in the multiple frames of images, wherein the preset semantic information includes a plurality of preset similarity parameter information; Performing similarity feature value calculation on the plurality of preset similarity parameter information of the plurality of groups of two frames of images in the plurality of frames of images, and obtaining a plurality of preset similarity parameter comparison results corresponding to the plurality of groups of two frames of images in the plurality of frames of images; the preset similarity parameters include any one or more of the number of target objects, surface properties of the target objects, the type of scene where the target objects are located, image clarity, image composition score, and image mean hash; Inputting the comparison results of multiple preset similarity parameters corresponding to multiple groups of two-frame images into an image similarity model to obtain similarity labels of the multiple groups of two-frame images, wherein the similarity labels are used to indicate whether each two-frame image is similar or not; wherein the image similarity model is trained by using the comparison results of multiple preset similarity parameters corresponding to multiple groups of two-frame images in a second video data set annotated with similarity labels and a first video data set; the second video data set is obtained by annotating similarity labels for multiple groups of two-frame images in the first video data set; the first video data set includes multiple videos of preset duration; wherein the videos of preset duration include N groups of images, each group of images includes M frames of images, and the M frames of images are multiple frames of images taken continuously; the similarity labels of any two frames of images in the M frames of images in each group of images in the first video data set indicate whether the corresponding two frames of images are similar or not; If there are similar images in the multiple groups of two-frame images, a target photo is generated based on the similar images in the multiple groups of two-frame images.

15. A server, It is characterized in that include: A memory and one or more processors, the memory being coupled to the processor; wherein the memory stores computer program code, the computer program code comprising computer instructions, and when the computer instructions are executed by the processor, the server executes the method as described in any one of claims 1-10 and 11.

16. An electronic device, It is characterized in that include: A memory and one or more processors, wherein the memory is coupled to the processor; wherein the memory stores computer program code, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 12-14.

17. A computer-readable storage medium, It is characterized in that It comprises computer instructions, which, when executed on a server, cause the server to execute the method as described in any one of claims 1-10 and 11; or, when executed on an electronic device, cause the electronic device to execute the method as described in any one of claims 12-14.