Trademark recognition method, device and electronic equipment
By calculating the similarity of the trademark's pattern and character features, and using the Euclidean distance and Lewinster distance evaluation values, the problem of low recognition accuracy in the existing technology is solved, and accurate identification of highly similar trademarks is achieved.
Patent Information
- Application Number
- CN202011580593.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-28
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-12-28
AI Technical Summary
Existing trademark recognition technology is difficult to accurately identify highly similar "copycat" trademarks, resulting in low recognition accuracy.
By obtaining the pattern feature vector and string feature of the target trademark, the similarity with multiple sample trademarks is calculated, and the Euclidean distance and Lewinster distance evaluation values are used to determine the matching results and improve the recognition accuracy.
It effectively improves the accuracy of trademark identification and avoids damage to genuine trademarks by "copycat" products.
Smart Images

Figure CN113780268B_ABST
Abstract
Description
Background Art
[0002] With the booming development of e-commerce, a large number of goods are displayed through e-commerce websites. In order to prevent merchants from using "copycat" trademarks that are extremely similar to genuine trademarks to deceive consumers, e-commerce platforms have proposed to conduct trademark inspections on the product images and related qualification materials provided by merchants to prevent consumers from being deceived.
[0003] Due to the huge number of products, a trained image recognition model is usually used to identify trademarks. However, since "copycat" trademarks usually have only slight differences from genuine trademarks in terms of pattern, shape, and color, and the pattern similarity of character information is also extremely high (for example, the "Laoganma" and "Laoyuma" trademarks only differ in Chinese characters, and the "adidas" and "adibas" only differ in characters), it is usually difficult for existing trademark recognition technology to accurately identify highly similar "copycat" trademarks, and the recognition accuracy needs to be improved urgently.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the present disclosure is to provide a trademark recognition method, device and electronic device, which are used to at least to a certain extent overcome the problem that the accuracy of trademark recognition needs to be improved due to the limitations and defects of related technologies.
[0006] According to a first aspect of an embodiment of the present disclosure, a trademark recognition method is provided, including: obtaining a first pattern feature vector and a first character string of a target trademark; calculating a first similarity between the first pattern feature vector and a plurality of second pattern feature vectors of a plurality of sample trademarks, and a second similarity between the first character string and a plurality of second character strings of the plurality of sample trademarks; and determining a matching result between the target trademark and the plurality of sample trademarks according to the first similarity and the second similarity.
[0007] In an exemplary embodiment of the present disclosure, obtaining a first similarity between the first pattern feature vector and a plurality of second pattern feature vectors of a plurality of sample trademarks, and obtaining a second similarity between the first character string and a plurality of second character strings of the plurality of sample trademarks includes:
[0008] Calculating N Euclidean distances between the first pattern feature vector and N second pattern feature vectors of N sample trademarks, where N≥1;
[0009] N Lewinster distances between the first character string and the N second character strings of the N sample trademarks are calculated.
[0010] In an exemplary embodiment of the present disclosure, determining the matching results between the target trademark and the plurality of sample trademarks according to the first similarity and the second similarity includes:
[0011] Determine N evaluation values according to the N Euclidean distances and the N Lewinster distances;
[0012] When the i-th evaluation value with the largest value among the N evaluation values is not zero, it is determined that the i-th sample trademark is the detection result of the target trademark information, 1≤i≤N.
[0013] In an exemplary embodiment of the present disclosure, determining N evaluation values according to the N Euclidean distances and the N Lewinster distances includes:
[0014] When the jth Euclidean distance is less than the first threshold and the jth Lewinster distance is less than the second threshold, the jth Euclidean distance and the jth Lewinster distance are substituted into a preset formula to obtain a jth evaluation value, 1≤j≤N;
[0015] When the j-th Euclidean distance is greater than or equal to the first threshold or the j-th Leverkusen distance is greater than or equal to the second threshold, the j-th evaluation value is set to zero.
[0016] In an exemplary embodiment of the present disclosure, the preset formula includes Sj=A*(Th1 / Ej)+B*(Th2 / Lj), wherein A and B are weight values, A+B=1, Sj is the jth evaluation value, Ej is the jth Euclidean distance, Lj is the jth Lewinster distance, Th1 is the first threshold, and Th2 is the second threshold.
[0017] In an exemplary embodiment of the present disclosure, the method for determining the first threshold includes:
[0018] Obtaining M minimum Euclidean distances between the M preset trademarks and the N sample trademarks;
[0019] Determine K hypothesized first thresholds between a maximum value among the M minimum Euclidean distances and zero;
[0020] Determining K F1 scores corresponding to the K assumed first thresholds according to the correspondence between the M preset trademarks and the N sample trademarks, and the M minimum Euclidean distances;
[0021] The hypothetical first threshold with the largest F1 score is determined as the first threshold.
[0022] In an exemplary embodiment of the present disclosure, the obtaining of the first pattern feature vector and the first character string of the target trademark includes:
[0023] Using a preset trademark detection model to obtain one or more target trademarks;
[0024] Acquire a preset number of pattern features in the target trademark, and generate the first pattern feature vector according to the preset number of pattern features;
[0025] Characters in the target trademark are detected, and when characters are detected in the target trademark, the first character string is generated according to positions of the detected characters in the target trademark.
[0026] According to a second aspect of an embodiment of the present disclosure, there is provided a trademark recognition device, including:
[0027] A feature extraction module, configured to obtain a first pattern feature vector and a first character string of a target trademark;
[0028] a similarity calculation module, configured to calculate a first similarity between the first pattern feature vector and a plurality of second pattern feature vectors of a plurality of sample trademarks, and a second similarity between the first character string and a plurality of second character strings of the plurality of sample trademarks;
[0029] The target matching module is configured to determine a matching result between the target trademark and the plurality of sample trademarks according to the first similarity and the second similarity.
[0030] According to a third aspect of the present disclosure, there is provided an electronic device, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute any one of the methods described above based on instructions stored in the memory.
[0031] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a program is stored, and when the program is executed by a processor, the trademark recognition method as described in any one of the above items is implemented.
[0032] The disclosed embodiment extracts the pattern features and character features of the target trademark, and identifies the target trademark by matching the pattern features and character features together, which can effectively improve the recognition accuracy of the trademark and prevent "counterfeit" products from damaging the normal use of the trademark.
[0033] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0035] Figure 1 is a flow chart of a trademark recognition method in an exemplary embodiment of the present disclosure.
[0036] Figure 2 It is a sub-flow chart of step S1 in one embodiment of the present disclosure.
[0037] Figure 3 It is a sub-flow chart of step S3 in one embodiment of the present disclosure.
[0038] Figure 4 The present invention is a flowchart for determining a first threshold value in one embodiment of the present invention.
[0039] Figure 5 It is a flowchart of a trademark recognition process in an application scenario of the present disclosure.
[0040] Figure 6 It is a block diagram of a trademark recognition device in an exemplary embodiment of the present disclosure.
[0041] Figure 7 is a block diagram of an electronic device in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0042] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0043] In addition, the accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities, which do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0044] The exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0045] Figure 1 The flowchart of the trademark recognition method in the exemplary embodiment of the present disclosure is schematically shown. Figure 1 , the trademark recognition method 100 may include:
[0046] Step S1, obtaining a first pattern feature vector and a first character string of a target trademark;
[0047] Step S2, calculating a first similarity between the first pattern feature vector and a plurality of second pattern feature vectors of a plurality of sample trademarks, and a second similarity between the first character string and a plurality of second character strings of the plurality of sample trademarks;
[0048] Step S3: determining a matching result between the target trademark and the plurality of sample trademarks according to the first similarity and the second similarity.
[0049] The disclosed embodiment extracts the pattern features and character features of the target trademark, and identifies the target trademark by matching the pattern features and character features together, which can effectively improve the recognition accuracy of the trademark and prevent "counterfeit" products from damaging the normal use of the trademark.
[0050] Next, each step of the trademark recognition method 100 is described in detail.
[0051] In step S1, a first pattern feature vector and a first character string of a target trademark are obtained.
[0052] Figure 2 It is a sub-flow chart of step S1 in one embodiment of the present disclosure.
[0053] refer to Figure 2 , step S1 may include:
[0054] Step S11, using a preset trademark detection model to obtain one or more target trademarks;
[0055] Step S12, obtaining a preset number of pattern features in the target trademark, and generating the first pattern feature vector according to the preset number of pattern features;
[0056] Step S13: detecting characters in the target trademark, and when characters are detected in the target trademark, generating the first character string according to positions of the detected characters in the target trademark.
[0057] In the embodiments of the present disclosure, a trademark detection model may be first trained using a target detection algorithm to detect trademark patterns (0, 1 or more) from images (photos, video frames or other visual displays), which are referred to as target trademarks in the present disclosure. The types of target detection models may be, for example, Faster RCNN (Faster Region-Convolutional Neural Networks) models, SSD (Single Shot MultiBox Detector) models, RefineDet models, etc., and the embodiments of the present disclosure do not impose any special restrictions on this.
[0058] In step S12, a pattern feature extraction model pre-trained with an image classification algorithm can be used to extract pattern features of a target trademark, so as to generate a first pattern feature vector according to the obtained preset value pattern features. The image classification algorithm can be, for example, a ResNet (Residual Network) algorithm, a DenseNet (DenseConvolutional Network) algorithm, etc. In one embodiment, the number of preset values of pattern features corresponding to a target trademark is 128, and the first pattern feature vector is 128-dimensional. In other embodiments, the number of preset values can also be more, and those skilled in the art can set it according to actual needs.
[0059] In step S13, a pre-trained character extraction model may be used to extract all characters of the target trademark, and the extracted characters may be combined into a character string, for example, by arranging the characters in order from top to bottom and from left to right.
[0060] In one embodiment, the character extraction model may be, for example, a Mask TextSpotter V3 model. MaskTextSpotter v3 is an OCR (Optical Character Recognition) detection and recognition model, which is an end-to-end model that can detect and recognize strings of any shape. In other embodiments, the character extraction model may also be other types, and those skilled in the art may set it according to actual needs.
[0061] In addition, a trained neural network model can be used to complete trademark detection, pattern feature extraction, and character extraction. The input of the neural network model is set to the image to be detected, and the output is set to the first pattern feature vector and the first character string.
[0062] When there is no character information in the target trademark (ie, the character information returned by the character extraction model is empty), no relevant processing of the characters and character strings is performed in the subsequent steps.
[0063] In step S2, a first similarity between the first pattern feature vector and a plurality of second pattern feature vectors of a plurality of sample trademarks, and a second similarity between the first character string and a plurality of second character strings of the plurality of sample trademarks are calculated.
[0064] In the disclosed embodiments, the first similarity can be represented by the Euclidean distance, for example, and the second similarity can be represented by the Lewinster distance, for example. Euclidean distance, also known as Euclidean distance, is the most common distance metric, which measures the absolute distance between two points in a multidimensional space. It can also be understood as: the true distance between two points in an m-dimensional space, or the natural length of a vector (i.e., the distance from the point to the origin). The Euclidean distance in two-dimensional and three-dimensional space is the actual distance between two points. Lewinster distance is the edit distance, which refers to the minimum number of operations required to transform a string into another string. The operations include: adding a character, deleting a character, and modifying a character.
[0065] In one embodiment of the present disclosure, first, N Euclidean distances between the first pattern feature vector and N second pattern feature vectors of N sample trademarks may be calculated, where N≥1, and then N Lewinster distances between the first character string and N second character strings of the N sample trademarks may be calculated.
[0066] Among them, N Euclidean distances can be written into a first array of float type, and the N Lewinster distances can be written into a second array of int type, wherein the number of elements in the first array and the second array are both N, and the i-th element in the two arrays corresponds to the i-th sample trademark, 1≤i≤N.
[0067] In step S3, the matching result between the target trademark and the plurality of sample trademarks is determined according to the first similarity and the second similarity.
[0068] Figure 3 It is a sub-flow chart of step S3 in one embodiment of the present disclosure.
[0069] refer to Figure 3 , step S3 may include:
[0070] Step S31, determining N evaluation values according to the N Euclidean distances and the N Lewinster distances;
[0071] Step S32: when the i-th evaluation value with the largest value among the N evaluation values is not zero, determining that the i-th sample trademark is the detection result of the target trademark information, 1≤i≤N.
[0072] Among them, step S31, for example, can be that when the jth Euclidean distance is less than the first threshold and the jth Lewinster distance is less than the second threshold, the jth Euclidean distance and the jth Lewinster distance are substituted into a preset formula to obtain the jth evaluation value, where j≤N; when the jth Euclidean distance is greater than or equal to the first threshold or the jth Lewinster distance is greater than or equal to the second threshold, the jth evaluation value is set to zero.
[0073] By normalizing the elements in the first array and the second array, taking the reciprocals and performing weighted summation, the evaluation score of the target trademark for each sample trademark can be obtained.
[0074] In one embodiment, the preset formula is:
[0075] Sj=A*(Th1 / Ej)+B*(Th2 / Lj) (1)
[0076] Where A and B are weight values, A+B=1, Sj is the jth evaluation value, Ej is the jth Euclidean distance, i.e., the jth element of the first array; Lj is the jth Lewinsky distance, i.e., the jth element of the second array; Th1 is the first threshold, and Th2 is the second threshold. In one embodiment, A=B=0.5. The value of the weight can be determined by itself according to the debugging result, and the present disclosure is not limited to this.
[0077] When the target trademark does not have any characters, the following formula can be used for identification:
[0078] Sj=A*(Th1 / Ej) (2)
[0079] After processing in step S31, when the N Euclidean distances in the target trademark are all greater than the first threshold, or the N Lewinster distances are all greater than the second threshold, all elements of the first array and the second array are zero. That is, the maximum value of the N evaluation values is zero, indicating that the target trademark and the sample trademark cannot match. When the maximum value of the N evaluation values is the i-th evaluation value, and the i-th evaluation value is not zero, it is determined that the target trademark matches the i-th sample trademark.
[0080] The function of outputting trademark recognition results can also be integrated with the aforementioned trademark detection function in the same neural network, that is, trademark detection, pattern feature vector extraction, character vector extraction, Euclidean distance calculation, Leverkusen distance calculation, evaluation value calculation, and matching result output can be achieved through a trained neural network.
[0081] In order to realize the model function, it is necessary to train the parameters of the model in advance, wherein the first threshold and the second threshold need to be reasonably determined to achieve more accurate trademark detection.
[0082] Figure 4 The present invention is a flowchart for determining a first threshold value in one embodiment of the present invention.
[0083] refer to Figure 4 , the process of determining the first threshold may include:
[0084] Step S41, obtaining M minimum Euclidean distances between the M preset trademarks and the N sample trademarks;
[0085] Step S42, determining K hypothesized first thresholds between the maximum value of the M minimum Euclidean distances and zero;
[0086] Step S43, determining K F1 scores corresponding to the K assumed first thresholds according to the correspondence between the M preset trademarks and the N sample trademarks, and the M minimum Euclidean distances;
[0087] Step S44: determine the hypothetical first threshold with the largest F1 score as the first threshold.
[0088] First, multiple trademark images can be collected as sample trademarks, a pattern feature extraction model can be used to generate and record a second pattern feature vector for each sample trademark, character information in the sample trademark can be manually annotated, and a second character string for each sample trademark can be generated and recorded.
[0089] Then, a plurality of preset trademarks participating in the training are obtained, and the preset trademarks may include sample trademarks or non-sample trademarks. In some embodiments, a portion of the sample trademarks may be used as preset trademarks participating in the training, and the sample trademarks as preset trademarks may be marked, thereby improving the efficiency of verifying the final recognition result of the sample trademark.
[0090] Since the input target trademark may not be among the sample trademarks, a first threshold needs to be determined to eliminate the results that are greater than the first threshold (i.e., very dissimilar) among the N Euclidean distances between the target trademark and the N sample trademarks. If the first threshold is set too large, some target trademarks that are not very similar to the sample trademarks will be judged to meet the similarity standard, reducing the recognition accuracy; if the first threshold is set too small, the impact of different shooting conditions on the image may cause the target trademark to be one of the sample trademarks, but it cannot be recognized as matching the sample trademark.
[0091] In order to set a suitable first threshold, the embodiment of the present disclosure first determines M minimum Euclidean distances (ie, distances used for detection) corresponding to M preset trademarks, and then uses the M minimum Euclidean distances to verify the detection effect of the assumed threshold.
[0092] First, K assumed preset values may be selected between 0 and the maximum value of the M minimum Euclidean distances. In one embodiment, the assumed preset value may be obtained between 0 and the maximum value of the M minimum Euclidean distances with a step size of 0.1. For example, when the maximum value is 5, the preset thresholds of 0.1, 0.2, ... 4.8, 4.9, etc. may be taken as the assumed first thresholds.
[0093] Then, the F1 score of the detection result under each assumed first threshold is obtained to evaluate the detection effect of each assumed first threshold.
[0094] The F1 score, also known as the balanced F score, is an indicator used in statistics to measure the accuracy of a binary classification model. Its maximum value is 1 and its minimum value is 0. It can be regarded as a harmonic mean of the model's precision and recall, taking into account both the precision and recall of the classification model.
[0095] The calculation formula of F1 score is:
[0096] F1=2*P*R / (P+R) (3)
[0097] Among them, P is the detection accuracy corresponding to a hypothetical first threshold, that is, when a preset trademark with a Euclidean distance greater than the hypothetical first threshold is judged as having no matching trademark among N sample trademarks, and a preset trademark with a Euclidean distance less than the hypothetical first threshold is judged as having a matching trademark among N sample trademarks, the ratio of the number of preset trademarks judged to have a matching trademark to the number of all preset trademarks; R is the recall rate corresponding to a hypothetical first threshold, that is, when a preset trademark with a Euclidean distance greater than the hypothetical first threshold is judged as having no matching trademark among N sample trademarks, and a preset trademark with a Euclidean distance less than the hypothetical first threshold is judged as having a matching trademark among N sample trademarks, the ratio of the number of preset trademarks judged to have a matching trademark to the number of all preset trademarks.
[0098] Since a higher F1 score indicates a more reasonable threshold setting, after obtaining the F1 score corresponding to each assumed first threshold, the assumed first threshold corresponding to the highest F1 score may be set as the first threshold.
[0099] The determination of the second threshold is the same as the second threshold, that is, obtaining M minimum Lewinster distances between M preset trademarks and N sample trademarks; determining K hypothetical second thresholds between the maximum value and zero among the M minimum Lewinster distances; determining K F1 scores corresponding to the K hypothetical second thresholds based on the correspondence between the M preset trademarks and the N sample trademarks, and the M minimum Lewinster distances; and determining the hypothetical second threshold with the largest F1 score as the second threshold.
[0100] By setting reasonable first threshold and second threshold, the detection accuracy can be improved.
[0101] Figure 5 It is a flowchart of a trademark recognition process in an application scenario of the present disclosure.
[0102] refer to Figure 5 , the trademark identification process 500 may include:
[0103] Step S51, obtaining a picture to be detected;
[0104] Step S52, using the trademark detection model to detect the target trademark in the image to be detected;
[0105] Step S53, obtaining a first pattern feature vector of the target trademark;
[0106] Step S54, obtaining N Euclidean distances between the first pattern feature vector and the N second pattern feature vectors;
[0107] Step S55, determining whether the first character string of the target trademark can be obtained, if yes, proceeding to step S56, if no, proceeding to step S58;
[0108] Step S56, obtaining N Lewinster distances between the first character string and the N second character strings;
[0109] Step S57, determining N evaluation values according to the N Euclidean distances and the N Leverkusen distances;
[0110] Step S58, determining N evaluation values according to the N Euclidean distances;
[0111] Step S59, determine whether the maximum value among the N evaluation values is equal to zero. If so, proceed to step S510 to output target matching failure information. If not, proceed to step S511 to output the sample trademark corresponding to the maximum value among the N evaluation values as the detection result.
[0112] Corresponding to the above method embodiment, the present disclosure also provides a trademark identification device, which can be used to execute the above method embodiment.
[0113] Figure 6 The following schematically shows a block diagram of a trademark recognition device in an exemplary embodiment of the present disclosure.
[0114] refer to Figure 6 , the trademark recognition device 600 may include:
[0115] A feature extraction module 61 is configured to obtain a first pattern feature vector and a first character string of a target trademark;
[0116] a similarity calculation module 62, configured to calculate a first similarity between the first pattern feature vector and a plurality of second pattern feature vectors of a plurality of sample trademarks, and a second similarity between the first character string and a plurality of second character strings of the plurality of sample trademarks;
[0117] The target matching module 63 is configured to determine a matching result between the target trademark and the plurality of sample trademarks according to the first similarity and the second similarity.
[0118] In an exemplary embodiment of the present disclosure, the similarity calculation module 62 is configured to: calculate N Euclidean distances between the first pattern feature vector and N second pattern feature vectors of N sample trademarks, N≥1; calculate N Lewinster distances between the first character string and N second character strings of the N sample trademarks.
[0119] In an exemplary embodiment of the present disclosure, the target matching module 63 is configured to: determine N evaluation values based on the N Euclidean distances and the N Lewinster distances; when the i-th evaluation value with the largest value among the N evaluation values is not zero, determine that the i-th sample trademark is the detection result of the target trademark information, 1≤i≤N.
[0120] In an exemplary embodiment of the present disclosure, the target matching module 63 is set to: when the jth Euclidean distance is less than a first threshold and the jth Lewinster distance is less than a second threshold, the jth Euclidean distance and the jth Lewinster distance are substituted into a preset formula to obtain the jth evaluation value, 1≤j≤N; when the jth Euclidean distance is greater than or equal to the first threshold or the jth Lewinster distance is greater than or equal to the second threshold, the jth evaluation value is set to zero.
[0121] In an exemplary embodiment of the present disclosure, the preset formula includes Sj=A*(Th1 / Ej)+B*(Th2 / Lj), wherein A and B are weight values, A+B=1, Sj is the jth evaluation value, Ej is the jth Euclidean distance, Lj is the jth Lewinster distance, Th1 is the first threshold, and Th2 is the second threshold.
[0122] In an exemplary embodiment of the present disclosure, it also includes a threshold determination module 64, which is configured to: obtain M minimum Euclidean distances between the M preset trademarks and the N sample trademarks; determine K hypothetical first thresholds between the maximum value of the M minimum Euclidean distances and zero; determine K F1 scores corresponding to the K hypothetical first thresholds based on the correspondence between the M preset trademarks and the N sample trademarks, and the M minimum Euclidean distances; and determine the hypothetical first threshold with the largest F1 score as the first threshold.
[0123] In an exemplary embodiment of the present disclosure, the feature extraction module 61 is configured to: use a preset trademark detection model to obtain one or more of the target trademarks; obtain a preset value of pattern features in the target trademark, and generate the first pattern feature vector based on the preset value of pattern features; detect characters in the target trademark, and when characters are detected in the target trademark, generate the first character string based on the position of the detected characters in the target trademark.
[0124] Since the functions of the device 600 have been described in detail in the corresponding method embodiments, the present disclosure will not elaborate on them here.
[0125] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0126] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0127] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0128] Refer to the following Figure 7 An electronic device 700 according to this embodiment of the present invention will be described. Figure 7 The electronic device 700 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0129] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include but are not limited to: at least one processing unit 710, at least one storage unit 720, and a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710).
[0130] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 710 can perform the steps shown above.
[0131] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 7201 and / or a cache storage unit 7202 , and may further include a read-only storage unit (ROM) 7203 .
[0132] The storage unit 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0133] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0134] The electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0135] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0136] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0137] The program product for implementing the above method according to an embodiment of the present invention can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0138] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0139] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0140] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0141] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0142] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0143] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and concept of the present disclosure are indicated by the claims.
Claims
1. A trademark identification method, characterized in that: include: Obtaining a first pattern feature vector and a first character string of a target trademark; Calculating a first similarity between the first pattern feature vector and a plurality of second pattern feature vectors of a plurality of sample trademarks, and a second similarity between the first character string and a plurality of second character strings of the plurality of sample trademarks; Determining a matching result between the target trademark and the plurality of sample trademarks according to the first similarity and the second similarity; Wherein, the obtaining of the first similarity between the first pattern feature vector and the plurality of second pattern feature vectors of the plurality of sample trademarks, and the second similarity between the first character string and the plurality of second character strings of the plurality of sample trademarks comprises: calculating N Euclidean distances between the first pattern feature vector and the N second pattern feature vectors of the N sample trademarks, N≥1; calculating N Lewinster distances between the first character string and the N second character strings of the N sample trademarks; Determining the matching results between the target trademark and the multiple sample trademarks according to the first similarity and the second similarity includes: determining N evaluation values according to the N Euclidean distances and the N Lewinster distances; when the i-th evaluation value with the largest value among the N evaluation values is not zero, determining that the i-th sample trademark is the detection result of the target trademark information, 1≤i≤N; Determining N evaluation values according to the N Euclidean distances and the N Lewinster distances includes: when the jth Euclidean distance is less than a first threshold and the jth Lewinster distance is less than a second threshold, substituting the jth Euclidean distance and the jth Lewinster distance into a preset formula to obtain the jth evaluation value, 1≤j≤N; when the jth Euclidean distance is greater than or equal to the first threshold or the jth Lewinster distance is greater than or equal to the second threshold, setting the jth evaluation value to zero; The method for determining the first threshold includes: obtaining M minimum Euclidean distances between the M preset trademarks and the N sample trademarks; determining K hypothetical first thresholds between the maximum value and zero among the M minimum Euclidean distances; determining K F1 scores corresponding to the K hypothetical first thresholds according to the corresponding relationship between the M preset trademarks and the N sample trademarks, and the M minimum Euclidean distances; and determining the hypothetical first threshold with the largest F1 score as the first threshold.
2. The trademark recognition method according to claim 1, characterized in that: The preset formula includes Sj=A*(Th1 / Ej)+B*(Th2 / Lj), where A and B are weight values, A+B=1, Sj is the jth evaluation value, Ej is the jth Euclidean distance, Lj is the jth Lewinster distance, Th1 is the first threshold, and Th2 is the second threshold.
3. The trademark recognition method according to claim 1, characterized in that: The step of obtaining the first pattern feature vector and the first character string of the target trademark includes: Using a preset trademark detection model to obtain one or more target trademarks; Acquire a preset number of pattern features in the target trademark, and generate the first pattern feature vector according to the preset number of pattern features; Characters in the target trademark are detected, and when characters are detected in the target trademark, the first character string is generated according to positions of the detected characters in the target trademark.
4. A trademark identification device, characterized in that: include: A feature extraction module, configured to obtain a first pattern feature vector and a first character string of a target trademark; a similarity calculation module, configured to calculate a first similarity between the first pattern feature vector and a plurality of second pattern feature vectors of a plurality of sample trademarks, and a second similarity between the first character string and a plurality of second character strings of the plurality of sample trademarks; a target matching module, configured to determine a matching result between the target trademark and the plurality of sample trademarks according to the first similarity and the second similarity; The similarity calculation module is configured to: calculate N Euclidean distances between the first pattern feature vector and N second pattern feature vectors of N sample trademarks, N≥1; calculate N Lewinster distances between the first character string and N second character strings of the N sample trademarks; The target matching module is configured to: determine N evaluation values according to the N Euclidean distances and the N Lewinster distances; when the i-th evaluation value with the largest value among the N evaluation values is not zero, determine that the i-th sample trademark is the detection result of the target trademark information, 1≤i≤N; Wherein, determining N evaluation values according to the N Euclidean distances and the N Lewinster distances comprises: When the jth Euclidean distance is less than the first threshold and the jth Lewinster distance is less than the second threshold, the jth Euclidean distance and the jth Lewinster distance are substituted into a preset formula to obtain the jth evaluation value, 1≤j≤N; when the jth Euclidean distance is greater than or equal to the first threshold or the jth Lewinster distance is greater than or equal to the second threshold, the jth evaluation value is set to zero; The method for determining the first threshold includes: obtaining M minimum Euclidean distances between the M preset trademarks and the N sample trademarks; determining K hypothetical first thresholds between the maximum value and zero among the M minimum Euclidean distances; determining K F1 scores corresponding to the K hypothetical first thresholds according to the corresponding relationship between the M preset trademarks and the N sample trademarks, and the M minimum Euclidean distances; and determining the hypothetical first threshold with the largest F1 score as the first threshold.
5. An electronic device, characterized in that: include: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the trademark recognition method according to any one of claims 1 to 3 based on instructions stored in the memory.
6. A computer-readable storage medium having a program stored thereon, wherein when the program is executed by a processor, the trademark recognition method according to any one of claims 1 to 3 is implemented.
