Drug test report electronic seal automatic positioning method, device and equipment and medium
Patent Information
- Application Number
- CN202611177762.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2046-08-05
AI Technical Summary
[0003]现有自动化签章技术均采用固定像素坐标盖章方式,签章位置永久固定,无法根据单页药检报告的文字排布、签章分布、页面版式动态调整
[0046]本发明的上述药检报告电子签章的自动定位方法,通过获取待签章药检报告,所述待签章药检报告中包括有文字和/或至少一个第一签章图像;对所述待签章药检报告进行文字坐标检测,得到文字禁止掩码图层;对所述待签章药检报告进行至少一个第一签章图像识别,得到签章禁止掩码图层;对所述待签章药检报告进行页边距识别,得到边缘禁止掩码图层;根据所述文字禁止掩码图层、签章禁止掩码图层和边缘禁止掩码图层,对待签章药检报告的图像网格进行评分,得到评分结果;根据所述评分结果,确定第二电子签章在待签章药检报告中的目标位置,使得所述目标位置与所述至少一个第一签章图像和文字在待签章药检报告中的位置不同。从而能够提高药检报告电子签章的自动定位的适应性、稳定性和精确性。
Smart Images

Figure CN122676528B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to an automatic positioning method, device, equipment and medium for electronic signatures on drug testing reports. Background Technology
[0002] Currently, drug test report signing methods are mainly divided into two categories: manual signing and traditional fixed-point automatic signing. Some lightweight intelligent signing solutions are developed using general vision models, but none of them can adapt to the high compliance and rigor requirements of the drug test report industry, and they have many inherent technical defects, the specific shortcomings of which are as follows:
[0003] Existing automated signature technologies all use fixed pixel coordinates for stamping, resulting in a permanently fixed signature position that cannot be dynamically adjusted according to the text layout, signature distribution, and page format of a single-page drug testing report. This easily leads to issues such as signatures obscuring test data or covering table lines, resulting in blurry report content, missing information, and failure to meet the readability standards of drug regulatory documents.
[0004] Existing technologies simply reserve blank areas and lack targeted mechanisms for recognizing and avoiding old signatures. They cannot accurately distinguish between existing company seals, approval verification seals, photocopied seals, and transparent watermarks on the page, which can easily lead to misjudgments that interfere with signatures or omissions of valid signatures.
[0005] Existing technology uses a fixed pixel edge white space method to set restricted areas, resulting in extremely poor layout adaptability and low aesthetic appeal and standardization of signatures.
[0006] The existing technology for signing and stamping is highly random, resulting in problems such as narrow blank areas, abrupt placement, and non-compliance with official document signing habits. The overall format is inconsistent and lacks professionalism. Summary of the Invention
[0007] The technical problem to be solved by this invention is to provide an automatic positioning method, device, equipment, and medium for electronic signatures on drug test reports. This improves the adaptability, stability, and accuracy of automatic positioning of electronic signatures on drug test reports.
[0008] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0009] An automatic positioning method for electronic signatures on drug testing reports, comprising:
[0010] Obtain a drug test report to be signed, the drug test report to be signed including text and / or at least one first signature image;
[0011] The text coordinates of the drug inspection report to be signed are detected to obtain a text prohibition mask layer;
[0012] Perform at least one first signature image recognition on the drug test report to be signed to obtain a signature prohibition mask layer;
[0013] Margin recognition is performed on the drug inspection report to be signed to obtain an edge prohibition mask layer;
[0014] Based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, the image grid of the drug inspection report to be signed is scored to obtain the scoring result;
[0015] Based on the scoring results, the target position of the second electronic signature in the drug test report to be signed is determined, such that the target position is different from the position of the at least one first signature image and text in the drug test report to be signed.
[0016] Optionally, text coordinate detection is performed on the drug test report to be signed to obtain a text prohibition mask layer, including:
[0017] The text coordinates of the drug inspection report to be signed are scanned to obtain the text coordinate frame.
[0018] The text coordinate frame is expanded to obtain a text mask layer.
[0019] Optionally, at least one first signature image recognition is performed on the drug test report to be signed to obtain a signature prohibition mask layer, including:
[0020] The drug inspection report to be signed is processed with uniform resolution, pixel normalization and standardization to obtain the target drug inspection report;
[0021] The target drug test report is subjected to downsampling, residual layer progression, stepwise downsampling and global feature fusion to obtain a global semantic feature map;
[0022] The global semantic feature map is subjected to bidirectional feature fusion, which involves both top-down upsampling and bottom-up sampling, to obtain a fused feature map.
[0023] The fused feature map is expanded to obtain a signature prohibition mask layer.
[0024] Optionally, the margins of the drug inspection report to be signed are identified to obtain an edge prohibition mask layer, including:
[0025] The margins of the drug inspection report to be signed are identified according to a preset page ratio to obtain safe margins.
[0026] Based on the security margins, an edge prohibition mask layer is obtained.
[0027] Optionally, based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, the image grid of the drug test report to be signed is scored to obtain the scoring result, including:
[0028] The text prohibition mask layer, the signature prohibition mask layer, and the edge prohibition mask layer are masked and blended to obtain an initial candidate blank area;
[0029] The initial candidate blank areas are filtered for invalid blank areas to obtain the candidate blank areas;
[0030] The candidate blank areas are scored to obtain the scoring results.
[0031] Optionally, the candidate blank areas are scored to obtain scoring results, including:
[0032] The distance between the candidate blank area and the nearest text is used to obtain the text distance.
[0033] The distance between the candidate blank area and the nearest first signature image is used to obtain the signature distance.
[0034] The visual compliance of the page is determined by the distance between the candidate blank area and the page margin.
[0035] The sufficiency of the blank area is determined based on the area of the candidate blank area;
[0036] The scoring results are obtained based on the distance between the text and the signature, the visual compliance of the page, and the sufficiency of the blank area.
[0037] Optionally, based on the scoring results, the target location of the second electronic signature in the drug inspection report to be signed is determined, including:
[0038] The blank area with the highest score in the scoring results will be used as the target position for the second electronic signature in the drug inspection report to be signed.
[0039] If no candidate blank area exists, the largest initial candidate blank area or the bottom blank area will be selected as the target position for the second electronic signature in the drug test report to be signed.
[0040] Embodiments of the present invention also provide an automatic positioning device for electronic signatures on drug test reports, comprising:
[0041] The acquisition module is used to acquire the drug test report to be signed, which includes text and / or at least one first signature image.
[0042] The processing module is used to perform text coordinate detection on the drug inspection report to be signed to obtain a text prohibition mask layer; to perform at least one first signature image recognition on the drug inspection report to be signed to obtain a signature prohibition mask layer; to perform page margin recognition on the drug inspection report to be signed to obtain an edge prohibition mask layer; to score the image grid of the drug inspection report to be signed based on the text prohibition mask layer, the signature prohibition mask layer, and the edge prohibition mask layer, to obtain a scoring result; and to determine the target position of the second electronic signature in the drug inspection report to be signed based on the scoring result, such that the target position is different from the position of the at least one first signature image and text in the drug inspection report to be signed.
[0043] Embodiments of the present invention also provide a computing device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the automatic positioning method for electronic signatures of drug test reports according to the present invention.
[0044] Embodiments of the present invention also provide a computer-readable storage medium storing a program that, when executed by a processor, implements the automatic positioning method for electronic signatures on drug testing reports as described in the present invention.
[0045] The above-described technical solution of the present invention has at least the following technical effects:
[0046] The automatic positioning method for electronic signatures on drug test reports of the present invention involves: acquiring a drug test report to be signed, which includes text and / or at least one first signature image; performing text coordinate detection on the drug test report to be signed to obtain a text prohibition mask layer; performing at least one first signature image recognition on the drug test report to be signed to obtain a signature prohibition mask layer; performing page margin recognition on the drug test report to be signed to obtain an edge prohibition mask layer; scoring the image grid of the drug test report to be signed based on the text prohibition mask layer, the signature prohibition mask layer, and the edge prohibition mask layer to obtain a scoring result; and determining the target position of the second electronic signature in the drug test report to be signed based on the scoring result, such that the target position is different from the position of the at least one first signature image and text in the drug test report to be signed. This improves the adaptability, stability, and accuracy of automatic positioning of electronic signatures on drug test reports. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating the automatic positioning method for electronic signatures in drug testing reports according to the present invention.
[0048] Figure 2This is a schematic diagram illustrating the expansion and enlargement of the text coordinate frame in the automatic positioning method for electronic signatures on drug testing reports of the present invention.
[0049] Figure 3 This is a schematic diagram of the second electronic signature position in the automatic positioning method of electronic signature for drug test reports of the present invention;
[0050] Figure 4 This is a schematic diagram of the automatic positioning device for the electronic signature of the drug inspection report of the present invention. Detailed Implementation
[0051] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the invention and to fully convey the scope of the invention to those skilled in the art.
[0052] like Figure 1 As shown, an embodiment of the present invention proposes an automatic positioning method for electronic signatures on drug testing reports, comprising:
[0053] Step S1: Obtain the drug test report to be signed, which includes text and / or at least one first signature image.
[0054] Step S2: Perform text coordinate detection on the drug inspection report to be signed to obtain a text prohibition mask layer;
[0055] Step S3: Perform at least one first signature image recognition on the drug test report to be signed to obtain a signature prohibition mask layer;
[0056] Step S4: Perform margin recognition on the drug inspection report to be signed to obtain an edge prohibition mask layer;
[0057] Step S5: Based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, score the image grid of the drug inspection report to be signed to obtain the scoring result;
[0058] Step S6: Based on the scoring results, determine the target position of the second electronic signature in the drug test report to be signed, such that the target position is different from the position of the at least one first signature image and text in the drug test report to be signed.
[0059] In this embodiment, as Figure 1As shown, firstly, a drug test report to be signed is obtained, which includes text and / or at least one first signature image; then, text coordinate detection is performed on the drug test report to be signed to obtain a text prohibition mask layer; at least one first signature image is recognized on the drug test report to be signed to obtain a signature prohibition mask layer; page margin recognition is performed on the drug test report to be signed to obtain an edge prohibition mask layer; based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, the image grid of the drug test report to be signed is scored to obtain a scoring result; based on the scoring result, the target position of the second electronic signature in the drug test report to be signed is determined, such that the target position is different from the position of the at least one first signature image and text in the drug test report to be signed.
[0060] This invention addresses three major pain points in traditional electronic signatures for drug testing reports: text detection, automatic signature recognition, multi-layer image mask fusion, four-dimensional weighted scoring, dynamic real-time verification, and fallback algorithms for extreme scenarios. These solutions integrate text detection, automatic signature recognition, multi-layer image mask fusion, four-dimensional weighted scoring, dynamic real-time verification, and fallback algorithms for extreme scenarios. When processing batches of drug testing reports awaiting signature, the invention can accurately and quickly perform automatic signatures at the designated signature locations on the reports. This improves the efficiency and accuracy of automatic signature positioning in electronic drug testing report signing.
[0061] In an optional embodiment of the present invention, step S2 involves performing text coordinate detection on the drug test report to be signed to obtain a text prohibition mask layer, including:
[0062] Step S21: Scan the text coordinates of the drug test report to be signed to obtain a text coordinate frame;
[0063] Step S22: Expand the text coordinate frame to obtain a text prohibition mask layer.
[0064] In this embodiment, firstly, the drug test report to be signed is scanned by text coordinates to obtain text coordinate frames; during text coordinate scanning, the entire drug test report to be signed is scanned to accurately capture the coordinate boundary frames of all text, numbers, symbols, and table lines on the page, without needing to identify the specific content of the text, only retaining spatial location information;
[0065] Then, the text coordinate frame is expanded and resized to obtain a text mask layer; as shown... Figure 2 As shown, outward rotation is performed on all detected text coordinate frames. Uniform pixel expansion eliminates visual overlap and partial occlusion caused by signatures being too close to text; based on the expanded text area, a binary text prohibition mask layer is generated to mark and distinguish the area; the formula for calculating the boundary of the text prohibition area is:
[0066] ,
[0067] in, This represents the top-left horizontal coordinate of the original text box. This represents the bottom right horizontal coordinate of the original text box. This indicates the top-left horizontal coordinate of the forbidden area in the expanded text box. This indicates the bottom right horizontal coordinate of the forbidden area within the expanded text box. This represents the top-left vertical coordinate of the original text box. This represents the bottom right vertical coordinate of the original text box. This indicates the top-left vertical coordinate of the forbidden area within the expanded text box. This represents the bottom right vertical coordinate of the forbidden area within the expanded text box. Indicates the number of pixels dilated;
[0068] In the text prohibition mask layer, the expanded text area is the prohibited signing area, and the non-text area is the candidate area. In this embodiment, the text coordinates of the drug test report to be signed are scanned to obtain a text coordinate frame; the text coordinate frame is expanded to obtain a text prohibition mask layer, so that the text area can be largely avoided during subsequent signing, so as to avoid the electronic signature covering the text area and affecting the recognition of the signature.
[0069] In an optional embodiment of the present invention, step S3 involves performing at least one first signature image recognition on the drug test report to be signed to obtain a signature prohibition mask layer, including:
[0070] Step S31: Perform unified resolution, pixel normalization and standardization processing on the drug inspection report to be signed to obtain the target drug inspection report;
[0071] Step S32: The target drug test report is downsampled, residual layer progressive, stepwise downsampled and global feature fusion is performed to obtain a global semantic feature map;
[0072] Step S33: Perform bidirectional feature fusion on the global semantic feature map by top-down upsampling and bottom-up upsampling to obtain a fused feature map;
[0073] Step S34: Expand the size of the fused feature map to obtain a signature prohibition mask layer.
[0074] In this embodiment, firstly, in step S31, the drug test report to be signed is processed by uniform resolution, pixel normalization, and standardization to obtain the target drug test report; the drug test report to be signed is adaptively scaled proportionally to a uniform resolution of 640×640 to ensure that the feature proportions of various report formats and different sizes of signatures are not distorted; then, pixel normalization processing is performed to map the image pixel values from 0~255 to the 0~1 range; the normalization formula is as follows: ,in These are the normalized pixel values. The values are the original image pixel values, with 255 being the maximum pixel amplitude. Then, they are converted into the standard tensor dimensions of the model, with the preferred normalized image tensor being [batch, 3, 640, 640] to adapt to subsequent convolution operations.
[0075] In step S32, the target drug inspection report is downsampled, progressively downsampled using residual layers, and then fused with global features to obtain a global semantic feature map. A multi-level concatenated structure consisting of basic convolutional layers, residual feature enhancement layers, and spatial pyramid pooling layers is used to complete multi-scale feature extraction. Specifically, the first round performs 3×3 convolutional downsampling to initially extract shallow features such as the red color block of the signature, the circular border, and the texture outline, filtering out minor text noise on the page. The second round performs multiple sets of progressively downsampled residual layer operations to retain shallow edge details, deepen mid-level texture features, and focus on learning the differentiated features of solid and uniform texture of effective fresh stamps, granular noise texture of photocopied light stamps, and transparent overlay texture of watermarked stamps. The third round performs four progressive downsampling operations to compress redundant image information and weaken the interference features of black text and table lines. The fourth round uses spatial pyramid pooling layers to complete multi-scale global feature fusion, adapting to various stamp sizes (large, medium, and small) and solving the problem of missed detection of irregularly shaped or incomplete stamps. The convolutional feature extraction formula is:
[0076] ,
[0077] in, Represents the global semantic feature map. This represents the target drug test report; K represents a 3×3 convolution kernel; S represents the stride; and P represents the padding value.
[0078] This embodiment can complete the purification of the exclusive features of the first signature image in the drug inspection report, accurately distinguish the texture differences between valid seals and various invalid interference seals, and provide core feature support for subsequent classification.
[0079] In step S33, the global semantic feature map is subjected to bidirectional feature fusion, including top-down upsampling and bottom-up / downsampling, to obtain a fused feature map. A bidirectional fusion structure is adopted to achieve complementary deep and shallow features: the first network performs top-down upsampling, progressively upsampling deep, strong-classifying semantic features and concatenating them with shallow and mid-level localization features, preserving accurate classification capabilities; the second network performs bottom-up / downsampling, reverse-transmitting shallow, fine-grained edge localization features to enhance the coordinate details of deep features; finally, three sets of multi-scale fused feature maps (80×80, 40×40, and 20×20) are output, corresponding to small, medium, and large-sized signatures, respectively; the expression for bidirectional feature fusion is:
[0080] ,
[0081]
[0082] in, Represents the fused feature map. This represents the upsampled feature map. Indicates upsampling operation. Represents deep classification features. This indicates shallow localization features. This indicates a feature channel concatenation operation;
[0083] In step S34, the fused feature map is expanded to obtain a signature prohibition mask layer. The signature coordinate frame in the fused feature map is then subjected to outward expansion. Pixels are uniformly enlarged, with sufficient safety spacing reserved; based on the enlarged signature area, an independent signature prohibition mask layer is generated; the formula for calculating the boundary of the signature prohibition area is:
[0084] ,
[0085] in, This represents the top-left horizontal coordinate of the original signature. This represents the bottom right horizontal coordinate of the original signature. This indicates the top-left horizontal coordinate of the expanded signature prohibition area. This indicates the bottom right horizontal coordinate of the area where signatures are prohibited after expansion. This represents the top-left vertical coordinate of the original signature. This represents the bottom right vertical coordinate of the original signature. This indicates the top-left vertical coordinate of the expanded signature prohibition area. This indicates the bottom right vertical coordinate of the area where signatures are prohibited after expansion. This indicates an increase in pixel size.
[0086] In an optional embodiment of the present invention, step S4 involves identifying the margins of the drug inspection report to be signed to obtain an edge prohibition mask layer, including:
[0087] Step S41: The margins of the drug inspection report to be signed are identified according to a preset page ratio to obtain the safe margins;
[0088] Step S42: Obtain the edge prohibition mask layer based on the security margin.
[0089] In this embodiment, firstly, in step S41, the global page size parameters are read, and the proportional prohibited areas on all four sides are calculated; the left and right edges are defined as prohibited areas at 5% of the page width, and the top and bottom edges are defined as prohibited areas at 6% of the page height; a global edge prohibited mask layer is generated to mark all page edge areas with illegal signatures. The formula for calculating the edge prohibited area boundary is:
[0090] ,
[0091] Where W represents the overall width of the page, and H represents the overall height of the page. This indicates the width of the prohibited area on both the left and right sides. Indicates the height of the prohibited zone at the top and bottom edges;
[0092] This embodiment uses a dynamic page ratio calculation mechanism to adapt to all sizes of drug inspection reports, such as A4 and A3, and solves the problems of inconsistent signature and stamp placement, trimming, and partial display in different formats.
[0093] In an optional embodiment of the present invention, in step S5, the image grid of the drug test report to be signed is scored according to the text prohibition mask layer, the signature prohibition mask layer, and the edge prohibition mask layer to obtain a scoring result, including:
[0094] Step S51: Perform mask fusion on the text prohibition mask layer, the signature prohibition mask layer and the edge prohibition mask layer to obtain the initial candidate blank area;
[0095] Step S52: Filter the initial candidate blank areas for invalid blank areas to obtain candidate blank areas;
[0096] Step S53: Score the candidate blank area to obtain the score result.
[0097] In this embodiment, in step S51, the three prohibition mask layers—text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer—are merged at the pixel level to summarize all global prohibition signature areas; all prohibited areas are subtracted from the complete page area to obtain the initial candidate blank area of the page.
[0098] By analyzing the connected components of the image, all continuous and complete blank blocks are extracted, and fragmented gaps are filtered out.
[0099] Invalid blank areas that do not meet the signature adaptation standard are removed; the initial candidate blank area calculation formula is:
[0100] ,
[0101] in, This indicates the area of the globally authorized area that can be legally signed and sealed. This indicates the total area of the drug test report page. This indicates the total area of the text-restricted zone. This indicates the total area of the prohibited area for signing and stamping. This indicates the total area of the forbidden zone at the edge of the page;
[0102] In step S52, the initial candidate blank areas are filtered for invalid blank areas to obtain candidate blank areas; the invalid blank area filtering threshold formula is:
[0103] ,
[0104] in, Represents the area of a single empty connected region. This represents the standard signature rendering area. 1.2 is a safety redundancy coefficient, reserving a small margin for error to prevent signatures from overlapping the lines.
[0105] This embodiment removes all invalid and non-compliant signature areas, retaining only high-quality signatureable blocks, providing an accurate data foundation for subsequent optimal position calculations, and ensuring signature compliance from a spatial perspective.
[0106] The candidate blank areas are scored to obtain the scoring results; all compliant blank areas are evenly divided into a 30-pixel × 30-pixel standard grid, and the center point of each grid is taken as the coordinates of the candidate signature; the total score is 100 points, with 25 points for each of the four dimensions. The score is calculated for each candidate point, and non-compliant candidate points are directly eliminated with zero points; the scoring calculation formula is: ,in Indicates the scoring result. Indicates the degree of distance between the text and the text. This indicates that the signature is far away from the area. Indicates the visual compliance of the page. This indicates the sufficiency of the blank area; all valid candidate points are sorted in descending order of total score, and the coordinates of the highest score are the target positions of the second electronic signature in the drug inspection report to be signed.
[0107] In an optional embodiment of the present invention, step S53, scoring the candidate blank area to obtain a scoring result, includes:
[0108] Step S531: Obtain the text distance based on the distance between the candidate blank area and the nearest text;
[0109] Step S532: Obtain the signature distance based on the distance between the candidate blank area and the first signature image;
[0110] Step S533: Obtain the page visual compliance based on the distance between the candidate blank area and the page margin;
[0111] Step S534: Based on the area of the candidate blank area, obtain the sufficiency of the blank area;
[0112] Step S535: Based on the text distance, signature distance, page visual compliance, and white space sufficiency, a scoring result is obtained.
[0113] In this embodiment, the text distance refers to the distance between the candidate blank area and the nearest text. For the text distance score, the farther the candidate blank area is from the nearest text block, the higher the score. If the candidate blank area overlaps with the text, it does not meet the requirements and the candidate blank area is directly eliminated.
[0114] The signature distance refers to the distance between the candidate blank area and the nearest first signature image. For the signature distance score, the farther the candidate blank area is from the nearest first signature image, the higher the score. If the candidate blank area overlaps with the first signature image, it does not meet the requirements and the candidate blank area is directly eliminated.
[0115] Regarding the page visual compliance score, in accordance with the official document signing specifications, the bottom right and bottom center areas of the page receive full marks, the center area receives second-best marks, and the top left area receives low marks.
[0116] For the score of the abundance of blank areas, the larger the area and the more regular the shape of the blank area where the candidate point is located, the higher the score; narrow and irregular areas will result in a significant deduction of points.
[0117] The overall score for the candidate blank area is the sum of the text distance score, the signature distance score, the page visual compliance score, and the blank area sufficiency score.
[0118] In an optional embodiment of the present invention, step S6, determining the target location of the second electronic signature in the drug inspection report to be signed based on the scoring result, includes:
[0119] Step S61: Select the blank area with the highest score in the scoring results as the target position of the second electronic signature in the drug inspection report to be signed.
[0120] Step S62: If there is no candidate blank area, select the largest initial candidate blank area or the bottom blank area as the target position of the second electronic signature in the drug test report to be signed.
[0121] In this embodiment, as Figure 3As shown, all candidate blank areas are sorted in descending order of total score, and the candidate blank area with the highest score is the target position of the second electronic signature in the drug inspection report to be signed. If there is no candidate blank area that meets the requirements, in the case of a large area of blank space, the text spacing of the entire text is traversed, and the smallest usable area with the largest spacing, no signature, and far from the edge is selected as the target position of the electronic signature. In the case of dense text on the entire page, the blank lines at the bottom of the page and the blank area in the footer are prioritized as the target position of the electronic signature to ensure that the core test data is not obscured. In the case of multiple signatures stacked, all existing signatures are avoided in the entire area, and the remaining unique compliant blank point on the page is iteratively selected as the target position of the electronic signature. The above method in this embodiment is applicable to the scenario of automatic signing of batch drug inspection reports to be signed. Through the above method, the accurate signing position adaptation of all pages can be achieved, with no signing dead spots, and the industry pain points of special layouts, dense layouts, and multi-signature pages cannot be intelligently signed.
[0122] like Figure 4 As shown, embodiments of the present invention also provide an automatic positioning device 40 for electronic signatures on drug testing reports, comprising:
[0123] The acquisition module 41 is used to acquire the drug test report to be signed, which includes text and / or at least one first signature image.
[0124] Processing module 42 is used to perform text coordinate detection on the drug inspection report to be signed to obtain a text prohibition mask layer; to perform at least one first signature image recognition on the drug inspection report to be signed to obtain a signature prohibition mask layer; to perform page margin recognition on the drug inspection report to be signed to obtain an edge prohibition mask layer; to score the image grid of the drug inspection report to be signed based on the text prohibition mask layer, the signature prohibition mask layer, and the edge prohibition mask layer to obtain a scoring result; and to determine the target position of the second electronic signature in the drug inspection report to be signed based on the scoring result, such that the target position is different from the position of the at least one first signature image and text in the drug inspection report to be signed.
[0125] Optionally, text coordinate detection is performed on the drug test report to be signed to obtain a text prohibition mask layer, including:
[0126] The text coordinates of the drug inspection report to be signed are scanned to obtain the text coordinate frame.
[0127] The text coordinate frame is expanded to obtain a text mask layer.
[0128] Optionally, at least one first signature image recognition is performed on the drug test report to be signed to obtain a signature prohibition mask layer, including:
[0129] The drug inspection report to be signed is processed with uniform resolution, pixel normalization and standardization to obtain the target drug inspection report;
[0130] The target drug test report is subjected to downsampling, residual layer progression, stepwise downsampling and global feature fusion to obtain a global semantic feature map;
[0131] The global semantic feature map is subjected to bidirectional feature fusion, which involves both top-down upsampling and bottom-up sampling, to obtain a fused feature map.
[0132] The fused feature map is expanded to obtain a signature prohibition mask layer.
[0133] Optionally, the margins of the drug inspection report to be signed are identified to obtain an edge prohibition mask layer, including:
[0134] The margins of the drug inspection report to be signed are identified according to a preset page ratio to obtain safe margins.
[0135] Based on the security margins, an edge prohibition mask layer is obtained.
[0136] Optionally, based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, the image grid of the drug test report to be signed is scored to obtain the scoring result, including:
[0137] The text prohibition mask layer, the signature prohibition mask layer, and the edge prohibition mask layer are masked and blended to obtain an initial candidate blank area;
[0138] The initial candidate blank areas are filtered for invalid blank areas to obtain the candidate blank areas;
[0139] The candidate blank areas are scored to obtain the scoring results.
[0140] Optionally, the candidate blank areas are scored to obtain scoring results, including:
[0141] The distance between the candidate blank area and the nearest text is used to obtain the text distance.
[0142] The distance between the candidate blank area and the nearest first signature image is used to obtain the signature distance.
[0143] The visual compliance of the page is determined by the distance between the candidate blank area and the page margin.
[0144] The sufficiency of the blank area is determined based on the area of the candidate blank area;
[0145] The scoring results are obtained based on the distance between the text and the signature, the visual compliance of the page, and the sufficiency of the blank area.
[0146] Optionally, based on the scoring results, the target location of the second electronic signature in the drug inspection report to be signed is determined, including:
[0147] The blank area with the highest score in the scoring results will be used as the target position for the second electronic signature in the drug inspection report to be signed.
[0148] If no candidate blank area exists, the largest initial candidate blank area or the bottom blank area will be selected as the target position for the second electronic signature in the drug test report to be signed.
[0149] It should be noted that all implementation methods in the above method embodiments are applicable to the embodiments of this device and can achieve the same technical effect.
[0150] Embodiments of the present invention also provide a computing device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the automatic location method for electronic signatures on drug testing reports according to the present invention. All implementations in the above method embodiments are applicable to the embodiments of this computing device and can achieve the same technical effects.
[0151] Embodiments of the present invention also provide a computer-readable storage medium storing a program that, when executed by a processor, implements the automatic location method for electronic signatures on drug testing reports described in this invention. All implementations in the above method embodiments are applicable to embodiments of this computing device and can achieve the same technical effects.
[0152] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0153] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0154] In the embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0155] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0156] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0157] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0158] Furthermore, it should be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent solutions of the present invention. Moreover, the steps performing the above series of processes can naturally be executed in the order described, but are not necessarily required to be executed in chronological order; some steps can be executed in parallel or independently of each other. Those skilled in the art will understand that all or any step or component of the method and apparatus of the present invention can be implemented in any computing device (including processors, storage media, etc.) or network of computing devices, in hardware, firmware, software, or a combination thereof. This is something that those skilled in the art can achieve by using their basic programming skills after reading the description of the present invention.
[0159] Therefore, the object of the present invention can also be achieved by running a program or a set of programs on any computing device. The computing device can be a known general-purpose device. Therefore, the object of the present invention can also be achieved simply by providing a program product containing program code for implementing the method or apparatus. That is, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any known storage medium or any storage medium developed in the future. It should also be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent to the present invention. Furthermore, the steps for performing the above series of processes can naturally be performed in the order described, but are not necessarily required to be performed in chronological order. Some steps can be performed in parallel or independently of each other.
[0160] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. An automatic positioning method for electronic signatures on drug testing reports, characterized in that, include: Obtain a drug test report to be signed, the drug test report to be signed including text and / or at least one first signature image; The text coordinates of the drug inspection report to be signed are detected to obtain a text prohibition mask layer; Perform at least one first signature image recognition on the drug test report to be signed to obtain a signature prohibition mask layer; Margin recognition is performed on the drug inspection report to be signed to obtain an edge prohibition mask layer; Based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, the image grid of the blank area of the drug test report to be signed is scored to obtain the scoring result; Based on the scoring results, the target position of the second electronic signature in the drug test report to be signed is determined, such that the target position is different from the position of the at least one first signature image and text in the drug test report to be signed. Specifically, based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, the image grid of the compliant blank area of the drug inspection report to be signed is scored to obtain the scoring results, including: The text prohibition mask layer, the signature prohibition mask layer, and the edge prohibition mask layer are masked and blended to obtain an initial candidate blank area; The initial candidate blank areas are filtered for invalid blank areas to obtain the candidate blank areas; The candidate blank areas are scored to obtain the scoring results.
2. The automatic positioning method for electronic signatures on drug inspection reports according to claim 1, characterized in that, The text coordinate detection of the drug test report to be signed is performed to obtain a text prohibition mask layer, including: The text coordinates of the drug inspection report to be signed are scanned to obtain the text coordinate frame. The text coordinate frame is expanded to obtain a text mask layer.
3. The automatic positioning method for electronic signatures on drug inspection reports according to claim 1, characterized in that, Perform at least one first signature image recognition on the drug test report to be signed to obtain a signature prohibition mask layer, including: The drug inspection report to be signed is processed with uniform resolution, pixel normalization and standardization to obtain the target drug inspection report; The target drug test report is subjected to downsampling, residual layer progression, stepwise downsampling and global feature fusion to obtain a global semantic feature map; The global semantic feature map is subjected to bidirectional feature fusion, which involves both top-down upsampling and bottom-up sampling, to obtain a fused feature map. The fused feature map is expanded to obtain a signature prohibition mask layer.
4. The automatic positioning method for electronic signatures on drug inspection reports according to claim 1, characterized in that, Margin recognition is performed on the drug inspection report to be signed to obtain an edge prohibition mask layer, including: The margins of the drug inspection report to be signed are identified according to a preset page ratio to obtain safe margins. Based on the security margins, an edge prohibition mask layer is obtained.
5. The automatic positioning method for electronic signatures on drug inspection reports according to claim 1, characterized in that, The candidate blank areas are scored to obtain the scoring results, including: The distance between the candidate blank area and the nearest text is used to obtain the text distance. The distance between the candidate blank area and the nearest first signature image is used to obtain the signature distance. The visual compliance of the page is determined by the distance between the candidate blank area and the page margin. The sufficiency of the blank area is determined based on the area of the candidate blank area; The scoring results are obtained based on the distance between the text and the signature, the visual compliance of the page, and the sufficiency of the blank area.
6. The automatic positioning method for electronic signatures on drug inspection reports according to claim 1, characterized in that, Based on the scoring results, the target location of the second electronic signature in the drug inspection report to be signed is determined, including: The blank area with the highest score in the scoring results will be used as the target position for the second electronic signature in the drug inspection report to be signed. If no candidate blank area exists, the largest initial candidate blank area or the bottom blank area will be selected as the target position for the second electronic signature in the drug test report to be signed.
7. An automatic positioning device for electronic signatures on drug testing reports, characterized in that, include: The acquisition module is used to acquire the drug test report to be signed, which includes text and / or at least one first signature image. The processing module is used to perform text coordinate detection on the drug inspection report to be signed and obtain a text prohibition mask layer; Perform at least one first signature image recognition on the drug test report to be signed to obtain a signature prohibition mask layer; Margin recognition is performed on the drug inspection report to be signed to obtain an edge prohibition mask layer; based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, the image grid of the blank area of the drug inspection report to be signed is scored to obtain a scoring result; based on the scoring result, the target position of the second electronic signature in the drug inspection report to be signed is determined, such that the target position is different from the position of the at least one first signature image and text in the drug inspection report to be signed; Specifically, based on the text prohibition mask layer, signature prohibition mask layer, and edge prohibition mask layer, the image grid of the compliant blank area of the drug inspection report to be signed is scored to obtain the scoring results, including: The text prohibition mask layer, the signature prohibition mask layer, and the edge prohibition mask layer are masked and blended to obtain an initial candidate blank area; The initial candidate blank areas are filtered for invalid blank areas to obtain the candidate blank areas; The candidate blank areas are scored to obtain the scoring results.
8. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Electronic signature generation method and device, equipment and storage medium
CN116189203A
Seal recognition method and apparatus, electronic device, and storage medium
WO2024169397A1