A method, device, equipment and system for locating text lines in an image
By performing text line positioning and POI area segmentation on natural scene images, combined with layout analysis, the problem of difficulty in identifying oblique text and adjacent text lines in the existing technology is solved, and precise positioning and accurate identification of text lines are achieved.
Patent Information
- Application Number
- CN201910376997.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-05-07
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2039-05-07
AI Technical Summary
When locating text lines in natural scene images, the existing technology is difficult to accurately identify slanted text and adjacent text lines, resulting in inaccurate detection frames and affecting the subsequent text recognition effect.
By locating text lines and segmenting POI areas on the input image, using machine learning models for feature extraction and position regression, combined with layout analysis, the POI areas to which the text line areas belong are determined, grouped into a group, and each POI area is output. line of text information.
It achieves precise positioning and segmentation of text lines in natural scenes, removes noise in non-POI areas, and improves the accuracy and efficiency of text recognition.
Smart Images

Figure CN111914830B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, device, equipment and system for locating text lines in an image. Background Art
[0002] There are a lot of texts in natural scenes, such as the house numbers, signboards, walls, and car windows of buildings on both sides of the road. These texts generally contain clear semantic information. When making map data, it is necessary to collect a large number of natural scene images, determine the point of interest (POI) areas in the natural scene images, and identify the text information on the POI areas in the natural scenes to obtain POI data. Before performing text recognition, it is necessary to locate the position of the text line in the POI area. Due to the large number and variety of POI areas and non-POI areas in natural scenes, it is necessary to determine the precise POI area, and the text layout direction and text spacing of text lines in different POI areas are different. Therefore, it is also necessary to accurately locate the text lines in the POI area.
[0003] In the prior art, a text line positioning algorithm based on detection or a text line positioning algorithm based on semantic segmentation is generally used to position text lines in an image. However, the text line positioning algorithm based on detection generally outputs a rectangular detection frame, which is mainly based on the detection and recognition of horizontal text. When the text line is an inclined text line, a large amount of background area will be covered in the rectangular detection frame, resulting in inaccurate text line detection frame and inability to determine the accurate text line area, which also creates difficulties for subsequent text recognition. The text line positioning algorithm based on semantic segmentation cannot segment adjacent text lines due to the lack of edge constraints. When positioning two columns of text areas that are close to each other on the left and right, or two lines of text areas that are close to each other on the top and bottom, it is impossible to distinguish different text lines, which brings great difficulties to subsequent text recognition. Summary of the invention
[0004] In view of the above problems, the present invention is proposed to provide a method, device, equipment and system for locating text lines in an image that overcome the above problems or at least partially solve the above problems.
[0005] In a first aspect, an embodiment of the present invention provides a method for locating a text line in an image, comprising the following steps:
[0006] Perform text line positioning on the input image to determine each text line area of the input image;
[0007] Perform region segmentation on the input image to obtain the point of interest (POI) region of the input image;
[0008] Determine the POI region to which the text line region belongs, and group the text line regions belonging to the same POI region;
[0009] Perform layout analysis on each group of text line areas, arrange and combine the text lines in each group of text line areas according to the analysis results, and output the text line information of each POI area.
[0010] In a second aspect, an embodiment of the present invention provides a device for locating a text line in an image, comprising:
[0011] A text line region determination module is used to locate text lines in an input image and determine each text line region of the input image;
[0012] The POI region determination module is used to segment the input image into regions to obtain the POI region of the input image;
[0013] A text line grouping module is used to determine the POI area to which the text line area belongs, and group the text line areas belonging to the same POI area into one group;
[0014] The layout analysis module is used to perform layout analysis on each group of text line areas, arrange and combine the text lines in each group of text line areas according to the analysis results, and output the text line information of each POI area.
[0015] In a third aspect, an embodiment of the present invention provides a server, including:
[0016] A receiving device, used for receiving images acquired by a terminal device;
[0017] The text line positioning device in the above image;
[0018] The first memory stores the collected images and the text line information of each POI area.
[0019] In a fourth aspect, an embodiment of the present invention provides a text line positioning system in an image, comprising: a mobile acquisition device and the above-mentioned server;
[0020] The mobile acquisition device is used to acquire images, and use a selected determination method to determine whether the acquired images are abnormal images, and if not, upload the acquired images to the server;
[0021] The server is used to locate text lines in the image.
[0022] In a fifth aspect, an embodiment of the present invention provides a mobile data collection device, including:
[0023] A first image acquisition device, used for acquiring images and sending them to a first processor;
[0024] The first processor is used to use a selected judgment method to judge whether the collected image is an abnormal image, and if not, upload the collected image to the server.
[0025] In a sixth aspect, an embodiment of the present invention provides a collection vehicle, wherein an image collection device is arranged on the vehicle, and the image collection device comprises:
[0026] A second image acquisition device, used for acquiring images and sending them to a second processor;
[0027] The second processor is provided with an image recognition device and a text line positioning device in the image, wherein the image recognition device is used to determine whether the collected image is an abnormal image by using a selected determination method, and if not, the image is input into the text line positioning device in the image; the text line positioning device in the image is used to realize positioning of the text line in the image;
[0028] The second memory stores the collected images and the text line information of each POI area.
[0029] In a seventh aspect, an embodiment of the present invention provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the above-mentioned method for locating text lines in an image.
[0030] In an eighth aspect, an embodiment of the present invention provides a computer device, comprising: a processor and a memory for storing processor executable commands; wherein the processor is configured to execute the above-mentioned text line positioning method in the image.
[0031] The beneficial effects of the above technical solution provided by the embodiment of the present invention include at least:
[0032] The text line positioning method in the above-mentioned image provided by the embodiment of the present invention accurately positions different text lines by performing text line positioning and POI area segmentation on the input image respectively. It can split adjacent text lines to avoid the appearance of large-area text line areas that affect the subsequent text recognition effect, and can segment text lines of different orientations including inclined text lines to obtain accurate text and boundary positions of the text area, and the text line positioning is accurate; it can effectively detect and segment targets in the image, classify and segment various POI areas of different categories in natural scenes, and obtain accurate segmentation results for various POI areas in the image. By determining the POI area to which the text line area belongs, the text line areas belonging to the same POI area are grouped together, and the text line noise appearing in the non-POI area can be removed; the text line area of each POI area is analyzed for layout, and the same POI area is associated with the text line area to facilitate text recognition and obtain effective POI data.
[0033] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0034] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0036] Figure 1 is a flow chart of a method for locating text lines in an image in an embodiment of the present invention;
[0037] Figure 2 is a flow chart of a method for locating a text line in another image in an embodiment of the present invention;
[0038] Figure 3 Schematic diagram of the starting module of the RPN of the entity segmentation model in an embodiment of the present invention;
[0039] Figure 4 Flow chart of a method for removing text lines from a non-POI area in an embodiment of the present invention;
[0040] Figure 5 is a flow chart of a method for locating a text line in an image in another embodiment of the present invention;
[0041] Figure 6 Schematic diagram of a device for locating a text line in an image according to an embodiment of the present invention;
[0042] Figure 7 A schematic diagram of the structure of a server in an embodiment of the present invention;
[0043] Figure 8 Schematic diagram of the structure of a text line positioning system in an image according to an embodiment of the present invention;
[0044] Fig. 9 for Figure 8 A schematic diagram of the structure of a mobile acquisition device of a text line positioning system in an image shown;
[0045] Fig.10 for Fig. 9 A structural schematic diagram of a first processor of a mobile acquisition device shown;
[0046] Fig.11 A schematic diagram of a specific input image according to an embodiment of the present invention;
[0047] Fig.12 For the determined Fig.11 Schematic diagram of text line area result of the input image shown;
[0048] Fig.13 For the determined Fig.12 The schematic diagram of the POI area result of the input image shown;
[0049] Fig.14 For the determined Fig.12 The schematic diagram of the text line information result of each POI area of the input image shown;
[0050] Fig.15 Schematic diagram of the structure of the image acquisition device of the acquisition vehicle in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0052] Embodiment 1:
[0053] In view of the problems existing in the above-mentioned prior art, the embodiment of the present invention provides a method for locating text lines in an image, which realizes the positioning of text lines based on point of interest (POI) data of natural scenes and is applied to the processing of natural scene images in map data production. The process is referred to as follows: Figure 1 As shown, the following steps are included:
[0054] S11: positioning text lines on the input image to determine each text line area of the input image;
[0055] This step can be performed in the first machine learning model. In the trained first machine learning model, feature extraction is performed on the input image, and position regression, classification and image segmentation are performed on the extracted candidate text areas to obtain all text line areas of the image. The first machine learning model can be an end-to-end entity segmentation model of text detection plus text segmentation, for example, Mask R-CNN (Mask Region-based Convolutional Neural Network, mask region-based convolutional neural network) model; or a two-level model of text detection and text segmentation, for example, Faster-R-CNN (Faster-Region-Convolutional Neural Networks, faster regional convolutional neural network) model plus FCN (Fully Convolutional Network, full convolutional network) model.
[0056] S12: performing region segmentation on the input image to obtain a point of interest (POI) region of the input image;
[0057] This step can be performed in the second machine learning model, in which the input image is feature extracted in the trained second machine learning model, and the candidate target area of the extracted image is subjected to position regression, classification and image segmentation to obtain the POI area of the image. The second machine learning model can be an end-to-end entity segmentation model of target detection plus target segmentation, such as the Mask R-CNN model; or a two-stage model of target detection and target segmentation, such as the Faster-R-CNN model plus the FCN model.
[0058] S13: determining the POI region to which the text line region belongs, and grouping the text line regions belonging to the same POI region into one group;
[0059] S14: Perform layout analysis on each group of text line areas respectively, arrange and combine the text lines of each group of text line areas according to the analysis results, and output text line information of each POI area.
[0060] The text line positioning method in the above-mentioned image provided by the embodiment of the present invention realizes the positioning of the text line of the area of interest in the image based on POI data, and accurately positions different text lines by performing text line positioning and POI area segmentation on the input image respectively. Through the first machine learning model, adjacent text lines can be split to avoid the appearance of large-area text line areas that affect the subsequent text recognition effect, and text lines with different orientations including inclined text lines can be segmented to obtain accurate text and boundary positions of the text area, and the text line positioning is accurate; through the second machine learning model, the target in the image can be effectively detected and segmented, and the various POI areas of different categories in the natural scene can be classified and segmented, and accurate segmentation results of each POI area in the image can be obtained. By determining the POI area to which the text line area belongs, the text line areas belonging to the same POI area are grouped together, and the text line noise appearing in the non-POI area can be removed; the text line area of each POI area is analyzed for layout, and the same POI area is associated with the text line area to facilitate text recognition and obtain effective POI data.
[0061] Embodiment 2:
[0062] As an optional embodiment of the present invention, when the first machine learning model is an end-to-end entity segmentation model of text detection and text segmentation, and the second machine learning model is an end-to-end entity segmentation model of target detection and target segmentation, refer to Figure 2 As shown, the text line positioning method in an image provided by an embodiment of the present invention includes the following steps:
[0063] S201: extracting features from an input image; whenever a candidate text region of an image is extracted, performing position regression and binary classification on the candidate text region to obtain an accurate position and foreground selection of the candidate text region;
[0064] Since there may be a deviation between the initial text bounding box position of the candidate text line area obtained by feature extraction and the actual bounding box position of the text in the input image, after the candidate text area is obtained by image segmentation, the initial text box position of the candidate text area is fine-tuned through bounding-box regression, so that the initial text box position of the candidate text area has a certain offset, thereby obtaining a candidate text area that is closer to the actual position of the text in the input image.
[0065] The candidate text area is subjected to binary classification to obtain a foreground selected area of the candidate text area. For example, features of corresponding image pixels of the candidate text area can be extracted. When the probability that the features of corresponding image pixels in the candidate text area belong to the foreground image is greater than a set threshold, the corresponding image pixel features are determined to be foreground image features. All foreground image features are obtained to obtain a foreground selected area of the candidate text line area.
[0066] S202: performing image segmentation on the candidate text region to segment the text contour of the candidate text region;
[0067] S203: obtaining a text line region of the image according to the accurate position of the candidate text region, the foreground selected area and the text outline of the candidate text region;
[0068] Since the text lines of the candidate text line area extracted in the first machine learning model contain some background of the input image, the candidate text area is segmented to segment the background and foreground of the candidate text area. The pixels of the candidate text area are classified into two categories, each pixel is classified into foreground (i.e., text outline) or background (i.e., non-text outline), and the segmentation results of the two categories are obtained. All foreground points of the candidate text area are extracted to obtain the text outline of the candidate text line area.
[0069] S204: Determine whether all text line regions in the image are extracted, if not, execute step S201, if yes, end the extraction of text line regions;
[0070] Through the above steps 201 to 204, the process of locating text lines in the input image and determining each text line region of the input image in the above embodiment is implemented.
[0071] S205: extracting features from the input image; whenever a candidate target region of an image is extracted, performing position regression and multi-classification on the candidate target region to obtain the accurate position and category of the candidate target region;
[0072] Since in the second machine learning model, there is a deviation between the initial bounding box position of the candidate target area extracted and the actual bounding box position of the target area in the input image, after the candidate target area is obtained by image segmentation, the initial bounding box position of the detected target area is fine-tuned through bounding box regression, so that the initial bounding box position of the target area has a certain offset, thereby obtaining a candidate target area that is closer to the actual position of the target in the input image.
[0073] The candidate target area is subjected to multiple classifications to obtain the category of each candidate target area. For example, features of corresponding image pixels of the candidate target area can be extracted. When the probability that the features of corresponding image pixels in the candidate target area belong to the foreground image is greater than a set threshold, the corresponding image pixel features are determined to be foreground image features. All foreground image features are obtained to determine the category of the candidate target area.
[0074] S206: performing image segmentation on the candidate target area to segment the target object in the candidate target area;
[0075] The input image is feature extracted, and the candidate target area obtained will contain some background of the input image. The candidate target area is segmented to separate the background and foreground of the candidate target area. The pixels in the candidate target area are classified into two categories, and each pixel is classified into foreground (i.e., target object) or background (i.e., non-target object). The binary classification result is obtained, and all foreground points in the candidate target area are extracted to obtain the target object in the candidate target area.
[0076] S207: Obtaining the target region of the image according to the accurate position and category of the candidate target region and the target object of the candidate target region;
[0077] S208: Determine whether all target areas of the image are extracted, if not, execute step S201, if yes, execute step S209;
[0078] S209: Selecting a POI region from the target regions of all images according to the category of the target region of the image.
[0079] Through the above steps S205 to S209, the process of performing region segmentation on the input image to obtain the POI region of the image in the above embodiment is implemented.
[0080] S210: According to the position of the text line area and the position of the POI area, determine whether the intersection area of the text line area and the POI area exceeds a set threshold; if so, execute steps S211-S213; if not, execute step S214:
[0081] S211: judging whether the intersection area of the text line area and the POI area exceeds a set threshold according to the position of the text line area and the position of the POI area;
[0082] S212: Obtain at least one text line region belonging to the same POI region, and group the at least one text line region into a group;
[0083] S213: Analyze the text line information of each group of text line areas, perform text splicing on the text line areas with consistent text line information in each group of text line areas, and output the text information of the spliced text lines in the POI area.
[0084] S214: Determine that the text line area does not belong to the POI area.
[0085] Through the above steps S210 to S213, the process of determining the POI area to which the text line area belongs in the above embodiment, grouping the text line areas belonging to the same POI area, performing layout analysis on each group of text line areas, arranging and combining the text lines of each group of text line areas according to the analysis results, and outputting the text line information of each POI area is realized.
[0086] Determining whether the text line area belongs to the POI area is based on the spatial position information of the text line area and the POI area. For example, a threshold value of the ratio of the intersection area of the text line area and the POI area to the area of the text line area is preset. Assuming the threshold value is 90%, when more than 90% of the area of the text line area falls into the POI area, it is determined that the text line area belongs to the POI area.
[0087] When determining the POI area to which a text line area belongs, statistics can be performed based on the proportion of pixels of the text line area that fall within the POI area. If more than 90% of the pixels of a text line area fall within the spatial range defined by a POI area, that is, the intersection area of the text line area and the POI area exceeds 90% of the area of the text line area, then it is determined that the text line area belongs to the POI area.
[0088] Alternatively, the coordinate position of each pixel point of the text row area is obtained according to entity segmentation, and the outline, shape, side length, aspect ratio, area size, center point position and other information of the text row area is determined according to the coordinate positions of all pixel points and the arrangement and combination relationship of the pixel points; the coordinate position of each pixel point of the POI area is obtained according to entity segmentation, and the outline, shape, side length, aspect ratio, area size, inclination angle and center point position and other information of the POI area is determined according to the coordinate positions of all pixel points and the arrangement and combination relationship of the pixel points. Based on the information determined by multiple pixel points of the above-mentioned POI area and text row area, it can be obtained whether there is any position overlap between the text row area and the POI area, and the intersection area is calculated to calculate whether the area overlap between the text row area and the POI area exceeds a set threshold.
[0089] Because a POI area may contain one or more text line areas, grouping at least one text line area of the same POI area can ensure that the text information in the output POI area is valid POI data. According to the layout analysis rules, the text line information of each group of text line areas after the combination of the POI area, including the size, position and other information of the line, is analyzed, and the text line areas with consistent text line information in each group of text line areas are spliced, the text content is combined, and the text information of the text lines of the spliced POI area is output.
[0090] For example, if a group of text line areas in a POI area includes two text line areas that belong to the same horizontal line, are arranged adjacently, and have equal text sizes, the text in the two text line areas can be spliced and output to obtain a complete text content and output the text information in the POI area. Taking the POI area as a plaque as an example, by obtaining the main name, branch name, business scope, contact information and other related text lines in the plaque, the complete text information in the plaque can be obtained.
[0091] In an embodiment of the present invention, the first machine learning model is an entity segmentation model, which performs feature extraction on the input image, generates candidate text regions of the image, and performs position regression and binary classification on the candidate text regions; at the same time, image segmentation is performed on the candidate text regions, and the text line region of the image is obtained based on the accurate position of the candidate text region, the foreground selection, and the text contour of the candidate text region.
[0092] During the training process of the entity segmentation model, you can learn from a poor detection or segmentation result to a better detection or segmentation result. The detection and segmentation processes are performed alternately. If the detection result of the candidate text area is inaccurate, the obtained text line area will be inaccurate; the obtained text line area is inaccurate, which will affect the entity segmentation model to learn in the direction of better detection results and obtain better detection results; better detection results will be conducive to obtaining better segmentation results. The detection and segmentation processes affect each other to obtain better detection and segmentation results.
[0093] When processing an image in the entity segmentation model, position regression and binary classification are performed based on the first candidate text area extracted to obtain the accurate position and foreground selection of the candidate text area, that is, the text detection result; at the same time, the image is segmented based on the first candidate text area to obtain the text contour of the text area, that is, the text segmentation result, and the accurate text line area is obtained based on the detection result and segmentation result; when the next candidate text area is extracted, the same operation is performed again until all the text line areas of the image are obtained. In the entity segmentation process of the text line area, detection and segmentation are mutually optimized and performed alternately to obtain accurate text line areas; for each candidate text area, the detection and segmentation processes are performed separately, and the segmentation result of the current candidate text area can affect the detection result of the next candidate text area; the detection result of the next candidate text area will also affect the segmentation result of the candidate text area; for the entire input image, the detection and segmentation processes are performed alternately, and the detection result and segmentation result are related.
[0094] The entity segmentation model provided by the embodiment of the present invention takes the Mask R-CNN model as an example, optimizes the inception module of the region candidate network RPN part in the applied entity segmentation algorithm according to the characteristics of the text line area, and replaces one convolution with a convolution group, so as to better extract features with contextual information of the text area, referring to Figure 3 As shown in the figure, the 3*3 convolution of the existing RPN part is optimized into a convolution group consisting of 1*1 convolution, 3*3 convolution and 5*5 convolution and a 3*3 pooling (max-pooling).
[0095] In an embodiment of the present invention, the second machine learning model is an entity segmentation model, which performs feature extraction on the input image, generates candidate target areas of the image, performs position regression and multi-classification on the candidate targets, and obtains the accurate position and category of the candidate target areas; at the same time, image segmentation is performed on the candidate target areas, and the target area of the image is obtained based on the accurate position, category and target object of the candidate target area.
[0096] In the training process of the entity segmentation model, you can learn from a poor detection or segmentation result to a better detection or segmentation result. The detection and segmentation processes are performed alternately. If the detection result of the candidate target area is inaccurate, the target area of the obtained image will be inaccurate; if the target area of the obtained image is inaccurate, it will affect the entity segmentation model to learn in the direction of better detection results and obtain better detection results; better detection results will be conducive to obtaining better segmentation results. The detection and segmentation processes affect each other to obtain better detection and segmentation results.
[0097] When processing an image in the entity segmentation model, position regression and multi-classification are performed based on the first candidate target area extracted to obtain the accurate position and category of the candidate text area, that is, the detection result of the target; at the same time, the image is segmented based on the first candidate target area to obtain the target object in the candidate area, that is, the segmentation result of the target. Based on the detection results and segmentation results, the accurate target area is obtained. When the next candidate target area is extracted, the same operation is performed again until all the target areas of the image are obtained. After all the target areas of the image are obtained, the POI area is selected from the target areas of all images according to the category of the target area of the image.
[0098] In the entity segmentation model, during the entity segmentation process of the target area, detection and segmentation are optimized and performed alternately to obtain an accurate target area; for each candidate target area, the detection and segmentation processes are performed separately, and the segmentation result of the current candidate target area can affect the detection result of the next candidate target area; the detection result of the next candidate target area will also affect the segmentation result of the candidate target area; for the entire input image, the detection and segmentation processes are performed alternately, and the detection result and the segmentation result are correlated.
[0099] Since the target area of the image includes POI areas and non-POI areas, it is also necessary to determine the category of the target area based on the results of multi-classification to distinguish POI areas from non-POI areas. For example, the target areas of different categories in the input image include house numbers, dense water signs, wall fonts, glass fonts, and suspended characters. According to the pre-set category of the POI area, the POI area and POI area are distinguished from the classified target areas. Assuming that house numbers, suspended characters, and dense water signs are POI areas, other target areas such as wall fonts and glass fonts are non-POI areas, and non-POI areas need to be removed as noise.
[0100] It should be noted that in the embodiment of the present invention, after distinguishing the POI area from the non-POI area, it is necessary to remove the non-POI area as noise, and at the same time, it is necessary to remove the text line area appearing in the non-POI area, so as to achieve the purpose of removing the text line noise, and only retain the POI area of the image and the text line area contained in the POI area. Figure 4 As shown, while executing the above steps S210 to S213, the above text line positioning method in the image may further include the following steps:
[0101] S401: According to the position of the text line area and the position of the non-POI area, determine whether the intersection area of the text line area and the non-POI area exceeds a set threshold; if so, execute step S402; if not, execute step S403:
[0102] S402: Determine that the text line region belongs to the non-POI region, and remove the non-POI region and the text line region belonging to the non-POI region;
[0103] S403: Determine that the text line area does not belong to the non-POI area, and exit the current process.
[0104] The method for determining whether a text line area belongs to a non-POI area is similar to the above-mentioned method for determining whether a text line area belongs to a POI area. The text line area belonging to the POI area is retained, and the text line area belonging to the non-POI area is removed, thereby achieving the purpose of removing noise.
[0105] Embodiment 3:
[0106] As another optional embodiment of the present invention, when the first machine learning model is a two-stage model of text detection and text segmentation, and the second machine learning model is a two-stage model of object detection and object segmentation, refer to Figure 5 As shown, the text line positioning method in an image provided by an embodiment of the present invention includes the following steps:
[0107] S501: extracting features from an input image to generate all candidate text regions of the image;
[0108] S502: Performing position regression and binary classification on each candidate text region to obtain the accurate position and foreground selection of the candidate text region;
[0109] S503: performing image segmentation on each candidate text region to segment the text contour of the candidate text region;
[0110] S504: Obtain all text line regions of the image according to the accurate position of each candidate text region, the foreground selection area, and the text outline of the candidate text region;
[0111] Through the above steps S501 to S504, the process of locating text lines on the input image and determining each text line area of the input image in the above embodiment can also be implemented.
[0112] S505: extracting features from the input image to generate all candidate target regions of the image;
[0113] S506: Performing position regression and multi-classification on each candidate target area to obtain the accurate position and category of each candidate target area;
[0114] S507: performing image segmentation on the candidate target area after the position and category are determined, and segmenting the target object in the candidate target area;
[0115] S508: Obtaining the target region of the image according to the accurate position and category of the candidate target region and the target object of the candidate target region;
[0116] S509: Selecting a POI region from the target regions of all images according to the category of the target region of the image.
[0117] Through the above steps S505 to S509, the process of performing region segmentation on the input image to obtain the POI region of the image in the above embodiment can also be implemented.
[0118] In an embodiment of the present invention, the first machine learning model is a two-level model of text detection and text segmentation. After feature extraction is performed on the input image and all candidate text regions of the image are generated, the text detection model performs position regression and binary classification on all candidate text regions to obtain the accurate position and foreground selection of the candidate text region, i.e., the text detection result of the candidate text region; the text segmentation model performs image segmentation on each candidate text region to segment the text contour of the candidate text region, i.e., the text segmentation result of the candidate text region; all text line regions of the image are obtained based on the accurate position, foreground selection and text contour of each candidate text region. In the model training process, the text detection model is firstly subjected to detection learning to obtain the detection results of all candidate text regions of the image, and then the text segmentation model is independently subjected to segmentation learning, and the learning processes of text detection and text segmentation are independent of each other.
[0119] Since in the first machine learning model, there is a deviation between the initial text bounding box position of the extracted candidate text line area and the actual bounding box position of the text in the input image, after the candidate text area is obtained by image segmentation, the initial text box position of the candidate text area is fine-tuned through bounding-box regression, so that the initial text box position of the candidate text area has a certain offset, thereby obtaining a candidate text area that is closer to the actual position of the text in the input image.
[0120] The candidate text area is subjected to binary classification to obtain a foreground selected area of the candidate text area. For example, features of corresponding image pixels of the candidate text area can be extracted. When the probability that the features of corresponding image pixels in the candidate text area belong to the foreground image is greater than a set threshold, the corresponding image pixel features are determined to be foreground image features. All foreground image features are obtained to obtain a foreground selected area of the candidate text line area.
[0121] Since the text lines of the candidate text line area extracted in the first machine learning model contain some background of the input image, the candidate text area is segmented to segment the background and foreground of the candidate text area. The pixels of the candidate text area are classified into two categories, each pixel is classified into foreground (i.e., text outline) or background (i.e., non-text outline), and the segmentation results of the two categories are obtained. All foreground points of the candidate text area are extracted to obtain the text outline of the candidate text line area.
[0122] In an embodiment of the present invention, the second machine learning model is a two-level model of target detection and target segmentation, which performs feature extraction on the input image to generate all candidate target areas of the image. The target detection model performs position regression and multi-classification on all candidate target areas to obtain the accurate position and category of the candidate text area, that is, the target detection result of the candidate target area; the target segmentation model performs image segmentation on each candidate target area to segment the target object of the candidate target area, that is, the target segmentation result of the candidate target area; the target area of the image is obtained based on the accurate position, category and target object of the candidate target area. According to the category of the target area of the image, the POI area is selected from the target areas of all images. In the model training process, the target detection model is first subjected to detection learning to obtain the detection results of all candidate target areas of the image, and then the target segmentation model is independently subjected to segmentation learning. The learning processes of target detection and target segmentation are independent of each other.
[0123] Since in the second machine learning model, there is a deviation between the initial bounding box position of the candidate target area extracted and the actual bounding box position of the target area in the input image, after the candidate target area is obtained by image segmentation, the initial bounding box position of the detected target area is fine-tuned through bounding box regression, so that the initial bounding box position of the target area has a certain offset, thereby obtaining a candidate target area that is closer to the actual position of the target in the input image.
[0124] The candidate target area is subjected to multiple classifications to obtain the category of each candidate target area. For example, features of corresponding image pixels of the candidate target area can be extracted. When the probability that the features of corresponding image pixels in the candidate target area belong to the foreground image is greater than a set threshold, the corresponding image pixel features are determined to be foreground image features. All foreground image features are obtained to determine the category of the candidate target area.
[0125] The input image is feature extracted, and the candidate target area obtained will contain some background of the input image. The candidate target area is segmented to separate the background and foreground of the candidate target area. The pixels in the candidate target area are classified into two categories, and each pixel is classified into foreground (i.e., target object) or background (i.e., non-target object). The binary classification result is obtained, and all foreground points in the candidate target area are extracted to obtain the target object in the candidate target area.
[0126] In this embodiment, steps S510 to S514 implement the process of determining the POI area to which the text line area belongs, grouping the text line areas belonging to the same POI area, and performing layout analysis on each group of text line areas, arranging and combining the text lines of each group of text line areas according to the analysis results, and outputting the text line information of each POI area. The description of steps S210 to S214 in Example 2 is referred to and will not be repeated here.
[0127] In some optional embodiments, the first machine learning model may be an end-to-end entity segmentation model of text detection and text segmentation described in the above embodiment 2, and the second machine learning model may be a two-level model of target detection and target segmentation described in embodiment 3; or the first machine learning model may be a two-level model of text detection and text segmentation described in the above embodiment 2, and the second machine learning model may be an end-to-end entity segmentation model of target detection and target segmentation described in embodiment 3.
[0128] Embodiment 4:
[0129] Based on the same inventive concept, an embodiment of the present invention also provides a text line positioning device, related storage media and equipment. Since the principles of the problems solved by these devices, related storage media and equipment are similar to the text line positioning method in the aforementioned image, the implementation of the device, related storage media and equipment can refer to the implementation of the aforementioned method, and the repeated parts will not be repeated.
[0130] Reference Figure 6 As shown, the text line positioning device in an image provided by an embodiment of the present invention includes:
[0131] The text line region determination module 101 is used to locate text lines in the input image and determine each text line region of the input image;
[0132] The POI region determination module 102 is used to segment the input image into regions to obtain the POI region of the image;
[0133] The text line grouping module 103 is used to determine the POI area to which the text line area belongs, and group the text line areas belonging to the same POI area into one group;
[0134] The layout analysis module 104 is used to perform layout analysis on each group of text line areas, arrange and combine the text lines of each group of text line areas according to the analysis results, and output the text line information of each POI area.
[0135] In one embodiment, the text line region determination module 101 locates text lines in the input image and generates various text line regions of the image, including:
[0136] In the first machine learning model obtained through training, feature extraction is performed on the input image, and position regression, classification and image segmentation are performed on the extracted candidate text areas to obtain all text line areas of the image.
[0137] In one embodiment, whenever a candidate text region of an image is extracted, the text line region determination module 101 is specifically configured to perform the following operations:
[0138] Performing position regression and binary classification on the candidate text region to obtain the accurate position and foreground selection of the candidate text region;
[0139] Performing image segmentation on the candidate text area to segment the text contour of the candidate text area;
[0140] The text line region of the image is obtained according to the accurate position of the candidate text region, the foreground selection area and the text outline of the candidate text region.
[0141] In one embodiment, the text line region determination module 101 performs feature extraction on the input image, performs position regression, classification and image segmentation on the extracted candidate text regions, and obtains all text line regions of the image, including:
[0142] Perform feature extraction on the input image to generate all candidate text regions of the image;
[0143] Perform position regression and binary classification on each candidate text area to obtain the accurate position and foreground selection of the candidate text area;
[0144] Perform image segmentation on each candidate text area to segment the text contour of the candidate text area;
[0145] According to the accurate position of each candidate text region, the foreground selection and the text contour of the candidate text region, all text line regions of the image are obtained.
[0146] In one embodiment, the POI region determination module 102 performs region segmentation on the input image to obtain the POI region of the image, including:
[0147] In the trained second machine learning model, feature extraction is performed on the input image, and position regression, classification and image segmentation are performed on the candidate target area of the extracted image to obtain the POI area of the image.
[0148] In one embodiment, whenever a candidate target area of an image is extracted, the POI area determination module 102 is specifically configured to perform the following operations:
[0149] Performing position regression and multi-classification on the candidate target area to obtain the accurate position and category of the candidate target area;
[0150] Performing image segmentation on the candidate target area to segment the target object in the candidate target area;
[0151] The target region of the image is obtained according to the accurate position and category of the candidate target region and the target object of the candidate target region.
[0152] In one embodiment, the POI region determining module 102 is further configured to select a POI region from the target regions of all images according to the category of the target region of the image.
[0153] In one embodiment, the POI region determination module 102 extracts features from the input image, performs position regression, classification, and image segmentation on the extracted candidate target region of the image, and obtains the POI region of the image, including:
[0154] Extract features from the input image and generate all candidate target areas of the image;
[0155] Perform position regression and multi-classification on each candidate target area to obtain the accurate position and category of each candidate target area;
[0156] Perform image segmentation on the candidate target area after determining the position and category, and segment the target object in the candidate target area;
[0157] Obtaining the target region of the image according to the accurate position and category of the candidate target region and the target object of the candidate target region;
[0158] According to the category of the target area of the image, a POI area is selected from the target areas of all images.
[0159] In one embodiment, the POI region determination module 102 selects a POI region from the target regions of all images according to the category of the target region of the image, specifically including:
[0160] According to the category of the target area of each image, the target area of the image is distinguished as a POI area or a non-POI area, and all POI areas are selected from the target areas of all images.
[0161] In one embodiment, the text line combination module 103 determines the POI area to which the text line area belongs, and groups the text line areas belonging to the same POI area into one group, including:
[0162] According to the accurate position of the text line area and the accurate position of the POI area, it is determined whether the intersection area of the text line area and the POI area exceeds a set threshold;
[0163] If so, determining that the text line area belongs to the POI area;
[0164] At least one text line region belonging to the same POI region is obtained, and the at least one text line region is grouped together.
[0165] In one embodiment, the text line combination module 103 is further used to determine whether the intersection area of the text line area and the non-POI area exceeds a set threshold according to the position of the text line area and the position of the non-POI area;
[0166] If so, it is determined that the text line region belongs to the non-POI region, and the non-POI region and the text line region belonging to the non-POI region are removed.
[0167] In one embodiment, the layout analysis module 104 performs layout analysis on each group of text line areas, arranges and combines text lines in each group of text line areas according to the analysis results, and outputs text lines in each POI area, including:
[0168] The text line information of each group of text line areas is analyzed, the text line areas with consistent text line information in each group of text line areas are text-joined, and the text information of the joined text lines of the POI area is output.
[0169] An embodiment of the present invention provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the above-mentioned method for locating a text line in an image is implemented.
[0170] An embodiment of the present invention provides a computer device, comprising: a processor and a memory for storing processor executable commands; wherein the processor is configured to execute the above-mentioned method for locating text lines in an image.
[0171] Embodiment 5:
[0172] The above text line positioning method in an image can be implemented on the server side. The above text line positioning device in an image can be set in the server to achieve the method. The structure of the server is as follows: Figure 7 As shown, including:
[0173] A receiving device 11, used for receiving images collected by a terminal device;
[0174] The text line positioning device 12 is used to perform text line positioning on the input image in the first machine learning model obtained by training, and determine each text line area of the input image; perform region segmentation on the input image in the second machine learning model obtained by training, and obtain the point of interest POI area of the image; determine the POI area to which the text line area belongs, and group the text line areas belonging to the same POI area; perform layout analysis on each group of text line areas, arrange and combine the text lines of each group of text line areas according to the analysis results, and output the text line information of each POI area;
[0175] The first memory 13 stores the collected images and the text line information of each POI area.
[0176] Reference to the functions realized by the text line positioning device Figure 6 The relevant description will not be repeated here.
[0177] In this way, the server locates the text line in the collected image. The image can be collected by a mobile collection device and then transmitted, or it can be collected by other methods and stored in the server.
[0178] Embodiment 6:
[0179] In this embodiment, the system composed of a mobile acquisition device and a server realizes text line positioning. The mobile acquisition device realizes preliminary positioning and recognition of text lines in an image to determine whether the image is a normal image. The server realizes positioning of text lines in a normal image and outputs specific positioning results.
[0180] Reference Figure 8 As shown, an embodiment of the present invention provides a text line positioning system in an image, comprising: a mobile acquisition device 2 and a server 1;
[0181] The mobile acquisition device 2 is used to acquire images and use a selected determination method to determine whether the acquired images are abnormal images. If not, the acquired images are uploaded to the server 1.
[0182] Server 1 is used to locate text lines in the image. The functions implemented by Server 1 refer to Figure 7 The relevant description will not be repeated here.
[0183] In the system, the specific implementation process of the above-mentioned embodiment 2 or embodiment 3 is performed on the server side, and the server 1 completes the process of positioning the text line in the POI area of the input image. The input image may be collected by the mobile acquisition device 2 and provided to the server 1. Since the processor computing power and data caching capacity of the mobile acquisition device are relatively poor, the speed of processing large data is too slow, and the power supply is limited, it is not suitable for directly positioning the text line in the image on the collected image. Therefore, it can be sent to the server side to perform the steps of the above-mentioned embodiment 2 or embodiment 3.
[0184] In one embodiment, the mobile acquisition device 2 determines whether the image is an abnormal image by performing preliminary text positioning and text recognition on the acquired image; specifically, the process includes:
[0185] Perform preliminary text positioning on the captured image to determine whether the text inclination meets the preset inclination requirements;
[0186] If not, determining that the image is an abnormal image;
[0187] If so, perform text recognition on the image after preliminary text positioning to determine whether the recognizability of the text meets the requirements; if not, determine that the image is an abnormal image, and if so, send it to the server 1.
[0188] The mobile acquisition device can be used to collect images and transmit them to the server. Before transmitting them to the server, the mobile acquisition device can also perform abnormal identification on the collected images in order to identify the normal images with better quality and transmit them to the server, thus avoiding transmitting unclear images that cannot be identified to the server to increase resource consumption.
[0189] For example, you can refer to Fig. 9 As shown, the mobile acquisition device 2 includes a first image acquisition device 21 and a first processor 22. The mobile acquisition device 2 can be, for example, a handheld mobile terminal or a vehicle-mounted terminal, such as a mobile phone or a driving recorder. The first image acquisition device 21 of the mobile acquisition device 2 can be a camera, which captures images by shooting with the camera and sends them to the first processor 22; the first processor 22 can be a central processing unit (CPU) or a graphics processing unit (GPU).
[0190] Optional, see Fig.10As shown, the first processor 22 includes a preliminary text positioning module 221 and a preliminary text recognition module 222. The preliminary text positioning module 221 is used to perform preliminary text positioning on the captured image, determine whether the text inclination meets the preset inclination requirement through the preliminary text positioning, send the captured image that meets the preset inclination requirement to the preliminary text recognition module 222, determine whether the recognizability of the text in the captured image meets the requirement through text recognition, and upload the captured image that meets the text recognizability requirement to the server 1. In the embodiment of the present invention, the preliminary text positioning module 221 and the preliminary text recognition module 222 can use the methods in the prior art to locate and recognize text, for example, a text line positioning algorithm based on detection or a text line positioning method based on semantic segmentation, or a text positioning method based on connected components and support vector machines; a text recognition method based on optical character recognition (OCR), or a text recognition method based on LSTM (Long Short-Term Memory)-CTC (Connectionist Temporal Classifier), as long as the preliminary text positioning and text recognition of the captured image can be achieved, and this is not limited in the embodiment of the present invention.
[0191] The preliminary text positioning module 221 performs preliminary text positioning on the captured image and determines whether the text inclination meets the preset inclination requirement. Specifically, after the preliminary text positioning module 221 performs preliminary text positioning on the captured image, it determines the inclination angle of the captured image and compares it with the preset angle threshold to determine whether the text inclination meets the preset inclination requirement. The specific determination method can adopt the method in the prior art. For example, the preliminary text positioning module 221 determines the position of each character in the collected image through preliminary text positioning, and then obtains the inclination angle α1 of the horizontal line formed by the upper center point of the first non-top character and the upper center point of the last non-top character, and simultaneously obtains the inclination angle α2 of the horizontal line formed by the lower center point of the first non-bottom character and the lower center point of the last non-bottom character. The average of α1 and α2 is the horizontal inclination angle α; at the same time, each character in the collected image is sheared to obtain the vertical inclination angle of each character, and the vertical inclination angle β is obtained by removing a minimum value and a maximum value and then averaging. After obtaining the inclination angles α and β, it is determined whether the inclination angles α and β are greater than a preset angle threshold. If so, it is determined that the text inclination does not meet the preset inclination requirement, and the image is determined to be an abnormal image. If not, the collected image is sent to the preliminary text recognition module 222.
[0192] The preliminary text recognition module 222 performs text recognition on the image after the preliminary text positioning, and determines whether the recognizability of the text meets the requirements. Specifically, the preliminary text recognition module 222 determines the size of each text in the image according to the text recognition result, and determines whether the smallest text in the image is larger than a preset text size threshold, or calculates the average value of the sizes of all the texts in the image, and determines whether the average value of the sizes of all the texts in the image is larger than a preset text size threshold. If not, it is determined that the recognizability of the text does not meet the requirements, and the image is determined to be an abnormal image. If so, the collected image is sent to the server 1. Specifically, the preliminary text recognition module 222 determines the pixel value of each text in the image according to the text recognition result, and determines whether the difference in pixel values between adjacent texts in the image is larger than a preset pixel difference threshold. If so, it is determined that the recognizability of the text does not meet the requirements, and the image is determined to be an abnormal image. If not, the collected image is sent to the receiving device 11 of the server 1.
[0193] The server 1 includes the text line positioning device in the image in the above embodiment 3, including the text line area determination module 101, the POI area determination module 102, the text line combination module 103 and the layout analysis module 104 described in the above embodiment, and completes the specific text positioning process of the above embodiment 2 or embodiment 3 on the server side. The server 1 can also send the intermediate results and the final result images in the positioning process to the mobile acquisition device 2 for display. The mobile acquisition device 2 has a display interface for displaying the input image input to the server 1, the result of the server 1 performing text line positioning on the input image through the first machine learning model, the result of the server 1 performing area segmentation on the input image through the second machine learning model, and the server 1 determines the POI area to which the text line area belongs, and groups the text line areas belonging to the same POI area into one group; each group of text line areas is subjected to layout analysis, and the text lines of each group of text line areas are arranged and combined according to the analysis results to obtain the image after the text line information of each POI area is obtained.
[0194] As a specific application of the embodiment of the present invention, in the server 1 Fig.11 The first machine learning model performs text line positioning on the input image according to the above steps S201 to S204 to determine the corresponding POI area of the input image. Fig.11 The text line areas of the input image shown are referred to Fig.12As shown, text line regions including: "China Construction Bank", "China Construction Bank", "24 hours", "Self-service Banking", "SelfService Banking", "China CITIC Bank", "CHINA CITIC BANK", "Huaxia Bank", and "HUAXIA BANK" are determined; at the same time, the second machine learning model realizes region segmentation of the input image according to the above steps S205 to S209, and determines the corresponding Fig.11 POI region of the input image shown, referring to Fig.13 As shown, the three regions enclosed by rectangles A, B, and C, that is, the POI regions, and the regions not enclosed by rectangles are non-POI regions. Through the above steps S210 to S213, for Fig.12 the determined text line regions shown determine the corresponding Fig.13 POI region shown, group the text line regions belonging to the same POI region into one group, and perform layout analysis on each group of text line regions respectively. According to the analysis results, arrange and combine the text lines of each group of text line regions, and output the text line information of each POI region, referring to Fig.14 As shown, group "China Construction Bank", "China Construction Bank", "24 hours", "Self-service Banking", and "SelfService Banking" into one group of text regions, group "China CITIC Bank", "CHINA CITIC BANK", "24 hours", "Self-service Banking", and "SELF SERVICE BANK" into another group of text regions, group "Huaxia Bank", "HUAXIA BANK", "24 hours", "Self-service Banking", and "Self Service Banking" into a third group of text regions, perform layout analysis on the three groups of text line regions respectively, arrange and combine the text lines of each group of text line regions, and output Fig.14 the text line information of each POI region shown, that is, obtain Fig.11 the complete text line information on each plaque of the input image shown. In this embodiment, when performing steps S210 to S213, steps S401 to S403 will also be executed to remove the text line regions of non-POI regions to eliminate noise. Since Fig.10 the input image shown does not include text line regions belonging to non-POI regions, the specific implementation process does not show the removal of text line regions of non-POI regions.
[0195] Embodiment 7:
[0196] In this embodiment, the text line positioning is realized by the collection vehicle, and the preliminary positioning and identification of the text line in the image is realized in the image acquisition device of the collection vehicle to determine whether the image is a normal image, and the positioning of the text line in the normal image is realized in the image acquisition device of the collection vehicle to output a specific positioning result. Since the collection vehicle is a large-scale device, the processor of the image acquisition device has strong computing power and data caching capacity, can process image data, and has a large power supply capacity, the process of positioning the text line in the image can be directly performed on the processor of the image acquisition device to perform the steps of the above-mentioned embodiment 2 or embodiment 3.
[0197] Based on the same inventive concept, the embodiment of the present invention further provides a collection vehicle, on which an image collection device is arranged, referring to Fig.15 As shown, the image acquisition device includes:
[0198] The second image acquisition device 31 is used to acquire images and send them to the second processor 32;
[0199] The second processor 32 includes an image recognition device and the above-mentioned text line positioning device in the image. The image recognition device is used to use a selected judgment method to judge whether the collected image is an abnormal image. If not, the image is input into the text line positioning device in the image. The text line positioning device in the image is used to realize positioning of the text line in the image.
[0200] The second memory 33 stores the collected images and the text line information of each POI area.
[0201] In one embodiment, the image recognition device determines whether the image is an abnormal image by performing preliminary text location and text recognition on the collected image; specifically, the following steps are performed:
[0202] Perform preliminary text positioning on the captured image to determine whether the text inclination meets the preset inclination requirements;
[0203] If not, determining that the image is an abnormal image;
[0204] If yes, perform text recognition on the image after preliminary text positioning to determine whether the recognizability of the text meets the requirements; if no, determine that the image is an abnormal image, and if yes, send it to the second processor 32.
[0205] Specifically, the second image acquisition device 31 of the acquisition vehicle may be a camera, which acquires images by shooting with the camera; the second processor 32 may be a central processing unit (CPU) or a graphics processing unit (GPU).
[0206] In a specific embodiment, the image recognition device implements the function of using a selected judgment method to determine whether the collected image is an abnormal image in a similar manner to the implementation of the first processor 22 described in the above embodiment 5. The detailed implementation process can refer to the specific description of the first pair of processors 22 in the above embodiment 5, which will not be repeated here.
[0207] The second processor 32 includes the above Figure 6 The text line positioning device in the image includes the text line area determination module 101, the POI area determination module 102, the text line combination module 103 and the layout analysis module 104 described in the above embodiment 4, and the specific text relocation process of the above embodiment 2 or embodiment 3 is completed in the second processor 32. Further, the collection vehicle can also display the intermediate results and the final result images in the positioning process. The collection vehicle has a display interface for locally displaying the input image, the result image of text line positioning of the input image by the first machine learning model, the result image of region segmentation of the input image by the second machine learning model, and the POI area to which the text line area belongs, and the text line areas belonging to the same POI area are grouped together; each group of text line areas is respectively analyzed for layout, and the text lines of each group of text line areas are arranged and combined according to the analysis results to obtain the image after the text line information of each POI area. It can also be that the collection vehicle can upload the intermediate results and the final result images in the positioning process to the server for storage.
[0208] As a specific application of the embodiment of the present invention, in the above-mentioned collection vehicle Fig.11 The POI area of the input image shown in the figure is used to locate the text line, and the intermediate result (refer to Fig.12 and Fig.13 ) and the final result (refer to Fig.14 ) is the same as when text line positioning is performed on the server side. The specific implementation process can refer to the description of the specific application in the above embodiment 5, which will not be repeated here.
[0209] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0210] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0211] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0212] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0213] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for locating text lines in an image, characterized in that: include: Perform text line positioning on the input image to determine each text line area of the input image; Perform region segmentation on the input image to obtain the point of interest (POI) region of the input image; Determine the POI region to which the text line region belongs, and group the text line regions belonging to the same POI region; Perform layout analysis on each group of text line areas, arrange and combine the text lines in each group of text line areas according to the analysis results, and output the text line information of each POI area.
2. The method according to claim 1, characterized in that The step of locating text lines on the input image and determining each text line region of the input image includes: In the first machine learning model obtained through training, feature extraction is performed on the input image, and position regression, classification and image segmentation are performed on the extracted candidate text areas to obtain all text line areas of the image.
3. The method according to claim 2, characterized in that Whenever a candidate text region is extracted from an image, the following operations are performed: Performing position regression and binary classification on the candidate text region to obtain the accurate position and foreground selection of the candidate text region; Performing image segmentation on the candidate text area to segment the text contour of the candidate text area; The text line region of the image is obtained according to the accurate position of the candidate text region, the foreground selection area and the text outline of the candidate text region.
4. The method according to claim 2, characterized in that Perform feature extraction on the input image, perform position regression, classification and image segmentation on the extracted candidate text areas, and obtain all text line areas of the image, including: Perform feature extraction on the input image to generate all candidate text regions of the image; Perform position regression and binary classification on each candidate text region to obtain the accurate position and foreground selection of the candidate text region; Perform image segmentation on each candidate text area to segment the text contour of the candidate text area; According to the accurate position of each candidate text region, the foreground selection and the text contour of the candidate text region, all text line regions of the image are obtained.
5. The method according to claim 1, characterized in that The step of performing region segmentation on the input image to obtain the POI region of the input image includes: In the trained second machine learning model, feature extraction is performed on the input image, and position regression, classification and image segmentation are performed on the candidate target area of the extracted image to obtain the POI area of the image.
6. The method according to claim 5, characterized in that Whenever a candidate target region of an image is extracted, the following operations are performed: Performing position regression and multi-classification on the candidate target area to obtain the accurate position and category of the candidate target area; Performing image segmentation on the candidate target area to segment the target object in the candidate target area; The target region of the image is obtained according to the accurate position and category of the candidate target region and the target object of the candidate target region.
7. The method according to claim 6, characterized in that According to the category of the target area of the image, a POI area is selected from the target areas of all images.
8. The method according to claim 5, characterized in that The feature extraction of the input image, the position regression, classification and image segmentation of the candidate target area of the extracted image, and the POI area of the image are obtained, including: Extract features from the input image and generate all candidate target areas of the image; Perform position regression and multi-classification on each candidate target area to obtain the accurate position and category of each candidate target area; Perform image segmentation on the candidate target area after determining the position and category, and segment the target object in the candidate target area; Obtaining the target region of the image according to the accurate position and category of the candidate target region and the target object of the candidate target region; According to the category of the target area of the image, a POI area is selected from the target areas of all images.
9. The method according to claim 7 or 8, characterized in that According to the category of the target area of the image, the POI area is selected from the target areas of all images, including: According to the category of the target area of each image, the target area of the image is distinguished as a POI area or a non-POI area, and all POI areas are selected from the target areas of all images.
10. The method according to claim 9, characterized in that The step of determining the POI region to which the text line region belongs and grouping the text line regions belonging to the same POI region into one group includes: According to the accurate position of the text line area and the accurate position of the POI area, it is determined whether the intersection area of the text line area and the POI area exceeds a set threshold; If so, determining that the text line area belongs to the POI area; At least one text line region belonging to the same POI region is obtained, and the at least one text line region is grouped together.
11. The method according to claim 10, characterized in that Also includes: According to the position of the text line area and the position of the non-POI area, determining whether the intersection area of the text line area and the non-POI area exceeds a set threshold; If so, it is determined that the text line region belongs to the non-POI region, and the non-POI region and the text line region belonging to the non-POI region are removed.
12. The method according to any one of claims 1 to 11, characterized in that: Perform layout analysis on each group of text line areas, arrange and combine the text lines in each group of text line areas according to the analysis results, and output the text lines of each POI area, including: The text line information of each group of text line areas is analyzed, the text line areas with consistent text line information in each group of text line areas are text-joined, and the text information of the joined text lines of the POI area is output.
13. A device for locating text lines in an image, characterized in that: include: A text line region determination module is used to locate text lines in an input image and determine each text line region of the input image; The POI region determination module is used to segment the input image into regions to obtain the POI region of the input image; A text line grouping module is used to determine the POI area to which the text line area belongs, and group the text line areas belonging to the same POI area into one group; The layout analysis module is used to perform layout analysis on each group of text line areas, arrange and combine the text lines in each group of text line areas according to the analysis results, and output the text line information of each POI area.
14. A server, characterized in that: include: A receiving device, used for receiving images acquired by a terminal device; The text line positioning device in an image as claimed in claim 13; The first memory stores the collected images and the text line information of each POI area.
15. A text line location system in an image, characterized in that: include: A mobile acquisition device and a server as claimed in claim 14; The mobile acquisition device is used to acquire images, and use a selected determination method to determine whether the acquired images are abnormal images, and if not, upload the acquired images to the server; The server is used to locate text lines in the image.
16. The text line positioning system according to claim 15, characterized in that: The mobile acquisition device is specifically used for: Perform preliminary text positioning on the captured image to determine whether the text inclination meets the preset inclination requirements; If not, determining that the image is an abnormal image; If so, perform text recognition on the image after preliminary text positioning to determine whether the recognizability of the text meets the requirements; if not, determine that the image is an abnormal image, and if so, send it to the server.
17. A mobile data collection device, characterized in that: include: A first image acquisition device, used for acquiring images and sending them to a first processor; The first processor is used to use a selected judgment method to determine whether the collected image is an abnormal image. If not, the collected image is uploaded to the server as described in any one of claims 14-16.
18. A collection vehicle, characterized in that: An image acquisition device is arranged on the vehicle, and the image acquisition device comprises: A second image acquisition device, used for acquiring images and sending them to a second processor; A second processor is provided with an image recognition device and a text line positioning device in an image as claimed in claim 13, wherein the image recognition device is used to determine whether the collected image is an abnormal image by using a selected determination method, and if not, the image is input into the text line positioning device in the image; the text line positioning device in the image is used to realize positioning of the text line in the image; The second memory stores the collected images and the text line information of each POI area.
19. The collection vehicle according to claim 18, characterized in that: The image recognition device is specifically used for: Perform preliminary text positioning on the captured image to determine whether the text inclination meets the preset inclination requirements; If not, determining that the image is an abnormal image; If so, perform text recognition on the image after preliminary text positioning to determine whether the recognizability of the text meets the requirements; if not, determine that the image is an abnormal image, and if so, send it to the text line positioning device in the image.
20. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the method for locating a text line in an image as described in any one of claims 1 to 12 is implemented.
21. A computer device comprising: A processor and a memory for storing processor executable commands; wherein the processor is configured to execute the text line positioning method in an image as described in any one of claims 1-12.
