Seal identification method and device, computer equipment and storage medium
By setting the seal color and position conditions in the seal recognition system, the candidate seals in the recognized image are screened, and the problem of low seal recognition accuracy in unsatisfactory environments is solved, achieving more efficient and accurate seal recognition.
Patent Information
- Application Number
- CN202411956279.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-25
AI Technical Summary
In undesirable environments such as low light, strong reflection or blurred image, changes in the color and morphology of the seal lead to a decrease in recognition accuracy, and the back-transparent phenomenon increases the problem of misidentification and misidentification.
By obtaining the image to be identified, it is recognized to determine the position coordinates and confidence of the candidate seal, and filter the candidate seal based on preset conditions such as the color and position of the seal to output the position coordinates and confidence of the target seal.
It improves the accuracy and efficiency of seal recognition, reduces the situation of misidentification and misidentification, and improves the user experience.
Smart Images

Figure CN119888745A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a seal recognition method, device, computer equipment and storage medium. Background Art
[0002] In recent years, with the advancement of educational informatization, grading systems have been increasingly used in various educational institutions. In the grading process, in addition to automated scoring, the recognition of seals on test papers has also become an important part of the system. Especially in exams, homework or assessments, teachers often stamp test papers. These seals, as a special mark, have important recognition and archiving value. In order to realize the electronic grading results, many grading systems have begun to use image recognition technology to automatically identify the seal information on the test paper, thereby further improving the automation level and accuracy of grading.
[0003] However, although the application of image recognition technology in the grading system has made certain progress, in some undesirable environments, such as low light, strong reflection or image blur, the color and shape of the seal may change, and the seal may show through the back of the paper (that is, the seal shows through the back of the paper and appears on the front), resulting in poor recognition accuracy and problems of misrecognition and missed recognition. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a seal recognition method, device, computer equipment and storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, the present application provides a seal recognition method, the method comprising:
[0006] Obtain an image to be recognized;
[0007] Identify the image to be identified, and determine the position coordinates and confidence level of at least one candidate seal from the image to be identified;
[0008] Each candidate seal in the at least one candidate seal is screened based on a preset condition, a candidate seal in the at least one candidate seal that meets the preset condition is used as a target seal, and a position coordinate and a confidence level of the target seal are output, wherein the preset condition includes a seal color condition and / or a seal position condition.
[0009] In combination with any embodiment of the present disclosure, the step of identifying the image to be identified and determining the position coordinates and confidence level of at least one candidate seal from the image to be identified includes:
[0010] According to the image to be identified, generating an enhanced image and a segmented image corresponding to the image to be identified;
[0011] The image to be recognized, the enhanced image and the segmented image are input into a seal recognition model to determine the position coordinates and confidence level of at least one candidate seal.
[0012] In combination with any embodiment of the present disclosure, generating a segmented image corresponding to the image to be identified according to the image to be identified includes:
[0013] An edge detection algorithm is used to perform edge segmentation on the image to be identified, and a segmented image corresponding to the image to be identified is generated.
[0014] In combination with any embodiment of the present disclosure, when the preset condition includes a seal position condition, and the seal position condition is that the seal is located at the text, screening each of the candidate seals based on the preset condition and taking the candidate seals that meet the preset condition as the target seal includes:
[0015] Performing text recognition on the image to be recognized, and determining the position coordinates and confidence level of at least one text line area in the image to be recognized;
[0016] For each candidate seal, determining an intersection area between the candidate seal and each text line region in the at least one text line region;
[0017] If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, the candidate seal is determined as a target seal.
[0018] In combination with any embodiment of the present disclosure, if the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, determining any candidate seal as a target seal includes:
[0019] If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, determine a seal label of the intersection image between any candidate seal and any text line area, wherein the seal label includes a real seal label and a suspicious seal label;
[0020] If the seal label of the intersection image between any candidate seal and any text line area is a suspicious seal label, then based on the character sequence in any text line area, it is determined whether any candidate seal is a target seal.
[0021] In combination with any embodiment of the present disclosure, the step of determining a seal label of an intersection image between any candidate seal and any text line region includes:
[0022] The intersection image of any candidate seal is input into a binary classification model to determine a seal label of the intersection image between any candidate seal and any text line region.
[0023] In combination with any embodiment of the present disclosure, the determining whether any candidate seal is a target seal based on a character sequence in any text line area includes:
[0024] Determine the number of positive characters and the number of non-positive characters in any text line region;
[0025] When the number of the normal characters is greater than the number of the non-normal characters, the candidate seal is determined to be a target seal.
[0026] In combination with any embodiment of the present disclosure, when the preset condition includes a seal color condition and the seal color condition is a target color, screening each of the candidate seals based on the preset condition and taking the candidate seals that meet the preset condition as the target seal includes:
[0027] For each of the candidate seals, obtaining the grayscale value of each pixel in the candidate seal in the target color channel;
[0028] Determine the grayscale square sum of the candidate seal in the target color channel according to the grayscale value of each pixel in the candidate seal in the target color channel;
[0029] The candidate seal whose grayscale square sum is greater than or equal to the second threshold is taken as the target seal.
[0030] In a second aspect, the present application also provides a seal recognition device, comprising:
[0031] An image acquisition module, used for acquiring an image to be identified;
[0032] A first determination module is used to identify the image to be identified, and determine the position coordinates and confidence level of at least one candidate seal from the image to be identified;
[0033] The second determination module is used to screen each candidate seal in the at least one candidate seal based on a preset condition, select the candidate seal in the at least one candidate seal that meets the preset condition as a target seal, and output the position coordinates and confidence of the target seal, wherein the preset condition includes a seal color condition and / or a seal position condition.
[0034] In one embodiment, the first determining module is specifically configured to:
[0035] According to the image to be identified, generating an enhanced image and a segmented image corresponding to the image to be identified;
[0036] The image to be recognized, the enhanced image and the segmented image are input into a seal recognition model to determine the position coordinates and confidence level of at least one candidate seal.
[0037] In one embodiment, the first determining module is specifically configured to:
[0038] An edge detection algorithm is used to perform edge segmentation on the image to be identified, and a segmented image corresponding to the image to be identified is generated.
[0039] In one embodiment, when the preset condition includes a seal position condition and the seal position condition is that the seal is located at the text, the second determining module is specifically configured to:
[0040] Performing text recognition on the image to be recognized, and determining the position coordinates and confidence level of at least one text line area in the image to be recognized;
[0041] For each candidate seal, determining an intersection area between the candidate seal and each text line region in the at least one text line region;
[0042] If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, the candidate seal is determined as a target seal.
[0043] In one embodiment, the second determining module is specifically configured to:
[0044] If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, determine a seal label of the intersection image between any candidate seal and any text line area, wherein the seal label includes a real seal label and a suspicious seal label;
[0045] If the seal label of the intersection image between any candidate seal and any text line area is a suspicious seal label, then based on the character sequence in any text line area, it is determined whether any candidate seal is a target seal.
[0046] In one embodiment, the second determining module is specifically configured to:
[0047] The intersection image of any candidate seal is input into a binary classification model to determine a seal label of the intersection image between any candidate seal and any text line region.
[0048] In one embodiment, the second determining module is specifically configured to:
[0049] Determine the number of positive characters and the number of non-positive characters in any text line region;
[0050] When the number of the normal characters is greater than the number of the non-normal characters, the candidate seal is determined to be a target seal.
[0051] In one embodiment, when the preset condition includes a seal color condition and the seal color condition is a target color, the second determining module is specifically configured to:
[0052] For each of the candidate seals, obtaining the grayscale value of each pixel in the candidate seal in the target color channel;
[0053] Determine the grayscale square sum of the candidate seal in the target color channel according to the grayscale value of each pixel in the candidate seal in the target color channel;
[0054] The candidate seal whose grayscale square sum is greater than or equal to the second threshold is taken as the target seal.
[0055] In a third aspect, the present application provides a computer program product, comprising a computer program / instructions, which implement the steps of the method described in any embodiment when the computer program / instructions are executed by a processor.
[0056] In a fourth aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in any of the above embodiments when executing the program.
[0057] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any of the above embodiments.
[0058] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0059] In the disclosed embodiment, by pre-setting seal color conditions and / or seal position conditions, at least one candidate seal identified from the image to be identified is verified based on the preset conditions, thereby determining the position coordinates and confidence level of the target seal from at least one candidate seal, thereby improving the accuracy and efficiency of seal recognition, reducing the problems of misidentification and missed identification of seals, and improving the user experience.
[0060] 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
[0061] The accompanying drawings, which are incorporated in and constitute a part of this disclosure, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0062] Figure 1 The following is a flow chart of a seal recognition method shown in some exemplary embodiments.
[0063] Figure 2 is a flow chart of another seal recognition method shown in some exemplary embodiments.
[0064] Figure 3 is a flow chart of yet another seal recognition method shown in some exemplary embodiments.
[0065] Figure 4 is a flow chart of yet another seal recognition method shown in some exemplary embodiments.
[0066] Figure 5a It is a schematic diagram of a positive text shown in some exemplary embodiments.
[0067] Figure 5b It is a schematic diagram of a non-positive text shown in some exemplary embodiments.
[0068] Figure 6 FIG. 4 is a schematic diagram of an image to be recognized shown in some exemplary embodiments.
[0069] Figure 7 is a flow chart of yet another seal recognition method shown in some exemplary embodiments.
[0070] Figure 8 The figure is a block diagram of a seal recognition device showing some exemplary embodiments.
[0071] Fig. 9 The figure is a hardware structure diagram of a computer device shown in some exemplary embodiments. DETAILED DESCRIPTION
[0072] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0073] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0074] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0075] Although the application of image recognition technology in the grading system has made certain progress, in some practical scenarios, especially in the case of uneven lighting and poor image quality, the existing seal recognition technology still faces many challenges. In some undesirable environments, such as low light, strong reflection or blurred image, the color and shape of the seal may change, resulting in a decrease in recognition accuracy. In addition, the back-transparency phenomenon of the seal (that is, the seal is visible on the back of the paper and appears on the front) is also a common problem. The back-transparency phenomenon will cause the seal pattern to interfere with other content on the test paper, increase the complexity of image recognition, and lead to misidentification or missed recognition. Although there are some image processing and recognition algorithms, the existing technology still cannot provide a stable and efficient solution when faced with these complex situations.
[0076] In view of this, the present disclosure provides a seal recognition method, device, computer equipment and storage medium. The seal recognition method can be applied to the scene of recognizing images such as user's test papers that have seal recognition requirements. Optionally, the seal recognition method can be performed by an image processing system, and the image processing system can be integrated on a terminal device (such as a learning machine). The terminal device can collect images through a built-in image acquisition component, and then the image processing system performs seal recognition on the collected images; or, the image to be recognized uploaded by the user can be received, so that the image processing system can perform seal recognition on the received image to be recognized.
[0077] Next, the embodiments of the present disclosure are described in detail.
[0078] The first aspect of the present disclosure provides a seal recognition method. Figure 1 , which comprises the following steps:
[0079] S101, obtaining an image to be recognized.
[0080] The image to be identified refers to an image that requires seal recognition.
[0081] Optionally, the user's test paper may be photographed by an image acquisition component built into the terminal device to obtain the image to be recognized; or, the image to be recognized uploaded by the user may be received to obtain the image to be recognized.
[0082] S102, identifying the image to be identified, and determining the position coordinates and confidence level of at least one candidate seal from the image to be identified.
[0083] The candidate seal refers to the seal that is preliminarily identified and determined on the image to be identified; the position coordinates of the candidate seal are used to characterize the specific position of the identified candidate seal in the image to be identified, and the confidence is used to characterize the reliability of the position coordinates of the identified candidate seal.
[0084] Optionally, after the image to be identified is acquired, the image to be identified may be input into a pre-trained seal recognition model to determine the position coordinates and confidence level of at least one candidate seal.
[0085] S103, screening each candidate seal in the at least one candidate seal based on a preset condition, taking the candidate seal in the at least one candidate seal that meets the preset condition as a target seal, and outputting the position coordinates and confidence of the target seal.
[0086] Wherein, the preset conditions include seal color conditions and / or seal position conditions. Seal color conditions refer to preset requirements for seal color, such as blue, etc. Seal position conditions refer to preset requirements for seal position, such as being located at the text, etc. The target seal refers to the seal that is finally determined in the image to be identified. It should be noted that the preset conditions can be set by the user. For example, the user can preset the seal color condition in the preset conditions to be red, and the seal position condition in the preset conditions to be located at a blank space, so that the image processing system screens each candidate seal in the at least one candidate seal based on the preset conditions set by the user.
[0087] Optionally, in the case where a seal color condition and / or a seal position condition are pre-set, each of the at least one determined candidate seal can be screened based on the preset condition, and the candidate seal that meets the preset condition is used as the target seal, and the position coordinates and confidence of the target seal are output. For example, if the seal color condition is blue and the seal position condition is located at the text, then based on the above two preset conditions, the candidate seal that is blue and located at the text can be selected from the candidate seals as the target seal, and the position coordinates and confidence of the selected target seal are input.
[0088] In the disclosed embodiment, by pre-setting seal color conditions and / or seal position conditions, at least one candidate seal identified from the image to be identified is verified based on the preset conditions, thereby determining the position coordinates and confidence level of the target seal from at least one candidate seal, thereby improving the accuracy and efficiency of seal recognition, reducing the problems of misidentification and missed identification of seals, and improving the user experience.
[0089] Based on the above embodiments, in an exemplary embodiment, Figure 2 As shown, the above S102 may be refined and may specifically include the following steps:
[0090] S201, generating an enhanced image and a segmented image corresponding to the image to be identified according to the image to be identified.
[0091] Among them, the enhanced image refers to the image generated by enhancing the image to be identified, which can improve the clarity, contrast, etc. of the image to be identified; the segmented image refers to the image obtained by segmenting the image to be identified, which can distinguish different areas in the image to be identified according to the pixel value, color, texture and other features of the image to be identified, so as to facilitate subsequent seal recognition and extraction.
[0092] Optionally, the image to be identified can be processed by contrast enhancement, histogram equalization, sharpening and other methods to obtain an enhanced image. It should be noted that, when the preset conditions include the seal color condition, the image to be identified can be enhanced based on the seal color condition. For example, if the seal color condition is blue, the red and green channels in the image to be identified can be suppressed, and the blue channel can be enhanced to obtain an enhanced image. Among them, the red and green channels in the image to be identified can be suppressed by the following formula (1), and the blue channel in the image to be identified can be suppressed by the following formula (2).
[0093] R=max(R-abs(BR),0) (1)
[0094] G=max(G-abs(BG),0) (2)
[0095] Among them, R, G and B refer to the red channel data, green channel data and blue channel data respectively. abs(BR) is used to represent the absolute value of the difference between the blue channel data and the red channel data, and abs(BG) is used to represent the absolute value of the difference between the blue channel data and the green channel data.
[0096] Furthermore, the blue channel data may be compared with the red channel data and the green channel data respectively. If the blue channel data is greater than or equal to the red channel data and the green channel data, a preset value may be added to the blue channel data, thereby enhancing the blue channel data.
[0097] Furthermore, an edge detection algorithm may be used to perform edge segmentation on the image to be identified, and generate a segmented image corresponding to the image to be identified. The edge detection algorithm may be a Sobel (Sobel Edge Detection Operator) algorithm, etc. Specifically, an edge detection algorithm may be used to analyze pixel changes in the image to be identified, determine edge positions in the image to be identified (i.e., positions with the largest pixel changes), and then mark edge positions, thereby forming a more accurate segmented image.
[0098] It should be noted that before the image to be identified is enhanced and segmented, the image to be identified can be preprocessed (such as cropping size, etc.), and then the preprocessed image to be identified is enhanced and segmented to generate more accurate enhanced images and segmented images.
[0099] S202: Input the image to be recognized, the enhanced image and the segmented image into a seal recognition model to determine the position coordinates and confidence level of at least one candidate seal.
[0100] Among them, the seal recognition model refers to a pre-trained model for initial screening of seals from images, which may be a YoloV5 (You Only Look Once Version 5) model; a large number of image samples containing seals may be prepared in advance, and the image samples are marked with seal position coordinate labels and confidence labels, and the model is trained based on the training set formed by the above image samples to obtain a seal recognition model.
[0101] Optionally, the image to be identified, the enhanced image and the segmented image may be input into a seal recognition model to determine the position coordinates and confidence level of at least one candidate seal in the image to be identified.
[0102] In this embodiment, by enhancing and segmenting the image to be identified, thereby generating an enhanced image and a segmented image, and then inputting the image to be identified, the enhanced image and the segmented image into the seal recognition model, the accuracy of the position coordinates and confidence of at least one determined candidate seal can be improved, thereby improving the accuracy of subsequent determination of the target seal.
[0103] In an exemplary embodiment, the preset condition includes a seal position condition, and the seal position condition is that the seal is located at the text, such as Figure 3 As shown, the above S103 may be refined, and may specifically include the following steps:
[0104] S301, performing text recognition on the image to be recognized, and determining the position coordinates and confidence level of at least one text line region in the image to be recognized.
[0105] The text line region refers to the spatial region containing a line of text in the image to be recognized. The position coordinates of the text line region refer to the specific position of the recognized text line region in the image to be recognized, and the confidence is used to represent the reliability of the position coordinates of the recognized text line region.
[0106] Optionally, the image to be recognized can be input into an OCR (Optical Character Recognition) model, and text recognition can be performed on the image to be recognized through the OCR model to identify at least one text line area in the image to be recognized, and determine the position coordinates and confidence of each text line area.
[0107] S302: For each candidate seal, determine an intersection area between the candidate seal and each text line region in the at least one text line region.
[0108] The intersection area refers to the area of the intersection image between each candidate seal and each text line area.
[0109] Optionally, after identifying at least one text line region in the image to be identified, for each candidate seal, an intersection image where the candidate seal and each text line region intersect may be determined, and the area of the intersection image, ie, the intersection area, may be determined.
[0110] S303: If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, determine any candidate seal as a target seal.
[0111] The first threshold refers to a preset threshold of the intersection area.
[0112] Optionally, after obtaining the intersection area between each candidate seal and each text line area, the intersection area between each candidate seal and each text line area can be compared with a first threshold; when the intersection area between any candidate seal and any text line area is greater than or equal to the first threshold, the candidate seal can be used as a target seal.
[0113] In this embodiment, when the preset conditions include seal position conditions, and the seal position condition is that the seal is located at the text, at least one text line area is obtained by identifying from the image to be identified, and the intersection area between each candidate seal and each text line area is determined, and then the candidate seal corresponding to the intersection area greater than or equal to the first threshold is taken as the target seal, the target seal can be determined more accurately and efficiently, thereby avoiding misrecognition and missed recognition.
[0114] Based on the above embodiments, in an exemplary embodiment, Figure 4 As shown, the above S303 is refined, specifically including the following steps:
[0115] S401 : if the intersection area between any candidate seal and any text line region is greater than or equal to a first threshold, determine a seal label of the intersection image between any candidate seal and any text line region.
[0116] The seal labels include real seal labels and questionable seal labels. The real seal labels are used to mark seals that are confirmed to be real, and the questionable seal labels are used to mark seals that cannot be confirmed to be real.
[0117] Optionally, when the intersection area between any candidate seal and any text line area is greater than or equal to the first threshold, the intersection image of any candidate seal can be input into a binary classification model, and the corresponding seal label can be determined for each candidate seal more efficiently and accurately through the binary classification model. The binary classification model refers to a pre-trained model for determining whether a candidate seal is authentic; in this embodiment, a plurality of image samples with authentic seal labels and image samples with suspicious seal labels can be prepared in advance, and the binary classification model can be trained with the pre-prepared image sample set, thereby obtaining a binary classification model that can identify the seal labels of candidate seals.
[0118] S402: If the seal label of the intersection image between any candidate seal and any text line region is a suspicious seal label, determine whether any candidate seal is a target seal based on a character sequence in any text line region.
[0119] The text sequence refers to the order in which the text is arranged in the text line area, such as forward or reverse.
[0120] Optionally, when the seal label of the intersection image between any candidate seal and any text line area is confirmed as a suspicious seal label, the text sequence of the text line area can be determined, and based on the determined text sequence of the text line area, it can be determined whether the candidate seal is the target seal.
[0121] One possible implementation method is to determine the number of normal characters and the number of non-normal characters in any text line area; when the number of normal characters is greater than the number of non-normal characters, determine the candidate seal as the target seal.
[0122] Among them, positive text refers to Figure 5a The text lines shown in the text area are normal, readable, and standard text; non-normal text refers to Figure 5b What is shown is text in the text line area with the text direction reversed, for example, it may be text that is visible from the back of the test paper corresponding to the image to be recognized.
[0123] Optionally, when the seal label of the intersection image between any candidate seal and any text line area is confirmed as a suspicious seal label, the text line area text sequence can be determined, and the number of positive characters and the number of non-positive characters can be determined from the determined text sequence; the determined number of positive characters and the number of negative characters are compared, and if it is determined that the number of positive characters is greater than the number of non-positive characters, the candidate seal can be determined to be the target seal. For example, the image to be identified can be as follows Figure 6 As shown, there are two candidate seals stamped on the normal text and the non-normal text; since the number of normal text in the candidate seal located on the upper right is greater than the number of non-normal text, it can be determined that the candidate seal is the target seal; and since the number of normal text in the candidate seal located on the lower left is less than the number of non-normal text, it can be determined that the candidate seal is not the target seal, and the candidate seal can be excluded.
[0124] It can be understood that by determining the number of positive characters and the number of non-positive characters in the text line area and comparing the number of positive characters and the number of non-positive characters, it is possible to more intuitively and accurately determine whether the candidate seal is the target seal, thereby improving the accuracy and efficiency of determining the target seal.
[0125] In this embodiment, when the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, the seal label of the intersection image between the candidate seal and any text line area is confirmed, and then for the intersection image marked with a suspicious seal label, the text sequence in the text line area is determined for further verification, so that the target seal can be identified more accurately; especially for the problem of misidentifying a back-transparent seal image as a real seal in the related art, this embodiment can solve the problem of misidentification of back-transparent seals, and ensure that there are no misidentified back-transparent seals in the identified target seals, thereby achieving the effect of improving the accuracy and efficiency of seal recognition, reducing misidentification and missed recognition, and improving the user experience.
[0126] In an exemplary embodiment, when the preset condition includes a stamp color condition and the stamp color condition is a target color, Figure 7 As shown, the above S103 may be refined, and may specifically include the following steps:
[0127] S701 , for each candidate seal, obtaining the grayscale value of each pixel in the candidate seal in a target color channel.
[0128] Among them, the target color refers to the pre-set standard seal color, such as blue, red, etc.
[0129] Optionally, after determining at least one candidate seal, the grayscale value of each pixel in the candidate seal in the target color channel may be extracted for each candidate seal. For example, if the target color is blue, the grayscale value of each pixel in the candidate seal in the blue channel may be extracted.
[0130] S702 , determining the grayscale square sum of the candidate seal in the target color channel according to the grayscale value of each pixel in the candidate seal in the target color channel.
[0131] Optionally, after the grayscale value of each pixel in the candidate seal in the target color channel is obtained, the grayscale value of each pixel in the target color channel may be squared and then added to obtain the grayscale square sum of the candidate seal in the target color channel.
[0132] S703: taking the candidate seal whose grayscale square sum is greater than or equal to the second threshold as the target seal.
[0133] The second threshold refers to a preset standard value of the grayscale square sum.
[0134] Optionally, the obtained grayscale square sum of each candidate seal in the target color channel may be compared with a second threshold value. If the grayscale square sum of any candidate seal in the target color channel is greater than or equal to the second threshold value, the candidate seal may be determined as the target seal.
[0135] In this embodiment, when the preset conditions include seal color conditions and the seal color conditions are the target color, by determining, for each candidate seal, the grayscale value of each pixel in the candidate seal in the target color channel, and determining the sum of the squares of the grayscale of the candidate seal in the target color channel, and then introducing a preset second threshold, and comparing the sum of the squares of the grayscale of each candidate seal in the target color channel with the second threshold, the target seal that meets the target color can be effectively screened out, thereby improving the accuracy of seal recognition, avoiding background interference and noise, and enhancing the robustness of recognition of the target seal, while also improving the automation and efficiency of seal recognition.
[0136] Corresponding to the embodiments of the aforementioned method, the present disclosure also provides embodiments of a device and a terminal to which the device is applied.
[0137] Second, as Figure 8 As shown, the present application also provides a seal recognition device, comprising:
[0138] The image acquisition module 801 is used to acquire the image to be recognized;
[0139] A first determination module 802 is used to identify the image to be identified, and determine the position coordinates and confidence level of at least one candidate seal from the image to be identified;
[0140] The second determination module 803 is used to screen each candidate seal in the at least one candidate seal based on a preset condition, select the candidate seal in the at least one candidate seal that meets the preset condition as a target seal, and output the position coordinates and confidence of the target seal, wherein the preset condition includes a seal color condition and / or a seal position condition.
[0141] In one embodiment, the first determining module 802 is specifically configured to:
[0142] According to the image to be identified, generating an enhanced image and a segmented image corresponding to the image to be identified;
[0143] The image to be recognized, the enhanced image and the segmented image are input into a seal recognition model to determine the position coordinates and confidence level of at least one candidate seal.
[0144] In one embodiment, the first determining module 802 is specifically configured to:
[0145] An edge detection algorithm is used to perform edge segmentation on the image to be identified, and a segmented image corresponding to the image to be identified is generated.
[0146] In one embodiment, when the preset condition includes a seal position condition and the seal position condition is that the seal is located at the text, the second determining module 803 is specifically configured to:
[0147] Performing text recognition on the image to be recognized, and determining the position coordinates and confidence level of at least one text line area in the image to be recognized;
[0148] For each candidate seal, determining an intersection area between the candidate seal and each text line region in the at least one text line region;
[0149] If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, the candidate seal is determined as a target seal.
[0150] In one embodiment, the second determining module 803 is specifically configured to:
[0151] If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, determine a seal label of the intersection image between any candidate seal and any text line area, wherein the seal label includes a real seal label and a suspicious seal label;
[0152] If the seal label of the intersection image between any candidate seal and any text line area is a suspicious seal label, then based on the character sequence in any text line area, it is determined whether any candidate seal is a target seal.
[0153] In one embodiment, the second determining module 803 is specifically configured to:
[0154] The intersection image of any candidate seal is input into a binary classification model to determine a seal label of the intersection image between any candidate seal and any text line region.
[0155] In one embodiment, the second determining module 803 is specifically configured to:
[0156] Determine the number of positive characters and the number of non-positive characters in any text line region;
[0157] When the number of the normal characters is greater than the number of the non-normal characters, the candidate seal is determined to be a target seal.
[0158] In one embodiment, when the preset condition includes a seal color condition and the seal color condition is a target color, the second determining module 803 is specifically configured to:
[0159] For each of the candidate seals, obtaining the grayscale value of each pixel in the candidate seal in the target color channel;
[0160] Determine the grayscale square sum of the candidate seal in the target color channel according to the grayscale value of each pixel in the candidate seal in the target color channel;
[0161] The candidate seal whose grayscale square sum is greater than or equal to the second threshold is taken as the target seal.
[0162] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.
[0163] A third aspect of the present disclosure provides a computer program product, including a computer program / instruction, which implements the method described in the first aspect when executed by a processor.
[0164] For the device embodiments and computer program product embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. In addition, the device embodiments described above are merely schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the disclosed solution. Those of ordinary skill in the art can understand and implement it without paying creative labor.
[0165] In a fourth aspect, the seal recognition device provided by the present disclosure can be applied to a computer device. Fig. 9 , which exemplarily shows a hardware schematic diagram of a computer device. For example, device 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0166] Device 900 may include one or more of the following components: a processing component 901 , a memory 902 , a power component 903 , a multimedia component 904 , an audio component 905 , an input / output (I / O) interface 906 , a sensor component 907 , and a communication component 908 .
[0167] The processing component 901 generally controls the overall actions of the device 900, such as actions associated with display, phone calls, data communications, camera actions, and recording actions. The processing component 901 may include one or more processors 909 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 901 may include one or more modules to facilitate the interaction between the processing component 901 and other components. For example, the processing component 901 may include a multimedia module to facilitate the interaction between the multimedia component 904 and the processing component 901.
[0168] The memory 902 is configured to store various types of data to support operations on the device 900. Examples of such data include instructions for any application or method operating on the device 900, contact data, phone book data, messages, pictures, videos, etc. The memory 902 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0169] The power component 903 provides power to the various components of the device 900. The power component 903 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 900.
[0170] The multimedia component 904 includes a screen providing an output interface between the device 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide action. In some embodiments, the multimedia component 904 includes a front camera and / or a rear camera. When the device 900 is in an action mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0171] The audio component 905 is configured to output and / or input audio signals. For example, the audio component 905 includes a microphone (MIC), and when the device 900 is in an action mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 902 or sent via the communication component 908. In some embodiments, the audio component 905 also includes a speaker for outputting audio signals.
[0172] I / O interface 906 provides an interface between processing component 901 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0173] The sensor assembly 907 includes one or more sensors for providing various aspects of status assessment for the device 900. For example, the sensor assembly 907 can detect the open / closed state of the device 900, the relative positioning of components, such as the display and keypad of the device 900, and the sensor assembly 907 can also detect the position change of the device 900 or a component of the device 900, the presence or absence of user contact with the device 900, the orientation or acceleration / deceleration of the device 900, and the temperature change of the device 900. The sensor assembly 907 can also include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 907 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 907 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0174] The communication component 908 is configured to facilitate wired or wireless communication between the device 900 and other devices. The device 900 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G or 5G or a combination thereof. In an exemplary embodiment, the communication component 908 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 908 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0175] In an exemplary embodiment, the device 900 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the seal recognition method of the above-mentioned computer device.
[0176] In a fifth aspect, the present disclosure, in an exemplary embodiment, further provides a non-transitory computer-readable storage medium including instructions, such as a memory 902 including instructions, and the instructions can be executed by a processor 909 of a device 900 to complete the seal recognition method of the computer device. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0177] The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0178] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the inventions claimed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not claimed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0179] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0180] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the scope of protection of the present disclosure.
Claims
1. A seal recognition method, characterized in that: The method comprises: Obtain an image to be recognized; Identify the image to be identified, and determine the position coordinates and confidence level of at least one candidate seal from the image to be identified; Each candidate seal in the at least one candidate seal is screened based on a preset condition, a candidate seal in the at least one candidate seal that meets the preset condition is used as a target seal, and a position coordinate and a confidence level of the target seal are output, wherein the preset condition includes a seal color condition and / or a seal position condition.
2. The method according to claim 1, characterized in that: The step of identifying the image to be identified and determining the position coordinates and confidence level of at least one candidate seal from the image to be identified includes: According to the image to be identified, generating an enhanced image and a segmented image corresponding to the image to be identified; The image to be recognized, the enhanced image and the segmented image are input into a seal recognition model to determine the position coordinates and confidence level of at least one candidate seal.
3. The method according to claim 2, characterized in that The step of generating a segmented image corresponding to the image to be identified according to the image to be identified includes: An edge detection algorithm is used to perform edge segmentation on the image to be identified, and a segmented image corresponding to the image to be identified is generated.
4. The method according to claim 1, characterized in that In the case where the preset condition includes a seal position condition and the seal position condition is that the seal is located at the text, screening each of the candidate seals based on the preset condition and taking the candidate seals that meet the preset condition as the target seal includes: Performing text recognition on the image to be recognized, and determining the position coordinates and confidence level of at least one text line area in the image to be recognized; For each candidate seal, determining an intersection area between the candidate seal and each text line region in the at least one text line region; If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, the candidate seal is determined as a target seal.
5. The method according to claim 4, characterized in that If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, determining any candidate seal as a target seal comprises: If the intersection area between any candidate seal and any text line area is greater than or equal to a first threshold, determine a seal label of the intersection image between any candidate seal and any text line area, wherein the seal label includes a real seal label and a suspicious seal label; If the seal label of the intersection image between any candidate seal and any text line area is a suspicious seal label, then based on the character sequence in any text line area, it is determined whether any candidate seal is a target seal.
6. The method according to claim 5, characterized in that The step of determining a seal label of an intersection image between any candidate seal and any text line region comprises: The intersection image of any candidate seal is input into a binary classification model to determine a seal label of the intersection image between any candidate seal and any text line region.
7. The method according to claim 5, characterized in that The step of determining whether any candidate seal is a target seal based on a character sequence in any text line region includes: Determine the number of positive characters and the number of non-positive characters in any text line region; In a case where the number of the normal characters is greater than the number of the non-normal characters, the candidate seal is determined to be a target seal.
8. The method according to claim 1, characterized in that In the case where the preset condition includes a seal color condition and the seal color condition is a target color, screening each of the candidate seals based on the preset condition and taking the candidate seals that meet the preset condition as the target seal includes: For each of the candidate seals, obtaining the grayscale value of each pixel in the candidate seal in the target color channel; Determine the grayscale square sum of the candidate seal in the target color channel according to the grayscale value of each pixel in the candidate seal in the target color channel; The candidate seal whose grayscale square sum is greater than or equal to the second threshold is taken as the target seal.
9. A seal recognition device, characterized in that: The device comprises: An image acquisition module, used for acquiring an image to be identified; A first determination module is used to identify the image to be identified, and determine the position coordinates and confidence level of at least one candidate seal from the image to be identified; The second determination module is used to screen each candidate seal in the at least one candidate seal based on a preset condition, select the candidate seal in the at least one candidate seal that meets the preset condition as a target seal, and output the position coordinates and confidence of the target seal, wherein the preset condition includes a seal color condition and / or a seal position condition.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
11. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 8 is implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.