Image comparison method, device, electronic device, and computer-readable storage medium

By processing and comparing the pixel matrix of the advertising image, the problem of increasing the workload of advertising image comparison and testing in the prior art is solved, faster and more accurate image comparison is achieved, and the quality of advertising delivery is improved.

CN113159206BActive Publication Date: 2025-02-28BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110469167.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-28
Publication Date
2025-02-28
Estimated Expiration
2041-04-28

AI Technical Summary

Technical Problem

In the comparison test of advertising image delivery effect, the workload of comparison test increases significantly with the continuous enrichment of key elements in advertising images, which is difficult to effectively solve and affects the quality of advertising delivery.

Method used

By obtaining the pixel matrix of the reference image and the image to be tested, their eigenvalues ​​are determined respectively, and the eigenvalues ​​are compared to obtain similarity, so that the image comparison test is quickly completed. The specific steps include building a random number matrix for dimensionality reduction processing, decomposing the matrix to obtain eigenvalues, and obtaining the image comparison results through eigenvalue comparison.

Benefits of technology

This method significantly reduces data processing volume, saves time and cost, improves image alignment efficiency, avoids pixel loss and noise problems, and improves alignment accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The present disclosure relates to an image comparison method, device, electronic device, and computer-readable storage medium. The method includes: obtaining a first pixel matrix of a reference image and a second pixel matrix of a test image; determining a first eigenvalue corresponding to the first pixel matrix and a second eigenvalue corresponding to the second pixel matrix; comparing the first eigenvalue and the second eigenvalue to obtain a similarity; and determining a comparison result between the test image and the reference image based on the similarity. According to the scheme of the present disclosure, the amount of data processing is reduced by directly processing the pixel matrix; by comparing the eigenvalues ​​of the images to determine whether the images match, the efficiency of image comparison is greatly improved because there is no need to reconstruct the images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to an image comparison method, device, electronic device, computer-readable storage medium, and computer program product. Background Art

[0002] In the advertising effect test, such as static splash screen advertising, the comparative test of the advertising image delivery effect is involved. The comparative test can be achieved by comparing some relevant elements between the expected advertising image and the actual advertising image.

[0003] In the related art, the eigenvalue decomposition method can be used to perform image comparison test. The eigenvalue decomposition method decomposes the entire image of the actual advertising image to obtain the corresponding eigenvalue and eigenvalue vector. Then, the image is reconstructed using the eigenvalues ​​with a higher contribution rate to remove the influence of irrelevant factors and obtain a reconstructed image. By comparing the similarity between the reconstructed image and the expected advertising image, a comparison test of the advertising image delivery effect can be achieved.

[0004] However, as the key elements in advertising images continue to increase, the workload of comparative testing has increased exponentially, making the quality of advertising delivery face great challenges. Therefore, there is an urgent need for an image comparison method that can perform image comparative testing faster. Summary of the invention

[0005] The present disclosure provides an image comparison method, device, electronic device, computer-readable storage medium, and computer program product to provide an image comparison method capable of performing image comparison test faster. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, there is provided an image comparison method, comprising:

[0007] Acquire a first pixel matrix of a reference image and a second pixel matrix of an image to be tested;

[0008] Determine a first eigenvalue corresponding to the first pixel matrix and a second eigenvalue corresponding to the second pixel matrix;

[0009] Comparing the first eigenvalue and the second eigenvalue to obtain a similarity;

[0010] A comparison result between the image to be tested and the reference image is determined according to the similarity.

[0011] In one embodiment, determining a second eigenvalue corresponding to the second pixel matrix includes:

[0012] Constructing a random number matrix conforming to a normal distribution, wherein the number of rows of the random number matrix is ​​greater than the target number of eigenvalues ​​in the first eigenvalues ​​and is less than or equal to the difference between the number of rows of the second pixel matrix and the target number, and the number of columns of the random number matrix is ​​the same as the number of rows of the second pixel matrix;

[0013] Performing dimensionality reduction processing on the second pixel matrix according to the random number matrix to obtain a target matrix, wherein the number of rows of the target matrix is ​​the same as the number of rows of the second pixel matrix, and the number of columns of the target matrix is ​​the same as the target number;

[0014] Performing matrix decomposition on the target matrix to obtain the second eigenvalues, wherein the number of eigenvalues ​​in the second eigenvalues ​​is the same as the target number.

[0015] In one embodiment, performing dimensionality reduction processing on the second pixel matrix according to the random number matrix to obtain a target matrix includes:

[0016] Determine a first intermediate matrix according to the random number matrix and the second pixel matrix, wherein the number of rows of the first intermediate matrix is ​​the same as the number of rows of the random number matrix, and the number of columns of the first intermediate matrix is ​​the same as the number of columns of the second pixel matrix;

[0017] Obtaining a conjugate transposed matrix of the first intermediate matrix, and performing matrix decomposition on the conjugate transposed matrix to obtain a second intermediate matrix, wherein the number of rows of the second intermediate matrix is ​​the same as the number of columns of the second pixel matrix, and the number of columns of the second intermediate matrix is ​​the same as the number of rows of the random number matrix;

[0018] A matrix of a previous target number of columns is obtained from the second intermediate matrix, and a product of the second pixel matrix and the matrix of the previous target number of columns is obtained as the target matrix.

[0019] In one embodiment, determining a first intermediate matrix according to the random number matrix and the second pixel matrix includes:

[0020] The first intermediate matrix is ​​obtained by the following formula:

[0021]

[0022] Among them, P (l×n) Represents the first intermediate matrix, R (l×m) represents the random number matrix, H (m×n) represents the second pixel matrix, represents the conjugate transposed matrix of the second pixel matrix, l represents the number of rows of the random number matrix, n represents the number of columns of the second pixel matrix, m represents the number of rows of the second pixel matrix, and j represents a preset adjustment parameter.

[0023] In one embodiment, determining a first eigenvalue corresponding to the first pixel matrix includes:

[0024] Performing matrix decomposition on the first pixel matrix to obtain a plurality of original eigenvalues;

[0025] Get the weight coefficient corresponding to each original eigenvalue;

[0026] The first i original eigenvalues ​​when the cumulative contribution rate reaches a threshold are obtained, the first i original eigenvalues ​​are used as the first eigenvalue, the cumulative contribution rate is the ratio of the first weighted sum to the second weighted sum, the first weighted sum is the weighted sum of the first i original eigenvalues ​​and the corresponding weight coefficients, the second weighted sum is the weighted sum of the multiple original eigenvalues ​​and the corresponding weight coefficients, and i is a positive integer.

[0027] In one embodiment, obtaining the weight coefficient corresponding to each original eigenvalue includes:

[0028] The weight coefficient corresponding to each original eigenvalue is obtained by the following formula:

[0029]

[0030] Among them, γ i represents the weight coefficient corresponding to the i-th original eigenvalue, k represents the number of original eigenvalues ​​when the cumulative contribution rate reaches the threshold, N represents the total number of original eigenvalues, and λ i represents the i-th original eigenvalue, and e represents a natural constant.

[0031] In one embodiment, comparing the first feature value and the second feature value to obtain the similarity includes:

[0032] generating a first vector according to the first eigenvalue, and generating a second vector according to the second eigenvalue;

[0033] A mutual correlation value between the first vector and the second vector is obtained as the similarity.

[0034] According to a second aspect of an embodiment of the present disclosure, there is provided an image comparison device, comprising:

[0035] An acquisition module, configured to acquire a first pixel matrix of a reference image and a second pixel matrix of an image to be tested;

[0036] A first eigenvalue generating module is configured to determine a first eigenvalue corresponding to the first pixel matrix;

[0037] A second eigenvalue generating module is configured to determine a second eigenvalue corresponding to the second pixel matrix;

[0038] A comparison module, configured to compare the first feature value and the second feature value to obtain a similarity;

[0039] The result generating module is configured to determine the comparison result between the image to be tested and the reference image according to the similarity.

[0040] In one embodiment, the second eigenvalue generating module includes:

[0041] a matrix generation unit, configured to construct a random number matrix conforming to a normal distribution, wherein the number of rows of the random number matrix is ​​greater than the target number of eigenvalues ​​in the first eigenvalues ​​and is less than or equal to the difference between the number of rows of the second pixel matrix and the target number, and the number of columns of the random number matrix is ​​the same as the number of rows of the second pixel matrix;

[0042] a dimensionality reduction unit, configured to perform dimensionality reduction processing on the second pixel matrix according to the random number matrix to obtain a target matrix, wherein the number of rows of the target matrix is ​​the same as the number of rows of the second pixel matrix, and the number of columns of the target matrix is ​​the same as the target number;

[0043] The first matrix decomposition unit is configured to perform matrix decomposition on the target matrix to obtain the second eigenvalues, wherein the number of eigenvalues ​​in the second eigenvalues ​​is the same as the target number.

[0044] In one embodiment, the dimension reduction unit comprises:

[0045] an intermediate matrix generating subunit, configured to determine a first intermediate matrix according to the random number matrix and the second pixel matrix, wherein the number of rows of the first intermediate matrix is ​​the same as the number of rows of the random number matrix, and the number of columns of the first intermediate matrix is ​​the same as the number of columns of the second pixel matrix;

[0046] a matrix decomposition subunit, configured to obtain a conjugate transposed matrix of the first intermediate matrix, and perform matrix decomposition on the conjugate transposed matrix to obtain a second intermediate matrix, wherein the number of rows of the second intermediate matrix is ​​the same as the number of columns of the second pixel matrix, and the number of columns of the second intermediate matrix is ​​the same as the number of rows of the random number matrix;

[0047] The target matrix generation subunit is configured to obtain a matrix of a previous target number of columns from the second intermediate matrix, and obtain the product of the second pixel matrix and the matrix of the previous target number of columns as the target matrix.

[0048] In one embodiment, the intermediate matrix generating subunit is configured to obtain the first intermediate matrix by executing the following formula:

[0049]

[0050] Among them, P (l×n) Represents the first intermediate matrix, R (l×m) represents the random number matrix, H (m×n) represents the second pixel matrix, represents the conjugate transposed matrix of the second pixel matrix, l represents the number of rows of the random number matrix, n represents the number of columns of the second pixel matrix, m represents the number of rows of the second pixel matrix, and j represents a preset adjustment parameter.

[0051] In one embodiment, the first feature value generating module includes:

[0052] A second matrix decomposition unit is configured to perform matrix decomposition on the first pixel matrix to obtain a plurality of original eigenvalues;

[0053] A weight coefficient acquisition unit is configured to acquire a weight coefficient corresponding to each original eigenvalue;

[0054] The first eigenvalue generation is configured to execute acquisition of the first i original eigenvalues ​​when the cumulative contribution rate reaches a threshold value, the first i original eigenvalues ​​are used as the first eigenvalue, the cumulative contribution rate is the ratio of the first weighted sum to the second weighted sum, the first weighted sum is the weighted sum of the first i original eigenvalues ​​and the corresponding weight coefficients, the second weighted sum is the weighted sum of the multiple original eigenvalues ​​and the corresponding weight coefficients, and i is a positive integer.

[0055] In one embodiment, the weight coefficient acquisition unit is configured to obtain the weight coefficient corresponding to each original eigenvalue by executing the following formula:

[0056]

[0057] Among them, γ i represents the weight coefficient corresponding to the i-th original eigenvalue, k represents the number of original eigenvalues ​​when the cumulative contribution rate reaches the threshold, N represents the total number of original eigenvalues, and λ i represents the i-th original eigenvalue, and e represents a natural constant.

[0058] In one embodiment, the comparison module includes:

[0059] a vector generating unit, configured to generate a first vector according to the first eigenvalue, and generate a second vector according to the second eigenvalue;

[0060] The similarity determination unit is configured to obtain a mutual correlation value between the first vector and the second vector as the similarity.

[0061] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0062] processor;

[0063] a memory for storing instructions executable by the processor;

[0064] Wherein, the processor is configured to execute the instructions to implement the image comparison method described in any one of the first aspects above.

[0065] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the image comparison method described in any one of the first aspects above.

[0066] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the image comparison method described in any one of the first aspects is implemented.

[0067] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0068] By processing the first pixel matrix of the reference image and the second pixel matrix of the image to be tested, the amount of data processing is reduced compared to eigenvalue decomposition of the entire image, thereby saving a lot of time cost; by processing the first pixel matrix and the second pixel matrix respectively to obtain the corresponding first eigenvalue and second eigenvalue, and comparing the first eigenvalue and the second eigenvalue to obtain the similarity, the comparison result of the reference image and the image to be tested is obtained according to the similarity. Compared with the traditional eigenvalue decomposition method, on the one hand, since there is no need to reconstruct the image, the efficiency of image comparison is greatly improved; on the other hand, the eigenvalue comparison method will not cause problems such as pixel loss and noise in the image, and therefore, it also helps to improve the accuracy of image comparison.

[0069] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0071] Figure 1 The figure is a diagram showing an application environment of an image comparison method according to an exemplary embodiment.

[0072] Figure 2 The figure is a flow chart of an image comparison method according to an exemplary embodiment.

[0073] Figure 3 The figure is a flowchart showing a step of obtaining a second eigenvalue according to an exemplary embodiment.

[0074] Figure 4 The figure is a flowchart showing steps of processing a second pixel matrix according to an exemplary embodiment.

[0075] Figure 5 The figure is a flowchart showing a step of obtaining a first eigenvalue according to an exemplary embodiment.

[0076] Figure 6 The figure is a flow chart of an image comparison method according to an exemplary embodiment.

[0077] Figure 7 The figure is a block diagram of an image comparison device according to an exemplary embodiment.

[0078] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment.

[0079] Fig. 9 is a block diagram of another electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0080] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0081] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0082] The image comparison method provided in the present disclosure can be applied to Figure 1In the electronic device 110 shown. The electronic device 110 can be any one of a terminal and a server. Among them, the terminal can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers. The electronic device 110 is deployed with a first eigenvalue generation logic, a second eigenvalue generation logic and an eigenvalue comparison logic. The first eigenvalue generation logic and the second eigenvalue generation logic can be the same logic. Specifically, after obtaining the reference image and the image to be tested, the electronic device 110 obtains the first pixel matrix of the reference image and the second pixel matrix of the image to be tested. The first pixel matrix is ​​processed by the first eigenvalue generation logic to obtain the corresponding first eigenvalue; the second pixel matrix is ​​processed by the second eigenvalue generation logic to obtain the corresponding second eigenvalue. The similarity between the first eigenvalue and the second eigenvalue is obtained by the eigenvalue comparison logic, and the comparison result of the reference image and the image to be tested is obtained according to the similarity.

[0083] Figure 2 is a flow chart of an image comparison method according to an exemplary embodiment. Figure 2 As shown, the image comparison method is used in the electronic device 110, and includes the following steps.

[0084] In step S210, a first pixel matrix of a reference image and a second pixel matrix of an image to be tested are obtained.

[0085] The reference image may be an image that has not been processed. The image to be tested may be an image that is processed from the reference image and is actually used in the application, for example, an image that is actually displayed on the opening page of the application. A mapping relationship between the image to be tested and the reference image may be established and stored in advance, so that the electronic device can automatically search for the corresponding reference image according to the image to be tested.

[0086] The reference image and the image to be tested may be a single static image; or an image located in the same frame obtained from the reference video and the video to be tested, for example, any frame in the video, a key frame in the video, etc. Among them, the key frame may be any frame in a key segment of the video, for example, any frame in a segment where a person's voice exists in the video, a segment where a person appears, etc.; or a specified frame in the video, such as the first frame. The reference image and the image to be tested may be pre-stored in a local database of the terminal; or may be stored in a server.

[0087] The pixel matrix is ​​a matrix representation of an image. The rows of the pixel matrix correspond to the height of the image (in pixels), the columns correspond to the width of the image (in pixels), and the elements of the pixel matrix correspond to the pixel values ​​of the pixels.

[0088] Specifically, the request to test the image to be tested can be manually triggered on demand by the background tester, for example, the background tester manually triggers the test request on his own computer; it can also be triggered by the electronic device itself, for example, after the server obtains the login instruction of the client, it triggers the test request for the splash screen advertising page by itself. In response to the test request, the electronic device obtains the image to be tested and the reference image corresponding to the image to be tested. For example, the splash screen advertising page is screenshoted to obtain the image to be tested. The version information of the client is obtained, and the pre-stored reference image corresponding to the version information is queried from the database. After obtaining the image to be tested and the reference image corresponding to the image to be tested, the client obtains the first pixel matrix of the reference image and the second pixel matrix of the image to be tested.

[0089] In step S220, a first eigenvalue corresponding to the first pixel matrix and a second eigenvalue corresponding to the second pixel matrix are determined.

[0090] The eigenvalue is used to indicate the importance of the feature. The first eigenvalue and the second eigenvalue may include one or more eigenvalues.

[0091] Specifically, after obtaining the first pixel matrix and the second pixel matrix, the electronic device processes the first pixel matrix through the first eigenvalue generation logic to obtain the first eigenvalue. The second pixel matrix is ​​processed through the second eigenvalue generation logic to obtain the second eigenvalue. The first eigenvalue generation logic and the second eigenvalue generation logic can be the same logic or different logic. The first eigenvalue generation logic and / or the second eigenvalue generation logic can be deployed based on the matrix decomposition method. For example, the first pixel matrix is ​​matrix decomposed to obtain multiple first eigenvalues ​​and eigenvectors corresponding to each first eigenvalue. Similarly, the second pixel matrix is ​​matrix decomposed to obtain multiple second eigenvalues ​​and eigenvectors corresponding to each second eigenvalue. Among them, the matrix decomposition method is a method of decomposing a pixel matrix into the product of at least one matrix, which can be but not limited to any one of triangular decomposition, full rank decomposition, QR (orthogonal triangular) decomposition, etc.

[0092] Alternatively, the first eigenvalue generation logic and / or the second eigenvalue generation logic may also be deployed based on a deep learning network. The deep learning network may be implemented using a convolutional neural network. The convolutional neural network includes at least one convolutional layer. The first pixel matrix input is traversed through each convolutional layer to obtain a first eigenvalue. The second pixel matrix input is traversed through each convolutional layer to obtain a second eigenvalue.

[0093] In step S230, the first eigenvalue and the second eigenvalue are compared to obtain a similarity.

[0094] In step S240, a comparison result between the image to be tested and the reference image is determined according to the similarity.

[0095] Specifically, the difference between the first eigenvalue and the second eigenvalue can be used as the similarity by comparing the numerical values ​​of the first eigenvalue and the second eigenvalue. Alternatively, a first vector is generated according to the first eigenvalue, and a second vector is generated according to the second eigenvalue. The mutual correlation value between the first vector and the second vector is calculated as the similarity. After obtaining the similarity, the electronic device can compare the similarity with a preset threshold. If the similarity is greater than the threshold, a comparison result is generated that the image to be tested matches the reference image; if the similarity is not greater than the threshold, a comparison result is generated that the image to be tested does not match the reference image.

[0096] In the above-mentioned image comparison method, by processing the first pixel matrix of the reference image and the second pixel matrix of the image to be tested, the amount of data processing is reduced compared with eigenvalue decomposition of the entire image, thereby saving a lot of time cost; by processing the first pixel matrix and the second pixel matrix respectively to obtain the corresponding first eigenvalue and second eigenvalue, and comparing the first eigenvalue and the second eigenvalue to obtain the similarity, the comparison result of the reference image and the image to be tested is obtained according to the similarity. Compared with the traditional eigenvalue decomposition method, on the one hand, since there is no need to reconstruct the image, the efficiency of image comparison is greatly improved; on the other hand, the use of eigenvalue comparison will not cause problems such as pixel loss and noise in the image, and therefore, it also helps to improve the accuracy of image comparison.

[0097] In an exemplary embodiment, if Figure 3 As shown, in step S220, the first eigenvalue corresponding to the first pixel matrix is ​​determined, which can be specifically implemented through the following steps.

[0098] In step S310, matrix decomposition is performed on the first pixel matrix to obtain a plurality of original eigenvalues.

[0099] Specifically, after obtaining the first pixel matrix, the electronic device can decompose the first pixel matrix by a matrix decomposition method to obtain a first eigenvalue diagonal matrix and a corresponding eigenvector. The diagonal elements of the first eigenvalue diagonal matrix can be non-negative real numbers, and are arranged in order according to the numerical value. The diagonal elements in the first eigenvalue diagonal matrix are obtained as multiple original eigenvalues.

[0100] In step S320, the weight coefficient corresponding to each original eigenvalue is obtained.

[0101] After obtaining multiple original eigenvalues, a corresponding weight coefficient is assigned to each original eigenvalue, wherein the larger the original eigenvalue is, the larger the corresponding weight coefficient is, so that the contribution of important original eigenvalues ​​in all original eigenvalues ​​can be increased. Specifically, the weight coefficient can be obtained by a preset weight function, which is a function used to calculate the weight coefficient corresponding to the eigenvalue, and any function type can be used, such as an exponential function, a polynomial function, etc. Alternatively, the weight coefficient can also be a pre-configured constant value, for example, a correspondence between a weight coefficient and an eigenvalue interval is pre-configured, and the target eigenvalue interval to which each original eigenvalue belongs is determined, and the weight coefficient corresponding to the target eigenvalue interval is queried from the correspondence as the weight coefficient corresponding to each original eigenvalue.

[0102] In step S330, the first i original eigenvalues ​​when the cumulative contribution rate reaches the threshold are obtained, the first i original eigenvalues ​​are used as the first eigenvalue, the cumulative contribution rate is the ratio of the first weighted sum to the second weighted sum, the first weighted sum is the weighted sum of the first i original eigenvalues ​​and the corresponding weight coefficients, the second weighted sum is the weighted sum of multiple original eigenvalues ​​and the corresponding weight coefficients, and i is a positive integer.

[0103] Specifically, after obtaining the weight coefficient corresponding to each original eigenvalue, the current original eigenvalue and the first weighted sum of the original eigenvalues ​​ranked before the current original eigenvalue and their corresponding weight coefficients can be obtained starting from the first original eigenvalue. Also, the second weighted sum of all original eigenvalues ​​and their corresponding weight coefficients is obtained. The ratio of the first weighted sum to the second weighted sum is calculated as the cumulative contribution rate corresponding to the current original eigenvalue. That is, if the current original eigenvalue is the i-th original eigenvalue, the first weighted sum of the first i original eigenvalues ​​and their corresponding weight coefficients is obtained, and the second weighted sum of all original eigenvalues ​​and their corresponding weight coefficients is obtained. The ratio of the first weighted sum to the second weighted sum is obtained as the cumulative contribution rate corresponding to the i-th original eigenvalue, for example, the first weighted sum is used as the numerator and the second weighted sum is used as the denominator to obtain the ratio of the first weighted sum to the second weighted sum. If the cumulative contribution rate corresponding to the i-th original eigenvalue is greater than the threshold, the processing is stopped, and the first i original eigenvalues ​​are used as the first eigenvalue.

[0104] In some possible embodiments, the first pixel matrix of the reference image may be processed in advance to obtain the first eigenvalue. A mapping relationship between the reference image and the first eigenvalue, the number of eigenvalues ​​in the first eigenvalue, and other information is established. When testing the image to be tested, the corresponding first eigenvalue may be directly queried from the corresponding relationship, thereby helping to further speed up the image comparison.

[0105] In this embodiment, by assigning a corresponding weight coefficient to each original eigenvalue and increasing the contribution of important eigenvalues, the number of original eigenvalues ​​ultimately used can be reduced while retaining as much valid information as possible, thereby increasing the speed of image comparison and reducing the resources required for image comparison.

[0106] In an exemplary embodiment, the weight coefficient corresponding to each original eigenvalue can be obtained by a preset weight function. The weight function can adopt an exponential function, which helps to more accurately obtain the weight coefficient corresponding to each original eigenvalue, thereby being more conducive to accurately extracting the first eigenvalue from multiple original eigenvalues. The weight coefficient corresponding to each original eigenvalue can be obtained by the following formula:

[0107]

[0108] Among them, γ i represents the weight coefficient corresponding to the i-th original eigenvalue, k represents the number of original eigenvalues ​​when the cumulative contribution rate reaches the threshold, N represents the total number of original eigenvalues, and λ i represents the ith original eigenvalue. Assume that when i=k, the cumulative contribution rate of the first k original eigenvalues ​​obtained by using the obtained weight coefficient is greater than the threshold, and e represents a natural constant.

[0109] In an exemplary embodiment, if Figure 4 As shown, in step S220, the second eigenvalue corresponding to the second pixel matrix is ​​determined, which can be specifically implemented through the following steps.

[0110] In step S410, a random number matrix conforming to a normal distribution is constructed, the number of rows of the random number matrix is ​​greater than the target number of eigenvalues ​​in the first eigenvalue, and is less than or equal to the difference between the number of rows of the second pixel matrix and the target number, and the number of columns of the random number matrix is ​​the same as the number of rows of the second pixel matrix.

[0111] Among them, the random number matrix that conforms to the normal distribution, that is, a randomly generated matrix with a mean of 0 and a variance of 1. In this embodiment, the random number matrix is ​​a matrix with l rows and m columns, and l can be a number obtained after summarizing multiple experiments, which is greater than the target number of eigenvalues ​​in the first eigenvalue, and less than or equal to the difference between the number of rows and the target number of the second pixel matrix. m represents the number of rows of the second pixel matrix. Exemplarily, the target number of eigenvalues ​​in the first eigenvalue is k, the number of rows of the second pixel matrix is ​​m, and the number of columns is n, then l>k and l≤mk, for example, l can be 2k. In this embodiment, l, m, and k are all positive integers.

[0112] Specifically, the number of rows and columns of the random number matrix is ​​preconfigured. After obtaining the second pixel matrix corresponding to the image to be tested, a random number matrix conforming to normal distribution can be randomly generated according to the number of rows and columns of the random number matrix.

[0113] In step S420, the second pixel matrix is ​​subjected to dimensionality reduction processing according to the random number matrix to obtain a target matrix, wherein the number of rows of the target matrix is ​​the same as the number of rows of the second pixel matrix, and the number of columns of the target matrix is ​​the same as the target number.

[0114] In step S430, matrix decomposition is performed on the target matrix to obtain second eigenvalues, and the number of eigenvalues ​​in the second eigenvalues ​​is the same as the target number.

[0115] Specifically, since the number of rows of the random number matrix is ​​less than the number of rows of the second pixel matrix, the random number matrix can be used to perform dimensionality reduction processing on the second pixel matrix to obtain a target matrix. The target matrix is ​​decomposed by a matrix decomposition method to obtain a second eigenvalue diagonal matrix and corresponding eigenvectors. The diagonal elements of the second eigenvalue diagonal matrix can be non-negative real numbers and are arranged in order according to the numerical value. The diagonal elements in the second eigenvalue diagonal matrix are obtained as the second eigenvalues.

[0116] In this embodiment, by constructing a random number matrix that conforms to the normal distribution, using the random number matrix to extract valid data from the second pixel matrix, and implementing dimensionality reduction processing on the second pixel matrix, the amount of calculation for image comparison can be reduced, thereby reducing the operating resources of the electronic device.

[0117] In an exemplary embodiment, if Figure 5 As shown, in step S420, the second pixel matrix is ​​subjected to dimensionality reduction processing according to the random number matrix to obtain a target matrix, which can be specifically achieved through the following steps.

[0118] In step S510, a first intermediate matrix is ​​determined according to the random number matrix and the second pixel matrix, wherein the number of rows of the first intermediate matrix is ​​the same as that of the random number matrix, and the number of columns of the first intermediate matrix is ​​the same as that of the second pixel matrix.

[0119] Specifically, after obtaining the random number matrix and the second pixel matrix, the electronic device can use the random number matrix to extract valid data from the second pixel matrix, implement the initial dimensionality reduction processing on the second pixel matrix, and obtain the first intermediate matrix.

[0120] The first intermediate matrix can be obtained by the following formula:

[0121]

[0122] Among them, P (l×n) Represents the first intermediate matrix, R (l×m)represents the random number matrix, H (m×n) represents the second pixel matrix, represents the conjugate transposed matrix of the second pixel matrix, l represents the number of rows of the random number matrix, n represents the number of columns of the second pixel matrix, m represents the number of rows of the second pixel matrix, and j represents a preset adjustment parameter. For example, j can be any number among 1, 2, 3, etc. After multiple implementations, it has been proved that when j=3, the image comparison takes more time, but the accuracy is the highest.

[0123] In step S520, the conjugate transposed matrix of the first intermediate matrix is ​​obtained, and the conjugate transposed matrix is ​​decomposed to obtain a second intermediate matrix, where the number of rows of the second intermediate matrix is ​​the same as the number of columns of the second pixel matrix, and the number of columns of the second intermediate matrix is ​​the same as the number of rows of the random number matrix.

[0124] In step S530, a matrix of the previous target number of columns is obtained from the second intermediate matrix, and the product of the second pixel matrix and the matrix of the previous target number of columns is obtained as the target matrix.

[0125] Specifically, the conjugate transposed matrix of the first intermediate matrix can be decomposed by a matrix decomposition method, and the obtained matrix having the same number of rows as the number of columns of the second pixel matrix and the same number of columns as the number of rows of the random number matrix is ​​used as the second intermediate matrix. The matrix of the front target number of columns is obtained from the second intermediate matrix, and the product of the matrix of the front target number of columns and the second pixel matrix is ​​obtained as the target matrix.

[0126] In this embodiment, by constructing a random number matrix that conforms to the normal distribution, the second pixel matrix is ​​subjected to dimensionality reduction processing based on the random number matrix and the above-mentioned method of generating the target matrix. While achieving the purpose of dimensionality reduction, the valid data in the second pixel matrix can be retained as much as possible, thereby reducing the amount of calculation of image comparison and ensuring the accuracy of image comparison.

[0127] Figure 6 is a flow chart of an image comparison method according to an exemplary embodiment. In this embodiment, the reference image is one of a plurality of key frame images extracted from a reference video; correspondingly, the image to be tested is an image extracted from the video to be tested and located in the same frame as the reference image. Figure 6 As shown, the following steps are included.

[0128] In step S602, a first pixel matrix of a reference image is obtained, and matrix decomposition is performed on the first pixel matrix to obtain a plurality of original eigenvalues ​​in a determined arrangement order.

[0129] The first pixel matrix can be decomposed by the following formula:

[0130] B=Aλ(T)H

[0131] Wherein, B represents the first pixel matrix, A and T represent the eigenvectors obtained by matrix decomposition, and λ represents the first eigenvalue diagonal matrix obtained by matrix decomposition.

[0132] Get the diagonal elements in the first eigenvalue diagonal matrix λ as the original eigenvalues ​​λ of the determined order i (i=1,2,...,N).

[0133] In step S604, a weight coefficient corresponding to each original eigenvalue is obtained through a preset weight function.

[0134] The weight coefficient corresponding to each original eigenvalue can be obtained by the following formula:

[0135]

[0136] Among them, γ i represents the weight coefficient corresponding to the i-th original eigenvalue, k represents the number of original eigenvalues ​​when the cumulative contribution rate reaches the threshold, N represents the total number of original eigenvalues, and λ i represents the ith original eigenvalue. Assume that when i=k, the cumulative contribution rate of the first k original eigenvalues ​​obtained by using the obtained weight coefficient is greater than the threshold, and e represents a natural constant.

[0137] In step S606, starting from the first original eigenvalue, the cumulative contribution rate corresponding to the current original eigenvalue is calculated based on the original eigenvalue and the weight coefficient corresponding to the original eigenvalue. The specific method for obtaining the cumulative contribution rate can refer to the above embodiment and will not be elaborated here. If the cumulative contribution rate of the first k original eigenvalues ​​calculated is greater than the threshold, the first k original eigenvalues ​​λ are added. i (i=1,2,...,k) is used as the first eigenvalue. For example, the threshold is 95%. When the first k original eigenvalues ​​are calculated, if the cumulative contribution rate is greater than 95%, the first k original eigenvalues ​​are used as the first eigenvalue.

[0138] In step S608, a second pixel matrix of the image to be tested is obtained. The number of rows of the second pixel matrix is ​​m, and the number of columns is n. Both m and n are positive integers.

[0139] In step S610, a random number matrix conforming to normal distribution is constructed. The number of rows of the random number matrix is ​​l, l>k and l≤mk, for example, l can be 2k, k is the number of eigenvalues ​​in the first eigenvalue. The number of columns of the random number matrix is ​​m. l and k are both positive integers.

[0140] In step S612, a first intermediate matrix is ​​determined according to the random number matrix and the second pixel matrix. The number of rows of the first intermediate matrix is ​​the same as the number of rows of the random number matrix, and the number of columns of the first intermediate matrix is ​​the same as the number of columns of the second pixel matrix. Step S612 can implement dimensionality reduction processing on the second pixel matrix.

[0141] The first intermediate matrix can be obtained by the following formula:

[0142]

[0143] Among them, P (l×n) Represents the first intermediate matrix, R (l×m) represents the random number matrix, H (m×n) represents the second pixel matrix, represents the conjugate transposed matrix of the second pixel matrix, l represents the number of rows of the random number matrix, n represents the number of columns of the second pixel matrix, m represents the number of rows of the second pixel matrix, and j represents a preset adjustment parameter. For example, j can be any number among 1, 2, 3, etc. After multiple implementations, it has been proved that when j=3, the image comparison takes more time, but the accuracy is the highest.

[0144] In step S614, the conjugate transposed matrix of the first intermediate matrix is ​​obtained, and the conjugate transposed matrix is ​​decomposed to obtain a second intermediate matrix, where the number of rows of the second intermediate matrix is ​​the same as the number of columns of the second pixel matrix, and the number of columns of the second intermediate matrix is ​​the same as the number of rows of the random number matrix.

[0145] The conjugate transposed matrix of the first intermediate matrix can be decomposed by the following formula to obtain the second intermediate matrix:

[0146]

[0147] Among them, P H (l×n) represents the conjugate transposed matrix of the first intermediate matrix; W (n×l) and Represents the eigenvector obtained by matrix decomposition, select W (n×l) As the second intermediate matrix; Σ (l×l) Represents the eigenvalue matrix obtained by matrix decomposition.

[0148] In step S616, a matrix of the previous target number of columns is obtained from the second intermediate matrix, and the product of the second pixel matrix and the matrix of the previous target number of columns is obtained as the target matrix.

[0149] That is, from W (n×l) Get the matrix of the previous target number column and get W (n×k) , the target matrix can be obtained by the following formula:

[0150] G (m×k) =H (m×n) W (n×k)

[0151] Among them, G (m×k) Represents the target matrix.

[0152] In step S618, matrix decomposition is performed on the target matrix to obtain second eigenvalues, and the number of eigenvalues ​​in the second eigenvalues ​​is the same as the target number.

[0153] The target matrix can be decomposed by the following formula to obtain the second eigenvalue:

[0154] G (m×k) =B (m×k) μ (k×k) N (k×k)

[0155] Among them, B (m×k) and N (k×k) represents the eigenvector obtained by matrix decomposition, μ (k×k) Represents the second eigenvalue diagonal matrix obtained by matrix decomposition. Get the diagonal elements in the second eigenvalue diagonal matrix as the second eigenvalue μ i (i=1,2,...,k).

[0156] In step S620, a one-dimensional first vector is generated according to the first eigenvalue, and a one-dimensional second vector is generated according to the second eigenvalue.

[0157] In step S622, a mutual correlation value between the first vector and the second vector is obtained as the similarity. For example, the distance between the first vector and the second vector may be calculated as the mutual correlation value.

[0158] In step S624, the similarity is compared with a preset threshold. If the similarity is greater than the preset threshold, a comparison result is generated indicating that the reference image matches the image to be tested; otherwise, a comparison result is generated indicating that the reference image does not match the image to be tested.

[0159] It should be understood that, although the various steps in the above flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above flowchart may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0160] Figure 7 FIG. 7 is a block diagram of an image comparison device 700 according to an exemplary embodiment. Figure 7 The device includes an acquisition module 702, a first feature value generation module 704, a second feature value generation module 706, a comparison module 708, and a result generation module 710.

[0161] The acquisition module 702 is configured to execute acquisition of a first pixel matrix of a reference image and a second pixel matrix of an image to be tested; the first eigenvalue generation module 704 is configured to execute determination of a first eigenvalue corresponding to the first pixel matrix; the second eigenvalue generation module 706 is configured to execute determination of a second eigenvalue corresponding to the second pixel matrix; the comparison module 708 is configured to execute comparison of the first eigenvalue and the second eigenvalue to obtain a similarity; the result generation module 710 is configured to execute determination of a comparison result between the image to be tested and the reference image based on the similarity.

[0162] In an exemplary embodiment, the second eigenvalue generation module 704 includes: a matrix generation unit, configured to execute construction of a random number matrix that conforms to a normal distribution, the number of rows of the random number matrix is ​​greater than the target number of eigenvalues ​​in the first eigenvalue, and is less than or equal to the difference between the number of rows of the second pixel matrix and the target number, and the number of columns of the random number matrix is ​​the same as the number of rows of the second pixel matrix; a dimensionality reduction unit, configured to execute dimensionality reduction processing on the second pixel matrix according to the random number matrix to obtain a target matrix, the number of rows of the target matrix is ​​the same as the number of rows of the second pixel matrix, and the number of columns of the target matrix is ​​the same as the target number; a first matrix decomposition unit, configured to execute matrix decomposition on the target matrix to obtain a second eigenvalue, and the number of eigenvalues ​​in the second eigenvalue is the same as the target number.

[0163] In an exemplary embodiment, a dimensionality reduction unit includes: an intermediate matrix generation subunit, configured to determine a first intermediate matrix based on a random number matrix and a second pixel matrix, the number of rows of the first intermediate matrix being the same as the number of rows of the random number matrix, and the number of columns of the first intermediate matrix being the same as the number of columns of the second pixel matrix; a matrix decomposition subunit, configured to obtain a conjugate transposed matrix of the first intermediate matrix, and perform matrix decomposition on the conjugate transposed matrix to obtain a second intermediate matrix, the number of rows of the second intermediate matrix being the same as the number of columns of the second pixel matrix, and the number of columns of the second intermediate matrix being the same as the number of rows of the random number matrix; obtaining a matrix of a preceding target number of columns from the second intermediate matrix, and obtaining the product of the second pixel matrix and the matrix of the preceding target number of columns as a target matrix.

[0164] In an exemplary embodiment, the intermediate matrix generating subunit is configured to obtain the first intermediate matrix by executing the following formula:

[0165]

[0166] Among them, P (l×n) Represents the first intermediate matrix, R (l×m) represents the random number matrix, H (m×n) represents the second pixel matrix, represents the conjugate transposed matrix of the second pixel matrix, l represents the number of rows of the random number matrix, n represents the number of columns of the second pixel matrix, m represents the number of rows of the second pixel matrix, and j represents a preset adjustment parameter.

[0167] In an exemplary embodiment, the first eigenvalue generation module 704 includes: a second matrix decomposition unit, configured to perform matrix decomposition on the first pixel matrix to obtain multiple original eigenvalues; a weight coefficient acquisition unit, configured to obtain the weight coefficient corresponding to each original eigenvalue; a first eigenvalue generation unit, configured to obtain the first i original eigenvalues ​​when the cumulative contribution rate reaches a threshold, the first i original eigenvalues ​​are used as the first eigenvalues, the cumulative contribution rate is the ratio of the first weighted sum to the second weighted sum, the first weighted sum is the weighted sum of the first i original eigenvalues ​​and the corresponding weight coefficients, the second weighted sum is the weighted sum of the multiple original eigenvalues ​​and the corresponding weight coefficients, and i is a positive integer.

[0168] In an exemplary embodiment, the weight coefficient obtaining unit is configured to obtain the weight coefficient corresponding to each original eigenvalue by executing the following formula:

[0169]

[0170] Among them, γ i represents the weight coefficient corresponding to the i-th original eigenvalue, k represents the number of original eigenvalues ​​when the cumulative contribution rate reaches the threshold, N represents the total number of original eigenvalues, and λ i represents the i-th original eigenvalue, and e represents a natural constant.

[0171] In an exemplary embodiment, the comparison module 708 includes: a vector generation unit, configured to generate a first vector according to a first eigenvalue, and to generate a second vector according to a second eigenvalue; and a similarity determination unit, configured to obtain a mutual correlation value between the first vector and the second vector as the similarity.

[0172] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0173] Figure 81 is a block diagram of an electronic device Z00 for image comparison according to an exemplary embodiment. For example, the electronic device Z00 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0174] Reference Figure 8 The electronic device Z00 may include one or more of the following components: a processing component Z02, a memory Z04, a power component Z06, a multimedia component Z08, an audio component Z10, an input / output (I / O) interface Z12, a sensor component Z14, and a communication component Z16.

[0175] The processing component Z02 generally controls the overall operation of the electronic device Z00, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component Z02 may include one or more processors Z20 to execute instructions to complete all or part of the steps of the above-described method. In addition, the processing component Z02 may include one or more modules to facilitate interaction between the processing component Z02 and other components. For example, the processing component Z02 may include a multimedia module to facilitate interaction between the multimedia component Z08 and the processing component Z02.

[0176] The memory Z04 is configured to store various types of data to support operations on the electronic device Z00. Examples of such data include instructions for any application or method operating on the electronic device Z00, contact data, phone book data, messages, pictures, videos, etc. The memory Z04 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0177] The power supply assembly Z06 provides power to various components of the electronic device Z00. The power supply assembly Z06 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device Z00.

[0178] The multimedia component Z08 includes a screen that provides an output interface between the electronic device Z00 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component Z08 includes a front camera and / or a rear camera. When the electronic device Z00 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0179] The audio component Z10 is configured to output and / or input audio signals. For example, the audio component Z10 includes a microphone (MIC), and when the electronic device Z00 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory Z04 or sent via the communication component Z16. In some embodiments, the audio component Z10 also includes a speaker for outputting audio signals.

[0180] I / O interface Z12 provides an interface between processing component Z02 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0181] The sensor component Z14 includes one or more sensors for providing various aspects of status assessment for the electronic device Z00. For example, the sensor component Z14 can detect the open / closed state of the electronic device Z00, the relative positioning of the components, such as the display and keypad of the electronic device Z00, and the sensor component Z14 can also detect the position change of the electronic device Z00 or a component of the electronic device Z00, the presence or absence of contact between the user and the electronic device Z00, the orientation or acceleration / deceleration of the electronic device Z00 and the temperature change of the electronic device Z00. The sensor component Z14 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component Z14 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component Z14 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0182] The communication component Z16 is configured to facilitate wired or wireless communication between the electronic device Z00 and other devices. The electronic device Z00 can access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component Z16 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component Z16 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0183] In an exemplary embodiment, the electronic device Z00 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0184] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory Z04 including instructions, and the above instructions can be executed by a processor Z20 of the electronic device Z00 to complete the above method. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0185] Fig. 9 is a block diagram of an electronic device S00 for image comparison according to an exemplary embodiment. For example, the electronic device S00 may be a server. Fig. 9 The electronic device S00 includes a processing component S20, which further includes one or more processors, and a memory resource represented by a memory S22 for storing instructions executable by the processing component S20, such as an application. The application stored in the memory S22 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component S20 is configured to execute the instructions to perform the above-mentioned image comparison method.

[0186] The electronic device S00 may further include a power supply component S24 configured to perform power management of the electronic device S00, a wired or wireless network interface S26 configured to connect the electronic device S00 to a network, and an input / output (I / O) interface S28. The electronic device S00 may operate based on an operating system stored in the memory S22, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD or the like.

[0187] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory S22 including instructions, and the above instructions can be executed by a processor of the electronic device S00 to complete the above method. The storage medium can be a computer-readable storage medium, for example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0188] In an exemplary embodiment, a computer program product is further provided, including a computer program, wherein when the computer program is executed by a processor, the image comparison method described in any one of the above embodiments is implemented.

[0189] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0190] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An image comparison method, characterized in that: include: Acquire a first pixel matrix of a reference image and a second pixel matrix of an image to be tested; Determine a first eigenvalue corresponding to the first pixel matrix and a second eigenvalue corresponding to the second pixel matrix; Determining a second eigenvalue corresponding to the second pixel matrix includes: constructing a random number matrix that conforms to a normal distribution, the number of rows of the random number matrix being greater than a target number of eigenvalues ​​in the first eigenvalues ​​and less than or equal to a difference between the number of rows of the second pixel matrix and the target number, and the number of columns of the random number matrix being the same as the number of rows of the second pixel matrix; performing dimensionality reduction processing on the second pixel matrix according to the random number matrix to obtain a target matrix, the number of rows of the target matrix being the same as the number of rows of the second pixel matrix, and the number of columns of the target matrix being the same as the target number; performing matrix decomposition on the target matrix to obtain the second eigenvalue, and the number of eigenvalues ​​in the second eigenvalue is the same as the target number; Comparing the first eigenvalue and the second eigenvalue to obtain a similarity; A comparison result between the image to be tested and the reference image is determined according to the similarity.

2. The image comparison method according to claim 1, characterized in that: The performing dimensionality reduction processing on the second pixel matrix according to the random number matrix to obtain a target matrix includes: Determine a first intermediate matrix according to the random number matrix and the second pixel matrix, wherein the number of rows of the first intermediate matrix is ​​the same as the number of rows of the random number matrix, and the number of columns of the first intermediate matrix is ​​the same as the number of columns of the second pixel matrix; Obtaining a conjugate transposed matrix of the first intermediate matrix, and performing matrix decomposition on the conjugate transposed matrix to obtain a second intermediate matrix, wherein the number of rows of the second intermediate matrix is ​​the same as the number of columns of the second pixel matrix, and the number of columns of the second intermediate matrix is ​​the same as the number of rows of the random number matrix; A matrix of a previous target number of columns is obtained from the second intermediate matrix, and a product of the second pixel matrix and the matrix of the previous target number of columns is obtained as the target matrix.

3. The image comparison method according to claim 2, characterized in that: The step of determining a first intermediate matrix according to the random number matrix and the second pixel matrix comprises: The first intermediate matrix is ​​obtained by the following formula: Among them, P (l×n) Represents the first intermediate matrix, R (l×m) represents the random number matrix, H (m×n) represents the second pixel matrix, represents the conjugate transposed matrix of the second pixel matrix, l represents the number of rows of the random number matrix, n represents the number of columns of the second pixel matrix, m represents the number of rows of the second pixel matrix, and j represents a preset adjustment parameter.

4. The image comparison method according to claim 1, characterized in that: The determining a first eigenvalue corresponding to the first pixel matrix includes: Performing matrix decomposition on the first pixel matrix to obtain a plurality of original eigenvalues; Get the weight coefficient corresponding to each original eigenvalue; The first i original eigenvalues ​​when the cumulative contribution rate reaches a threshold are obtained, the first i original eigenvalues ​​are used as the first eigenvalue, the cumulative contribution rate is the ratio of the first weighted sum to the second weighted sum, the first weighted sum is the weighted sum of the first i original eigenvalues ​​and the corresponding weight coefficients, the second weighted sum is the weighted sum of the multiple original eigenvalues ​​and the corresponding weight coefficients, and i is a positive integer.

5. The image comparison method according to claim 4, characterized in that: The obtaining of the weight coefficient corresponding to each original eigenvalue includes: The weight coefficient corresponding to each original eigenvalue is obtained by the following formula: Among them, γ i represents the weight coefficient corresponding to the i-th original eigenvalue, k represents the number of original eigenvalues ​​when the cumulative contribution rate reaches the threshold, N represents the total number of original eigenvalues, and λ i represents the i-th original eigenvalue, and e represents a natural constant.

6. The image comparison method according to claim 1, characterized in that: The comparing the first eigenvalue and the second eigenvalue to obtain the similarity includes: generating a first vector according to the first eigenvalue, and generating a second vector according to the second eigenvalue; A mutual correlation value between the first vector and the second vector is obtained as the similarity.

7. An image comparison device, characterized in that: include: An acquisition module, configured to acquire a first pixel matrix of a reference image and a second pixel matrix of an image to be tested; A first eigenvalue generating module is configured to determine a first eigenvalue corresponding to the first pixel matrix; A second eigenvalue generating module is configured to determine a second eigenvalue corresponding to the second pixel matrix; The second eigenvalue generation module includes: a matrix generation unit, configured to execute construction of a random number matrix that conforms to a normal distribution, the number of rows of the random number matrix is ​​greater than the target number of eigenvalues ​​in the first eigenvalue, and is less than or equal to the difference between the number of rows of the second pixel matrix and the target number, and the number of columns of the random number matrix is ​​the same as the number of rows of the second pixel matrix; a dimensionality reduction unit, configured to execute dimensionality reduction processing on the second pixel matrix according to the random number matrix to obtain a target matrix, the number of rows of the target matrix is ​​the same as the number of rows of the second pixel matrix, and the number of columns of the target matrix is ​​the same as the target number; a first matrix decomposition unit, configured to execute matrix decomposition on the target matrix to obtain the second eigenvalue, and the number of eigenvalues ​​in the second eigenvalue is the same as the target number; A comparison module, configured to compare the first feature value and the second feature value to obtain a similarity; The result generating module is configured to determine the comparison result between the image to be tested and the reference image according to the similarity.

8. The image comparison device according to claim 7, characterized in that: The dimension reduction unit comprises: an intermediate matrix generating subunit, configured to determine a first intermediate matrix according to the random number matrix and the second pixel matrix, wherein the number of rows of the first intermediate matrix is ​​the same as the number of rows of the random number matrix, and the number of columns of the first intermediate matrix is ​​the same as the number of columns of the second pixel matrix; a matrix decomposition subunit, configured to obtain a conjugate transposed matrix of the first intermediate matrix, and perform matrix decomposition on the conjugate transposed matrix to obtain a second intermediate matrix, wherein the number of rows of the second intermediate matrix is ​​the same as the number of columns of the second pixel matrix, and the number of columns of the second intermediate matrix is ​​the same as the number of rows of the random number matrix; The target matrix generation subunit is configured to obtain a matrix of a previous target number of columns from the second intermediate matrix, and obtain the product of the second pixel matrix and the matrix of the previous target number of columns as the target matrix.

9. The image comparison device according to claim 8, characterized in that: The intermediate matrix generating subunit is configured to obtain the first intermediate matrix by executing the following formula: Among them, P (l×n) Represents the first intermediate matrix, R (l×m) represents the random number matrix, H (m×n) represents the second pixel matrix, represents the conjugate transposed matrix of the second pixel matrix, l represents the random number matrix , n represents the number of columns of the second pixel matrix, m represents the number of rows of the second pixel matrix, and j represents a preset adjustment parameter.

10. The image comparison device according to claim 7, characterized in that: The first eigenvalue generating module comprises: A second matrix decomposition unit is configured to perform matrix decomposition on the first pixel matrix to obtain a plurality of original eigenvalues; A weight coefficient acquisition unit is configured to acquire a weight coefficient corresponding to each original eigenvalue; A first eigenvalue generating unit is configured to execute acquisition of the first i original eigenvalues ​​when the cumulative contribution rate reaches a threshold value, the first i original eigenvalues ​​are used as the first eigenvalue, the cumulative contribution rate is the ratio of the first weighted sum to the second weighted sum, the first weighted sum is the weighted sum of the first i original eigenvalues ​​and the corresponding weight coefficients, the second weighted sum is the weighted sum of the multiple original eigenvalues ​​and the corresponding weight coefficients, and i is a positive integer.

11. The image comparison device according to claim 10, characterized in that: The weight coefficient acquisition unit is configured to obtain the weight coefficient corresponding to each original eigenvalue by executing the following formula: Among them, γ i represents the weight coefficient corresponding to the i-th original eigenvalue, k represents the number of original eigenvalues ​​when the cumulative contribution rate reaches the threshold, N represents the total number of original eigenvalues, and λ i represents the i-th original eigenvalue, and e represents a natural constant.

12. The image comparison device according to claim 7, characterized in that: The comparison module comprises: a vector generating unit, configured to generate a first vector according to the first eigenvalue, and generate a second vector according to the second eigenvalue; The similarity determination unit is configured to obtain a mutual correlation value between the first vector and the second vector as the similarity.

13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the image comparison method as described in any one of claims 1 to 6.

14. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the image comparison method as claimed in any one of claims 1 to 6.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the image comparison method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Straw combustion detection method based on deep learning and regional characteristics

    CN111428695A

  • Character image matching method, device and equipment and computer storage medium

    CN111898544A