Insurance policy verification method, device, system and equipment based on AI model and medium
Patent Information
- Application Number
- CN202611089224.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-08-18
AI Technical Summary
[0004]但采用上述方法有如下技术问题:线下签署的保单会包含保险公司红色承保章、骑缝章、批改批注、标注信息等;而印章以及批注信息可能会与保单的核心字段(例如投保人、保额、期限、业务选项等)重叠或覆盖,让前景像素与文字像素重叠融合
在本申请的实施例中,本申请可以获取保单图像并将保单图像拆分为三原色通道对应的图像,得到原色通道图像;基于三张原色通道图像的像素区间识别印章对应的印章像素图像,基于印章像素图像生成印章遮挡掩码;根据印章遮挡掩码的轮廓进行掩码优化处理,得到印章优化掩码;拼接印章优化掩码和保单图像得到拼接图像,并调用预设AI补全模型对拼接图像进行文字补全,得到补全图像;利用OCR技术从补全图像提取特征信息,并根据特征信息进行校验处理。本申请先通过分通道色彩分割精准定位保单红色印章,再借助 AI 图像修复还原被印章遮挡的文字内容,解决传统 OCR 识别因印章遮挡造成字段漏检、识别失真的问题,有效降低保单校验出错率,大幅提升保单自动校验精度与自动化处理效率。
Smart Images

Figure CN122598153A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of insurance policy verification, and in particular to an AI-based insurance policy verification method, apparatus, system, equipment, and medium. Background Technology
[0002] With the development of the insurance business, more and more people are starting to purchase insurance. In order to prevent malicious individuals from committing insurance fraud through malicious applications, insurance companies need to verify the applications of policyholders. Verification can not only ensure the validity of the policy, but also promptly identify potential problems in the insurance configuration.
[0003] One common verification method is to obtain image information of the business policy (e.g., the sales staff take a picture or scan the policy signed offline by the policyholder and upload the image), then call OCR technology to extract the corresponding fields from the image information, and then compare the extracted feature fields with the fields corresponding to the business service to determine whether the business policy meets the requirements.
[0004] However, the above method has the following technical problems: offline signed insurance policies will include the insurance company's red underwriting stamp, seal across the binding, approval annotations, and other information; these stamps and annotations may overlap or cover the core fields of the policy (such as policyholder, sum insured, term, and business options), causing foreground pixels to overlap and merge with text pixels. This not only breaks the text outline, resulting in incomplete text detection box segmentation, but also causes OCR technology to miss obscured core fields, reducing the accuracy of verification. Summary of the Invention
[0005] In view of the aforementioned problems, this application is made to provide an AI-based policy verification method, apparatus, system, device, and medium that overcomes or at least partially solves the aforementioned problems, including: A policy verification method based on an AI model, the method comprising: The policy image is acquired and split into images corresponding to the three primary color channels to obtain the primary color channel images; Based on the pixel range of the three primary color channel images, identify the stamp pixel image corresponding to the stamp, and generate a stamp occlusion mask based on the stamp pixel image. The mask optimization process is performed based on the outline of the seal occlusion mask to obtain the seal optimization mask, wherein the mask optimization process includes pixel filtering and trajectory merging. The stamp optimization mask and the policy image are spliced together to obtain a spliced image, and a preset AI completion model is called to complete the text in the spliced image to obtain a completed image; Feature information is extracted from the completed image using OCR technology, and verification processing is performed based on the feature information.
[0006] Optionally, the step of identifying the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and generating a stamp occlusion mask based on the stamp pixel image, includes: The three primary color channel images are stacked and merged into a three-dimensional color matrix in channel order, and a threshold comparison function is called to assign values to the three-dimensional color matrix based on a preset three-dimensional color gamut range value to generate a stamp pixel image. The stamp pixel image is weighted and fused with a preset red probability heat map to obtain a stamp fused image. The preset red probability heat map is generated by calculating the red confidence level using all pixels of the policy image. The noise and edges of the fused image of the seal are adjusted to obtain the seal occlusion mask.
[0007] Optionally, adjusting the noise and edges of the fused image of the seal to obtain a seal occlusion mask includes: The noise in the stamp fusion image is eliminated by calling a preset square structuring element, resulting in a noise-processed image; The flood filling algorithm is used to identify and fill the black closed holes in the noise-processed image. Then, a closing operation is performed on the noise-processed image after the holes are filled to close the edges of the noise-processed image, thus obtaining an edge-processed image. Perform a bitwise AND and inversion operation on the edge-processed image and the policy image to obtain the seal occlusion mask.
[0008] Optionally, the step of performing mask optimization processing based on the outline of the seal occlusion mask to obtain a seal-optimized mask includes: Based on the contour retrieval function, a candidate list of contours containing contour coordinates is extracted from the seal occlusion mask; Calculate several feature parameters corresponding to each candidate contour in the contour candidate list to obtain a contour feature dataset, wherein the feature parameters include: the bounding rectangle of the contour, the total area of contour pixels, the aspect ratio, and the contour perimeter. The contour of the seal occlusion mask is optimized based on the contour feature dataset to obtain the seal optimization mask.
[0009] Optionally, the step of performing mask optimization processing on the contour of the seal occlusion mask based on the contour feature dataset to obtain a seal-optimized mask includes: Based on the numerical value of the contour feature dataset, the candidate contours in the contour candidate list are divided into complete candidate contours and missing candidate contours. The missing candidate contours are filtered according to a preset area filtering threshold to obtain filtered candidate contours; The filtered candidate contours are aggregated and merged to obtain the seam-covering contour, and the seam-covering contour and the complete candidate contour are fused to obtain the stamp-optimized mask.
[0010] Optionally, the process of stitching the optimized seal mask and the policy image to obtain a stitched image, and then calling a preset AI completion model to complete the text in the stitched image to obtain a completed image, includes: The optimized mask for the seal and the policy image are subjected to channel stitching and standardization to obtain a stitched image; A preset AI completion model is invoked to extract predicted feature images from the stitched image, and the fields of the predicted feature images are repaired and completed to obtain a completed image.
[0011] An insurance policy verification device based on an AI model, the device comprising: The acquisition module is used to acquire the policy image and split the policy image into images corresponding to the three primary color channels to obtain the primary color channel images; The recognition module is used to identify the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and to generate a stamp occlusion mask based on the stamp pixel image. An optimization module is used to perform mask optimization processing based on the outline of the seal occlusion mask to obtain a seal optimized mask, wherein the mask optimization processing includes pixel filtering and trajectory merging. The completion module is used to stitch together the seal optimization mask and the policy image to obtain a stitched image, and call a preset AI completion model to complete the text in the stitched image to obtain a completed image; The verification module is used to extract feature information from the completed image using OCR technology and perform verification processing based on the feature information.
[0012] An insurance policy verification system based on an AI model, the system comprising: an insurance policy verification platform and several communication terminals; The policy verification platform communicates with each of the communication terminals, which are used to collect and upload policy images. The policy verification platform is used to execute the AI model-based policy verification method described above.
[0013] An apparatus includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the policy verification method based on the AI model as described above.
[0014] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the AI-based policy verification method as described above.
[0015] This application has the following advantages: In the embodiments of this application, the application can acquire a policy image and split the policy image into images corresponding to the three primary color channels to obtain primary color channel images; identify the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and generate a stamp occlusion mask based on the stamp pixel image; perform mask optimization processing according to the outline of the stamp occlusion mask to obtain an optimized stamp mask; stitch the optimized stamp mask and the policy image to obtain a stitched image, and call a preset AI completion model to perform text completion on the stitched image to obtain a completed image; use OCR technology to extract feature information from the completed image, and perform verification processing based on the feature information. This application first accurately locates the red stamp of the policy through channel color segmentation, and then uses AI image restoration to restore the text content obscured by the stamp, solving the problem of field omission and recognition distortion caused by stamp occlusion in traditional OCR recognition, effectively reducing the error rate of policy verification, and significantly improving the accuracy and efficiency of automatic policy verification. Attached Figure Description
[0016] To more clearly illustrate the technical solution of this application, the drawings used in the description of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the steps of an AI-based policy verification method according to an embodiment of this application. Figure 2 This is a structural block diagram of an AI model-based insurance policy verification device provided in one embodiment of this application; Figure 3 This is a structural block diagram of an AI model-based insurance policy verification system provided in one embodiment of this application; Figure 4 This is a schematic diagram of the structure of a computer device provided in one embodiment of this application. Detailed Implementation
[0018] To make the objectives, features, and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0019] With the development of the insurance business, more and more people are starting to purchase insurance. In order to prevent malicious individuals from committing insurance fraud through malicious applications, insurance companies need to verify the applications of policyholders. Verification can not only ensure the validity of the policy, but also promptly identify potential problems in the insurance configuration.
[0020] One common verification method is to obtain image information of the business policy (e.g., the sales staff take a picture or scan the policy signed offline by the policyholder and upload the image), then call OCR technology to extract the corresponding fields from the image information, and then compare the extracted feature fields with the fields corresponding to the business service to determine whether the business policy meets the requirements.
[0021] However, the above method has the following technical problems: offline signed insurance policies will include the insurance company's red underwriting stamp, seal across the binding, approval annotations, and other information; these stamps and annotations may overlap or cover the core fields of the policy (such as policyholder, sum insured, term, and business options), causing foreground pixels to overlap and merge with text pixels. This not only breaks the text outline, resulting in incomplete text detection box segmentation, but also causes OCR technology to miss obscured core fields, reducing the accuracy of verification.
[0022] To address the aforementioned issues, the following specific embodiments will provide a detailed description and explanation of an AI-based policy verification method, apparatus, system, device, and medium provided in this application.
[0023] To address the technical issue of existing technologies where fields within policy images are obscured by seals, leading to inaccuracies in field extraction and reduced policy verification accuracy, this paper refers to... Figure 1 The diagram shows a flowchart of an AI-based policy verification method according to an embodiment of this application.
[0024] In one embodiment, the AI model-based policy verification method is applicable to a policy verification platform that can receive different policy images, correct the policy images, and then perform verification processing.
[0025] As an example, the policy verification method based on the AI model may include: S11. Obtain the policy image and split the policy image into images corresponding to the three primary color channels to obtain the primary color channel images.
[0026] It can read the original policy image (JPG / PNG / PDF) to obtain the policy image. Next, it can detect the four corner points and edge lines. Based on the minimum bounding rectangle and Hough transform, it performs tilt correction and perspective correction, correcting the distorted policy image to a standard rectangle viewed from above.
[0027] Since policy images may be uploaded by sales personnel after being photographed, the tilted shooting angle can cause text stretching and seal distortion. The above processing can ensure that the policy layout is neat, the text lines are horizontal, and the seal area is geometrically accurate.
[0028] Next, a bilateral filter (instead of a simple Gaussian filter) can be applied to the image to suppress noise while preserving the strokes of the text and the edges of the stamp. Simultaneously, scan patterns and image noise can be removed to prevent false contours from appearing in subsequent channel segmentation. These operations result in a smooth and clean image with sharp edges for the text and stamp.
[0029] Next, global illumination normalization (correction for reflections, overexposure, or underexposure) can be performed. Specifically, the image brightness histogram can be calculated to compress highlight areas and enhance shadow areas, achieving dynamic range balance. This also eliminates flash reflections, window shadows, and bright spots in screen photography.
[0030] After completing the above operations, the policy image can be split into images corresponding to the three primary color channels, obtaining the primary color channel images. Specifically, the `cv.split` function of OpenCV (Open Source Computer Vision Library, an open-source, cross-platform computer vision and image processing library) can be used to strictly separate the policy image into R, G, and B single-channel grayscale images, obtaining the primary color channel images. Simultaneously, an effective region mask can be created for each channel (excluding black or white borders), retaining only the policy content area. This splitting process ensures that the three channels are independent, clean, and free from boundary interference.
[0031] In an optional embodiment, adaptive white balance correction (red enhancement constraint) can be applied to the sub-channels. Specifically, white balance can be performed on the G or B channels to eliminate ambient color shift; no white balance is performed on the R channel (to preserve the red features of the stamp).
[0032] A standard white balance will wash away the red stamp, causing the segmentation to completely fail. The above steps allow for differentiated processing, ensuring "color correction in the text area and fidelity preservation of red in the stamp area." Simultaneously, it ensures normal color in the text area while preventing the loss or shifting of the red stamp color.
[0033] Optionally, channel-specific min-max normalization can be performed (non-global, local window normalization). Specifically, local extrema can be calculated using a 32×32 sliding window, and local contrast normalization can be performed to [0, 255]. This is to avoid global normalization darkening the text or diluting the seal, and to maintain the relative gradient between the text and the seal.
[0034] In another optional embodiment, channel quality scoring and outlier filtering can also be performed. Specifically, sharpness, contrast, and effective proportion scores can be calculated for each of the three channels. If the scores fall below a threshold, a resampling prompt is automatically triggered to ensure that the images in subsequent steps are of acceptable quality.
[0035] S12. Identify the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and generate a stamp occlusion mask based on the stamp pixel image.
[0036] In one embodiment, after obtaining three independent grayscale images, the stamp pixel image corresponding to the stamp in the image can be identified based on the pixel range of the primary color channel image, and a stamp occlusion mask can be generated based on the stamp pixel image.
[0037] The seal occlusion mask can be a binary mask of the policy seal that is noise-free, free of text occlusion, and completely closed (white 255 represents the seal occlusion area, black 0 represents the normal printed text and paper background area).
[0038] The red seal on the insurance policy has problems such as fading, semi-transparent overlay, uneven shade, reddish background, interference from light red stains, and misjudgment of red foreground by high pixel values of text. The single-channel threshold cannot accurately distinguish the seal from the background text, and is prone to masking omissions, over-detection, breakage, and noise.
[0039] This application can use three-dimensional color gamut joint constraints to filter interference layer by layer and fill in the missing areas of the seal to form a high-precision seal mask.
[0040] In an optional embodiment, the step of identifying the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and generating a stamp occlusion mask based on the stamp pixel image, may include the following sub-steps: S121. Stack and merge the three primary color channel images into a three-dimensional color matrix in channel order, and call the threshold comparison function to assign values to the three-dimensional color matrix based on the preset three-dimensional color gamut range value to generate a stamp pixel image.
[0041] S122. The stamp pixel image is weighted and fused with a preset red probability heat image to obtain a stamp fused image, wherein the preset red probability heat image is generated by calculating the red confidence level using all pixels of the policy image.
[0042] S123. Adjust the noise and edges of the stamp fusion image to obtain the stamp occlusion mask.
[0043] In one embodiment, a three-dimensional color gamut rule for the red color of the policy stamp can be constructed to determine a preset three-dimensional color gamut range value.
[0044] Specifically, it can load sample datasets of round and long strip seals used in industry insurance policies, statistically analyze the RGB grayscale distribution range of millions of seal pixels, solidify the basic threshold of the dedicated three-dimensional color gamut, and obtain the preset three-dimensional color gamut range value.
[0045] For the single-channel basic intervals R∈[160,255], G∈[30,120], and B∈[30,120]. To address the issue that pixels of semi-transparent light red stamps and lightly faded stamps are easily confused with the light red background of paper, a dual-channel difference strong red constraint condition is added, forming a three-dimensional joint judgment formula. Pixels simultaneously satisfy the following conditions: 1. 160 ≤ R ≤ 255; 2. 30 ≤ G ≤ 120; 3. 30 ≤ B ≤ 120; 4. R - G > 60; 5. R - B > 60; The rules for excluding interfering red pixels can be as follows: Printed light red borders, pink annotations, and orange markers only satisfy the single-channel red range but cannot simultaneously satisfy the dual-channel difference constraint; therefore, they are directly classified as non-stamp pixels. The entire set of three-dimensional color gamut constraint rules can be encapsulated into a callable judgment function as the underlying criterion for subsequent pixel selection.
[0046] Traditional techniques rely solely on red brightness for filtering ordinary single-channel R-value thresholds. This leads to significant misidentification of reddish paper backgrounds, red printed lines, and pink handwritten annotations as stamp areas, causing excessive mask expansion and obscuring a large amount of normal text. This application establishes a dedicated 3D color judgment standard for insurance policy stamps, retaining only standard insurance red stamp pixels and thoroughly filtering out irrelevant red interference sources such as paper background color, decorative red lines, and pink graffiti, thereby reducing the probability of false mask detection from a rule-based perspective.
[0047] After setting the preset 3D color gamut range value, the three primary color channel images can be stacked and merged into a 3D color matrix in channel order. Then, the OpenCV built-in cv.inRange() function is called, taking the preset 3D color gamut range value as the input parameter, and iterating through the 3D color matrix pixel by pixel to determine the color. If all pixels meet the 3D color gamut constraints, a value of 255 is assigned (white, marked as a candidate pixel for the stamp); if any constraint is not met, a value of 0 is assigned (black, background / text pixels), generating the stamp pixel image Mask_Raw.
[0048] After traversal, the Mask_Raw image of the stamp pixel image is cropped to remove invalid pixel areas caused by blank black and white borders at the image edges.
[0049] Because individual threshold filtering for each channel loses the multi-channel linkage features and cannot simultaneously constrain the G and B channel values, the filtering of light-colored stamp pixels is incomplete, resulting in large areas of holes and breaks in the stamp mask. Through the above operation, all pixels conforming to the red stamp color gamut characteristics can be filtered in batches at once, outputting a coarse mask that completely covers the stamp body, fully preserving the basic outline of circular warranty stamps and segmented seals. This application, by abandoning the inefficient serial filtering method of sequentially filtering R / G / B channels, adopts matrix parallel pixel determination, balancing computational speed and pixel filtering integrity, and adapting to the real-time computing needs of embedded devices.
[0050] Next, you can iterate through all the pixels of the policy image, calculate the red confidence score point by point, and generate a single-channel preset red probability heatmap that is exactly the same size as the original image.
[0051] Set two levels of confidence thresholds: high confidence threshold T1 = 0.3, low confidence threshold T2 = 0.1; perform hierarchical weighted processing on the HeatMap: Score ≥ 0.3: High-reliability pixels for the stamp, weighted by 1.0, fully preserved in the mask; 0.1 < Score < 0.3: Faded, semi-transparent stamp pixels, weight coefficient 0.6, supplemented by coarse mask; Score ≤ 0.1: weak red interference pixels, weight coefficient 0, directly discarded.
[0052] In one embodiment, the red confidence level can be calculated as follows: Score=255R (G+B) / 2.
[0053] The score ranges from -1 to 1, with a higher score indicating higher purity of the red ink in the pixel.
[0054] Next, the preset red probability heatmap image HeatMap and the stamp pixel image Mask_Raw can be merged by pixel-level bitwise OR to obtain the stamp fused image, which can be the fusion weighted mask Mask_Weight.
[0055] Due to fading of the stamp over long-term storage and insufficient pressure, a semi-transparent light red area was created. Relying solely on a fixed inRange threshold would directly filter out the light red pixels, resulting in large areas of voids inside the stamp mask. During the AI restoration stage, the occlusion markers were missing, and the occluded text could not be completed.
[0056] This application allows low-concentration light red stamp pixels to be effectively added to the mask, repairing stamp mask breaks and hollowing defects, and ensuring that all light red ink areas overlapping with text are marked as masked areas.
[0057] Finally, the noise and edges of the stamp fusion image can be adjusted to obtain the stamp occlusion mask.
[0058] In one embodiment, to remove all plain text areas from the mask, retaining only the actual red stamp-occluded area, and ensuring that normally printed text is not marked as obscured, the step of adjusting the noise and edges of the stamp-fused image to obtain the stamp-occlusion mask may include the following sub-steps: S1231. Call the preset square structuring element to eliminate the noise in the stamp fusion image to obtain a noise-processed image.
[0059] S1232. The flood filling algorithm is used to identify the black closed holes in the noise-processed image and fill them. The closing operation is performed on the noise-processed image after the holes are filled to close the edge of the noise-processed image and obtain the edge-processed image.
[0060] S1233. Perform bitwise AND and inversion operations on the edge-processed image and the policy image to obtain the seal occlusion mask.
[0061] In one embodiment, a 2×2 square kernel can be constructed, the size of which can be tested on a large number of policy images to take into account both noise removal and seal edge protection.
[0062] Next, an erosion operation (cv.erode) can be performed on the stamp fusion image Mask_Weight. Specifically, the Kernel can be used to traverse the mask, retaining only the white pixels completely covered by the structuring element, thus eliminating dust spots, scan patterns, pixel-level noise, and tiny red ink spots.
[0063] After erosion, a dilation operation (cv.dilate) is performed, using the same 2×2 structuring element to restore the overall size of the seal and avoid shrinking the seal due to erosion. After opening, a denoising mask is output to obtain the noise-processed image Mask_Denoise.
[0064] Dust captured by a camera, halftone dots from a scanner, and tiny red ink spots on paper can generate numerous isolated, tiny white noise points in a mask. These noise points are identified as occlusion areas by an AI repair network, incorrectly correcting normal text without occlusion and causing text blurring and distortion. This application can remove all isolated noise points and speckles smaller than 4 pixels, completely preserving the continuous outline of the seal, resulting in a clean and noise-free mask image and eliminating invalid occlusion marks. Furthermore, it adapts to small-sized customized morphological structural elements for policy seals, unlike the common 3×3 and 5×5 large structural elements. While removing tiny noise points, it does not erode the thin, elongated edges of the seal, thus balancing the dual needs of noise reduction and outline fidelity.
[0065] Next, the cv.floodFill algorithm built into OpenCV can be used to detect the black closed holes inside the Mask_Denoise mask of the noise-processed image. Starting from the black pixels at the boundary of the mask, the black closed area inside the stamp is traversed in reverse.
[0066] Specifically, the black holes formed by the light ink inside the seal can be completely filled with white (255), eliminating the hollow areas inside the seal. Simultaneously, a 3×3 elliptical morphological closing operation structuring element can be constructed to perform a closing operation on the mask after filling the holes (the closing operation can be dilation followed by erosion). Specifically, dilation can be used to fill in the tiny gaps at the seal's edge and segment the gaps along the seal's seams; then erosion restores the original outer contour of the seal, preventing the mask from over-expanding and covering the surrounding text. Through the above processing, the mask after hole filling and edge closure can be output, resulting in the edge-processed image Mask_Close.
[0067] Because uneven ink distribution and blank areas left by the stamp can create closed black holes inside the mask, the repair AI would initially determine that the hole areas are unobstructed and skip text completion. Simultaneously, minor gaps on the stamp's edge cause incomplete marking of obstructed areas, resulting in incomplete text repair. However, through the above operations, the stamp mask is completely closed with no internal holes and continuous edges without gaps. All ink-covered areas are uniformly marked as obstructed, ensuring that all text covered by the stamp enters the AI repair range. Furthermore, the optimized combination of flood hole filling and elliptical closing operations, adapting elliptical structural elements to the curved edges of circular insurance stamps and the linear edges of long, strip-shaped stamps, better conforms to the natural contours of the stamp compared to square structural elements, avoiding jagged edges and distortion.
[0068] Finally, the edge-processed image and the policy image can be subjected to bitwise AND and inversion operations to obtain the seal occlusion mask.
[0069] Specifically, an image gradient map can be extracted from the policy image, and the Sobel operator can be used to calculate the gradient magnitudes of the horizontal and vertical character strokes. Then, character identification rules can be constructed: If the gradient magnitude is greater than the gradient threshold T_grad, and the width of the connected component is less than 8 pixels and the aspect ratio is greater than 3, it is determined to be a region of printed black text strokes.
[0070] Based on the above rules, a text inversion suppression mask Mask_Text can be generated. The text inversion suppression mask can be set to 255 for pixels that meet the text determination rules and 0 for the rest of the area.
[0071] Perform a bitwise AND and NOT operation on the edge-processed image Mask_Close and the text inverse suppression mask Mask_Text. If a pixel belongs to a text region, the corresponding position in the stamp mask is forcibly set to 0, thus removing text pixels that are mistakenly included in the mask. This yields the stamp occlusion mask Mask_Filter, which is a text suppression optimization mask.
[0072] For black printed text, reflective strokes can increase the grayscale value of the R channel, and some thin characters may meet the red color gamut threshold, leading to incorrect inclusion in the stamp mask. During the AI restoration stage, clear, unobstructed text can be altered, causing recognition errors. By employing the above methods, all pure text areas in the mask can be removed, retaining only the actual red stamp-obstructed areas. Normal printed text will not be marked as obstructed, ensuring the complete preservation of the original image information of unobstructed text. This application's gradient text feature inverse mask suppression strategy utilizes high-frequency gradient features of text strokes to inversely filter misdetected pixels in the mask, achieving bidirectional differentiation of "stamp preservation and text removal." Conventional red stamp segmentation processes lack this text inverse filtering step.
[0073] In an optional embodiment, the quality of the stamp occlusion mask_Filter can be verified. Specifically, global pixel metrics of the stamp occlusion mask_Filter can be statistically analyzed, such as the total percentage of white occluded pixels, the number of independent connected components, and the maximum or minimum area of a single connected component.
[0074] Next, the quality judgment thresholds for the three-layer mask can be set: 1. If the occlusion percentage is less than 0.5%, it is determined that there is no stamp, an alarm message is output, the segmentation process is terminated, and the original image is returned for re-acquisition. 2. Occlusion percentage > 30%: This indicates severe reddish tint in the image and significant interference with the background color of the paper, triggering an output quality alarm. 3. The maximum area of the connected component is too small: the seal segmentation is determined to be incomplete, and the weighted fusion process is restarted.
[0075] When all masking parameters are qualified, the seal occlusion mask Mask_Filter is saved using 8-bit lossless image encoding, and the mask size, pixel statistics parameters, and quality score are recorded simultaneously.
[0076] Quality verification can intercept substandard masked images in advance, filter low-quality policy inputs, ensure stable input for downstream connected domain clustering, AI repair, and OCR recognition processes, and improve the automation robustness of the entire solution.
[0077] S13. Perform mask optimization processing based on the outline of the seal occlusion mask to obtain a seal optimized mask, wherein the mask optimization processing includes pixel filtering and trajectory merging.
[0078] After obtaining the seal occlusion mask Mask_Filter (255 = seal occlusion, 0 = text or background), the outline of the seal occlusion mask can be identified (including distinguishing the outlines of two types of seals: round insurance seals and segmented strip seals). Then, stains and noise are filtered out, and broken and scattered seal color blocks are merged to generate a unified occlusion mask after classification optimization. This results in an optimized seal mask, which provides a precise guiding mask for subsequent AI image restoration steps.
[0079] The seal in the mask is a single, nearly circular connected region, while the seal across the binding is broken into dozens of discrete, long, strip-shaped color blocks due to spanning multiple pages, creases, and uneven ink distribution. Without proper classification, the segmentation of the seal across the binding will cause fragmented markings. AI only repairs single segments, missing text in the middle, leaving OCR with incomplete characters. Ordinary contour filtering, relying solely on length and width thresholds, cannot distinguish between table lines, handwritten lines, and the seal across the binding, easily leading to false filtering and missed merging issues. This application employs multi-dimensional geometric feature extraction of the contour, followed by seal type rule discrimination, and finally mask optimization to achieve automatic seal classification, noise filtering, and integration of the binding blocks.
[0080] In one embodiment, the step of performing mask optimization processing based on the outline of the seal occlusion mask to obtain a seal-optimized mask may include the following sub-steps: S131. Extract a candidate list of contours containing contour coordinates from the seal occlusion mask based on the contour retrieval function.
[0081] S132. Calculate several feature parameters corresponding to each candidate contour in the contour candidate list to obtain a contour feature dataset, wherein the feature parameters include: the bounding rectangle of the contour, the total area of contour pixels, the aspect ratio, and the contour perimeter.
[0082] S133. Perform mask optimization processing on the contour of the seal occlusion mask based on the contour feature dataset to obtain the seal optimization mask.
[0083] In one embodiment, after obtaining the seal occlusion mask Mask_Filter, boundary clipping can be performed first to remove the blank white edges and scan black edges around the image, retaining only the valid content area of the policy, thus reducing invalid contour calculations.
[0084] Next, you can call OpenCV's cv.findContours contour retrieval function, select RETR_EXTERNAL as the retrieval mode (extract only the outermost contour), and select CHAIN_APPROX_SIMPLE as the retrieval method to compress contour points, reduce coordinate storage, and improve calculation speed.
[0085] Iterate through all retrieved outer contours, and simultaneously encapsulate the hierarchical index and original pixel coordinate set corresponding to each contour to generate a contour candidate list Contour_List.
[0086] Pre-filter the contour list: directly remove tiny, fragmented contours (single-pixel noise, scratches, and fragments) with a total number of contour points < 5, reducing the computational cost of subsequent feature calculations, and outputting a list of valid contour candidates carrying complete coordinate information.
[0087] Because the mask contains a large number of fragmented, isolated noise contours and multi-layered nested pseudo-contours, direct feature calculation would result in a massive amount of invalid computation. Furthermore, nested inner contours could misjudge the internal hollow areas of the seal as independent occlusion regions, interfering with the seal classification logic. Through the above operations, only the outer contour of the main seal body can be retained, filtering out extremely fine fragment contours, reducing the number of candidate objects, and completely preserving the boundary coordinates of all effective occlusion blocks of the underwriting seal and the seal across the seam, providing a clean data source for multi-dimensional feature calculation. Moreover, the dedicated outer contour retrieval and the pre-filtering mechanism based on contour point counts, unlike the general full-level contour traversal method, preemptively removes worthless tiny fragments, balancing the computing power limitations of embedded devices with contour integrity, and adapting to low-computing-power real-time processing scenarios on counter terminals.
[0088] Next, you can iterate through each valid contour in the contour candidate list, calculate the feature parameters corresponding to several multi-dimensional geometric features of each candidate contour, and store the feature parameters uniformly as a contour feature structure Feature_Item.
[0089] Specifically, the feature parameters may include the following: 1. Outline enclosing the circumscribed rectangle: coordinates of the top left corner of the rectangle (x, y), width W, and height H; 2. Area: Total area of pixels within the outline that are obscured by white pixels; 3. Aspect Ratio = Max (W,H) / Min (W,H); 4. Perimeter: The total pixel length of the contour edge; 5. Circularity = (4 × π × Area) / (Perimeter²), with a value range of 0 to 1. The closer the value is to 1, the closer the outline is to a circle. 6. Center coordinates (Cx, Cy): The center point of the circumscribed rectangle, used for subsequent cross-hatching distance clustering.
[0090] After completing feature calculations for all contours, a contour feature dataset, Feature_Set, is generated. Each data point is bound to the original coordinates of the corresponding contour, ensuring a one-to-one mapping between features and image blocks. Then, the contour feature dataset is numerically normalized: area and perimeter are mapped to the 0-1 range to eliminate threshold adaptation issues caused by differences in image size (large or small).
[0091] This application can construct a six-dimensional feature vector that includes size, shape, proportion, and center position, and quantitatively distinguish four types of blocks: circles, strips, thin lines, and stains, providing a quantitative basis for subsequent seal classification.
[0092] Finally, the contours of the stamp occlusion mask can be filtered based on the contour feature dataset to select contours that meet the feature requirements. Then, the contours are optimized and stitched together to obtain the optimized stamp mask.
[0093] In one embodiment, the step of performing mask optimization processing on the contour of the stamp occlusion mask based on the contour feature dataset to obtain a stamp optimized mask may include the following sub-steps: S1331. Based on the numerical value of the contour feature dataset, divide the candidate contours in the contour candidate list into complete candidate contours and missing candidate contours.
[0094] S1332. Filter the missing candidate contours according to the preset area filtering threshold to obtain filtered candidate contours.
[0095] S1333. Aggregate and merge the filtered candidate contours to obtain the seam-covering contour, and fuse the seam-covering contour and the complete candidate contour to obtain the stamp-optimized mask.
[0096] After calculating the Feature_Set contour feature dataset, a single contour feature can be extracted from the Feature_Set contour feature dataset. A unique dual-constraint judgment rule is set for circular underwriting stamps, and a stamp is judged to be an underwriting circular stamp if it meets the following conditions: 1. Circularity > 0.7; 2. Aspect ratio ∈ [0.8, 1.3] (close to square / circle); 3. The area of a single block is within the preset coverage area range [800, 12000] pixels, filtering out oversized color blocks and tiny spots.
[0097] Contours that satisfy all constraints are labeled with the category Label=1 (Insurance Circle), and stored separately in the Circle_Contours collection. Contours that do not meet the conditions are retained, resulting in missing candidate contours.
[0098] The outline of the identified underwriting circle is slightly expanded at the edges (1 pixel structuring element) to fill in the slightly missing edges of the stamp, ensuring the integrity of the circular occlusion area, and obtaining a complete candidate outline. This complete candidate outline is an independent mask Mask_Circle for the underwriting circle, which is temporarily cached for subsequent mask fusion.
[0099] Slight compression or damage to a round underwriting stamp can cause a slight decrease in roundness, and a single roundness threshold can easily lead to missed underwriting stamps. At the same time, large areas of stains and square printed color blocks can easily be misjudged as round stamps. Through the above operations, all red round underwriting stamps on policies can be accurately separated, the round obscured area can be completely preserved, and the stamps can be separated from the long strip across the seam to avoid masking distortion caused by the mixing and optimization of the two types of stamps.
[0100] For missing candidate contours, a long strip seal determination constraint can be constructed. If the constraint is satisfied, Label=2 (seal). The specific constraints are as follows: 1. The aspect ratio is greater than 4, and the block is long and thin. 2. Distinguish the direction: For horizontal seam seals, W > H; for vertical seam seals, H > W. 3. Area range [100, 6000], excluding extremely fine table lines and large areas of stains; 4. Contour compactness > 0.3, filtering out discrete dot-like stray lines.
[0101] Contours that meet the rules are uniformly stored in the original segment set Seal_Strip_List of the seal; the remaining missing candidate contours that do not meet the rules of round seal and seal with Label=0 (stains / interference lines) are entered into the next level of filtering process.
[0102] The center coordinates, line direction, and circumscribed rectangle boundary of each seam segment contour are recorded synchronously as the basic parameters for subsequent clustering and merging.
[0103] The geometric shapes of the lines of the seal across the seam are similar to the horizontal lines of the policy form and the lines of the handwritten signature. Relying solely on the aspect ratio will lead to a large number of misidentifications of irrelevant lines. This application introduces multiple constraints such as direction, area, and compactness to achieve accurate differentiation. This application can completely extract all scattered and broken color blocks of the seal across the seam, isolate irrelevant long and interfering lines such as those from forms and handwriting, and separately collect all effective seal-covered segments.
[0104] During filtering, missing candidate contours can be read from the set of interfering contours (stains, ink spots, scratches, thin table lines) with Label=0, and two levels of area filtering thresholds can be set, as follows: Level 1 Filtering: Areas < 30 pixels are directly identified as tiny dust spots or ink dots and are all removed; Secondary filtering: Areas with a width of 30 ≤ Area < 100 and an aspect ratio > 10 are judged as extremely fine table lines or scratches and are simultaneously removed.
[0105] Filtered candidate contours are generated from the filtered missing candidate contours. These filtered candidate contours can be used as a noise mask (Mask_Noise) and then removed in reverse during subsequent mask fusion.
[0106] After filtering, only the complete candidate outline of the Label=1 insured round seal and the filtered candidate outline of the Label=2 cross-seam segment are retained as the two types of valid seal outlines, while all irrelevant and interfering blocks are removed.
[0107] Paper dust, scan dots, and minor scratches generate numerous small connected regions. If not filtered out, these regions will be included in the occlusion mask, causing AI to indiscriminately repair blank text areas, resulting in blurred and disordered text. This application can remove all minor interference color blocks that are not related to seals, retaining only the areas occluded by the genuine underwriting seal and the seal across the seam, simplifying the effective occlusion mask content, and reducing the amount of computational work required for invalid repair.
[0108] Finally, all candidate contours (strips along the seam) in Seal_Strip_List can be traversed, and the center coordinates of the segment (Cx, Cy) and the direction of the line (horizontal or vertical) can be used as the dual core features for clustering: only segments with consistent direction are allowed to be classified into the same cluster group.
[0109] The Euclidean distance clustering determination is as follows: If the horizontal or vertical distance between the centers of two cross-stamps is less than the preset threshold of 80 pixels, they are considered to be the same group of consecutive cross-stamps and are assigned to the same cluster Group_N; if the distance exceeds the threshold, they are considered to be cross-stamps on different pages or in different columns and are stored in separate clusters.
[0110] For all scattered segments within each cluster, calculate the minimum bounding rectangle of the entire cluster: take the leftmost, rightmost, topmost, and bottommost boundaries of all segments within the cluster to generate a complete long bounding box.
[0111] Fill the entire smallest bounding rectangle region with white (255) to merge the scattered seam-crossing segments of the same group into a single continuous occlusion block, generating a merged complete seam-crossing mask, resulting in the seam-crossing occlusion contour Mask_SealMerge. Repeat this process for all clusters to obtain a seamless, integrated seam-crossing occlusion contour.
[0112] The seal across the printing edge is often broken into dozens of small segments due to policy folds, insufficient ink, and printing gaps. The text covered within these gaps lacks obscuring markers, preventing AI from repairing it. Ultimately, OCR identifies these gap characters as incomplete or misread. The above method allows for the merging of broken and scattered seals in the same row or column into a single, long, obscuring area. The entire line of text covered by the seal is then marked as the area to be repaired, eliminating the defect of missed repairs in the gaps.
[0113] Finally, a pixel-level bitwise OR operation can be performed on the complete candidate contour Mask_Circle (underwriting circle mask) and the seam occlusion contour Mask_SealMerge to obtain the fused base mask Mask_Base.
[0114] In an optional embodiment, the fusion base mask Mask_Base can be optimized for mask edge smoothing. Specifically, a morphological closing operation can be performed using a 3×3 elliptical structuring element to slightly smooth the jagged edges and small gaps at the joint of the two types of seals, ensuring that the edges of the obscured area are continuous and soft, without sharp breaks.
[0115] Next, interference can be removed from the fusion base mask Mask_Base. Specifically, the fusion base mask Mask_Base and the filter candidate contour Mask_Noise can be bitwise ANDed and inverted to completely remove residual dirt and noise blocks.
[0116] Then, the mask is standardized and encoded, specifically converted into an 8-bit single-channel binary image, and metadata such as the number of underwriting seals, the number of cross-seam clusters, and the total occluded pixel area are recorded simultaneously.
[0117] Finally, a quality self-check can be performed to verify whether there are large mask holes or missing stamp blocks. If no abnormalities are found, the optimized stamp mask Mask_Guide will be output.
[0118] Because the edges of the circular seal and the seam mask are jagged and the boundaries are uneven after segmentation and merging, inputting them into the AI restoration network will cause a harsh transition of the restoration boundary, resulting in blurred and ghosting edges of the restored text. This application can generate an integrated seal occlusion guide mask with smooth edges, complete classification, no noise, and no segment gaps, fully covering the circular seal and seam occlusion areas, providing a precise and continuous occlusion positioning benchmark for AI text restoration.
[0119] S14. The stamp optimization mask and the policy image are spliced together to obtain a spliced image, and a preset AI completion model is called to complete the text in the spliced image to obtain a completed image.
[0120] In one embodiment, after obtaining the optimized integrated seal mask (Mask_Guide, where 255 represents the seal occlusion area and 0 represents normal text or background) and the policy image, the optimized seal mask and the policy image can be stitched together to obtain a stitched image. Finally, a preset AI completion model (which can be a multi-scale lightweight convolutional coding network or a lightweight context-modification CNN network) is called to complete the text in the stitched image, resulting in a completed image. The completed image is a high-definition restored policy image that completely removes all red seals and fully restores the occluded text.
[0121] Traditional image red removal methods simply erase red pixels, simultaneously erasing overlapping text beneath the stamp; general generative restoration models lack mask constraints, making them prone to tampering with unobstructed original text and generating false typos, and their large parameter set makes them unsuitable for deployment on embedded devices at counters; conventional restoration methods do not incorporate prior knowledge of the printed text on the policy, restoring font and line spacing errors, still resulting in incomplete OCR recognition. This application only restores obstructed areas, completely preserving the original text, and faithfully restoring the strokes of the characters.
[0122] In one embodiment, the process of stitching the optimized seal mask and the policy image to obtain a stitched image, and then calling a preset AI completion model to complete the text in the stitched image to obtain a completed image, may include the following sub-steps: S141. Perform channel splicing and standardization processing on the seal optimization mask and the policy image to obtain a spliced image.
[0123] S142. Call the preset AI completion model to extract the predicted feature image from the stitched image, and repair and complete the fields of the predicted feature image to obtain the completed image.
[0124] In one embodiment, two input materials can be read, including a color-normalized original policy image and a stamp-optimized mask (Mask_Guide). After acquiring the two materials, the resolution, pixel size, and channel bit depth of the two images can be unified. If the sizes are inconsistent, the mask is scaled using bilinear interpolation to be exactly the same size as the original image.
[0125] To avoid subsequent errors, pixel-level coordinate registration and verification can be performed on the two images. Specifically, the key points at the four corners of the original image and the mask can be extracted, and the coordinate offset can be calculated. If there is a misalignment of ≥1 pixel, the mask can be shifted based on the original image to achieve a one-to-one correspondence for each pixel and eliminate the residual deviation of the previous geometric correction.
[0126] Next, channel concatenation can be performed to construct a 4-channel composite input tensor. Specifically, the 3-channel RGB original image and the single-channel mask can be stacked along the channel dimension to make the tensor dimension uniform and standardized [Batch, 4, H, W], which is compatible with the lightweight CNN input format of PyTorch.
[0127] Next, numerical normalization mapping is performed. Specifically, the RGB original image pixels can be linearly mapped from 0 to 255 to [-1, 1], and the binary mask values 0 / 255 can be mapped to [0, 1], eliminating the divergence of network gradients caused by differences in numerical ranges. Optionally, boundary padding preprocessing can also be added. Specifically, the 4-channel tensor can be padded with a 16-pixel mirrored boundary to solve the problem of missing context when repairing image edge stamp occlusion areas. After completion, a normalized stitched image is output, which can be the input tensor.
[0128] Because the original image and the mask may have size misalignment or pixel offset, this can lead to offset of the repair area, resulting in a "half-repaired, half-preserved" discontinuity. Furthermore, inconsistent numerical ranges in the two channels can cause instability in the network's training or inference gradients. By constructing a unified 4-channel input with fully aligned pixels, normalized values, and complete edge context, we can ensure that the network accurately locates each area obscured by the stamp, eliminating edge repair defects.
[0129] In one embodiment, a preset AI completion model is invoked to extract predicted feature images from the stitched images. The encoder of the preset AI completion model uses depthwise separable convolutions instead of standard 3×3 convolutions, significantly reducing the number of model parameters and floating-point operations, thus meeting the low-computing-power real-time inference requirements of the embedded device.
[0130] Specifically, the preset AI completion model can construct three layers of multi-scale parallel coding branches: Shallow branch (1×1 convolution): Extracts fine-grained texture of character strokes and character edges; Mid-level branch (3×3 depth convolution): Extracts the horizontal context and field layout structure of a single line of text; Deep branch (dilated separable convolution, dilation rate 2): Extracts entire fields and table global layout context.
[0131] The output feature maps from the three branches are concatenated and fused, and redundant features are compressed through 1×1 convolution to generate a multi-scale encoded feature Encode_Feature that integrates multi-scale text context. Optionally, residual short connection structures can be introduced to prevent gradient vanishing in deep networks and ensure that light-colored, small text features are not lost.
[0132] Achieving millisecond-level inference through a lightweight network, while taking into account multi-dimensional text context features such as strokes, single lines, and whole blocks, it provides complete prior information on layout, font, and strokes for text reconstruction.
[0133] Finally, the model's decoder can be called to receive multi-scale encoded features (Encode_Feature). The encoder has a built-in pre-trained policy text prior embedding module, and the prior knowledge base contains three types of rules specific to financial insurance policies, as follows: 1. Character Priority: Fixed font for printed Chinese characters, numbers 0-9, 18-digit ID card numbers, and fixed font for uppercase and lowercase amounts; 2. Layout Prerequisites: Policy text is arranged horizontally, with fixed line spacing, fields are aligned horizontally, and table cell text is centered; 3. Field Pre-testing: The rows for name, ID card number, premium amount, and insurance type name should have a standard text structure.
[0134] During the decoding sampling process, the feature map of each layer is fused with the prior feature vector of the text channel by channel, and the network is constrained to predict pixels in accordance with the policy printing format: the text must be horizontal and not tilted, the character spacing must be uniform, and the font thickness must match the original image.
[0135] Regionally differentiated decoding: Prior weights are added to high-priority key fields such as ID card numbers and premium figures to enhance the accuracy of digital stroke reconstruction; the weight of description text for ordinary insurance products is reduced to take into account processing speed.
[0136] Upsample layer by layer to restore the original image resolution, and output the predicted feature image Decode_Feature before restoration.
[0137] The above operations can restore the text font, layout, and style of the obscured area to be completely consistent with the original printing style of the policy, including highly sensitive key fields such as name, ID card number, and amount.
[0138] After obtaining the predicted feature image Decode_Feature, the fields of the predicted feature image can be repaired and completed to obtain a completed image. Specifically, the predicted feature image Decode_Feature output by decoding can be mapped to the RGB pixel value range [-1,1], and then restored to the image pixel range of 0~255 through inverse normalization to generate a temporary predicted repair image Img_Pred.
[0139] Next, the preset gated weight image Gate_Map is called to perform pixel fusion calculation on the temporary predicted repair image Img_Pred. The pixel fusion calculation can be to traverse the entire image pixel by pixel, completely replace the masked area with the predicted text pixels after prior constraints, and retain the original policy image pixels in the unmasked area, thus completing the removal of seal pixels and the completion of lower layer text pixels.
[0140] For scenarios where a long strip of seal across multiple lines obscures text, the method involves segmentation and reasoning based on the boundaries of each line of text, restoring the obscured characters line by line to avoid overlapping and disordered text across lines and columns, resulting in a temporary fused output image. Through this processing, all red seal pixels can be accurately extracted, the missing text under the masked area can be completely restored, the boundaries of each line of text are clear and not overlapping, and the original image retains no obscured information with zero loss.
[0141] In one embodiment, the network of the preset AI completion model can be decomposed into a dual-branch data stream, including: a feature encoding branch and a mask gating constraint branch. The gating branch extracts the mask features of the fourth channel of the input tensor separately and generates a single-channel 0~1 preset gating weight image Gate_Map.
[0142] The gating logic layer constraints are as follows: 1. Gate_Map pixel value = 1 (white masking area): Allows the network convolutional layers to update the pixel features at this location and perform text repair inference; 2. Gate_Map pixel value = 0 (mask black normal text area): Forces the original image's RGB pixel features to be locked, sets the gradient of the convolution backpropagation to 0, and does not allow modification, blurring, or replacement of the original text.
[0143] After each convolutional layer output, gated fusion is performed: Feature_Out = Gate_Map * New_Feature + (1 - Gate_Map) * Origin_Feature. Occluded areas use the network to predict new pixels, while unoccluded areas completely reuse the original image pixels.
[0144] The gating layer runs through all network layers of the encoder and decoder, not just the output layer, and blocks pixel modification in unobstructed areas throughout the entire process.
[0145] Unconstrained generative networks redraw the entire image pixel by pixel, blurring, altering, and generating typos in clear, unobstructed information such as the policyholder's name, ID card, and premium figures. This directly leads to distorted information extracted by OCR and failure of policy verification and matching.
[0146] By setting a preset gate weight image Gate_Map, all original text, tables, and backgrounds not covered by the stamp in the policy can retain their original pixels, and pixel repair is only performed in the stamp area marked by the mask, thus preventing information distortion in unobstructed areas.
[0147] Finally, the quality of the temporarily fused images can be verified. Specifically, a three-layer automated quality verification index is constructed to quantitatively detect each temporarily fused image. The quantitative indexes are as follows: 1. Repair integrity detection: Statistically calculate the average gradient of the text in the masked area. If the gradient is lower than the threshold, it is determined that the text repair is incomplete or the strokes are missing, and it is marked as repair failure. 2. Pseudo-text detection: Traverse the repair area to identify irregular garbled characters and malformed characters. If pseudo-text is found, the repair is deemed abnormal. 3. Boundary consistency detection: Calculate the grayscale difference between the repaired area and the surrounding original text. If the difference is too high, it is judged as a light-dark fault.
[0148] Different anomaly handling is implemented for the test results of different indicators, as follows: 1. Minor defects: Retain the image and add a low-quality label; downstream OCR adds confidence verification. 2. Severe repair failure: Automatically revert to step S12 to re-optimize the stamp occlusion mask and execute the AI repair inference a second time.
[0149] 3. Perform lossless encoding on verified images: uniformly save them as RGB lossless bit images, and simultaneously attach metadata (mask occlusion area, repair inference time, quality score, number of stamps).
[0150] Output the completed image Img_Final (without stamp and clear, intact text) for subsequent OCR text extraction processing.
[0151] S15. Use OCR technology to extract feature information from the completed image, and perform verification processing based on the feature information.
[0152] In one embodiment, before feature extraction, the completed image is converted into a standardized grayscale image, Gray_Standard. Then, the standardized grayscale image, Gray_Standard, can be normalized to the [0,1] interval, and a batch tensor is constructed and fed into a preset text detection model to extract feature information. The preset text detection model can be a conventional text extraction model in the field.
[0153] Next, the feature information can be converted into a standardized JSON dataset Clean_Field_Data, which includes policy number, policyholder name, ID number, total premium, type of insurance, underwriting date, field coordinates, identification confidence level, and anomaly classification label; the supporting backend data sources include: user real-name database (policyholder identity filing information), insurance company benchmark policy database (official underwriting original policy filing data), and insurance compliance verification rule database.
[0154] Then, the JSON dataset Clean_Field_Data is processed sequentially through field cleaning and standardization, real-name identity verification, policy verification, and rule validation. Specifically, business information about the user's insurance application can be obtained, and the corresponding business fields can be extracted from the business information. These business fields are then compared with the fields in the feature information to determine the validation result.
[0155] Optionally, the similarity and matching degree of the fields can also be calculated to determine the verification result. The verification method can be adjusted according to actual needs, and this application does not impose further limitations on it.
[0156] In this embodiment, this application provides an AI-based policy verification method, the advantages of which are as follows: This application can acquire a policy image and split the policy image into images corresponding to the three primary color channels to obtain primary color channel images; identify the stamp pixel image corresponding to the stamp based on the pixel intervals of the three primary color channel images, and generate a stamp occlusion mask based on the stamp pixel image; perform mask optimization processing according to the outline of the stamp occlusion mask to obtain an optimized stamp mask; stitch the optimized stamp mask and the policy image to obtain a stitched image, and call a preset AI completion model to perform text completion on the stitched image to obtain a completed image; use OCR technology to extract feature information from the completed image, and perform verification processing based on the feature information. This application first accurately locates the red stamp of the policy through channel color segmentation, and then uses AI image restoration to restore the text content obscured by the stamp, solving the problem of field omission and recognition distortion caused by stamp occlusion in traditional OCR recognition, effectively reducing the error rate of policy verification, and significantly improving the accuracy and efficiency of automatic policy verification.
[0157] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0158] This application also provides an AI-based policy verification device, see [link to relevant documentation]. Figure 2 The diagram shows a schematic of the structure of an AI-based insurance policy verification device according to an embodiment of this application.
[0159] As an example, the AI-based policy verification device may include: The acquisition module 201 is used to acquire the policy image and split the policy image into images corresponding to the three primary color channels to obtain the primary color channel images; The recognition module 202 is used to recognize the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and to generate a stamp occlusion mask based on the stamp pixel image. The optimization module 203 is used to perform mask optimization processing based on the outline of the seal occlusion mask to obtain a seal optimized mask, wherein the mask optimization processing includes pixel filtering and trajectory merging. The completion module 204 is used to splice the seal optimization mask and the policy image to obtain a spliced image, and call a preset AI completion model to complete the text in the spliced image to obtain a completed image; The verification module 205 is used to extract feature information from the completed image using OCR technology and perform verification processing based on the feature information.
[0160] Optionally, the step of identifying the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and generating a stamp occlusion mask based on the stamp pixel image, includes: The three primary color channel images are stacked and merged into a three-dimensional color matrix in channel order, and a threshold comparison function is called to assign values to the three-dimensional color matrix based on a preset three-dimensional color gamut range value to generate a stamp pixel image. The stamp pixel image is weighted and fused with a preset red probability heat map to obtain a stamp fused image. The preset red probability heat map is generated by calculating the red confidence level using all pixels of the policy image. The noise and edges of the fused image of the seal are adjusted to obtain the seal occlusion mask.
[0161] Optionally, adjusting the noise and edges of the fused image of the seal to obtain a seal occlusion mask includes: The noise in the stamp fusion image is eliminated by calling a preset square structuring element, resulting in a noise-processed image; The flood filling algorithm is used to identify and fill the black closed holes in the noise-processed image. Then, a closing operation is performed on the noise-processed image after the holes are filled to close the edges of the noise-processed image, thus obtaining an edge-processed image. Perform a bitwise AND and inversion operation on the edge-processed image and the policy image to obtain the seal occlusion mask.
[0162] Optionally, the step of performing mask optimization processing based on the outline of the seal occlusion mask to obtain a seal-optimized mask includes: Based on the contour retrieval function, a candidate list of contours containing contour coordinates is extracted from the seal occlusion mask; Calculate several feature parameters corresponding to each candidate contour in the contour candidate list to obtain a contour feature dataset, wherein the feature parameters include: the bounding rectangle of the contour, the total area of contour pixels, the aspect ratio, and the contour perimeter. The contour of the seal occlusion mask is optimized based on the contour feature dataset to obtain the seal optimization mask.
[0163] Optionally, the step of performing mask optimization processing on the contour of the seal occlusion mask based on the contour feature dataset to obtain a seal-optimized mask includes: Based on the numerical value of the contour feature dataset, the candidate contours in the contour candidate list are divided into complete candidate contours and missing candidate contours. The missing candidate contours are filtered according to a preset area filtering threshold to obtain filtered candidate contours; The filtered candidate contours are aggregated and merged to obtain the seam-covering contour, and the seam-covering contour and the complete candidate contour are fused to obtain the stamp-optimized mask.
[0164] Optionally, the process of stitching the optimized seal mask and the policy image to obtain a stitched image, and then calling a preset AI completion model to complete the text in the stitched image to obtain a completed image, includes: The optimized mask for the seal and the policy image are subjected to channel stitching and standardization to obtain a stitched image; A preset AI completion model is invoked to extract predicted feature images from the stitched image, and the fields of the predicted feature images are repaired and completed to obtain a completed image.
[0165] This application also provides an AI-based policy verification system, see [link to relevant documentation]. Figure 3 The diagram shows a schematic of the structure of an AI-based policy verification system according to an embodiment of this application.
[0166] As an example, the AI-based policy verification system may include: a policy verification platform and several communication terminals. The policy verification platform communicates with each of the communication terminals, which are used to collect and upload policy images. The policy verification platform is used to execute the AI model-based policy verification method as described in the above embodiments.
[0167] Reference Figure 4 The computer device shown in this application, which is a policy verification method based on an AI model, may specifically include the following: The aforementioned computer device 12 is manifested in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, memory 28, and a bus 18 connecting different system components (including memory 28 and processing unit 16).
[0168] Bus 18 refers to one or more of several types of bus 18 architectures, including memory bus 18 or memory controller, peripheral bus 18, graphics acceleration port, processor, or local bus 18 using any of the various bus 18 architectures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus 18, Micro Channel Architecture (MAC) bus 18, Enhanced ISA bus 18, Audio / Video Electronics Standards Association (VESA) local bus 18, and Peripheral Component Interconnect (PCI) bus 18.
[0169] Computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0170] Memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (commonly referred to as a "hard disk drive"). Figure 4 As not shown, a disk drive for reading and writing to a removable non-volatile disk (such as a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42 configured to perform the functions of the embodiments of this application.
[0171] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory. Such program modules 42 include—but are not limited to—an operating system, one or more application programs, other program modules 42, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of this application.
[0172] Computer device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, camera, etc.), and with one or more devices that enable a user to interact with the computer device 12, and / or with any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed through an input / output interface (I / O interface 22). Furthermore, computer device 12 can also communicate with one or more networks (e.g., local area network (LAN)), wide area network (WAN), and / or public networks (e.g., the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be understood that, although... Figure 4 Not shown, it can be combined with computer device 12 to use other hardware and / or software modules, including but not limited to: microcode, device drivers, processing unit 16, external disk drive array, RAID system, tape drive and data backup storage system 34, etc.
[0173] The processing unit 16 executes various functional applications and data processing by running programs stored in memory 28, such as implementing the policy verification method based on an AI model provided in the embodiments of this application.
[0174] That is, when the processing unit 16 executes the above program, it achieves the following: The policy image is acquired and split into images corresponding to the three primary color channels to obtain the primary color channel images; Based on the pixel range of the three primary color channel images, identify the stamp pixel image corresponding to the stamp, and generate a stamp occlusion mask based on the stamp pixel image. The mask optimization process is performed based on the outline of the seal occlusion mask to obtain the seal optimization mask, wherein the mask optimization process includes pixel filtering and trajectory merging. The stamp optimization mask and the policy image are spliced together to obtain a spliced image, and a preset AI completion model is called to complete the text in the spliced image to obtain a completed image; Feature information is extracted from the completed image using OCR technology, and verification processing is performed based on the feature information.
[0175] In this application embodiment, this application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the policy verification method based on an AI model as provided in all embodiments of this application.
[0176] That is, to implement the following when the program is executed by the processor: The policy image is acquired and split into images corresponding to the three primary color channels to obtain the primary color channel images; Based on the pixel range of the three primary color channel images, identify the stamp pixel image corresponding to the stamp, and generate a stamp occlusion mask based on the stamp pixel image. The mask optimization process is performed based on the outline of the seal occlusion mask to obtain the seal optimization mask, wherein the mask optimization process includes pixel filtering and trajectory merging. The stamp optimization mask and the policy image are spliced together to obtain a spliced image, and a preset AI completion model is called to complete the text in the spliced image to obtain a completed image; Feature information is extracted from the completed image using OCR technology, and verification processing is performed based on the feature information.
[0177] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0178] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0179] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. These programming languages include object-oriented programming languages—such as Java, Smalltalk, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider). The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably.
[0180] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0181] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0182] The above provides a detailed description of the policy verification method, apparatus, system, equipment, and medium based on an AI model provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A policy verification method based on an AI model, characterized in that, The method includes: The policy image is acquired and split into images corresponding to the three primary color channels to obtain the primary color channel images; Based on the pixel range of the three primary color channel images, identify the stamp pixel image corresponding to the stamp, and generate a stamp occlusion mask based on the stamp pixel image. The mask optimization process is performed based on the outline of the seal occlusion mask to obtain the seal optimization mask, wherein the mask optimization process includes pixel filtering and trajectory merging. The stamp optimization mask and the policy image are spliced together to obtain a spliced image, and a preset AI completion model is called to complete the text in the spliced image to obtain a completed image; Feature information is extracted from the completed image using OCR technology, and verification processing is performed based on the feature information; The process involves stitching the optimized mask of the seal and the policy image to obtain a stitched image, and then using a preset AI completion model to complete the text in the stitched image to obtain a completed image, including: The optimized mask for the seal and the policy image are subjected to channel stitching and standardization to obtain a stitched image; A preset AI completion model is invoked to extract predicted feature images from the stitched image, and the fields of the predicted feature images are repaired and completed to obtain a completed image.
2. The policy verification method based on an AI model according to claim 1, characterized in that, The step of identifying the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and generating a stamp occlusion mask based on the stamp pixel image, includes: The three primary color channel images are stacked and merged into a three-dimensional color matrix in channel order, and a threshold comparison function is called to assign values to the three-dimensional color matrix based on a preset three-dimensional color gamut range value to generate a stamp pixel image. The stamp pixel image is weighted and fused with a preset red probability heat map to obtain a stamp fused image. The preset red probability heat map is generated by calculating the red confidence level using all pixels of the policy image. The noise and edges of the fused image of the seal are adjusted to obtain the seal occlusion mask.
3. The policy verification method based on an AI model according to claim 2, characterized in that, The step of adjusting the noise and edges of the fused image of the seal to obtain the seal occlusion mask includes: The noise in the stamp fusion image is eliminated by calling a preset square structuring element, resulting in a noise-processed image; The flood filling algorithm is used to identify and fill the black closed holes in the noise-processed image. Then, a closing operation is performed on the noise-processed image after the holes are filled to close the edges of the noise-processed image, thus obtaining an edge-processed image. Perform a bitwise AND and inversion operation on the edge-processed image and the policy image to obtain the seal occlusion mask.
4. The policy verification method based on an AI model according to claim 1, characterized in that, The step of performing mask optimization processing based on the outline of the seal occlusion mask to obtain a seal-optimized mask includes: Based on the contour retrieval function, a candidate list of contours containing contour coordinates is extracted from the seal occlusion mask; Calculate several feature parameters corresponding to each candidate contour in the contour candidate list to obtain a contour feature dataset, wherein the feature parameters include: the bounding rectangle of the contour, the total area of contour pixels, the aspect ratio, and the contour perimeter. The contour of the seal occlusion mask is optimized based on the contour feature dataset to obtain the seal optimization mask.
5. The policy verification method based on an AI model according to claim 4, characterized in that, The step of performing mask optimization processing on the contour of the seal occlusion mask based on the contour feature dataset to obtain the seal optimized mask includes: Based on the numerical value of the contour feature dataset, the candidate contours in the contour candidate list are divided into complete candidate contours and missing candidate contours. The missing candidate contours are filtered according to a preset area filtering threshold to obtain filtered candidate contours; The filtered candidate contours are aggregated and merged to obtain the seam-covering contour, and the seam-covering contour and the complete candidate contour are fused to obtain the stamp-optimized mask.
6. A policy verification device based on an AI model, characterized in that, The device includes: The acquisition module is used to acquire the policy image and split the policy image into images corresponding to the three primary color channels to obtain the primary color channel images; The recognition module is used to identify the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and to generate a stamp occlusion mask based on the stamp pixel image. An optimization module is used to perform mask optimization processing based on the outline of the seal occlusion mask to obtain a seal optimized mask, wherein the mask optimization processing includes pixel filtering and trajectory merging. The completion module is used to stitch together the seal optimization mask and the policy image to obtain a stitched image, and call a preset AI completion model to complete the text in the stitched image to obtain a completed image; The verification module is used to extract feature information from the completed image using OCR technology and perform verification processing based on the feature information. The process involves stitching the optimized mask of the seal and the policy image to obtain a stitched image, and then using a preset AI completion model to complete the text in the stitched image to obtain a completed image, including: The optimized mask for the seal and the policy image are subjected to channel stitching and standardization to obtain a stitched image; A preset AI completion model is invoked to extract predicted feature images from the stitched image, and the fields of the predicted feature images are repaired and completed to obtain a completed image.
7. The policy verification device based on an AI model according to claim 6, characterized in that, The step of identifying the stamp pixel image corresponding to the stamp based on the pixel range of the three primary color channel images, and generating a stamp occlusion mask based on the stamp pixel image, includes: The three primary color channel images are stacked and merged into a three-dimensional color matrix in channel order, and a threshold comparison function is called to assign values to the three-dimensional color matrix based on a preset three-dimensional color gamut range value to generate a stamp pixel image. The stamp pixel image is weighted and fused with a preset red probability heat map to obtain a stamp fused image. The preset red probability heat map is generated by calculating the red confidence level using all pixels of the policy image. The noise and edges of the fused image of the seal are adjusted to obtain the seal occlusion mask.
8. A policy verification system based on an AI model, characterized in that, The system includes: a policy verification platform and several communication terminals; The policy verification platform communicates with each of the communication terminals, the communication terminals are used to collect and upload policy images, and the policy verification platform is used to execute the policy verification method based on the AI model as described in any one of claims 1-5.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the policy verification method based on an AI model as described in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer-executable program, which is used to cause a computer to perform the policy verification method based on an AI model as described in any one of claims 1-5.