CN116188822B - Image similarity judging method, device, electronic equipment and storage medium - Google Patents

Image similarity judging method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116188822B
CN116188822B CN202310473129.3A CN202310473129A CN116188822B CN 116188822 B CN116188822 B CN 116188822B CN 202310473129 A CN202310473129 A CN 202310473129A CN 116188822 B CN116188822 B CN 116188822B
Authority
CN
China
Prior art keywords
image
feature
feature vector
vector
image feature
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310473129.3A
Other languages
Chinese (zh)
Other versions
CN116188822A (en
Inventor
汪昭辰
刘世章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Chenyuan Technology Information Co ltd
Original Assignee
Qingdao Chenyuan Technology Information Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Chenyuan Technology Information Co ltd filed Critical Qingdao Chenyuan Technology Information Co ltd
Priority to CN202310473129.3A priority Critical patent/CN116188822B/en
Publication of CN116188822A publication Critical patent/CN116188822A/en
Application granted granted Critical
Publication of CN116188822B publication Critical patent/CN116188822B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/761Proximity, similarity or dissimilarity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Evolutionary Computation (AREA)
  • Databases & Information Systems (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Image Analysis (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application provides an image similarity judging method, an image similarity judging device, electronic equipment and a storage medium, and relates to the field of image processing, wherein the method comprises the steps of obtaining a normalized image by normalizing an obtained image to be processed; calculating image features of the normalized image; obtaining the image feature difference rates of the first image and the second image according to the image feature matrix of the first image and the image feature matrix of the second image, and judging whether the first image and the second image are similar according to whether the image feature difference rates meet a first preset condition. The application can accurately compare whether the two images are similar or not through the image characteristic difference rate, and can realize rapid comparison in a large number of images, thereby improving the image comparison accuracy and efficiency.

Description

Image similarity judging method, device, electronic equipment and storage medium
Technical Field
The present application relates to the field of image processing, and in particular, to a method and apparatus for determining image similarity, an electronic device, and a storage medium.
Background
At present, for similarity comparison of images, image color histogram features of the images or two-dimensional discrete cosine transform of the images are mostly adopted to obtain image fingerprints, and content analysis of the images and similarity judgment between different images are carried out according to the image fingerprints.
However, the noise immunity of the above-mentioned method is poor, the image detection accuracy is low, and the similarity determination result is affected, for example, after performing a graph transformation such as a magnitude-to-shape ratio transformation or adding a watermark to an image, the image fingerprint after the graph transformation is changed compared with the original image fingerprint, but the substantial content of the image is still the same, that is, the detection accuracy of the existing image similarity determination method is not high.
In addition, the similarity comparison mode of the existing images has higher dependence on a sample library, model training is needed according to a large number of sample images, the training cost is high, the training time is long, the noise resistance is poor, the image content comparison efficiency is low, and meanwhile, the problems that target images similar to specified images are quickly and accurately found in massive image data cannot be solved by the methods.
Disclosure of Invention
In view of the above, the present application aims to provide an image similarity determining method, an apparatus, an electronic device and a storage medium, which can pointedly solve the problem of low accuracy and efficiency of the existing image similarity determining method, and can quickly and accurately find out image data similar to a specified image in mass image data.
Based on the above object, in a first aspect, the present application provides an image similarity determining method, which includes: acquiring an image to be processed, wherein the image to be processed comprises a first image and a second image, and carrying out normalization processing on the image to be processed to obtain a normalized image; calculating an image feature matrix of the normalized image, and obtaining image feature difference rates of the first image and the second image according to the image feature matrix of the first image and the image feature matrix of the second image; judging whether the image characteristic difference rate meets a first preset condition, if so, determining that the first image is similar to the second image, and if not, determining that the first image is dissimilar to the second image.
Optionally, obtaining the image feature difference rates of the first image and the second image according to the image feature matrix of the first image and the image feature matrix of the second image includes: obtaining a feature difference value between each feature in the first image and the second image according to the image feature matrix of the first image and the image feature matrix of the second image; obtaining the characteristic difference value of the first image and the second image according to the characteristic difference value between each characteristic in the first image and the second image; and obtaining the image characteristic difference rate according to the mode of the image characteristic matrix of the first image, the mode of the image characteristic matrix of the second image and the characteristic difference values of the first image and the second image.
Optionally, the first preset condition is:
wherein ,representing a first image->Representing a second image->Representing the difference rate of the image feature matrix of the first image and the second image,/for the first image>Is an inherent error->For calculating error +.>Is a preset characteristic difference rate threshold.
Optionally, the image to be processed includes a plurality of second images, and the method includes: carrying out normalization processing and image feature extraction on a plurality of second images to obtain an image feature database containing feature data of each second image, wherein the feature data comprises a feature matrix of the second image, a model of the image feature matrix, an image feature vector and a model of the image feature vector; and judging the image similarity of the first image and a second image in the image characteristic database.
Optionally, performing image similarity determination on the first image and a second image in the image feature database includes: obtaining an image feature vector of the first image according to the feature value of the image feature matrix of the first image; performing modular value calculation on the image feature vector of the first image to obtain a module of the image feature vector of the first image; and carrying out similarity judgment on the first image and the second image according to the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image, so as to obtain a first judgment result.
Optionally, performing similarity judgment on the first image and the second image according to a module of an image feature vector of the first image and a module of an image feature vector of the second image to obtain a first judgment result, including: under the condition that the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image meet a second preset condition, carrying out similarity judgment on the first image and the second image according to the vector difference rate of the image feature vector of the first image and the image feature vector of the second image to obtain a second judgment result; and under the condition that the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image do not meet a second preset condition, obtaining a first judging result that the first image and the second image are dissimilar.
Optionally, the second preset condition is:
wherein ,representing a first image->Representing a second image->Is the image feature vector of the first image,modulo the image feature vector of the first image, < >>For the image feature vector of the second image, +.>Modulo the image feature vector of the second image, < > >A preset threshold value that is a modulus of the image feature vector,the representation is->Minimum value->The denominator cannot be zero if +.>At the same time zero, then->
Optionally, performing similarity judgment on the first image and the second image according to a vector difference rate of the image feature vector of the first image and the image feature vector of the second image to obtain a second judgment result, including: calculating a vector difference value of the image feature vector of the first image and the image feature vector of the second image; calculating the vector difference rate of the image feature vector of the first image and the image feature vector of the second image according to the modulus of the image feature vector of the first image, the modulus of the image feature vector of the second image and the vector difference value of the image feature vector of the first image and the image feature vector of the second image; and under the condition that the vector difference rate is larger than a vector difference rate threshold value, obtaining a second judging result of dissimilarity between the first image and the second image, and under the condition that the vector difference rate is smaller than or equal to the vector difference rate threshold value, executing the step of judging whether the image characteristic difference rate meets a first preset condition.
In a second aspect, there is also provided an image similarity determination apparatus, the apparatus including: the image processing module is used for acquiring an image to be processed, wherein the image to be processed comprises a first image and a second image, and normalizing the image to be processed to obtain a normalized image; the computing module is used for computing an image feature matrix of the normalized image, and obtaining the image feature difference rates of the first image and the second image according to the image feature matrix of the first image and the image feature matrix of the second image; and the comparison module is used for judging whether the image characteristic difference rate meets a first preset condition, if so, determining that the first image is similar to the second image, and if not, determining that the first image is dissimilar to the second image.
In a third aspect, there is also provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor runs the computer program to implement the method of the first aspect.
In a fourth aspect, there is also provided a computer readable storage medium having stored thereon a computer program for execution by a processor to perform the method of any of the first aspects.
In general, the present application has at least the following benefits:
the normalized images are obtained by normalizing the images, so that each image can be calculated under a unified coordinate system, then the image characteristics of the normalized images are calculated, the image content of the images is analyzed, the characteristic matrix is extracted, the characteristic difference rate between the images of the two images is truly and accurately judged according to the image characteristic matrix of the two images, and then whether the two images are similar or not can be judged according to the characteristic difference rate.
Drawings
In the drawings, the same reference numerals refer to the same or similar parts or elements throughout the several views unless otherwise specified. The figures are not necessarily drawn to scale. It is appreciated that these drawings depict only some embodiments according to the disclosure and are not therefore to be considered limiting of its scope. The exemplary embodiments of the present application and the descriptions thereof are for explaining the present application and do not constitute an undue limitation of the present application. In the drawings:
FIG. 1 is a schematic diagram showing an application environment of an alternative image similarity determination method according to an embodiment of the present application;
FIG. 2 is a schematic diagram showing an application environment of another alternative image similarity determination method according to an embodiment of the present application;
FIG. 3 is a flowchart showing steps of an image similarity determination method according to an embodiment of the present application;
FIG. 4 shows a neighborhood of an embodiment of the application and />Schematic of (2);
FIG. 5 is a flowchart showing steps for determining whether a first image is similar to a second image in accordance with an embodiment of the present application;
fig. 6 is a schematic diagram showing the structure of an image similarity judging device according to an exemplary embodiment of the present application;
fig. 7 shows a schematic diagram of an electronic device according to an embodiment of the application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In one aspect of the embodiment of the present invention, an image similarity determining method is provided, and as an alternative implementation manner, the image similarity determining method may be applied, but is not limited to, in an application environment as shown in fig. 1. The application environment comprises the following steps: a terminal device 102, a network 104 and a server 106 which interact with a user in a man-machine manner. Human-computer interaction can be performed between the user 108 and the terminal device 102, and an image similarity judging application program runs in the terminal device 102. The terminal device 102 includes a man-machine interaction screen 1022, a processor 1024 and a memory 1026. The man-machine interaction screen 1022 is used for displaying images; the processor 1024 is configured to obtain an image to be processed, and perform image similarity determination according to the image to be processed. The memory 1026 is used to store feature data of the image.
The server 106 includes a database 1062 and a processing engine 1064, and the database 1062 is used to store the feature data of the images. The processing engine 1064 is configured to: acquiring an image to be processed, wherein the image to be processed comprises a first image and a second image, and carrying out normalization processing on the image to be processed to obtain a normalized image; calculating an image feature matrix of the normalized image, and obtaining the image feature difference rates of the first image and the second image according to the image feature matrix of the first image and the image feature matrix of the second image; judging whether the image characteristic difference rate meets a first preset condition, if so, determining that the first image is similar to the second image, and if not, determining that the first image is dissimilar to the second image.
In one or more embodiments, the image similarity determining method of the present application may be applied to the application environment shown in fig. 2. As shown in fig. 2, a human-machine interaction may be performed between a user 202 and a user device 204. The user device 204 includes a memory 206 and a processor 208. The user equipment 204 in this embodiment may perform the image similarity determination, but is not limited to, referring to the operations performed by the terminal equipment 102.
Optionally, the terminal device 102 and the user device 204 include, but are not limited to, a mobile phone, a tablet computer, a notebook computer, a PC, a vehicle-mounted electronic device, a wearable device, and the like, and the network 104 may include, but is not limited to, a wireless network or a wired network. Wherein the wireless network comprises: WIFI and other networks that enable wireless communications. The wired network may include, but is not limited to: wide area network, metropolitan area network, local area network. The server 106 may include, but is not limited to, any hardware device that may perform calculations. The server may be a single server, a server cluster composed of a plurality of servers, or a cloud server. The above is merely an example, and is not limited in any way in the present embodiment.
In the related technology, image color histogram features of images or two-dimensional discrete cosine transform of images are mostly adopted to obtain image fingerprints, content analysis of the images and similarity judgment between different images are carried out according to the image fingerprints, noise resistance is poor, image detection accuracy is low, dependence on a sample library is high, model training is needed according to a large number of sample images, training cost is high, training time is long, noise resistance is poor, and image content comparison efficiency is low. Meanwhile, the methods cannot quickly and accurately search the target image similar to the designated image in the massive image data.
In order to solve the above technical problems, as an alternative implementation manner, an embodiment of the present application provides an image similarity determining method.
Fig. 3 shows a flowchart of steps of an image similarity determination method according to an embodiment of the present application. As shown in FIG. 3, the image similarity judging method comprises the following steps S301 to S304:
s301, acquiring an image to be processed, and carrying out normalization processing on the image to be processed to obtain a normalized image.
In this embodiment, the image to be processed includes a first image and a second image, where the image to be processed may be an image derived from one or more resource libraries, may be an image specified by a user, may be an image derived from the internet, or may be one or more images in one video clip.
In this embodiment, the normalization processing of the images to be processed includes, but is not limited to, normalization of an amplitude-to-shape ratio, resolution and color space of the images to be processed, so that each image to be processed has the same image dimension, so that the content of different images can be conveniently analyzed under the same coordinate system, and the similarity analysis between the content of different images can be conveniently performed according to the pixels of the images, thereby accelerating the analysis rate of the content of the images.
S302, calculating an image feature matrix of the normalized image, and obtaining the image feature difference rates of the first image and the second image according to the image feature matrix of the first image and the image feature matrix of the second image.
It will be appreciated that each image has image features, including but not limited to image features composed of UniformLBP features, which have good sensitivity to image texture changes, so that the present embodiment adopts the UniformLBP features of the image as the image features, which can better reflect the content features of the image.
In an alternative example, the image features may also be other image features, such as histogram features, sift features, hog features, haar features, etc., which are not listed here.
Taking image features as UniformLBP features as an example, in this embodiment, the image features include an image feature matrix and a modulus of the image feature matrix, and calculating the image feature matrix of the normalized image may obtain sixteen-bit feature data by normalizing the low-eight-bit feature data and the high-eight-bit feature data of the image, and obtain sixteen-bit feature data according to the sixteen-bit feature dataAnd obtaining an image feature matrix by the feature matrix.
FIG. 4 shows a neighborhood and />Specifically, as shown in FIG. 4, 3×3 neighborhood features are extracted for normalized image pixels as low-octet features ()>Distance 1, feature point number 8), extracting 5×5 neighborhood feature as high-eight feature (++>Distance 2, feature points 8). According to equation 1 +.> and />Thereby obtaining sixteen-bit characteristic data of the pixel point (++>) Calculate +.>Characteristic results in YUV three components +.>And (5) a feature matrix. In this embodiment, equation 1 is:
(equation 1)
Where c is the center pixel, i is the feature point in the neighborhood, and pixel is the pixel value. According to the magnitude relation between the pixel value of the central pixel and the pixel value of the characteristic point in the neighborhood, the characteristic point in the neighborhood can be obtained And (5) a feature matrix.
It will be appreciated that when obtaining the feature matrix of the image from the feature matrix of the pixels, it is necessary to adapt to the local deformation and rotation of the image, so that the present embodiment obtains YUV three componentsAfter the feature matrix, in YUV three components +.>Performing dimension reduction calculation based on the characteristics to obtain an image form->And the characteristic is taken as an image characteristic matrix.
In this embodiment, the modulus of the image feature matrix is obtained by performing a modulus calculation on the image feature matrix, and specifically, the modulus calculation formula of the image feature matrix is as follows:
where i is the YUV component, wi and hi are the width and height, respectively, of the component,for the abscissa of the pixel point, m and n are non-negative integers, and +.>Is->Characteristic value of pixel coordinate point in v dimension, < >>As a dimension of the features,
according to the mode, the image feature matrix of the first image, the image feature matrix of the second image and the modes of the respective image feature matrices can be obtained, and then the image feature difference rates of the first image and the second image are obtained according to the image feature matrix of the first image and the image feature matrix of the second image, and the calculation method comprises the following steps: obtaining a characteristic difference value between each characteristic in the first image and the second image according to the image characteristic matrix of the first image and the image characteristic matrix of the second image; obtaining the characteristic difference value of the first image and the second image according to the characteristic difference value between each characteristic in the first image and the second image; and obtaining the image characteristic difference rate according to the mode of the image characteristic matrix of the first image, the mode of the image characteristic matrix of the second image and the characteristic difference values of the first image and the second image.
Specifically, according to the image feature matrix of the first image and the image feature matrix of the second image, a feature difference value formula between each feature in the first image and each feature in the second image is obtained as follows:
wherein Representing a first image->Representing a second image->Characteristic difference values of the first image and the second image in v dimension under YUV component are represented, +.>Is pixel point +.>Representing the first image at the point +.>Characteristic value of the place>Representing the second image at the point +.>Characteristic value of the place>,/>
,/>And m, n are non-negative integers, ">And hi is the width and height, respectively, of the component.
The feature difference value between each feature of the first image and each feature of the second image can be obtained according to the above formula 3, and then the feature difference value of the first image and each feature of the second image can be obtained according to the feature difference value between each feature of the first image and each feature of the second image, wherein the specific image feature difference value calculation formula is as follows:
wherein ,for the characteristic difference value of the first image and the second image,/or->Characteristic difference values of the first image and the second image in the v dimension under YUV component are represented, i is YUV component, wi and hi are width and height under component, and +.>The abscissa and ordinate of the pixel point.
Further, the image feature difference rate The calculation formula of (2) is as follows:
wherein ,for the characteristic difference value of the first image and the second image,/or->Modulo the feature matrix of the first image, +.>Modulo the feature matrix of the second image, +.>As a denominator other than 0, when +.>And->When all are 0, the combination is->
The difference rate of the image characteristics of the first image and the second image can be calculated by the above formula 3, formula 4 and formula 5It can be understood that the difference between the images is due to the difference of the pixel characteristics, and the image characteristic difference rates of the first image and the second image in this embodiment are calculated according to the image characteristic matrix, so that the characteristic difference rate between the two images can be truly and accurately determined, and further, the characteristic difference rate can be determined according to the characteristic difference rateAnd judging whether the two images are similar or not, and the method has the characteristic of accurate calculation.
It should be noted that, in this embodiment, whether the first image and the second image are similar or not is determined, which may be determined not only according to the image feature difference rate of the first image and the second image, but also according to the feature vector between the images or other features of the images.
S303, judging whether the image characteristic difference rate meets a first preset condition, if so, determining that the first image is similar to the second image, and if not, determining that the first image is dissimilar to the second image.
In this embodiment, the first preset condition is:
wherein ,representing a first image->Representing a second image->Image characteristic difference rate representing first image and second image,/or->Is an inherent error->For calculating error +.>Is a preset characteristic difference rate threshold value, wherein +.>Can be obtained according to a plurality of calculation in practice.
When (when)When the first preset condition is met, the image characteristic difference rate of the first image and the second image is smaller within the error allowable range, and the similarity of the first image and the second image can be determined, when ∈>When the first preset condition is not met, the image characteristic difference rate of the first image and the second image is larger, and the first image and the second image can be determined to be dissimilar.
The image similarity judging method provided by the embodiment can judge the image feature difference rate between the images according to the image feature matrix of the two images truly and accurately, further judge whether the two images are similar according to the image feature difference rate, and has the characteristic of accurate calculation.
When there are more images to be processed, for example, when the difference rate of image features is calculated between an image and a massive image, the calculation amount calculated by using the feature matrix is too large, the embodiment further provides a method for judging the similarity between an image and a massive image, for example, when the image to be processed includes a plurality of second images, the method in this embodiment includes:
And carrying out normalization processing and image feature extraction on the plurality of second images to obtain an image feature database containing feature data of each second image, wherein the feature data comprises a feature matrix of the second image, a model of the image feature matrix, an image feature vector and a model of the image feature vector, and then carrying out image similarity judgment on the first image and the second image in the image feature database.
For example, the normalization processing of the amplitude-to-shape ratio, the resolution ratio and the color space is performed on the mass images formed by the plurality of second images one by one, then the feature data of each image is extracted, and the feature data set of the plurality of second images is used as the feature database.
Further, in the case of comparing a first image with a massive image composed of a plurality of second images, if the first image is compared with each image, the calculation amount is huge, so the embodiment can exclude the second image dissimilar to the first image through the preset condition, so as to reduce the calculation amount.
In this embodiment, performing image similarity determination on the first image and the second image in the image feature database includes: obtaining an image feature vector of the first image according to the feature value of the image feature matrix of the first image; performing modular value calculation on the image feature vector of the first image to obtain a module of the image feature vector of the first image; and carrying out similarity judgment on the first image and the second image according to the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image, so as to obtain a first judgment result.
In this embodiment, the image feature vector is calculated by extracting a feature matrix from the image under the same coordinate system. The image feature vector FV may be expressed as:
wherein the dimension of FV is 3481,representation vector->Component values of k dimensions in->The calculation formula of (2) is as follows:
where w and h are the width and height of the image under the component,feature matrix for image->At->Characteristic value at point +_>For the value of vector k dimension, +.>For judging->Whether or not the characteristic value of (2) is
The modulo calculation formula of the image feature vector is as follows:
wherein ,for image feature vector +.>Is (are) mould>Representation vector->Component values of the k dimensions in (a).
The similarity judgment is performed on the first image and the second image according to the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image, so as to obtain a first judgment result, which comprises the following steps: under the condition that the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image meet a second preset condition, carrying out similarity judgment on the first image and the second image according to the vector difference rate of the image feature vector of the first image and the image feature vector of the second image to obtain a second judgment result; and under the condition that the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image do not meet the second preset condition, obtaining a first judging result of dissimilarity between the first image and the second image.
The second preset condition is as follows:
wherein ,representing a first image->Representing a second image->Is the image feature vector of the first image,modulo the image feature vector of the first image, < >>For the image feature vector of the second image, +.>Modulo the image feature vector of the second image, < >>The representation is->Minimum value of->A preset threshold value for modulo of the image feature vector, < >>As the denominator is not zero, ifAt the same time zero, then->
By the method, the second image dissimilar to the first image can be eliminated according to the mode of the image characteristic vector, so that the calculated amount is reduced. However, the first image and the second image cannot be directly determined to be similar only according to the modulus of the image feature vector, so that the embodiment further performs similarity judgment on the first image and the second image according to the vector difference ratio of the image feature vector of the first image and the image feature vector of the second image to obtain a second judgment result, which specifically includes: calculating a difference value between the image feature vector of the first image and the image feature vector of the second image; calculating the vector difference rate of the image feature vector of the first image and the image feature vector of the second image according to the modulus of the image feature vector of the first image, the modulus of the image feature vector of the second image and the vector difference value of the image feature vector of the first image and the image feature vector of the second image; and under the condition that the vector difference rate is larger than a vector difference rate threshold, obtaining a second judging result of dissimilarity between the first image and the second image, and under the condition that the vector difference rate is smaller than or equal to the vector difference rate threshold, executing the step of judging whether the image characteristic difference rate meets a first preset condition.
In this embodiment, a vector difference value calculation formula of the image feature vector of the first image and the image feature vector of the second image is:
wherein ,for the vector difference value of the image feature vectors of the first image and the second image, +.>Image feature vector representing the first image +.>Component values of k dimensions in->Image feature vector representing the second image +.>Component values of the k dimensions in (a).
The vector difference rate calculation formula of the image feature vector of the first image and the image feature vector of the second image is as follows:
wherein ,for the vector difference ratio of the image feature vector of the first image and the image feature vector of the second image, is>Modulo +.>Modulo +.>Minimum value->Cannot be as a denominatorZero, ifAt the same time zero, then->
In case the vector difference rate is greater than the vector difference rate threshold, i.e,/>For the preset threshold, the fact that the difference between the first image and the second image is larger at the moment is indicated, a second judging result of dissimilarity between the first image and the second image is obtained, and when the vector difference rate is smaller than or equal to the vector difference rate threshold, namely +.>The step of determining whether the matrix difference rate satisfies the first preset condition, that is, the step of the step S303 is performed to avoid repetition, which is not described herein again, in order to obtain an accurate calculation result.
Fig. 5 shows a flowchart of the steps for determining whether the first image is similar to the second image, and referring to fig. 5, the steps S501 to S503 include:
s501, judging whether the module of the image feature vector of the first image and the module of the image feature vector of the second image meet a second preset condition, if yes, executing step S502, if not, determining that the first image and the second image are dissimilar,
s502, judging whether the vector difference rate of the image feature vector of the first image and the image feature vector of the second image is smaller than or equal to a vector difference rate threshold, if yes, executing step S503, and if not, determining that the first image and the second image are dissimilar.
S503, judging whether the image characteristic difference rate of the first image and the second image meets a first preset condition, if so, determining that the first image and the second image are similar, and if not, determining that the first image and the second image are dissimilar.
According to the method for judging the similarity between the first image and the massive second images, which is provided by the embodiment, the massive second images are normalized and subjected to feature extraction to form the feature database, so that when the comparison is performed, only the feature data of the first image are required to be extracted, and then the similarity between the first image and the massive second images is compared according to the feature data of the first image and the feature data of the second image, and the comparison efficiency of the massive images is improved. And the second images which are dissimilar to the first image can be gradually removed by screening the second images in mass according to different image characteristics, so that the similarity comparison rate of the second images in mass can be further improved.
It will be appreciated that, when the image features are obtained according to other image features such as the histogram feature, the sift feature, the hog feature, and the haar feature, the method of determining whether the two images are similar in this embodiment may also be obtained according to the limiting conditions of the other features, and the second preset condition in this embodiment is also merely exemplary.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present invention. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
The following are embodiments of the image similarity determination apparatus of the present invention, which may be used to perform embodiments of the method of the present invention. For details not disclosed in the embodiment of the image similarity determination device of the present invention, please refer to the embodiment of the method of the present invention.
Fig. 6 is a schematic diagram showing the structure of an image similarity determination apparatus according to an exemplary embodiment of the present invention. The image similarity determination means may be implemented as all or part of the terminal by software, hardware or a combination of both. The image similarity determination apparatus 600 includes:
The image preprocessing module 601 is configured to obtain an image to be processed, and normalize the image to be processed to obtain a normalized image, where the image to be processed includes a first image and a second image.
The feature calculation module 602 is configured to calculate an image feature matrix of the normalized image, and obtain an image feature difference ratio of the first image and the second image according to the image feature matrix of the first image and the image feature matrix of the second image.
The judging module 603 is configured to judge whether the image feature difference rate meets a first preset condition, if yes, determine that the first image and the second image are similar, and if not, determine that the first image and the second image are dissimilar.
In one example, the image to be processed includes a plurality of second images, the image preprocessing module 601 is further configured to normalize the plurality of second images, and the feature calculating module 602 is configured to extract image features of the plurality of second images, to obtain an image feature database including feature data of each of the second images, where the feature data includes a feature matrix of the second image, a module of the image feature matrix, and a module of the image feature vector and the image feature vector. The judging module 603 is further configured to perform image similarity judgment on the first image and the second image in the image feature database.
It should be noted that, when the image similarity determining device provided in the foregoing embodiment performs the image similarity determining method, only the division of the foregoing functional modules is used as an example, and in practical application, the foregoing functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the image similarity determination device provided in the above embodiment and the image similarity determination generating method embodiment belong to the same concept, which embody detailed implementation procedures and are not described herein.
According to the application, the normalized images are obtained by carrying out normalization processing on the images, so that each image can be calculated under a unified coordinate system, then the image characteristics of the normalized images are calculated, the image content of the images is analyzed, the characteristic matrix is extracted, the image characteristic difference rate between the images is truly and accurately judged according to the image characteristic matrixes of the two images, and further whether the two images are similar or not can be judged according to the image characteristic difference rate, so that the method has the characteristic of accurate calculation. In addition, when similarity judgment is carried out on the first image and the massive second image, the massive second image is normalized and subjected to feature extraction to form a feature database, so that when comparison is carried out, only feature data of the first image are required to be extracted, and then similarity of the first image and the massive second image is compared according to the feature data of the first image and the feature data of the second image, and comparison efficiency of the massive images is improved. And the second images which are dissimilar to the first image can be gradually removed by screening the second images in mass according to different image characteristics, so that the similarity comparison rate of the second images in mass can be further improved.
The embodiment of the application also provides an electronic device corresponding to the image similarity judging method provided by the previous embodiment, so as to execute the image similarity judging method.
Fig. 7 shows a schematic diagram of an electronic device according to an embodiment of the application. As shown in fig. 7, the electronic device 800 includes: a memory 801 and a processor 802, the memory 801 storing a computer program executable on the processor 802, the processor 802 executing the method provided by any of the preceding embodiments of the application when the computer program is executed.
Alternatively, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the steps of the above-described image similarity determination method by a computer program.
Alternatively, as will be appreciated by those skilled in the art, the structure shown in fig. 7 is merely illustrative, and the electronic device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a mobile internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Fig. 7 is not limited to the structure of the electronic device and the electronic apparatus described above. For example, the electronics may also include more or fewer components (e.g., network interfaces, etc.) than shown in fig. 7, or have a different configuration than shown in fig. 7.
The memory 801 may be used to store software programs and modules, such as program instructions/modules corresponding to the image similarity determining method and apparatus in the embodiment of the present invention, and the processor 802 executes the software programs and modules stored in the memory 801 to perform various functional applications and data processing, that is, implement the image similarity determining method described above. The memory 801 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. In some examples, the memory 801 may further include memory remotely located relative to the processor 802, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 801 may be used, among other things, for storing image characteristic data. As an example, the above memory 801 may include, but is not limited to, each module in the above image similarity determination device. In addition, other module units in the image similarity determination device may be included, but are not limited to, and are not described in detail in this example.
Optionally, the electronic device comprises transmission means 803, the transmission means 803 being adapted to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission means 803 includes a network adapter (Network Interface Controller, NIC) that can be connected to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 803 is a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
In addition, the electronic device further includes: a display 804, configured to display the first determination result or the second determination result; and a connection bus 805 for connecting the respective module parts in the above-described electronic apparatus.
The present embodiments provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from a computer readable storage medium, the processor executing the computer instructions, causing the computer device to perform the above-described image similarity determination method, wherein the computer program is arranged to execute the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described computer-readable storage medium may be configured to store a computer program for executing the steps of the image similarity determination method.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method of the various embodiments of the present invention.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided by the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and are merely a logical functional division, and there may be other manners of dividing the apparatus in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. An image similarity judging method, characterized in that the method comprises:
acquiring an image to be processed, wherein the image to be processed comprises a first image and a second image, and carrying out normalization processing on the image to be processed to obtain a normalized image;
calculating an image feature matrix of the normalized image, and obtaining a feature difference value between each feature in the first image and each feature in the second image according to the image feature matrix of the first image and the image feature matrix of the second image; obtaining the characteristic difference value of the first image and the second image according to the characteristic difference value between each characteristic in the first image and the second image; obtaining image feature difference rates of the first image and the second image according to the mode of the image feature matrix of the first image, the mode of the image feature matrix of the second image and the feature difference values of the first image and the second image;
Judging whether the image characteristic difference rate meets a first preset condition, if so, determining that the first image is similar to the second image, and if not, determining that the first image is dissimilar to the second image, wherein the first preset condition comprises that the sum of the image characteristic difference rate, the inherent error and the calculation error is smaller than or equal to a preset characteristic difference rate threshold value.
2. The image similarity determination method according to claim 1, wherein the first preset condition is:
wherein ,representing a first image->Representing a second image->Image characteristic difference rate representing first image and second image,/or->Is an inherent error->For calculating error +.>Is a preset characteristic difference rate threshold.
3. The image similarity determination method according to claim 1, wherein the image to be processed includes a plurality of second images, the method further comprising:
carrying out normalization processing and image feature extraction on a plurality of second images to obtain an image feature database containing feature data of each second image, wherein the feature data comprises an image feature matrix of the second image, a module of the image feature matrix, an image feature vector and a module of the image feature vector;
And judging the image similarity of the first image and a second image in the image characteristic database.
4. The image similarity determination method according to claim 3, wherein performing image similarity determination on the first image and a second image in the image feature database comprises:
obtaining an image feature vector of the first image according to the feature value of the image feature matrix of the first image;
performing modular value calculation on the image feature vector of the first image to obtain a module of the image feature vector of the first image;
and carrying out similarity judgment on the first image and the second image according to the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image, so as to obtain a first judgment result.
5. The image similarity determination method according to claim 4, wherein performing similarity determination on the first image and the second image according to a modulus of an image feature vector of the first image and a modulus of an image feature vector of the second image to obtain a first determination result includes:
under the condition that the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image meet a second preset condition, carrying out similarity judgment on the first image and the second image according to the vector difference rate of the image feature vector of the first image and the image feature vector of the second image to obtain a second judgment result;
And under the condition that the modulus of the image feature vector of the first image and the modulus of the image feature vector of the second image do not meet a second preset condition, obtaining a first judging result that the first image and the second image are dissimilar.
6. The image similarity determination method according to claim 5, wherein the second preset condition is:
wherein ,representing a first image->Representing a second image->Is the image feature vector of the first image,modulo the image feature vector of the first image, < >>Is the image feature vector of the second image,modulo the image feature vector of the second image, < >>A preset threshold value that is a modulus of the image feature vector,the representation is->Is set to be a minimum value of (c),the denominator cannot be zero if +.>At the same time is zero, then
7. The image similarity determination method according to claim 5, wherein performing similarity determination on the first image and the second image according to a vector difference ratio of the image feature vector of the first image and the image feature vector of the second image to obtain a second determination result, comprises:
calculating a vector difference value of the image feature vector of the first image and the image feature vector of the second image;
Calculating the vector difference rate of the image feature vector of the first image and the image feature vector of the second image according to the modulus of the image feature vector of the first image, the modulus of the image feature vector of the second image and the vector difference value of the image feature vector of the first image and the image feature vector of the second image;
and under the condition that the vector difference rate is larger than a vector difference rate threshold value, obtaining a second judging result of dissimilarity between the first image and the second image, and under the condition that the vector difference rate is smaller than or equal to the vector difference rate threshold value, executing the step of judging whether the image characteristic difference rate meets a first preset condition.
8. An image similarity determination apparatus, characterized by comprising:
the image processing module is used for acquiring an image to be processed, wherein the image to be processed comprises a first image and a second image, and normalizing the image to be processed to obtain a normalized image;
the computing module is used for computing an image feature matrix of the normalized image, and obtaining a feature difference value between each feature in the first image and each feature in the second image according to the image feature matrix of the first image and the image feature matrix of the second image; obtaining the characteristic difference value of the first image and the second image according to the characteristic difference value between each characteristic in the first image and the second image; obtaining image feature difference rates of the first image and the second image according to the mode of the image feature matrix of the first image, the mode of the image feature matrix of the second image and the feature difference values of the first image and the second image;
The comparison module is used for judging whether the image characteristic difference rate meets a first preset condition, if yes, the first image and the second image are similar, if not, the first image and the second image are dissimilar, and the first preset condition comprises that the sum of the image characteristic difference rate, the inherent error and the calculation error is smaller than or equal to a preset characteristic difference rate threshold value.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor runs the computer program to implement the method of any one of claims 1-7.
10. A computer readable storage medium having stored thereon a computer program, wherein the program is executed by a processor to implement the method of any of claims 1-7.
CN202310473129.3A 2023-04-28 2023-04-28 Image similarity judging method, device, electronic equipment and storage medium Active CN116188822B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310473129.3A CN116188822B (en) 2023-04-28 2023-04-28 Image similarity judging method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310473129.3A CN116188822B (en) 2023-04-28 2023-04-28 Image similarity judging method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116188822A CN116188822A (en) 2023-05-30
CN116188822B true CN116188822B (en) 2023-08-18

Family

ID=86444645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310473129.3A Active CN116188822B (en) 2023-04-28 2023-04-28 Image similarity judging method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116188822B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112821A (en) * 2023-06-09 2023-11-24 青岛尘元科技信息有限公司 Image retrieval system and method, storage medium, and electronic device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182188A (en) * 2016-12-08 2018-06-19 广东精点数据科技股份有限公司 A kind of image search method and device based on rarefaction representation
CN109214273A (en) * 2018-07-18 2019-01-15 平安科技(深圳)有限公司 Facial image comparison method, device, computer equipment and storage medium
CN113159206A (en) * 2021-04-28 2021-07-23 北京达佳互联信息技术有限公司 Image comparison method and device, electronic equipment and computer readable storage medium
CN114596453A (en) * 2022-02-07 2022-06-07 阿里巴巴(中国)有限公司 Image processing method, image processing apparatus, and computer-readable storage medium
CN115063799A (en) * 2022-08-05 2022-09-16 中南大学 Print form mathematical formula identification method and device and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019185384A (en) * 2018-04-10 2019-10-24 キヤノン株式会社 Image authentication device, image authentication method, computer program and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182188A (en) * 2016-12-08 2018-06-19 广东精点数据科技股份有限公司 A kind of image search method and device based on rarefaction representation
CN109214273A (en) * 2018-07-18 2019-01-15 平安科技(深圳)有限公司 Facial image comparison method, device, computer equipment and storage medium
WO2020015075A1 (en) * 2018-07-18 2020-01-23 平安科技(深圳)有限公司 Facial image comparison method and apparatus, computer device, and storage medium
CN113159206A (en) * 2021-04-28 2021-07-23 北京达佳互联信息技术有限公司 Image comparison method and device, electronic equipment and computer readable storage medium
CN114596453A (en) * 2022-02-07 2022-06-07 阿里巴巴(中国)有限公司 Image processing method, image processing apparatus, and computer-readable storage medium
CN115063799A (en) * 2022-08-05 2022-09-16 中南大学 Print form mathematical formula identification method and device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于特征融合和多重倒排索引的图像检索方法研究;郭忠强;中国优秀硕士学位论文全文数据库 信息科技辑;第2017卷(第02期);第I138-2659页 *

Also Published As

Publication number Publication date
CN116188822A (en) 2023-05-30

Similar Documents

Publication Publication Date Title
CN116188805B (en) Image content analysis method and device for massive images and image information network
CN116188822B (en) Image similarity judging method, device, electronic equipment and storage medium
KR20220051162A (en) Visual positioning methods, training methods for related models, and related devices and devices
CN107272899B (en) VR (virtual reality) interaction method and device based on dynamic gestures and electronic equipment
CN114330565A (en) Face recognition method and device
CN113822427A (en) Model training method, image matching device and storage medium
CN110956131A (en) Single-target tracking method, device and system
CN114612531A (en) Image processing method and device, electronic equipment and storage medium
CN116883698B (en) Image comparison method and related device
CN110555861B (en) Optical flow calculation method and device and electronic equipment
CN116912556A (en) Picture classification method and device, electronic equipment and storage medium
CN111931794B (en) Sketch-based image matching method
CN116152530B (en) Image difference determining method and device, storage medium and electronic equipment
CN113763313A (en) Text image quality detection method, device, medium and electronic equipment
CN113705660A (en) Target identification method and related equipment
CN110110111B (en) Method and device for monitoring screen
CN111507944A (en) Skin smoothness determination method and device and electronic equipment
Yang et al. A local structural information representation method for image quality assessment
CN117333790A (en) Similarity judging method and device for video events and electronic equipment
CN117115477A (en) Mass image comparison method, device and equipment based on image information network
EP4075383A1 (en) Portable device positioning data processing method and apparatus, device, and storage medium
CN117152650A (en) Video content analysis method and video event information network for massive videos
CN113365027B (en) Video processing method and device, electronic equipment and storage medium
CN117112818A (en) Method, system, equipment and storage medium for removing duplicate of mass images
CN109977734B (en) Image processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant