CN114913513A - Method and device for calculating similarity of official seal images, electronic equipment and medium - Google Patents

Method and device for calculating similarity of official seal images, electronic equipment and medium Download PDF

Info

Publication number
CN114913513A
CN114913513A CN202111187915.4A CN202111187915A CN114913513A CN 114913513 A CN114913513 A CN 114913513A CN 202111187915 A CN202111187915 A CN 202111187915A CN 114913513 A CN114913513 A CN 114913513A
Authority
CN
China
Prior art keywords
similarity
official seal
model
seal image
candidate
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.)
Pending
Application number
CN202111187915.4A
Other languages
Chinese (zh)
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.)
Beijing Zetyun Tech Co ltd
Original Assignee
Beijing Zetyun Tech 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 Beijing Zetyun Tech Co ltd filed Critical Beijing Zetyun Tech Co ltd
Priority to CN202111187915.4A priority Critical patent/CN114913513A/en
Publication of CN114913513A publication Critical patent/CN114913513A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)

Abstract

The application provides a method, a device, an electronic device and a medium for calculating the similarity of official seal images, wherein the method for calculating the similarity comprises the following steps: acquiring a first target official seal image and a second target official seal image; according to a pre-acquired first similarity model, carrying out similarity comparison on the first target official seal image and the second target official seal image to obtain a similarity value; and obtaining a similarity judgment result according to the similarity value and a preset similarity threshold value. According to the method, the similarity model is applied, the method of extracting and comparing the local characteristics of the images instead of feature matching and the like is used for comparing the similarity of the first target official seal image and the second target official seal image, whether the first target official seal image and the second target official seal image are similar is judged based on the whole image, the problems of color interference, background noise interference, image blurring and the like in a complex scene can be avoided, and the similarity judgment result with higher reliability is obtained.

Description

Method and device for calculating similarity of official seal images, electronic equipment and medium
Technical Field
The application relates to the technical field of image processing, in particular to a method and a device for calculating similarity of official seal images, electronic equipment and a medium.
Background
The official seal refers to a seal used by organs, groups and enterprises and public institutions, and the official seal image is a series of images including the official seal in the content.
In recent years, image processing techniques have been developed to greatly facilitate the use of official seals by people, such as official seal identification based on official seal images, and official seal authenticity identification. Generally, the industry often uses a feature matching method to complete the process of calculating the similarity of the official seal, and the application of this method has a high requirement on the definition of the image of the official seal, but in an actual application scene, the definition of the image of the official seal is low, and if the similarity of the official seal is calculated by the feature matching method, the reliability of the calculation result of the similarity of the official seal is reduced, that is, the applicability of the conventional similarity calculation method of the official seal in a complex scene is poor.
Disclosure of Invention
The application aims to provide a method and a device for calculating the similarity of official seal images, electronic equipment and a medium, which are used for solving the problem that the conventional official seal similarity calculation method is poor in applicability in a complex scene.
In a first aspect, an embodiment of the present application provides a method for calculating similarity of official seal images, including:
acquiring a first target official seal image and a second target official seal image;
carrying out similarity comparison on the first target official seal image and the second target official seal image according to a pre-acquired first similarity model to obtain a similarity value, wherein the first similarity model is a model constructed based on a deep learning algorithm;
and obtaining a similarity judgment result according to the similarity value and a preset similarity threshold value.
Optionally, the obtaining process of the first similarity model includes:
acquiring a sample set and N candidate similarity models, wherein N is an integer greater than or equal to 1;
performing data enhancement on the sample set to obtain an enhanced sample set;
and training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model, wherein the first similarity model is the candidate similarity model with the highest recognition accuracy in the trained N candidate similarity models.
Optionally, the training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model includes:
obtaining a training subset and a verification subset according to the enhanced sample set;
training the N candidate similarity models according to the training subsets to obtain M candidate similarity models, wherein M is an integer greater than or equal to N;
verifying the M candidate similarity models according to the verification subset to obtain verification information corresponding to each candidate similarity model, wherein the verification information comprises the identification accuracy of the candidate similarity models;
and determining the candidate similarity model with the highest identification accuracy rate in the M candidate similarity models as the first similarity model.
Optionally, after the first target official seal image and the second target official seal image are obtained, before the similarity comparison between the first target official seal image and the second target official seal image is performed according to the pre-obtained first similarity model to obtain a similarity value, the method further includes:
acquiring first weight information corresponding to the first similarity model;
converting the first weight information into second weight information, wherein the number of dependency libraries of the configuration environment corresponding to the second weight information is less than that of the dependency libraries of the configuration environment corresponding to the first weight information;
generating a second similarity model according to the second weight information, wherein the processing efficiency of the second similarity model is higher than that of the first similarity model;
according to a pre-acquired first similarity model, similarity comparison is carried out on the first target official seal image and the second target official seal image, and a similarity value is obtained, wherein the similarity value comprises the following steps:
and comparing the similarity of the first target official seal image and the second target official seal image according to the second similarity model to obtain the similarity value.
Optionally, the performing similarity comparison on the first target official seal image and the second target official seal image according to a pre-obtained first similarity model to obtain a similarity value includes:
the first target official seal image and the second target official seal image are subjected to standardization processing, and a first standard image and a second standard image are obtained respectively;
comparing the similarity of the first standard image and the second standard image according to the first similarity model to obtain similar information;
and carrying out normalization processing on the similar information to obtain the similar value.
Optionally, when the value range of the similarity value is [0, 1], the similarity threshold is greater than or equal to 0.4 and less than 1.
Optionally, the first similarity model includes an attention mechanism component.
In a second aspect, an embodiment of the present application provides an apparatus for calculating similarity of official seal images, including:
the first acquisition module is used for acquiring a first target official seal image and a second target official seal image;
the comparison module is used for comparing the similarity of the first target official seal image and the second target official seal image according to a pre-acquired first similarity model to obtain a similarity value, wherein the first similarity model is a model constructed based on a deep learning algorithm;
and the judging module is used for obtaining a similarity judging result according to the similarity value and a preset similarity threshold value.
Optionally, the similarity calculation apparatus further includes a second obtaining module for obtaining the first similarity model, where the second obtaining module includes:
the data acquisition unit is used for acquiring a sample set and N candidate similarity models, wherein N is an integer greater than or equal to 1;
the sample enhancement unit is used for carrying out data enhancement on the sample set to obtain an enhanced sample set;
and the training unit is used for training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model, wherein the first similarity model is the candidate similarity model with the highest recognition accuracy in the trained N candidate similarity models.
Optionally, the training unit includes:
obtaining a training subset and a verification subset according to the enhanced sample set;
training the N candidate similarity models according to the training subsets to obtain M candidate similarity models, wherein M is an integer greater than or equal to N;
verifying the M candidate similarity models according to the verification subset to obtain verification information corresponding to each candidate similarity model, wherein the verification information comprises the identification accuracy of the candidate similarity models;
and determining the candidate similarity model with the highest identification accuracy rate in the M candidate similarity models as the first similarity model.
Optionally, the similarity calculation apparatus further includes a conversion module, where the conversion module includes:
acquiring first weight information corresponding to the first similarity model;
converting the first weight information into second weight information, wherein the number of dependency libraries of the configuration environment corresponding to the second weight information is less than that of the dependency libraries of the configuration environment corresponding to the first weight information;
generating a second similarity model according to the second weight information, wherein the processing efficiency of the second similarity model is higher than that of the first similarity model;
the comparison module comprises:
and comparing the similarity of the first target official seal image and the second target official seal image according to the second similarity model to obtain the similarity value.
Optionally, the comparing module includes:
the first target official seal image and the second target official seal image are subjected to standardization processing, and a first standard image and a second standard image are obtained respectively;
according to the first similarity model, similarity comparison is carried out on the first standard image and the second standard image to obtain similar information;
and carrying out normalization processing on the similar information to obtain the similar value.
Optionally, when the value range of the similarity value is [0, 1], the similarity threshold is greater than or equal to 0.4 and less than 1.
Optionally, the first similarity model includes an attention mechanism component.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a processor, a memory, and a program or instructions stored on the memory and executable on the processor, the program or instructions, when executed by the processor, implementing the steps in the method for calculating the similarity of official seal images according to the first aspect.
In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instructions are stored, and when the program or instructions are executed by a processor, the program or instructions implement the steps in the method for calculating the similarity of official seal images according to the first aspect.
In the embodiment of the application, the similarity comparison is performed on the first target official seal image and the second target official seal image by using a method of extracting and comparing local characteristics of images such as a substituted feature matching method in a similarity model application manner, and whether the first target official seal image and the second target official seal image are similar is judged based on the whole image, so that the problems of color interference, background noise interference, image blurring and the like in a complex scene can be avoided, and a similarity judgment result with higher reliability can be obtained.
Drawings
Fig. 1 is a flowchart of a method for calculating similarity of official seal images according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an apparatus for calculating similarity of official seal images according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a flowchart of a method for calculating similarity of official seal images according to an embodiment of the present application, and as shown in fig. 1, the method for calculating similarity includes:
step 101, a first target official seal image and a second target official seal image are obtained.
And 102, comparing the similarity of the first target official seal image and the second target official seal image according to a pre-acquired first similarity model to obtain a similarity value, wherein the first similarity model is a model constructed based on a deep learning algorithm.
And 103, obtaining a similarity judgment result according to the similarity value and a preset similarity threshold value.
In the technical field of image processing, the related art mostly adopts a feature matching manner to complete similarity comparison between the first target official seal image and the second target official seal image, and such a feature matching manner is implemented based on local features in the images, and in a case that imaging quality of the first target official seal image and the second target official seal image is poor (for example, image blur, image color interference, background noise interference, and the like), the identified local features for characterizing the first target official seal image and/or the second target official seal image are unstable, which results in low reliability of a final output similarity determination result.
The similarity calculation method provided by the application completes the similarity comparison between the first target official seal image and the second target official seal image by applying the similarity model instead of the feature matching mode, can reduce the adverse effect caused by the local feature blurring of the images under the condition that the imaging quality of the first target official seal image and/or the second target official seal image is poor, judges whether the first target official seal image and the second target official seal image are similar or not based on the whole images, and accordingly outputs the similarity judgment result with higher reliability.
The first target official seal image and the second target official seal image are both images of which the contents comprise official seals.
The data sources of the first target official seal image and the second target official seal image may be the same, for example, the first target official seal image and the second target official seal image are both images uploaded by a user, that is, the user determines whether the official seal corresponding to the first target official seal image is the same as the official seal corresponding to the second target official seal image by the similarity calculation method.
The data sources of the first target official seal image and the second target official seal image may also be different, for example, the first target official seal image is an image uploaded by a user, and the second target official seal image is an image stored in the database, that is, the user determines whether at least one official seal corresponding to the official seal image in the database is the same as the official seal corresponding to the first target official seal image by using the similarity calculation method.
The first similarity model is any one of similarity network models in deep learning or a combination of two or more similarity network models, which is not limited in the present invention. For example, the first similarity model may be a similarity model constructed based on a twin Network (Siamese Network); the first similarity model can also be a similarity model constructed based on a FaceNet network; the first similarity model can also be a similarity model constructed by integrating a twin network and a FaceNet network, namely, different weights are respectively given to the output result of the twin network and the output result of the FaceNet network, and the final similarity recognition result is output in a weighting calculation mode.
The similarity determination result comprises a first determination result and a second determination result, wherein the first determination result is used for indicating that a official seal corresponding to the first target official seal image is the same as an official seal corresponding to the second target official seal image, and the second determination result is used for indicating that the official seal corresponding to the first target official seal image is different from the official seal corresponding to the second target official seal image.
The specific execution process of step 103 may be:
acquiring the similarity value and a preset similarity threshold;
if the similarity value is larger than the similarity threshold value, outputting the first judgment result;
and if the similarity value is smaller than or equal to the similarity threshold, outputting the second judgment result.
Optionally, the obtaining process of the first similarity model includes:
acquiring a sample set and N candidate similarity models, wherein N is an integer greater than or equal to 1;
performing data enhancement on the sample set to obtain an enhanced sample set;
and training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model, wherein the first similarity model is the candidate similarity model with the highest recognition accuracy in the trained N candidate similarity models.
Each element (i.e., each sample official seal image) in the sample set may be acquired by a user through a camera device (e.g., a camera, a smart phone, etc.), may also be downloaded by the user from a network resource library, and may also be identified from an input file, which is not limited in this application.
As described above, by means of data enhancement, the number of elements in the sample set can be reasonably filled under the condition that the number of elements in the sample set is small, so that the problem of under-fitting of the alternative similarity model in the training process is avoided; the element diversity of the enhanced sample set can be improved, the enhanced sample set can better simulate the first target official seal image and/or the second target official seal image, the generalization capability and the robustness of the first similarity model determined after the training of the N alternative similarity models are improved, and the first similarity model can output a similarity judgment result with high reliability in a complex scene.
In practice, the data enhancement modes include but are not limited to: a mode of increasing or decreasing the value of the saturation of each sample common seal image in the sample set, a mode of increasing or decreasing the value of the contrast of each sample common seal image in the sample set, a mode of increasing or decreasing the value of the brightness of each sample common seal image in the sample set, a mode of performing graying processing on each sample common seal image in the sample set, a mode of rotating each sample common seal image in the sample set, a mode of performing random clipping or edge pixel block addition on each sample common seal image in the sample set, and the like; the user can select one or more of the above data enhancement modes to complete the data enhancement work on the sample set based on actual needs.
Further, the training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model includes:
obtaining a training subset and a verification subset according to the enhanced sample set;
training the N candidate similarity models according to the training subsets to obtain M candidate similarity models, wherein M is an integer greater than or equal to N;
verifying the M candidate similarity models according to the verification subset to obtain verification information corresponding to each candidate similarity model, wherein the verification information comprises the identification accuracy of the candidate similarity models;
and determining the candidate similarity model with the highest identification accuracy rate in the M candidate similarity models as the first similarity model.
Further, in order to improve the efficiency of the similarity model training, an embodiment of the present invention provides to classify the sample official seal images, where the classification of the multiple sample official seal images may be performed before the sample set is subjected to data processing (for example, data enhancement) after the sample set is obtained, or may be performed after the sample set is subjected to enhancement processing, and the obtained enhanced sample set is classified, which is not limited in this respect.
As described above, after obtaining the enhanced sample set, the user classifies the plurality of sample official seal images in the enhanced sample set according to the official seal corresponding to each sample official seal image in the enhanced sample set, that is, the plurality of sample official seal images corresponding to the same official seal belong to the same class; the method includes the steps that a plurality of sample official seal images belonging to different classes can be distinguished through folders or label files, for example, under the condition that the different sample official seal images are distinguished in a folder mode and comprise a first sample official seal image and a second sample official seal image, if a corresponding official seal of the first sample official seal image is the same as a corresponding official seal of the second sample official seal image, the first sample official seal image and the second sample official seal image are stored in the same folder; if the official seal corresponding to the first sample official seal image is different from the official seal corresponding to the second sample official seal image, the first sample official seal image and the second sample official seal image are stored in different folders, and the probability of classification errors of the sample official seal images can be reduced by distinguishing the sample official seal images through the folders.
After classifying the sample official seal images, a plurality of training units are formed by randomly selecting two sample official seal images from a plurality of classes, wherein each training unit comprises similar attributes, the similar attributes are generally binary values, illustratively, when the similar attributes are set to be 1, the two sample official seal images included by the training unit belong to the same class, and when the similar attributes are set to be 0, the two sample official seal images included by the training unit belong to different classes. And subsequently finishing the training of a plurality of candidate similarity models through a plurality of training units to obtain the first similarity model.
In order to better apply the obtained training units, the training units may be further divided, for example, by means of random classification, into a training subset, a verification subset and a test subset; then training the N candidate similarity models through the training subsets to obtain M candidate similarity models; then, the verification subset is utilized to verify the M candidate similarity models, and the precision and the recall rate (namely the recognition accuracy rate) corresponding to each candidate similarity model are obtained; and finally, determining the candidate similarity model with the highest precision and recall rate as the first similarity model, and simultaneously testing the first similarity model by using the test subset to obtain test information for indicating the reliability of the similarity judgment result output by the first similarity model.
For example, the process of obtaining the candidate similarity model according to the candidate similarity model may be:
if the training round of the training subset for a candidate similarity model is set to be 200 times, and after 100 times of training, the loss function of the candidate similarity model tends to be stable, in the next 100 times of training, every 1 time of training, the obtained candidate similarity model after training is a candidate similarity model, that is, the candidate similarity model can obtain 100 candidate similarity models after training.
It should be noted that, every 1 round of training, the weight information of each node corresponding to the candidate similarity model is adjusted, that is, each node of the candidate similarity models corresponding to the same candidate similarity model is the same, but the weight information of each node is different.
The fact that the loss function tends to be stable generally means that the loss function is less than or equal to a preset loss threshold, and in practice, the loss threshold may be adaptively adjusted based on user requirements, which is not limited in the embodiment of the present application.
In practice, the quantitative ratio between the training, validation and test subsets may be 6: 2: 2; preferably, the number ratio between the training subset, the verification subset and the test subset is set to be 8: 1: 1; in case the number of training units is too large, the ratio of the number between the training subset, the validation subset and the test subset may also be set to 98: 1: 1, the user can adaptively adjust the number ratio according to actual needs, which is not limited in the embodiment of the present application.
Optionally, after the first target official seal image and the second target official seal image are obtained, before the similarity comparison between the first target official seal image and the second target official seal image is performed according to the pre-obtained first similarity model to obtain a similarity value, the method further includes:
acquiring first weight information corresponding to the first similarity model;
converting the first weight information into second weight information, wherein the number of dependency libraries of the configuration environment corresponding to the second weight information is less than that of the dependency libraries of the configuration environment corresponding to the first weight information;
generating a second similarity model according to the second weight information, wherein the processing efficiency of the second similarity model is higher than that of the first similarity model;
according to a pre-acquired first similarity model, similarity comparison is carried out on the first target official seal image and the second target official seal image, and a similarity value is obtained, wherein the similarity value comprises the following steps:
and comparing the similarity of the first target official seal image and the second target official seal image according to the second similarity model to obtain the similarity value.
As described above, the first similarity model suitable for training (the number of the dependency libraries corresponding to the configuration environment is large) is converted into the second similarity model suitable for inference (the number of the dependency libraries corresponding to the configuration environment is small) to improve the similarity determination efficiency of the first target official seal image and the second target official seal image.
The configuration environment corresponding to the similarity model comprises a first type and a second type, wherein the first type configuration environment takes training efficiency as a guide, more dependence libraries (mostly for model training purposes) exist, and the effect of improving the training efficiency of the similarity model is achieved at the cost of sacrificing the detection efficiency of the similarity model; the second type of configuration environment is guided by reasoning efficiency, the number of the dependence libraries is small (mostly for model detection purposes), and the similarity judgment efficiency of the similarity model can be improved to a certain extent.
In practice, in order to increase the obtaining efficiency of the first similarity model, that is, increase the training efficiency of the N candidate similarity models, it is preferable to apply the first-class configuration environment to train the models, that is, to complete the construction and training of the N candidate similarity models in the first-class configuration environment.
After a first similarity model is obtained in a first type of configuration environment, extracting and converting first weight information of the first similarity model to obtain second weight information corresponding to a second type of configuration environment, and generating a second similarity model with higher similarity judgment efficiency based on the second weight information; due to the fact that the number of the dependency libraries of the corresponding configuration environment is smaller, the configuration efficiency of the second similarity model is better than that of the first similarity model, and the use experience of a user can be improved.
The first type of configuration environment includes, but is not limited to, a PyTorch framework, and the second type of configuration environment includes, but is not limited to, an ONNX framework, a TensorRT framework, etc.
Optionally, the performing similarity comparison on the first target official seal image and the second target official seal image according to a pre-obtained first similarity model to obtain a similarity value includes:
standardizing the first target official seal image and the second target official seal image to respectively obtain a first standard image and a second standard image;
comparing the similarity of the first standard image and the second standard image according to the first similarity model to obtain similar information;
and carrying out normalization processing on the similar information to obtain the similar value.
As described above, the normalization processing procedure includes resolution adjustment (the resolution of the first target official seal image and the resolution of the second target official seal image are both adjusted to a resolution suitable for the first similarity model processing), image rotation (the pentagonal star pattern in the first target official seal image is in a state of being laid right, and the pentagonal star pattern in the second target official seal image is in a state of being laid right), dimension expansion, and the like.
Further, after the first standard image is processed, the first similarity model outputs a first vector matrix, after the second standard image is processed, the first similarity model outputs a second vector matrix, the dimension of the first vector matrix is the same as that of the second vector matrix, and the distance between the first vector matrix and the second vector matrix is obtained through calculation, so that the similar information can be obtained; and finally, converting the obtained similar information into a similar value with better visualization effect in a normalization processing mode.
Preferably, the value range of the similarity value is set to [0, 1], in practical application, the value range of the similarity value may also be set to [ -1, 1], and the value range of the similarity value is not limited in the embodiment of the present application.
Further, when the value range of the similarity value is [0, 1], the similarity threshold is greater than or equal to 0.4 and less than 1.
When the value range of the similarity value is set to be [0, 1], judging that the condition that the similarity value is 0 is that the official seal corresponding to the first target official seal image is different from the official seal corresponding to the second target official seal image, and judging that the condition that the similarity value is 1 is that the official seal corresponding to the first target official seal image is the same as the official seal corresponding to the second target official seal image; in practical application, in order to obtain a similarity determination result with high reliability, the similarity threshold is preferably set to be 0.6.
Optionally, the first similarity model includes an attention mechanism component.
By introducing the attention mechanism component, when the first similarity model identifies a plurality of features in the first target official seal image or the second target official seal image, the first similarity model focuses more on key features (such as official seal character features) in the plurality of features so as to further reduce interference caused by adverse factors such as background noise, so that the first vector matrix and the second vector matrix output by the first similarity model can fully represent the features of the first target official seal image and the second target official seal image, and the reliability of a similarity determination result obtained by the first similarity model is further enhanced.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a similarity calculation apparatus 200 for official seal images according to an embodiment of the present application, and as shown in fig. 2, the similarity calculation apparatus 200 includes:
a first obtaining module 201, configured to obtain a first target official seal image and a second target official seal image;
a comparison module 202, configured to perform similarity comparison on the first target official seal image and the second target official seal image according to a pre-obtained first similarity model, so as to obtain a similarity value, where the first similarity model is a model constructed based on a deep learning algorithm;
and the judging module 203 is configured to obtain a similarity judging result according to the similarity value and a preset similarity threshold.
Optionally, the similarity calculation apparatus 200 further includes a second obtaining module for obtaining the first similarity model, where the second obtaining module includes:
the data acquisition unit is used for acquiring a sample set and N candidate similarity models, wherein N is an integer greater than or equal to 1;
the sample enhancement unit is used for carrying out data enhancement on the sample set to obtain an enhanced sample set;
and the training unit is used for training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model, wherein the first similarity model is the candidate similarity model with the highest recognition accuracy in the trained N candidate similarity models.
Optionally, the training unit includes:
obtaining a training subset and a verification subset according to the enhanced sample set;
training the N candidate similarity models according to the training subsets to obtain M candidate similarity models, wherein M is an integer greater than or equal to N;
verifying the M candidate similarity models according to the verification subset to obtain verification information corresponding to each candidate similarity model, wherein the verification information comprises the identification accuracy of the candidate similarity models;
and determining the candidate similarity model with the highest identification accuracy rate in the M candidate similarity models as the first similarity model.
Optionally, the similarity calculation apparatus 200 further includes a conversion module, and the conversion module includes:
acquiring first weight information corresponding to the first similarity model;
converting the first weight information into second weight information, wherein the number of dependency libraries of the configuration environment corresponding to the second weight information is less than that of the dependency libraries of the configuration environment corresponding to the first weight information;
generating a second similarity model according to the second weight information, wherein the processing efficiency of the second similarity model is higher than that of the first similarity model;
the comparison module comprises:
and comparing the similarity of the first target official seal image and the second target official seal image according to the second similarity model to obtain the similarity value.
Optionally, the comparing module 202 includes:
standardizing the first target official seal image and the second target official seal image to respectively obtain a first standard image and a second standard image;
according to the first similarity model, similarity comparison is carried out on the first standard image and the second standard image to obtain similar information;
and carrying out normalization processing on the similar information to obtain the similar value.
Optionally, when the value range of the similarity value is [0, 1], the similarity threshold is greater than or equal to 0.4 and less than 1.
Optionally, the first similarity model includes an attention mechanism component.
The device 200 for calculating the similarity of official seal images in the embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in an electronic apparatus.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 3, the electronic device includes: bus 301, transceiver 302, antenna 303, bus interface 304, processor 305, and memory 306. The processor 305 can implement the processes of the above embodiment of the method for calculating the similarity of official seal images, and can achieve the same technical effects, and for avoiding repetition, the details are not repeated here.
In fig. 3, a bus architecture (represented by bus 301), bus 301 may include any number of interconnected buses and bridges, with bus 301 linking together various circuits including one or more processors, represented by processor 305, and memory, represented by memory 306. The bus 301 may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface 304 provides an interface between the bus 301 and the transceiver 302. The transceiver 302 may be one element or may be multiple elements, such as multiple receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 305 is transmitted over a wireless medium via the antenna 303. further, the antenna 303 receives the data and transmits the data to the processor 305.
The processor 305 is responsible for managing the bus 301 and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And the memory 306 may be used to store data used by the processor 305 in performing operations.
Alternatively, the processor 305 may be a CPU, ASIC, FPGA or CPLD.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the processes of the foregoing method embodiments, and can achieve the same technical effects, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application or portions thereof contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a second terminal device, etc.) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method for calculating the similarity of official seal images, which is characterized by comprising the following steps:
acquiring a first target official seal image and a second target official seal image;
carrying out similarity comparison on the first target official seal image and the second target official seal image according to a pre-acquired first similarity model to obtain a similarity value, wherein the first similarity model is a model constructed based on a deep learning algorithm;
and obtaining a similarity judgment result according to the similarity value and a preset similarity threshold value.
2. The similarity calculation method according to claim 1, wherein the obtaining of the first similarity model includes:
acquiring a sample set and N candidate similarity models, wherein N is an integer greater than or equal to 1;
performing data enhancement on the sample set to obtain an enhanced sample set;
and training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model, wherein the first similarity model is the candidate similarity model with the highest recognition accuracy in the trained N candidate similarity models.
3. The similarity calculation method according to claim 2, wherein the training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model comprises:
obtaining a training subset and a verification subset according to the enhanced sample set;
training the N candidate similarity models according to the training subsets to obtain M candidate similarity models, wherein M is an integer greater than or equal to N;
verifying the M candidate similarity models according to the verification subset to obtain verification information corresponding to each candidate similarity model, wherein the verification information comprises the identification accuracy of the candidate similarity models;
and determining the candidate similarity model with the highest identification accuracy rate in the M candidate similarity models as the first similarity model.
4. The similarity calculation method according to claim 1, wherein after the acquiring the first target official seal image and the second target official seal image, before the similarity comparison of the first target official seal image and the second target official seal image according to the pre-acquired first similarity model to obtain the similarity value, the method further comprises:
acquiring first weight information corresponding to the first similarity model;
converting the first weight information into second weight information, wherein the number of dependency libraries of the configuration environment corresponding to the second weight information is less than that of the dependency libraries of the configuration environment corresponding to the first weight information;
generating a second similarity model according to the second weight information, wherein the processing efficiency of the second similarity model is higher than that of the first similarity model;
according to a pre-acquired first similarity model, similarity comparison is carried out on the first target official seal image and the second target official seal image, and a similarity value is obtained, wherein the similarity value comprises the following steps:
and comparing the similarity of the first target official seal image and the second target official seal image according to the second similarity model to obtain the similarity value.
5. The similarity calculation method according to claim 1, wherein the comparing the similarity of the first target official seal image and the second target official seal image according to a pre-acquired first similarity model to obtain a similarity value comprises:
standardizing the first target official seal image and the second target official seal image to respectively obtain a first standard image and a second standard image;
comparing the similarity of the first standard image and the second standard image according to the first similarity model to obtain similar information;
and carrying out normalization processing on the similar information to obtain the similar value.
6. A similarity calculation apparatus for official seal images, comprising:
the first acquisition module is used for acquiring a first target official seal image and a second target official seal image;
the comparison module is used for comparing the similarity of the first target official seal image and the second target official seal image according to a pre-acquired first similarity model to obtain a similarity value, wherein the first similarity model is a model constructed based on a deep learning algorithm;
and the judging module is used for obtaining a similarity judging result according to the similarity value and a preset similarity threshold value.
7. The similarity calculation apparatus according to claim 6, further comprising a second acquisition module for acquiring the first similarity model, the second acquisition module comprising:
the data acquisition unit is used for acquiring a sample set and N candidate similarity models, wherein N is an integer greater than or equal to 1;
the sample enhancement unit is used for carrying out data enhancement on the sample set to obtain an enhanced sample set;
and the training unit is used for training the N candidate similarity models according to the enhanced sample set to obtain the first similarity model, wherein the first similarity model is the candidate similarity model with the highest recognition accuracy in the trained N candidate similarity models.
8. The similarity calculation apparatus according to claim 7, wherein the training unit includes:
obtaining a training subset and a verification subset according to the enhanced sample set;
training the N candidate similarity models according to the training subsets to obtain M candidate similarity models, wherein M is an integer greater than or equal to N;
verifying the M candidate similarity models according to the verification subset to obtain verification information corresponding to each candidate similarity model, wherein the verification information comprises the identification accuracy of the candidate similarity models;
and determining the candidate similarity model with the highest identification accuracy rate in the M candidate similarity models as the first similarity model.
9. The similarity calculation apparatus according to claim 6, further comprising a conversion module that includes:
acquiring first weight information corresponding to the first similarity model;
converting the first weight information into second weight information, wherein the number of dependency libraries of the configuration environment corresponding to the second weight information is less than that of the dependency libraries of the configuration environment corresponding to the first weight information;
generating a second similarity model according to the second weight information, wherein the processing efficiency of the second similarity model is higher than that of the first similarity model;
the comparison module comprises:
and comparing the similarity of the first target official seal image and the second target official seal image according to the second similarity model to obtain the similarity value.
10. The similarity calculation apparatus according to claim 6, wherein the comparison module comprises:
standardizing the first target official seal image and the second target official seal image to respectively obtain a first standard image and a second standard image;
according to the first similarity model, similarity comparison is carried out on the first standard image and the second standard image to obtain similar information;
and carrying out normalization processing on the similar information to obtain the similar value.
CN202111187915.4A 2021-10-12 2021-10-12 Method and device for calculating similarity of official seal images, electronic equipment and medium Pending CN114913513A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111187915.4A CN114913513A (en) 2021-10-12 2021-10-12 Method and device for calculating similarity of official seal images, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111187915.4A CN114913513A (en) 2021-10-12 2021-10-12 Method and device for calculating similarity of official seal images, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN114913513A true CN114913513A (en) 2022-08-16

Family

ID=82760917

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111187915.4A Pending CN114913513A (en) 2021-10-12 2021-10-12 Method and device for calculating similarity of official seal images, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN114913513A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116645661A (en) * 2023-07-27 2023-08-25 深圳市青虹激光科技有限公司 Method and system for detecting duplicate prevention code

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106297825A (en) * 2016-07-25 2017-01-04 华南理工大学 A kind of speech-emotion recognition method based on integrated degree of depth belief network
CN107480789A (en) * 2017-08-07 2017-12-15 北京中星微电子有限公司 The efficient conversion method and device of a kind of deep learning model
CN108763898A (en) * 2018-05-22 2018-11-06 李招兵 A kind of information processing method and system
CN111275199A (en) * 2020-01-17 2020-06-12 深圳壹账通智能科技有限公司 Conversion method and system of deep learning model file, computer equipment and computer readable storage medium
CN111291765A (en) * 2018-12-07 2020-06-16 北京京东尚科信息技术有限公司 Method and device for determining similar pictures

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106297825A (en) * 2016-07-25 2017-01-04 华南理工大学 A kind of speech-emotion recognition method based on integrated degree of depth belief network
CN107480789A (en) * 2017-08-07 2017-12-15 北京中星微电子有限公司 The efficient conversion method and device of a kind of deep learning model
CN108763898A (en) * 2018-05-22 2018-11-06 李招兵 A kind of information processing method and system
CN111291765A (en) * 2018-12-07 2020-06-16 北京京东尚科信息技术有限公司 Method and device for determining similar pictures
CN111275199A (en) * 2020-01-17 2020-06-12 深圳壹账通智能科技有限公司 Conversion method and system of deep learning model file, computer equipment and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116645661A (en) * 2023-07-27 2023-08-25 深圳市青虹激光科技有限公司 Method and system for detecting duplicate prevention code
CN116645661B (en) * 2023-07-27 2023-11-14 深圳市青虹激光科技有限公司 Method and system for detecting duplicate prevention code

Similar Documents

Publication Publication Date Title
CN110798417A (en) Signal modulation identification method and device based on cyclic residual error network
CN111079841A (en) Training method and device for target recognition, computer equipment and storage medium
US20220207397A1 (en) Artificial Intelligence (AI) Model Evaluation Method and System, and Device
CN111723815B (en) Model training method, image processing device, computer system and medium
CN112381092A (en) Tracking method, device and computer readable storage medium
CN115761366A (en) Zero sample picture classification method, system, device and medium for supplementing missing features
Wang et al. A posterior evaluation algorithm of steganalysis accuracy inspired by residual co-occurrence probability
CN111783812A (en) Method and device for identifying forbidden images and computer readable storage medium
CN113283388B (en) Training method, device, equipment and storage medium of living body face detection model
CN114663705A (en) Video auditing model training method, video auditing method and related device
CN114913513A (en) Method and device for calculating similarity of official seal images, electronic equipment and medium
CN111488950B (en) Classification model information output method and device
Lv et al. A color distance model based on visual recognition
CN110659631A (en) License plate recognition method and terminal equipment
CN112818774A (en) Living body detection method and device
CN108830302B (en) Image classification method, training method, classification prediction method and related device
CN111222558A (en) Image processing method and storage medium
CN115713669A (en) Image classification method and device based on inter-class relation, storage medium and terminal
CN113033525B (en) Training method of image recognition network, electronic device and storage medium
Liu et al. Model compression with generative adversarial networks
CN112766320B (en) Classification model training method and computer equipment
CN114896594A (en) Malicious code detection device and method based on image feature multi-attention learning
CN114241253A (en) Model training method, system, server and storage medium for illegal content identification
CN113870210A (en) Image quality evaluation method, device, equipment and storage medium
CN114283289A (en) Image classification method based on multi-model fusion

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20220816