Data extraction method, device, equipment, readable storage medium and product
By segmenting and sorting image rectangles using a target bounding box algorithm, combined with text recognition and post-processing, the problems of low data extraction efficiency and low accuracy are solved, achieving efficient and accurate data extraction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2026-03-17
AI Technical Summary
Existing data extraction methods are inefficient and error-prone, especially when extracting trailing data from photographed images, where accuracy is low.
The target bounding box algorithm is used to segment the image into multiple rectangular boxes, which are then sorted to extract the target rectangular boxes containing the target data. Text recognition is then performed, including preprocessing and postprocessing to improve accuracy.
It improves the efficiency and accuracy of data extraction, ensures that the target data is sorted neatly, simplifies the data analysis process, and reduces the workload for users.
Smart Images

Figure CN116740725B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data extraction technology, and in particular relates to a data extraction method, apparatus, device, readable storage medium and product. Background Technology
[0002] Footer links are links attached to the end of promotional information posted by WeChat official accounts or mini-programs. Footer data (such as send and click data) can be used to determine the popularity of the promotion.
[0003] For end-of-line data, the current method requires extracting the date and data from the photographed image. However, the current data extraction method is inefficient and prone to errors. Therefore, it is necessary to solve the problems of low accuracy and low efficiency. Summary of the Invention
[0004] This application provides a data extraction method, apparatus, device, readable storage medium, and product that can effectively improve the efficiency and accuracy of data extraction.
[0005] In a first aspect, embodiments of this application provide a data extraction method, which includes: acquiring a first image of target data; segmenting the first image into multiple rectangles based on a target bounding box algorithm, and sorting the multiple rectangles to obtain sorted rectangles; extracting a target rectangle containing target data from the sorted rectangles; and performing text recognition on the target rectangle to obtain the target data.
[0006] According to an embodiment of the first aspect of this application, the target data includes tail data of a recommended activity, the tail data includes first popularity data and second popularity data, and the first image includes a first sub-image of the first popularity data and a second sub-image of the second popularity data; based on a target bounding box algorithm, the first image is segmented into multiple rectangular boxes, and the multiple rectangular boxes are sorted to obtain sorted rectangular boxes, including: based on a target bounding box algorithm, the first sub-image is segmented into multiple first rectangular boxes, and the multiple first rectangular boxes are sorted to obtain sorted first rectangular boxes; based on a target bounding box algorithm, the second sub-image is segmented into multiple second rectangular boxes, and the second sub-image is sorted into multiple second rectangular boxes, and the second sub-image is sorted into multiple second rectangular boxes. Multiple second rectangles are sorted to obtain sorted second rectangles; from the sorted rectangles, target rectangles containing target data are extracted, including: extracting a first target rectangle containing first popularity data from the sorted first rectangles, and extracting a second target rectangle containing second popularity data from the sorted second rectangles; performing text recognition on the target rectangles to obtain target data, including: performing text recognition on the first target rectangle to obtain first popularity data; performing text recognition on the second target rectangle to obtain second popularity data; the data extraction method further includes: calculating the intersection of the first popularity data and the second popularity data.
[0007] According to any of the foregoing embodiments of the first aspect of this application, extracting a target rectangle containing target data from a sorted rectangle further includes: extracting a third target rectangle containing a first record date from a sorted first rectangle, and extracting a fourth target rectangle containing a second record date from a sorted second rectangle, wherein the first record date is the record date of the first popularity data, and the second record date is the record date of the second popularity data; performing text recognition on the target rectangle to obtain target data further includes: performing text recognition on the third target rectangle to obtain the first record date; performing text recognition on the fourth target rectangle to obtain the second record date; the first popularity data includes first sub-popularity data corresponding to multiple record dates, and the second popularity data includes second sub-popularity data corresponding to multiple record dates; calculating the intersection of the first popularity data and the second popularity data includes: grouping the first sub-popularity data and the second sub-popularity data corresponding to the same record date in the first record date and the second record date into a row or a column.
[0008] According to any of the foregoing embodiments of the first aspect of this application, the first popularity data includes the number of sends, and the second popularity data includes the number of clicks; after calculating the intersection of the first popularity data and the second popularity data, the data extraction method further includes: calculating the click-through rate for each record date based on the click-through rate and the number of sends for the same record date; grouping the click-through rate, the number of sends, and the click-through rate for the same record date into a row or a column; and sorting the click-through rate, the number of sends, and the click-through rate for each record date according to the chronological order of the record dates.
[0009] According to any of the foregoing embodiments of the first aspect of this application, before segmenting the first image into multiple rectangular boxes based on the target bounding box algorithm and sorting the multiple rectangular boxes to obtain sorted rectangular boxes, the data extraction method further includes: preprocessing the first image to obtain a preprocessed first image; wherein, the preprocessing includes at least one of the following: grayscale conversion, binarization, denoising, enhancement, and tilt correction.
[0010] According to any of the foregoing embodiments of the first aspect of this application, before performing text recognition on the target rectangle to obtain target data, the data extraction method further includes: segmenting the characters in the target rectangle to separate each character; performing text recognition on the target rectangle to obtain target data, including: recognizing each character in the target rectangle and converting the recognized characters into text format to obtain target data; after performing text recognition on the target rectangle to obtain target data, the data extraction method further includes: post-processing the target data to obtain post-processed target data, wherein post-processing includes at least one of the following: concatenation, deduplication, and formatting; storing the post-processed target data in a target file or database.
[0011] According to any of the foregoing embodiments of the first aspect of this application, before segmenting the first image into multiple rectangular boxes based on the target bounding box algorithm and sorting the multiple rectangular boxes to obtain sorted rectangular boxes, the data extraction method further includes: detecting whether the first image needs correction; when the first image needs correction, correcting the first image based on a pre-trained image correction model to obtain a corrected first image; segmenting the first image into multiple rectangular boxes based on the target bounding box algorithm and sorting the multiple rectangular boxes to obtain sorted rectangular boxes, including: segmenting the corrected first image into multiple rectangular boxes based on the target bounding box algorithm and sorting the multiple rectangular boxes to obtain sorted rectangular boxes.
[0012] According to any of the foregoing embodiments of the first aspect of this application, the target bounding box algorithm includes a target detection algorithm or a deep learning algorithm.
[0013] Secondly, embodiments of this application provide a data extraction device, which includes: an acquisition module for acquiring a first image of target data; a segmentation and sorting module for segmenting the first image into multiple rectangles based on a target bounding box algorithm and sorting the multiple rectangles to obtain sorted rectangles; an extraction module for extracting target rectangles containing target data from the sorted rectangles; and a recognition module for performing text recognition on the target rectangles to obtain the target data.
[0014] Thirdly, embodiments of this application provide an electronic device, which includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the data extraction method provided in the first aspect.
[0015] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the data extraction method provided in the first aspect.
[0016] Fifthly, embodiments of this application provide a computer program product stored in a non-volatile storage medium, which is executed by at least one processor to implement the steps of the data extraction method provided in the first aspect.
[0017] The data extraction method, apparatus, device, readable storage medium, and product of this application embodiment, for a first image of acquired target data, divides the first image into multiple rectangular boxes based on a target bounding box algorithm, and sorts the multiple rectangular boxes to obtain sorted rectangular boxes; from the sorted rectangular boxes, target rectangular boxes containing target data are extracted, effectively removing other data besides the target data while ensuring that the target rectangular boxes containing the target data are neatly sorted. Thus, based on this, text recognition is then performed on the target rectangular boxes to obtain the target data, which can effectively improve the efficiency and accuracy of data extraction. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A schematic flowchart of a data extraction method provided in an embodiment of this application;
[0020] Figure 2 Another flowchart illustrating the data extraction method provided in this application embodiment;
[0021] Figure 3 Another flowchart illustrating the data extraction method provided in this application embodiment;
[0022] Figure 4 Another flowchart illustrating the data extraction method provided in this application embodiment;
[0023] Figure 5 Another flowchart illustrating the data extraction method provided in this application embodiment;
[0024] Figure 6 Another flowchart illustrating the data extraction method provided in this application embodiment;
[0025] Figure 7 A schematic diagram of the structure of the data extraction device provided in the embodiments of this application;
[0026] Figure 8 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0027] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0028] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0029] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0030] Various modifications and variations can be made to this application without departing from its spirit or scope, which will be apparent to those skilled in the art. Therefore, this application is intended to cover modifications and variations falling within the scope of the corresponding claims (the claimed technical solutions) and their equivalents. It should be noted that the embodiments provided in this application can be combined with each other without contradiction.
[0031] It should be noted that the acquisition, storage, use, and processing of data in this application embodiment all comply with the relevant provisions of national laws and regulations.
[0032] Before describing the technical solutions provided in the embodiments of this application, in order to facilitate understanding of the embodiments of this application, this application first specifically explains the problems existing in the related technologies:
[0033] Optical Character Recognition (OCR) is a technology that converts text in an image into an editable electronic text format. This technology has evolved to recognize various languages and writing styles, including handwriting and print. OCR technology typically employs image processing and pattern recognition algorithms to successfully and automatically identify text regions and convert them into editable text or digital information.
[0034] Therefore, OCR technology can significantly reduce the time and workload of manual text input, making digitization work more efficient and accurate. OCR technology has been widely used in email, e-commerce, library digitization, record management, social media, and other fields.
[0035] However, the inventors of this application have discovered some drawbacks in OCR technology. Specifically, the text in the image needs to be neatly formatted; otherwise, the accuracy may be low, and the recognition results may be incorrect. Therefore, manual intervention is still required to verify and correct the recognition results, which is inefficient.
[0036] In view of the inventors’ above-mentioned research findings, the embodiments of this application provide a data extraction method, apparatus, device, readable storage medium and product, which can solve the technical problems of low efficiency and error-proneness of current data extraction methods in related technologies.
[0037] The technical concept of this application embodiment is as follows: For the first image of the acquired target data, based on the target bounding box algorithm, the first image is segmented into multiple rectangular boxes, and the multiple rectangular boxes are sorted to obtain sorted rectangular boxes; from the sorted rectangular boxes, the target rectangular boxes containing the target data are extracted, effectively removing other data besides the target data while ensuring that the target rectangular boxes containing the target data are neatly sorted. Thus, based on this, text recognition is then performed on the target rectangular boxes to obtain the target data, which can effectively improve the efficiency and accuracy of data extraction.
[0038] The data extraction method provided in the embodiments of this application will be introduced first below.
[0039] Figure 1 This is a schematic flowchart illustrating a data extraction method provided in an embodiment of this application. Figure 1 As shown, the data extraction method may include the following steps S101 to S104.
[0040] S101, Obtain the first image of the target data.
[0041] The target data can be any data that is desired to be extracted, and this application embodiment does not limit this. For example, in some embodiments, the target data may include tail data of recommended activities. The first image is the image containing the target data, which can be obtained by taking a picture.
[0042] It should be noted that the acquisition, storage, use, and processing of data in this application embodiment all comply with the relevant provisions of national laws and regulations.
[0043] S102. Based on the target bounding box algorithm, the first image is segmented into multiple rectangular boxes, and the multiple rectangular boxes are sorted to obtain sorted rectangular boxes.
[0044] In S102, target bounding box algorithms, such as object detection algorithms (YOLO algorithm) or deep learning algorithms (Faster R-CNN algorithm), can be used to segment the first image into multiple rectangular boxes (i.e., small grids). Then, based on the coordinate positions of each rectangular box, the multiple rectangular boxes are sorted according to their relative positions to obtain multiple sorted rectangular boxes.
[0045] S103. Extract the target rectangle containing the target data from the sorted rectangles.
[0046] In the sorted bounding boxes, some bounding boxes may not contain the target data, while others may contain the target data. In S103, the target bounding boxes containing the target data can be extracted from the sorted bounding boxes. The number of target bounding boxes can be one or more; this embodiment does not limit the number.
[0047] S104. Perform text recognition on the target rectangle to obtain the target data.
[0048] In S104, text recognition is performed on the target rectangle to extract the target data.
[0049] The data extraction method of this application embodiment, for the first image of the acquired target data, divides the first image into multiple rectangles based on a target bounding box algorithm, and sorts the multiple rectangles to obtain sorted rectangles; from the sorted rectangles, the target rectangles containing the target data are extracted, effectively removing other data besides the target data while ensuring that the target rectangles containing the target data are neatly sorted. Thus, based on this, text recognition is then performed on the target rectangles to obtain the target data, which can effectively improve the efficiency and accuracy of data extraction.
[0050] According to some embodiments of this application, optionally, the target data may include end-of-line data of the recommended activity, which includes first popularity data and second popularity data. The first and second popularity data can be data that reflects the popularity of the activity. For example, in some examples, the first popularity data may include the number of sends, and the second popularity data may include the number of clicks. The images of the first and second popularity data can be acquired separately; that is, the first image may include a first sub-image of the first popularity data and a second sub-image of the second popularity data.
[0051] Figure 2 This is another schematic flowchart illustrating the data extraction method provided in an embodiment of this application. For example... Figure 2 As shown, correspondingly, in step S102, based on the target bounding box algorithm, the first image is segmented into multiple rectangular boxes, and the multiple rectangular boxes are sorted to obtain sorted rectangular boxes. Specifically, this may include the following steps:
[0052] S1021. Based on the target bounding box algorithm, the first sub-image is segmented into multiple first rectangular boxes, and the multiple first rectangular boxes are sorted to obtain the sorted first rectangular boxes.
[0053] S1022. Based on the target bounding box algorithm, the second sub-image is segmented into multiple second rectangular boxes, and the multiple second rectangular boxes are sorted to obtain the sorted second rectangular boxes.
[0054] That is, in order to ensure the accuracy of data extraction, the first sub-image and the second sub-image can be segmented and sorted respectively. The first sub-image is segmented into multiple first rectangular boxes, and the second sub-image is segmented into multiple second rectangular boxes.
[0055] Accordingly, S103, extracting the target rectangle containing the target data from the sorted rectangles may include the following steps:
[0056] Extract the first target rectangle containing the first popularity data from the sorted first rectangle, and extract the second target rectangle containing the second popularity data from the sorted second rectangle.
[0057] Accordingly, S104, perform text recognition on the target rectangle to obtain target data, which may specifically include the following steps:
[0058] S1041. Perform text recognition on the first target rectangle to obtain the first popularity data;
[0059] S1042. Perform text recognition on the second target rectangle to obtain the second popularity data.
[0060] After obtaining the first and second popularity data, the data extraction method may further include the following step S105:
[0061] Calculate the intersection of the first and second popularity data.
[0062] In this way, the first and second sub-images can be segmented, sorted, extracted, and identified separately, ensuring the accuracy of the obtained first and second popularity data and avoiding confusion between them. Finally, calculating the intersection of the first and second popularity data allows for the summarization of the two data sets, facilitating user analysis.
[0063] According to some embodiments of this application, optionally, step S103, extracting the target rectangle containing the target data from the sorted rectangles, may further include the following steps:
[0064] Extract a third target rectangle containing the first record date from the sorted first rectangle, and extract a fourth target rectangle containing the second record date from the sorted second rectangle. The first record date is the record date of the first popularity data, and the second record date is the record date of the second popularity data.
[0065] Accordingly, S104, performing text recognition on the target rectangle to obtain target data, may also include the following steps:
[0066] Perform text recognition on the third target rectangle to obtain the first recorded date;
[0067] Text recognition is performed on the fourth target rectangle to obtain the second recorded date.
[0068] The first record date is associated with the first popularity data, and the second record date is associated with the second popularity data.
[0069] Table 1 schematically shows the first record date and the first popularity data. Table 2 schematically shows the second record date and the second popularity data.
[0070] Table 1
[0071] First record date First popularity data (e.g., number of messages sent) 20230327 178192 20230328 159436 20230323 37755 20230329 194399 20230324 198023 20230325 189581 20230326 187858
[0072] Table 2
[0073] Second record date Second, popularity data (such as clicks). 20230328 2884 20230327 3122 20230323 469 20230329 3490 20230324 3225 20230325 2867 20230326 2684
[0074] As shown in Table 1, the first popularity data can include first sub-popularity data corresponding to multiple record dates, such as 178192 or 159436. As shown in Table 2, the second popularity data can include second sub-popularity data corresponding to multiple record dates, such as 2884 or 3122.
[0075] Accordingly, S105, calculating the intersection of the first popularity data and the second popularity data, may include the following steps:
[0076] Group the first and second sub-popularity data corresponding to the same record date in the first and second record dates into a row or column.
[0077] Table 3 schematically shows the first and second popularity data after taking the intersection.
[0078] Table 3
[0079]
[0080] As shown in Table 3, for example, the first sub-popularity data 178192 and the second sub-popularity data 3122 with the record date of 20230327 are grouped into one row, and the first sub-popularity data 159436 and the second sub-popularity data 2884 with the record date of 20230328 are grouped into one row.
[0081] In this way, by calculating the intersection of the first and second popularity data, the first and second popularity data can be summarized, making it easier for users to analyze the first and second popularity data and greatly saving users from tedious office work.
[0082] As mentioned earlier, the first popularity data includes the number of messages sent, and the second popularity data includes the number of clicks.
[0083] Figure 3 This is another schematic flowchart illustrating the data extraction method provided in an embodiment of this application. For example... Figure 3 As shown, according to some embodiments of this application, optionally, after S105, calculating the intersection of the first popularity data and the second popularity data, the data extraction method may further include the following steps S301 to S303.
[0084] S301. Calculate the click-through rate for each record date based on the number of clicks and the number of messages sent for the same record date.
[0085] Specifically, the click-through rate (CTR) for a given record date can be calculated by comparing the number of clicks (3122) to the number of messages sent on the same record date. For example, the CTR for record date 20230327 can be calculated by comparing the number of clicks (3122) to the number of messages sent on the same record date (178192), which is 3122 / 178192 = 1.75%.
[0086] S302. Group the number of clicks, the number of messages sent, and the click-through rate for the same record date into one row or one column.
[0087] S303. Sort the number of clicks, the number of messages sent, and the click-through rate for each recorded date according to the time sequence of the recorded date.
[0088] Table 4 schematically illustrates the number of clicks, sends, and click-through rate for multiple record dates after sorting.
[0089] Table 4
[0090] Record date Send volume Click count Click-through rate 20230323 37755 469 1.24% 20230324 198023 3225 1.63% 20230325 189581 2867 1.51% 20230326 187858 2684 1.43% 20230327 178192 3122 1.75% 20230328 159436 2884 1.81% 20230329 194399 3490 1.8% total 1145244 18741 1.64%
[0091] The key to judging the popularity of an event is the click-through rate (CTR), which is calculated by dividing the number of clicks by the number of messages sent. A higher CTR indicates a more popular event. A higher number of messages sent suggests that more people are likely interested in the event.
[0092] As shown in Table 4, by sorting the number of clicks, messages sent, and click-through rate for each recorded date according to the chronological order of the recorded date, users can easily and intuitively analyze the popularity of the activity, further reducing their workload.
[0093] For OCR recognition of digits, binarization and enhancement operations can be performed on the digit area during the preprocessing stage to make the digits stand out and be clearly visible.
[0094] Figure 4 This is another schematic flowchart illustrating the data extraction method provided in an embodiment of this application. For example... Figure 4 As shown, according to some embodiments of this application, optionally, before S102, which involves segmenting the first image into multiple rectangular boxes based on a target bounding box algorithm and sorting the multiple rectangular boxes to obtain the sorted rectangular boxes, the data extraction method may further include the following steps:
[0095] S401. Preprocess the first image to obtain the preprocessed first image;
[0096] The preprocessing includes at least one of the following: grayscale conversion, binarization, denoising, enhancement, and tilt correction.
[0097] Thus, by preprocessing the first image, the recognition rate of the first image can be improved, further reducing the difficulty of OCR recognition and improving the accuracy of OCR recognition.
[0098] Figure 5 This is another schematic flowchart illustrating the data extraction method provided in an embodiment of this application. For example... Figure 5 As shown, according to some embodiments of this application, optionally, before performing text recognition on the target rectangle in S104 to obtain the target data, the data extraction method may further include the following steps:
[0099] S501. Divide the characters in the target rectangle into individual characters.
[0100] By segmenting the characters within the text region, each character is separated for subsequent character recognition operations.
[0101] Accordingly, S104, perform text recognition on the target rectangle to obtain target data, including:
[0102] The system identifies each character within the target rectangle and converts the identified characters into text format to obtain the target data.
[0103] The text obtained after OCR recognition can be segmented using regular expressions to extract the numerical parts, and then formatted and stored.
[0104] After performing text recognition on the target rectangle in S104 to obtain the target data, the data extraction method may also include the following steps S502 and S503.
[0105] S502. Post-process the target data to obtain post-processed target data. Post-processing includes at least one of the following: splicing, deduplication, and formatting.
[0106] Formatting involves converting extracted data such as record dates, clicks, sends, and click-through rates into a computer-readable format, such as CSV or Excel, and storing it in a database or spreadsheet. This will greatly improve the efficiency of data analysis and processing.
[0107] S503. Store the post-processed target data in a target file or database.
[0108] In this way, by performing post-processing such as splicing, deduplication, and formatting on the target data, duplicate and redundant data can be avoided, reducing interference to users.
[0109] The inventors of this application further realized that the first image of the obtained target data may exhibit phenomena such as poor shooting, misalignment, or skewness. When the first image exhibits phenomena such as poor shooting, misalignment, or skewness, if no processing is performed, it may affect the accuracy of the final data extraction.
[0110] Figure 6 This is another schematic flowchart illustrating the data extraction method provided in an embodiment of this application. For example... Figure 6 As shown, according to some embodiments of this application, optionally, before S102, when the first image is segmented into multiple rectangular boxes based on the target bounding box algorithm and the multiple rectangular boxes are sorted to obtain the sorted rectangular boxes, the data extraction method may further include the following steps S601 and S602.
[0111] S601. Detect whether the first image needs correction.
[0112] In S601, for example, it can detect whether any one or more lines of characters in the first image are on a straight line, and / or detect whether the angle between the direction of travel of each line of characters in the first image and the line direction is greater than a preset threshold. The size of the preset threshold can be flexibly adjusted, and this embodiment does not limit it. When any one or more lines of characters in the first image are not on a straight line, and / or the angle between the direction of travel of each line of characters in the first image and the line direction is greater than the preset threshold, it is determined that the first image needs to be corrected.
[0113] S602. When the first image needs to be corrected, the first image is corrected based on the pre-trained image correction model to obtain the corrected first image.
[0114] Image correction models can be pre-trained using neural network algorithms, deep learning algorithms, or machine learning algorithms. These models can be used to correct images that need correction, such as correcting the direction of each line of characters in the first image so that each line of characters in the first image is on a straight line, and making the angle between the direction of each line of characters in the first image and the line direction less than or equal to a preset threshold, thereby obtaining the corrected first image.
[0115] Accordingly, S102, based on the target bounding box algorithm, the first image is segmented into multiple rectangular boxes, and the multiple rectangular boxes are sorted to obtain sorted rectangular boxes. Specifically, this may include the following steps:
[0116] Based on the target bounding box algorithm, the corrected first image is segmented into multiple rectangular boxes, and these rectangular boxes are sorted to obtain sorted rectangular boxes.
[0117] Thus, by correcting the first image using a pre-trained image correction model, the characters in the first image can be arranged neatly, further improving the accuracy of data extraction.
[0118] According to some embodiments of this application, OCR recognition may optionally use the Tesseract engine, which has the advantage of high recognition rate. Tesseract is an open-source OCR engine that uses statistical methods to recognize and extract text, and supports multiple languages and platforms.
[0119] According to some embodiments of this application, optionally, data such as recorded date, number of clicks, number of sends, and click rate can be filled into an Excel file using Python or other related toolkits for subsequent processing and analysis.
[0120] Python automation refers to using Python programs to automatically perform repetitive, tedious, lengthy, or computationally intensive tasks. The main purpose of Python automation is to improve work efficiency and reduce manual operations, such as through automated scripts for data processing and analysis.
[0121] The data extraction method provided in this application embodiment can extract dates and data more accurately, simplifying the data input process and improving work efficiency. Furthermore, through scene optimization and preprocessing, this application embodiment can overcome the shortcomings of OCR technology, greatly improving the efficiency of text recognition. The data is saved to Excel in the form of a script for intersection and calculation processing, significantly reducing tedious office work.
[0122] Based on the data extraction method provided in the above embodiments, this application also provides specific implementations of the data extraction device. Please refer to the following embodiments.
[0123] Figure 7 This is a schematic diagram of a data extraction device provided in an embodiment of this application. Figure 7 As shown, the data extraction device 70 provided in this embodiment may include the following modules:
[0124] The acquisition module 701 is used to acquire the first image of the target data;
[0125] The segmentation and sorting module 702 is used to segment the first image into multiple rectangular boxes based on the target bounding box algorithm, and sort the multiple rectangular boxes to obtain sorted rectangular boxes.
[0126] Extraction module 703 is used to extract the target rectangle containing the target data from the sorted rectangles;
[0127] The recognition module 704 is used to perform text recognition on the target rectangle to obtain the target data.
[0128] The data extraction apparatus of this application, for a first image of acquired target data, segments the first image into multiple rectangular frames based on a target bounding box algorithm, and sorts these rectangular frames to obtain sorted rectangular frames. From these sorted rectangular frames, target rectangular frames containing target data are extracted. This effectively removes other data besides the target data while ensuring that the target rectangular frames containing the target data are neatly arranged. Therefore, further text recognition is performed on the target rectangular frames to obtain the target data, effectively improving the efficiency and accuracy of data extraction.
[0129] In some embodiments, the target data includes tail data of recommended activities, the tail data includes first popularity data and second popularity data, and the first image includes a first sub-image of the first popularity data and a second sub-image of the second popularity data. The segmentation and sorting module 702 is specifically used to segment the first sub-image into multiple first rectangles based on a target bounding box algorithm, and sort the multiple first rectangles to obtain sorted first rectangles; and to segment the second sub-image into multiple second rectangles based on the target bounding box algorithm, and sort the multiple second rectangles to obtain sorted second rectangles. The extraction module 703 is specifically used to extract a first target rectangle containing the first popularity data from the sorted first rectangles, and to extract a second target rectangle containing the second popularity data from the sorted second rectangles. The recognition module 704 is specifically used to perform text recognition on the first target rectangles to obtain the first popularity data; and to perform text recognition on the second target rectangles to obtain the second popularity data. The data extraction device in this embodiment further includes an intersection module for calculating the intersection of the first popularity data and the second popularity data.
[0130] In some embodiments, the extraction module 703 is further specifically used to extract a third target rectangle containing the first record date from the sorted first rectangle, and to extract a fourth target rectangle containing the second record date from the sorted second rectangle, wherein the first record date is the record date of the first popularity data, and the second record date is the record date of the second popularity data. The recognition module 704 is further specifically used to perform text recognition on the third target rectangle to obtain the first record date; and to perform text recognition on the fourth target rectangle to obtain the second record date. The first popularity data includes first sub-popularity data corresponding to multiple record dates, and the second popularity data includes second sub-popularity data corresponding to multiple record dates. The intersection module is specifically used to group the first sub-popularity data and the second sub-popularity data corresponding to the same record date in the first record date and the second record date into a row or a column.
[0131] In some embodiments, the first popularity data includes the number of sends, and the second popularity data includes the number of clicks. The data extraction apparatus of this application embodiment further includes a sorting module, used to calculate the click-through rate for each record date based on the click-through rate and the number of sends for the same record date; group the click-through rate, the number of sends, and the click-through rate for the same record date into a row or a column; and sort the click-through rate, the number of sends, and the click-through rate for each record date according to the chronological order of the record dates.
[0132] In some embodiments, the data extraction device of this application further includes a preprocessing module, which is specifically used to preprocess the first image to obtain a preprocessed first image; wherein the preprocessing includes at least one of the following: grayscale conversion, binarization, denoising, enhancement, and tilt correction.
[0133] In some embodiments, the data extraction device of this application further includes a segmentation module, used to segment the characters in the target rectangle, separating each character. The recognition module 704 is specifically used to recognize each character in the target rectangle and convert the recognized characters into text format to obtain the target data. The data extraction device of this application further includes a post-processing module, used to post-process the target data to obtain post-processed target data. The post-processing includes at least one of the following: concatenation, deduplication, and formatting; storing the post-processed target data in a target file or database.
[0134] In some embodiments, the data extraction apparatus of this application further includes a correction module, used to detect whether the first image needs correction; when the first image needs correction, the first image is corrected based on a pre-trained image correction model to obtain the corrected first image. The segmentation and sorting module 702 is specifically used to segment the corrected first image into multiple rectangular boxes based on a target bounding box algorithm, and sort the multiple rectangular boxes to obtain sorted rectangular boxes.
[0135] In some embodiments, the target bounding box algorithm includes an object detection algorithm or a deep learning algorithm.
[0136] Figure 7 Each module / unit in the device shown has the function of implementing each step in the data extraction method provided in the above method embodiments, and can achieve its corresponding technical effect. For the sake of brevity, it will not be described in detail here.
[0137] Based on the data extraction method provided in the above embodiments, this application also provides specific implementation methods for electronic devices. Please refer to the following embodiments.
[0138] Figure 8 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.
[0139] Electronic devices may include a processor 801 and a memory 802 storing computer program instructions.
[0140] Specifically, the processor 801 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0141] Memory 802 may include mass storage for data or instructions. For example, and not limitingly, memory 802 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. In one example, memory 802 may include removable or non-removable (or fixed) media, or memory 802 may be a non-volatile solid-state memory. Memory 802 may be internal or external to an electronic device.
[0142] In one example, memory 802 may be read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0143] Memory 802 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this application.
[0144] The processor 801 reads and executes the computer program instructions stored in the memory 802 to implement the methods / steps in the above method embodiments and achieve the corresponding technical effects achieved by the method embodiments in executing their methods / steps. For the sake of brevity, these details will not be repeated here.
[0145] In one example, the electronic device may also include a communication interface 808 and a bus 810. Wherein, such as Figure 8 As shown, the processor 801, memory 802, and communication interface 808 are connected through bus 810 and complete communication with each other.
[0146] The communication interface 808 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0147] Bus 810 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 810 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.
[0148] Furthermore, in conjunction with the data extraction methods in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the data extraction methods in the above embodiments. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as electronic circuits, semiconductor memory devices, ROM, random access memory, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, and hard disks.
[0149] In conjunction with the data extraction methods in the above embodiments, this application embodiment can provide a computer program product, which is stored in a non-volatile storage medium and executed by at least one processor to implement the steps of the data extraction method provided in the above embodiments.
[0150] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0151] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0152] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0153] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, 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, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0154] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A data extraction method, characterized by, The method comprises the following steps: obtaining a first image of target data; the target data comprises tail data of recommended activities, and the tail data comprises first popularity data and second popularity data; the first image comprises a first sub-image of the first popularity data and a second sub-image of the second popularity data; the first popularity data and the second popularity data are data reflecting the popularity of activities; segmenting the first sub-image into a plurality of first rectangular frames based on a target bounding box algorithm, and sorting the plurality of first rectangular frames to obtain sorted first rectangular frames; segmenting the second sub-image into a plurality of second rectangular frames based on the target bounding box algorithm, and sorting the plurality of second rectangular frames to obtain sorted second rectangular frames; extracting a first target rectangular frame containing the first popularity data and a third target rectangular frame containing a first record date from the sorted first rectangular frames, and extracting a second target rectangular frame containing the second popularity data and a fourth target rectangular frame containing a second record date from the sorted second rectangular frames; the first record date is the record date of the first popularity data, and the second record date is the record date of the second popularity data; performing character recognition on the first target rectangular frame to obtain the first popularity data; performing character recognition on the second target rectangular frame to obtain the second popularity data; performing character recognition on the third target rectangular frame to obtain the first record date, and performing character recognition on the fourth target rectangular frame to obtain the second record date; the first popularity data comprises a plurality of first sub-popularity data corresponding to respective record dates, and the second popularity data comprises a plurality of second sub-popularity data corresponding to respective record dates; grouping the first sub-popularity data and the second sub-popularity data corresponding to the same record date in the first record date and the second record date into a row or a column.
2. The data extraction method of claim 1, wherein, The first popularity data comprises a sending amount, and the second popularity data comprises a click amount; After calculating the intersection of the first popularity data and the second popularity data, the data extraction method further comprises: calculating the click rate of each record date according to the click amount and the sending amount of the same record date; grouping the click amount, the sending amount and the click rate of the same record date into a row or a column; sorting the click amount, the sending amount and the click rate of each record date in chronological order of the record dates.
3. The data extraction method of claim 1, wherein, Before the step of segmenting the first image into a plurality of rectangular frames based on the target bounding box algorithm and sorting the plurality of rectangular frames to obtain sorted rectangular frames, the data extraction method further comprises: preprocessing the first image to obtain a preprocessed first image; wherein the preprocessing comprises at least one of the following: grayscale, binarization, denoising, enhancement and tilt correction.
4. The data extraction method of claim 1, wherein, Before the step of performing character recognition on the target rectangular frame to obtain the target data, the data extraction method further comprises: segmenting characters in the target rectangular frame to separate each character; the step of performing character recognition on the target rectangular frame to obtain the target data comprises: recognize each character in the target rectangular frame, and convert the recognized character into a text format to obtain the target data; After the character recognition on the target rectangular frame is performed to obtain the target data, the data extraction method further includes: performing post-processing on the target data to obtain post-processed target data, the post-processing including at least one of the following: splicing, deduplication, and formatting; storing the post-processed target data in a target file or a database.
5. The data extraction method of claim 1, wherein, Before the first image is segmented into multiple rectangular frames based on the target bounding box algorithm and the multiple rectangular frames are sorted to obtain sorted rectangular frames, the data extraction method further includes: detecting whether the first image needs to be corrected; when the first image needs to be corrected, correcting the first image based on a pre-trained image correction model to obtain a corrected first image; segmenting the corrected first image into multiple rectangular frames based on the target bounding box algorithm, and sorting the multiple rectangular frames to obtain sorted rectangular frames. The target bounding box algorithm includes a target detection algorithm or a deep learning algorithm.
6. The data extraction method of claim 1, wherein, includes:
7. A data extraction apparatus characterized by comprising: an acquisition module configured to acquire a first image of target data; the target data includes tailing data of a recommended activity, the tailing data includes first popularity data and second popularity data, and the first image includes a first sub-image of the first popularity data and a second sub-image of the second popularity data; the first popularity data and the second popularity data are data reflecting the popularity of an activity; a segmentation and sorting module configured to segment the first sub-image into multiple first rectangular frames based on a target bounding box algorithm, sort the multiple first rectangular frames to obtain sorted first rectangular frames, segment the second sub-image into multiple second rectangular frames based on the target bounding box algorithm, and sort the multiple second rectangular frames to obtain sorted second rectangular frames; an extraction module configured to extract a first target rectangular frame containing the first popularity data and a third target rectangular frame containing a first record date from the sorted first rectangular frames, and extract a second target rectangular frame containing the second popularity data and a fourth target rectangular frame containing a second record date from the sorted second rectangular frames; the first record date is a record date of the first popularity data, and the second record date is a record date of the second popularity data; an identification module configured to perform character recognition on the first target rectangular frame to obtain the first popularity data; perform character recognition on the second target rectangular frame to obtain the second popularity data; and perform character recognition on the second target rectangular frame to obtain the second popularity data. The third target rectangular frame is subjected to character recognition to obtain the first record date, and the fourth target rectangular frame is subjected to character recognition to obtain the second record date; the first popularity data comprises a plurality of first sub-popularity data corresponding to respective record dates, and the second popularity data comprises a plurality of second sub-popularity data corresponding to respective record dates; The intersection module is configured to group the first sub-popularity data and the second sub-popularity data corresponding to the same record date in the first record date and the second record date into one row or one column.
8. An electronic device, comprising: The electronic device comprises a processor, a memory, and a computer program stored on the memory and executable on the processor, and the computer program, when executed by the processor, implements the steps of the data extraction method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and the computer program, when executed by the processor, implements the steps of the data extraction method according to any one of claims 1 to 6.
10. A computer program product, characterised in that, The computer program product is stored in a non-volatile storage medium, and the computer program product is executed by at least one processor to implement the steps of the data extraction method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Table data acquisition method and apparatus, and server
WO2020140698A1