A method and system for improving the performance of small sample text detection

By introducing text line semantic rules in the post-processing stage of the deep learning model, the probability mask of few-sample text detection is merged and enhanced, which solves the problems of discontinuity and missed detection in text detection in few-sample scenarios, and improves the integrity and reliability of text detection.

CN121884351BActive Publication Date: 2026-06-30SPEEDBOT ROBOTICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SPEEDBOT ROBOTICS CO LTD
Filing Date
2026-03-20
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In real-world industrial applications of rule-based text, existing technologies struggle to effectively address text detection issues with small sample sizes, resulting in low and discontinuous confidence levels in the text probability mask output by the model, leading to incorrect segmentation or missed detection of text lines.

Method used

By introducing a post-processing correction mechanism based on text line semantic rules, the probability mask of the deep learning model is obtained, discrete text regions are inferred and merged to generate enhanced semantic regions, and the probability values ​​of text regions in the probability mask are enhanced through weighted operations.

Benefits of technology

Without relying on a large amount of additional data, it significantly improves the completeness and reliability of text detection, effectively solves the problems of missed detection and discontinuous recognition in small sample scenarios, and has low implementation cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121884351B_ABST
    Figure CN121884351B_ABST
Patent Text Reader

Abstract

This invention relates to the fields of computer vision and deep learning technology, and discloses a method and system for improving the performance of few-shot text detection. The method, applied to few-shot text detection in regular text scenarios, includes at least the following steps: acquiring an image to be detected; constructing and training a detection model based on deep learning prediction; inputting the image to be detected into the detection model based on deep learning prediction to obtain a detection result. The method further includes: obtaining a probability mask predicted by the detection model based on deep learning prediction for the input image; inferring and merging discrete text regions based on the probability mask to generate an enhanced semantic region; and performing probability enhancement correction on the probability mask based on the enhanced semantic region. This invention corrects and enhances the initial prediction results of the model in few-shot scenarios without relying on a large amount of additional data, improving the completeness and continuity of text line detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and deep learning technology, and in particular to a method and system for improving the performance of small sample text detection. Background Technology

[0002] Text detection is a crucial preliminary step in Optical Character Recognition (OCR) and document information extraction, aiming to accurately locate text regions from natural scene images or document images. In regular text scenarios such as industrial documents, standardized invoices, standard forms, and customized specification documents, the text exhibits fixed layout patterns, uniform line direction, and regular character arrangement, representing a high-frequency text detection requirement in industrial applications. In recent years, deep learning-based text detection methods, such as DBNet (Dynamic Binarization Network) and PSENet, have achieved outstanding performance on public datasets through end-to-end learning. These methods typically rely on extensive training on large-scale, high-quality datasets to learn complex text features.

[0003] However, in actual industrial applications of the aforementioned rule-based text, there is often a severe challenge of insufficient training data (i.e., "small samples"). Collecting and labeling large amounts of data that meet the specific needs of a particular scenario for rule-based text with specific formats and layouts is costly and time-consuming. When a model pre-trained on a general dataset is directly applied to downstream tasks involving small samples of such rule-based text, the model often suffers from significant defects in its predictions because it fails to learn sufficient target scenario features. These defects are mainly manifested in low and discontinuous confidence levels in the text probability mask output by the model, leading to the incorrect segmentation of complete text lines into multiple fragmented regions, or the missed detection of some text regions. Current technologies address this issue by attempting to collect more data or fine-tuning the model, but this is difficult to implement in scenarios with scarce data. Traditional post-processing methods (such as heuristic rules based on geometric features) struggle to intelligently understand the semantic structure of the text, cannot effectively recover text regions misjudged by the model, and are ill-suited to the layout patterns and detection requirements of rule-based text scenarios. Summary of the Invention

[0004] In view of the above-mentioned shortcomings in the fields of computer vision and deep learning technology, the present invention provides a method and system for improving the performance of small sample text detection. It can correct and enhance the initial prediction results of the model in small sample scenarios without relying on a large amount of additional data, thereby improving the integrity and continuity of text line detection.

[0005] To achieve the above objectives, the embodiments of the present invention adopt the following technical solutions:

[0006] A method for improving the performance of few-shot text detection, applied to few-shot text detection in regular text scenarios, includes at least the following steps: acquiring an image to be detected, constructing and training a detection model based on deep learning prediction, and inputting the image to be detected into the detection model based on deep learning prediction to obtain a detection result. The method for improving the performance of few-shot text detection includes:

[0007] Obtain the probability mask of the input image predicted by the detection model based on deep learning prediction;

[0008] Based on the probability mask, discrete text regions are inferred and merged to generate enhanced semantic regions;

[0009] The probability mask is subjected to probability enhancement correction based on the enhanced semantic region.

[0010] According to one aspect of the present invention, the inference and merging of discrete text regions based on the probability mask includes:

[0011] Each discrete text region in the probability mask is represented as a geometric shape, forming a set of geometric shapes;

[0012] Two geometric shapes are randomly selected from the set of geometric shapes, and a conditional judgment is made. Based on the judgment result, a semantic merge is performed to generate a new geometric shape and add it to the set of geometric shapes, until there are no more geometric shapes in the set of geometric shapes that can be merged.

[0013] According to one aspect of the present invention, the step of randomly selecting two geometric shapes from the set of geometric shapes, performing conditional judgment, and semantically merging them according to the judgment result to generate a new geometric shape to be added to the set of geometric shapes includes:

[0014] Determine whether the two selected geometric shapes meet the proximity condition based on the text line direction;

[0015] If the conditions are met, the two geometric shapes are semantically merged to generate a new geometric shape;

[0016] Wherein, the geometric shape is a rotating rectangle, and the proximity condition based on the text line direction is: after extending one of the rotating rectangles along its long side by a preset length, it intersects with another rotating rectangle.

[0017] According to one aspect of the present invention, the specific steps of generating a new geometric shape by semantic merging based on the judgment result include:

[0018] Calculate the distance between the center points of the two rotating rectangles and the unit vector of the line connecting their centers;

[0019] Calculate the intersection distance of the two rotating rectangles based on the distance between their center points;

[0020] Based on the sign of the intersection distance, different calculation models are used to determine the coordinates of the center point and the length of the long side of the new rotated rectangle after merging.

[0021] According to one aspect of the present invention, the step of generating a new geometric shape by semantic merging based on the judgment result further includes: determining the tilt angle of the merged new rotated rectangle, specifically:

[0022] The two rotated rectangles to be merged are defined as the dominant rectangle and the candidate rectangle, respectively.

[0023] If the area of ​​the dominant rectangle is greater than the area of ​​the candidate rectangle by a predetermined multiple, then the tilt angle of the merged new rotated rectangle adopts the tilt angle of the dominant rectangle.

[0024] Otherwise, the tilt angle of the merged new rotating rectangle is determined by the direction angle of the unit vector of the center line.

[0025] According to one aspect of the present invention, the probability enhancement correction of the probability mask based on the enhanced semantic region includes: converting the enhanced semantic region into a weighted mask, and enhancing the probability values ​​of pixels in the probability mask corresponding to the text region of the weighted mask through weighted operations.

[0026] According to one aspect of the invention, the weighting operation includes:

[0027] Through formula Perform mask weighting;

[0028] Through formula

[0029] Perform dynamic enhancements;

[0030] in, Here, mask is the probability mask, and mask is the weight mask. The weighted prediction weights are... is the dynamically enhanced prediction mask, where k is an enhancement coefficient greater than 1.

[0031] According to one aspect of the present invention, the probabilistic enhancement correction of the probabilistic mask based on the enhanced semantic region further includes: a limiting operation to restrict the value of the dynamically enhanced prediction mask to the range of 0 to 1.

[0032] According to one aspect of the present invention, the detection model based on deep learning prediction is a segmentation-based deep learning prediction model.

[0033] A system for improving the performance of few-sample text detection, the system being implemented based on the aforementioned method for improving the performance of few-sample text detection, comprising:

[0034] The acquisition module obtains the probability mask of the detection model based on deep learning prediction for the input image;

[0035] The semantic module infers and merges discrete text regions based on the probability mask to generate an enhanced semantic region;

[0036] The correction module performs probability enhancement correction on the probability mask based on the enhanced semantic region.

[0037] The advantages of this invention are as follows: Without modifying the internal structure of the deep learning model or relying on a large amount of additional training data, it intelligently identifies and merges fragmented text regions predicted due to insufficient data by introducing a post-processing correction mechanism based on text line semantic rules, and significantly enhances the probability weight of these regions. This effectively solves the problems of missed detections and discontinuous recognition in small sample scenarios, significantly improving the completeness and reliability of the detection results. As a general post-processing module, this method is easily integrated into various existing text detection workflows, with low implementation cost and significant results. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 This is a schematic flowchart illustrating a method for improving the performance of small sample text detection according to the present invention.

[0040] Figure 2 This is a system structure diagram of an invention for improving the performance of small sample text detection;

[0041] Figure 3 This is a schematic diagram of the text detection results before processing in the method and system for improving small sample text detection performance according to the present invention.

[0042] Figure 4 This is a diagram showing the text detection results before processing in the method and system for improving small sample text detection performance according to the present invention.

[0043] Figure 5 This is a schematic diagram of the predicted text region of the method and system for improving small sample text detection performance according to the present invention;

[0044] Figure 6 This is a schematic diagram of the enhanced text region mask weights of the method and system for improving small sample text detection performance according to the present invention;

[0045] Figure 7 The image shows the final text detection result of the method and system for improving small sample text detection performance according to the present invention. Detailed Implementation

[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] Example 1

[0048] like Figure 1 As shown, a method for improving the performance of few-shot text detection is applied to few-shot text detection in regular text scenarios. The few-shot text detection method includes at least the following steps: acquiring the image to be detected, constructing and training a detection model based on deep learning prediction, and inputting the image to be detected into the deep learning prediction detection model to obtain the detection result. The method for improving the performance of few-shot text detection includes:

[0049] Step S1: Obtain the probability mask for the input image prediction by the detection model based on deep learning prediction;

[0050] Step S1, obtaining the probability mask for the input image prediction by the detection model based on deep learning prediction, specifically includes:

[0051] The basic process of constructing and training a deep learning-based prediction detection model is as follows: First, the image to be detected is preprocessed, including but not limited to normalizing the image size to a preset input resolution, standardizing pixel values ​​to the [0,1] range, and using Gaussian filtering to suppress random noise, to obtain a standardized image that meets the input format requirements of the detection model; then, the standardized image is input into the trained deep learning detection model, which extracts features through multi-scale convolution, fuses contextual information, and performs pixel-level classification prediction, outputting the probability value of each pixel belonging to a text region; finally, the probability values ​​of all pixels are arranged according to the spatial coordinates of the original image to generate an initial probability mask, where the value of each element in the mask is in the range of [0,1], and the higher the value, the stronger the confidence that the position is a text region.

[0052] This embodiment uses the DBNet network model as an example for illustration. In practical applications, other models such as DBNet++, ContourNet, and FCENet can be implemented in the same way.

[0053] A segmentation-based deep learning prediction detection model is used to perform forward inference on the input image to obtain a probability mask output by the model. The deep learning prediction detection model is a segmentation-based deep learning prediction detection model, such as DBNet or DBNet++. This embodiment exemplarily uses the DBNet network model. The probability mask is a matrix with the same width and height as the input image. The value of each element in the matrix represents the probability that the corresponding pixel belongs to text; that is, the pixel-level weighted mask output by the last layer of the DBNet network.

[0054] In practical applications, the detection model based on deep learning prediction can be pre-trained on a general dataset (such as ICDAR2019-LSVT) and fine-tuned on a small number of samples for a specific downstream task (such as 10 real scene samples, including common interference scenarios such as uneven lighting and slight noise).

[0055] like Figure 3 and Figure 4 The image shows the detection effect of the DBNet model's predicted probability mask obtained in this step. Since the model in this embodiment only uses 10 real scene samples for fine-tuning, the number of training samples is limited, resulting in a weak response of the model to text regions, discontinuous text extraction (some short text blocks are broken), and missed detection of local text regions.

[0056] Step S2: Based on the probability mask, infer and merge discrete text regions to generate enhanced semantic regions;

[0057] Step S2, which involves inferring and merging discrete text regions based on the probability mask, includes the following process:

[0058] First, each discrete text region in the probability mask is represented as a geometric shape, forming a set of geometric shapes;

[0059] Two geometric shapes are randomly selected from the set of geometric shapes, and a conditional judgment is made. Based on the judgment result, a semantic merge is performed to generate a new geometric shape and add it to the set of geometric shapes, until there are no more geometric shapes in the set of geometric shapes that can be merged.

[0060] In practical applications, the step of randomly selecting two geometric shapes from the geometric shape set, performing conditional judgments, and semantically merging them based on the judgment results to generate a new geometric shape to be added to the geometric shape set includes:

[0061] Determine whether the two selected geometric shapes meet the proximity condition based on the text line direction;

[0062] If the conditions are met, the two geometric shapes are semantically merged to generate a new geometric shape;

[0063] Wherein, the geometric shape is a rotating rectangle, and the proximity condition based on the text line direction is: after extending one of the rotating rectangles along its long side by a preset length, it intersects with another rotating rectangle.

[0064] In practical applications, the specific steps for generating new geometric shapes through semantic merging based on the judgment results include:

[0065] Calculate the distance between the center points of the two rotating rectangles and the unit vector of the line connecting their centers;

[0066] Calculate the intersection distance of the two rotating rectangles based on the distance between their center points;

[0067] Based on the sign of the intersection distance, different calculation models are used to determine the coordinates of the center point and the length of the long side of the new rotated rectangle after merging.

[0068] In practical applications, the step of generating a new geometric shape by semantic merging based on the judgment result further includes: determining the tilt angle of the new rotated rectangle after merging, specifically:

[0069] The two rotated rectangles to be merged are defined as the dominant rectangle and the candidate rectangle, respectively.

[0070] If the area of ​​the dominant rectangle is greater than the area of ​​the candidate rectangle by a predetermined multiple, then the tilt angle of the merged new rotated rectangle adopts the tilt angle of the dominant rectangle.

[0071] Otherwise, the tilt angle of the merged new rotating rectangle is determined by the direction angle of the unit vector of the center line.

[0072] This embodiment uses the DBNet network as an example for illustration, specifically including:

[0073] Use a preset threshold (this preset threshold is denoted as...). , The value of can be adjusted according to the contrast of the input image. The probability mask obtained in step S1 is binarized to obtain the initial text mask, and all connected regions in the initial text mask are calculated.

[0074] Subsequently, each connected region is traversed, the minimum bounding rectangle of each connected region is obtained, all the obtained rectangles are stored in a dynamic array blocks (hereinafter referred to as the blocks set), and sorted in descending order according to the area of ​​each rectangle.

[0075] After binarization, connected component analysis, and geometric representation, each discrete text region is represented as a rotated rectangle, and the sorted set of blocks formed by all rectangles is the set of geometric shapes.

[0076] Step S22: Iteratively execute the following steps until there are no more mergeable geometries in the set of geometries:

[0077] Step S221: Select two geometric shapes from the set of geometric shapes; specifically:

[0078] From the current set of blocks (i.e. the current set of geometry), select the two rotating rectangles with the largest and second largest areas, and denote them as the dominant rectangle (block1) and the candidate rectangle (block2) respectively.

[0079] Step S222: Determine whether the two selected geometric shapes meet the proximity condition based on the text line direction; wherein, the proximity condition based on the text line direction is: after extending one of the rotated rectangles along its long side by a preset length, it intersects with the other rotated rectangle. Specifically:

[0080] Using block1 as a reference, extend it along both ends of its long side by 1 / 3 of its length. Then determine whether the extended region has any spatial intersection with the region of block2.

[0081] Step S223: If the conditions are met, the two geometric shapes are semantically merged, and the resulting new geometric shape is added to the geometric shape set. Specifically:

[0082] If the extended block1 and block2 intersect, then they meet the merging condition. In this case, block1 and block2 are removed from the blocks set, and a new rotated rectangle (merge_block) is generated. At the same time, merge_block is added to the blocks set.

[0083] If the extended block1 and block2 have no intersection, the current block set remains unchanged. In this iteration, while keeping the blocks unchanged, we try to find the third largest rectangle in the current set as a new candidate pair for block1. This process continues until block1 has been evaluated against all other rectangles in the array and none of them meet the merging condition.

[0084] The iteration process ends when all rotated rectangles in the blocks set cannot be merged. At this point, the remaining rotated rectangles in the blocks set are the final generated enhanced semantic regions. There is at least one enhanced semantic region, which reflects the more complete text line position after semantic inference.

[0085] Furthermore, the semantic merging of the two geometric shapes specifically includes:

[0086] Step S231: Calculate the distance between the center points of the two rotated rectangles and the unit vector of the line connecting their centers; where the center point of block1 is denoted as c1 and the center point of block2 is denoted as c2, specifically:

[0087] 1) Calculate the distance (dist) between the center points of block1 and block2:

[0088]

[0089] In the formula, and These are the x and y coordinates of the center point of block1. and These are the x and y coordinates of the center point of block2.

[0090] 2) Calculate the unit vector (u) of the line connecting the centers:

[0091]

[0092] Step S232: Calculate the intersection distance of the two rotating rectangles based on the center point distance; specifically:

[0093] Calculate the intersection distance (inter_dist) between block1 and block2:

[0094]

[0095] In the formula, and It is the length of the longer side of block1 and block2, and inter_dist is the minimum distance of the shorter side.

[0096] Step S233: Based on the sign of the intersection distance, different calculation models are used to determine the coordinates of the center point and the length of the longer side of the newly rotated rectangle after merging. Specifically:

[0097] 1) If This indicates that block1 and block2 do not intersect, therefore the center coordinates of merge_block are:

[0098]

[0099]

[0100] 2) If inter_dist < 0, it means that block1 and block2 intersect. Therefore, the center coordinates of merge_block are:

[0101]

[0102]

[0103] In the formula, and Let x and y be the x and y coordinates of the unit vector (u).

[0104] 3) Calculate the length of the longer side of the new rotated rectangle merge_block after merging. :

[0105]

[0106] In this case, the shorter side length of merge_block is the same as the shorter side length of block1.

[0107] Furthermore, the semantic merging of the two geometric shapes also includes determining the tilt angle of the newly rotated rectangle after merging, specifically through the area of ​​block1 ( ) and the area of ​​block2 ( The steps to determine the size relationship are as follows:

[0108] 1) Set the preset multiplier for area comparison. The preset multiplier The value can be flexibly adjusted according to the consistency of the text area size; in this embodiment, the exemplary value is 2.

[0109] 2) Determine the tilt angle based on the specific circumstances:

[0110] like Note: Since the area of ​​block1 is much larger than that of block2, its tilt angle is more representative of the actual direction of the text line. Therefore, the tilt angle of merge_block is directly adopted from the tilt angle of block1.

[0111] like This indicates that the area difference between block1 and block2 is small. Therefore, the direction of the longer side of merge_block after merging is consistent with the direction of the line connecting the centers of the two rotated rectangles. Thus, its tilt angle is determined by the direction angle corresponding to the unit vector of the line connecting the centers. In other words, the tilt angle of merge_block is:

[0112]

[0113] In the formula, It is the unit vector of the line connecting the center points of block1 and block2, given by Calculated.

[0114] In practical applications, the extension ratio and area comparison multiple threshold of the above proximity conditions can be adjusted according to the specific scenario.

[0115] Step S3: Perform probability enhancement correction on the probability mask based on the enhanced semantic region.

[0116] Step S3, which performs probability enhancement correction on the probability mask based on the enhanced semantic region, specifically includes:

[0117] The enhanced semantic region is converted into a weighted mask, and the probability values ​​of pixels in the probability mask corresponding to the text region of the weighted mask are enhanced by weighted operations.

[0118] In practical applications, the weighting operation includes:

[0119] Through formula Perform mask weighting;

[0120] Through formula

[0121] Perform dynamic enhancements;

[0122] in, Here, mask is the probability mask, and mask is the weight mask. The weighted prediction weights are... is the dynamically enhanced prediction mask, where k is an enhancement coefficient greater than 1.

[0123] In practical applications, the probability enhancement correction of the probability mask based on the enhanced semantic region further includes: a limiting operation, which restricts the value of the dynamically enhanced prediction mask to the range of 0 to 1.

[0124] In practical applications, the detection model based on deep learning prediction is a segmentation-based deep learning prediction model.

[0125] In this embodiment, the DBNet network is used as an example for illustration, specifically including:

[0126] The enhanced semantic region is converted into a weighted mask, and the probability values ​​of pixels in the probability mask corresponding to the text region of the weighted mask are enhanced through weighted operations. Specifically:

[0127] The enhanced semantic region generated in step S2 is converted into a binary weighted mask. The pixel values ​​of the ROI regions (i.e., the regions corresponding to the enhanced semantic regions) of this mask are set to 1 (indicating a higher probability that the region is text), while the pixel values ​​of the remaining regions are set to 0. This mask is then applied to the probability mask output by DBNet. The specific steps are as follows:

[0128] 1) Apply the mask to In the middle, the predicted weights of the text regions are obtained ( ):

[0129]

[0130] like Figure 5 As shown, after the enhanced semantic region generated in step S2 is converted into a binary weighted mask, it accurately covers the discrete and fragmented text blocks in step S1, forming a complete text line mask region.

[0131] 2) According to The numerical value is used to dynamically enhance the probability of the text region, resulting in an enhanced prediction mask. ):

[0132] ;

[0133] like Figure 6 As shown, after probability enhancement correction, the final predicted mask ( The pixel values ​​in the text area are generally improved, while the pixel values ​​in the background area are suppressed, significantly improving the distinction between text and background; the text lines show a complete and continuous detection effect.

[0134] 3) Limiting operation: [This refers to the operation of limiting the amplitude of the data.] The value is limited to the range of 0 to 1 to obtain the final prediction mask. ):

[0135]

[0136] In the formula, is the probability mask output by DBNet, where the pixel values ​​represent the probability that the corresponding position belongs to the text; mask is the binary weight mask obtained by enhancing the semantic region transformation; These are the weighted prediction weights; This is the dynamically enhanced prediction mask; This is the final prediction mask; k is an enhancement coefficient greater than 1, and in this embodiment, it is exemplarily set to 10. k can also be determined according to... The text probability distribution is dynamically adjusted, if If the average probability value of the Chinese text region is less than 0.3, k can be 15~20 to achieve strong enhancement. If the average probability value is between 0.3 and 0.6, k can be 8~12 to achieve medium-strength enhancement. If the average probability value is higher than 0.6, k can be 5~8 to achieve weak enhancement. This is to adapt to the initial probability mask with different confidence levels and avoid over-enhancement or under-enhancement.

[0137] like Figure 7 As shown, after the probability enhancement correction in step S3, the original discrete and fragmented small text boxes are merged into complete rectangular boxes covering the entire text line. The same line of text corresponds to only one precise rotated rectangular box. This ensures that all valid text regions generate corresponding predicted text boxes, significantly reducing the false negative rate. Misidentified text boxes in non-text regions are completely suppressed, and the text boxes only cover the real text regions without any redundant noise text boxes.

[0138] In addition to the method proposed in this embodiment, other methods can also be used to increase the weight of the Roi region.

[0139] Example 2

[0140] like Figure 2 As shown, a system for improving the performance of few-sample text detection, wherein the method for improving the performance of few-sample text detection based on the above includes:

[0141] Get module M1 to obtain the probability mask of the detection model based on deep learning prediction for the input image;

[0142] Semantic module M2 infers and merges discrete text regions based on the probability mask to generate an enhanced semantic region;

[0143] The correction module M3 performs probability enhancement correction on the probability mask based on the enhanced semantic region.

[0144] The modules described above work in sequence to form a complete data processing loop: the acquisition module M1 is the system's input interface, and its output probability mask is the foundation for all subsequent processing. The semantic module M2 is the core computing unit; it intelligently analyzes and reconstructs the low-quality probability mask provided by M1, and its output enhanced semantic region represents the system's semantic understanding of the text line structure. The correction module M3 is the system's output optimization unit; it uses the enhanced semantic region generated by M2 to correct the initial input probability mask of M1, thus completing the final enhancement of the detection result. The three modules are connected in series, with data flowing from M1 to M2 and then to M3. Working together, they achieve a complete logical loop from initial predictive analysis to structural inference and final result enhancement.

[0145] Example 3

[0146] A method for detecting small sample text includes the following steps:

[0147] Step 1: Acquire the image to be detected;

[0148] Step 2: Build and train a detection model based on deep learning prediction;

[0149] Step 3: Input the image to be detected into the detection model based on deep learning prediction to obtain the detection result.

[0150] In step 2, when constructing and training the detection model based on deep learning prediction, the method for improving the detection effect of small sample text as described in Example 1 is used.

[0151] The beneficial effects of this invention are: without modifying the internal structure of the deep learning model or relying on a large amount of additional training data, it intelligently identifies and merges fragmented text regions predicted due to insufficient data by introducing a post-processing correction mechanism based on text line semantic rules, and significantly enhances the probability weight of these regions. This effectively solves the problems of missed detections and discontinuous recognition in small sample scenarios, significantly improving the completeness and reliability of the detection results. As a general post-processing module, this method is easily integrated into various existing text detection workflows, with low implementation cost and significant results.

[0152] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for improving the effect of small sample text detection, applied to a small sample text detection method in a regular text scenario, the small sample text detection method comprising at least the following steps: The method involves acquiring an image to be detected, constructing and training a detection model based on deep learning prediction, and inputting the image to be detected into the detection model to obtain a detection result. The method for improving the detection performance of small sample text includes: Obtain the probability mask of the input image predicted by the detection model based on deep learning prediction; Based on the probability mask, discrete text regions are inferred and merged to generate enhanced semantic regions; wherein, the inference and merging of discrete text regions based on the probability mask includes: representing each discrete text region in the probability mask as a geometric shape to form a set of geometric shapes; randomly selecting two geometric shapes from the set of geometric shapes, performing conditional judgment, and semantically merging them according to the judgment result to generate a new geometric shape to be added to the set of geometric shapes, including: judging whether the two selected geometric shapes meet the proximity condition based on the text line direction; if they meet the condition, semantically merging the two geometric shapes to generate a new geometric shape; wherein, the geometric shape is a rotated rectangle, and the proximity condition based on the text line direction is: after extending one of the rotated rectangles along its long side direction by a preset length, it intersects with another rotated rectangle, until there are no geometric shapes in the set of geometric shapes that can be merged; The probability enhancement correction based on the enhanced semantic region includes: converting the enhanced semantic region into a weighted mask, and enhancing the probability value of pixels in the probability mask corresponding to the text region of the weighted mask through weighted operations.

2. The method of claim 1, wherein, The specific steps for generating a new geometric shape by semantic merging based on the judgment result include: Calculate the distance between the center points of the two rotated rectangles; Calculate the intersection distance of the two rotating rectangles based on the distance between their center points; Based on the sign of the intersection distance, different calculation models are used to determine the coordinates of the center point and the length of the long side of the new rotated rectangle after merging.

3. The method of claim 2, wherein, The step of generating a new geometric shape by semantic merging based on the judgment result further includes: determining the tilt angle of the new rotated rectangle after merging, specifically: Calculate the unit vector of the line connecting the centers of the two rotating rectangles; The two rotated rectangles to be merged are defined as the dominant rectangle and the candidate rectangle, respectively. If the area of ​​the dominant rectangle is greater than the area of ​​the candidate rectangle by a predetermined multiple, then the tilt angle of the merged new rotated rectangle adopts the tilt angle of the dominant rectangle. Otherwise, the tilt angle of the merged new rotating rectangle is determined by the direction angle of the unit vector of the center line.

4. The method of claim 1, wherein, The weighting operation includes: Masking is weighted by the formula M = 1 - e By the formula Perform dynamic enhancements; wherein, is the probability mask, mask is the weight mask, is the weighted prediction mask, is the dynamically enhanced prediction mask, k is an enhancement factor greater than 1.

5. The method of claim 4, wherein, The method of performing probability enhancement correction on the probability mask based on the enhanced semantic region further includes: a limiting operation, which restricts the value of the dynamically enhanced prediction mask to the range of 0 to 1.

6. The method of claim 1, wherein, The detection model based on deep learning prediction is a segmentation-based deep learning prediction model.

7. A system for improving small sample text detection effect, characterized in that, The system is implemented based on the method for improving small sample text detection performance as described in any one of claims 1 to 6, including: The acquisition module obtains the probability mask of the detection model based on deep learning prediction for the input image; The semantic module infers and merges discrete text regions based on the probability mask to generate an enhanced semantic region; The correction module performs probability enhancement correction on the probability mask based on the enhanced semantic region.

Citation Information

Patent Citations

  • Picture information structuring method and device based on table lines

    CN117711006A

  • Intelligent extraction method and system for input text containing mathematical formula

    WO2025200481A1