Picture data expansion method and device, computer equipment and medium

By randomly modifying the character recognition and entity labels of medical images, we solve the problem of image data expansion in the medical field, improve model generalization and data quality, and reduce resource costs.

CN118570828APending Publication Date: 2024-08-30YUN ZHI SHENG (XIN YANG) SHU ZI KE JI YOU XIAN GONG SI
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410780031.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the medical field, medical record picture data are difficult to obtain and there are few public annotated medical data, which makes the picture data expansion scheme difficult to implement and affects the generalization of the model and data quality.

Method used

By performing character recognition on the target image, the entity tags and entity words in the text data are obtained, and the entity tags that need to be expanded are randomly modified, including deletion or replacement, to achieve image data expansion.

Benefits of technology

This method is simple and easy to expand, improves the generalization of the model, reduces labor and computing resource costs, achieves efficient image data expansion, and avoids a large amount of text annotation and data model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570828A
    Figure CN118570828A
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and discloses a picture data expansion method and device, computer equipment and a medium, and the method comprises the steps: determining a picture which needs to realize data expansion at present as a target picture; character recognition is conducted on the target picture, obtained text data contained in the target picture is target text data, and the text data, obtained through character recognition, of the picture contains entity words corresponding to predefined entity tags; and determining the entity tag needing to be expanded as a target entity tag, and randomly modifying the entity word corresponding to the target entity tag in the target picture to obtain a picture obtained by data expansion. Therefore, the technical scheme is simple, convenient and easy to expand, the same data does not need to be repeatedly used, and the model generalization can be effectively improved; meanwhile, a large amount of text labeling and data model training do not need to be carried out, and picture data expansion can be efficiently achieved while low labor and computing resource cost is kept.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method, device, computer equipment and medium for expanding image data. Background Art

[0002] With the application of digital technology in the medical field, new medical formats such as smart medical care are booming, among which patient medical records are particularly important as their core foundation. However, medical records are difficult to obtain in large quantities as patients' private information, and there are few publicly annotated medical data, especially medical record images. Therefore, how to implement image data expansion solutions in medical scenarios is an urgent problem to be solved by technicians in this field. Summary of the invention

[0003] In view of this, the present invention provides a method, apparatus, computer device and medium for expanding picture data to achieve picture data expansion in corresponding scenarios.

[0004] In a first aspect, the present invention provides a method for expanding image data, the method comprising:

[0005] Determine the image that currently needs data expansion as the target image;

[0006] Performing character recognition on the target image to obtain text data contained in the target image as target text data; wherein the text data of the image obtained by character recognition contains entity words corresponding to predefined entity tags;

[0007] An entity tag to be expanded is determined to be a target entity tag, and an entity word corresponding to the target entity tag in the target image is randomly modified to obtain a data expanded image.

[0008] The image data expansion method provided by the present invention has the following advantages:

[0009] For pictures that need data expansion, the present invention first performs character recognition to obtain entity words corresponding to predefined entity tags, and then randomly modifies the entity words corresponding to the entity tags that need to be expanded, so as to obtain pictures after data expansion and realize the expansion of picture data. It can be seen that the technical solution of the present invention is simple, convenient and easy to expand. It is different from the reuse of the same data in upsampling, which can effectively improve the generalization of the model; at the same time, it does not require a large amount of text annotation and data model training, and can efficiently realize picture data expansion while maintaining low labor and computing resource costs.

[0010] In an optional implementation, randomly modifying the entity word corresponding to the target entity tag in the target image includes:

[0011] Randomly select and delete or replace entity words corresponding to the target entity tag;

[0012] If it is chosen to delete the entity word corresponding to the target entity tag, the entity word corresponding to the target entity tag is directly deleted from the target image;

[0013] If you choose to replace the entity word corresponding to the target entity tag, randomly select an entity word from the target data set, and use the selected entity word to replace the entity word corresponding to the target entity tag in the target image; wherein the target data set is a pre-collected set of all entity words that can correspond to the target entity tag.

[0014] In an optional implementation, before randomly selecting an entity word from the target data set, the method further includes:

[0015] Randomly select whether it is necessary to move the position of the entity word corresponding to the target entity tag. If not, execute the step of randomly selecting an entity word from the target data set. Otherwise, determine the movable range based on the position information of the entity word corresponding to the target entity tag in the target image, move the entity word corresponding to the target entity tag within the movable range, and execute the step of randomly selecting an entity word from the target data set; wherein, the text data of the image obtained by character recognition also includes the position information of the entity word corresponding to the preset entity tag in the image to which it belongs.

[0016] In an optional implementation, moving the entity word corresponding to the target entity tag within the movable range includes:

[0017] If the entity word corresponding to the target entity tag in the target text data belongs to a non-table field, and the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag belong to the same row or the same column, then the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag are moved according to the same displacement within the movable range.

[0018] In an optional implementation, moving the entity word corresponding to the target entity tag within the movable range includes:

[0019] If the entity word corresponding to the target entity tag in the target text data belongs to a table field, the blank part within the movable range is determined, and the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag are moved in a copying manner to fill the blank part.

[0020] In an optional implementation, replacing the entity word corresponding to the target entity label in the target image with the selected entity word includes:

[0021] After replacing the entity word corresponding to the target entity tag with the selected entity word, determine whether the entity word corresponding to the target entity tag will cover other characters in the target image. If so, randomly select another entity word from the target data set again. Otherwise, directly replace the entity word corresponding to the target entity tag in the target image with the selected entity word.

[0022] In an optional implementation, after obtaining the image obtained by data expansion, the method further includes:

[0023] Return to the step of randomly modifying the entity words corresponding to the target entity label in the target image.

[0024] In a second aspect, the present invention provides a picture data expansion device, the device comprising:

[0025] A determination module is used to: determine that the picture that currently needs to implement data expansion is the target picture;

[0026] A recognition module is used to: perform character recognition on the target image to obtain text data contained in the target image as target text data; wherein the text data of the image contains entity tags and corresponding entity words;

[0027] The expansion module is used to: determine that the entity tag to be expanded is a target entity tag, and randomly modify the entity word corresponding to the target entity tag in the target image to obtain a data expanded image.

[0028] The image data expansion device provided by the present invention has the following advantages:

[0029] For pictures that need data expansion, the present invention first performs character recognition to obtain entity words corresponding to predefined entity tags, and then randomly modifies the entity words corresponding to the entity tags that need to be expanded, so as to obtain pictures after data expansion and realize the expansion of picture data. It can be seen that the technical solution of the present invention is simple, convenient and easy to expand. It is different from the reuse of the same data in upsampling, which can effectively improve the generalization of the model; at the same time, it does not require a large amount of text annotation and data model training, and can efficiently realize picture data expansion while maintaining low labor and computing resource costs.

[0030] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the image data expansion method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0031] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the image data expansion method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0033] Figure 1 is a flow chart of a method for expanding picture data according to an embodiment of the present invention;

[0034] Figure 2 is a schematic diagram of a picture in a picture data expansion method provided by an embodiment of the present invention;

[0035] Figure 3 is a structural block diagram of a picture data expansion device according to an embodiment of the present invention;

[0036] Figure 4 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0038] Key data in medical scenarios include diagnosis, surgery, and medication costs. These data are of great significance for diagnosis review, insurance claims, and other aspects, which requires the relevant medical models to have very high accuracy. Therefore, the requirements for the quality and scale of data used for model training are also increased. The main expansion methods currently include upsampling, that is, reusing the same data multiple times; or using deep learning methods and generative adversarial networks to expand data by generating pseudo data.

[0039] However, upsampling methods will reduce the generalization of the model; methods such as deep learning require data labeling and model training, and have poor scalability for newly added data types.

[0040] To solve the above problems, an embodiment of the present invention provides an embodiment of image data expansion. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system (computer device) including a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0041] In this embodiment, a method for expanding image data is provided, which can be used in terminal devices such as mobile phones, tablet computers, etc. Figure 1 is a flow chart of a method for expanding picture data according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0042] S11: Determine that the picture that currently needs to implement data expansion is the target picture.

[0043] It should be noted that the technical solution of the present invention can be applied to medical scenarios, especially to medical records in tabular form such as medical lists, doctor's orders, invoices, etc.; of course, it can also be applied to other scenarios where image data expansion is required according to actual needs, all of which are within the scope of protection of the present invention. The embodiment of the present invention specifically describes the technical solution by applying it to medical scenarios.

[0044] The pictures in the medical scene that currently need to be expanded can be called target pictures, and the corresponding data expansion can be implemented for the target pictures later; of course, multiple pictures can be used as target pictures at the same time, and the corresponding data expansion can be implemented for each target picture, so as to efficiently realize the expansion of a large amount of picture data.

[0045] S12: Perform character recognition on the target image to obtain text data contained in the target image as target text data; wherein the text data of the image obtained by character recognition contains entity words corresponding to predefined entity tags.

[0046] It should be noted that the embodiments of the present invention can collect pictures of different layout styles for medical records in advance and perform entity annotation. The entity label can be customized according to the needs. It can be understood as a unified annotation of the same type of words in the picture. The entity word is the specific word corresponding to the entity label in the picture, and the data value is the specific value corresponding to the entity word in the picture. The entity label and the entity word can be used as an entity tuple, and the entity word and the data value can be used as a key-value pair; Figure 2 The "total amount" can be labeled as k-amount, "one thousand seven hundred sixty-one yuan and two cents" can be labeled as v-amount, "project name" can be labeled as k-itemname, and "non-vascular 3D imaging" can be labeled as v-itemname, where (k-amount, total amount) is an entity tuple, i.e. (entity label, entity word), and (k-amount, v-amount) is a key-value pair, i.e. (key, value).

[0047] Performing character recognition (such as OCR character recognition) on the target image can obtain the text data DATAocr therein, and the text data is used as the input of the image data expansion step. In a specific implementation, the text data DATAocr may contain multiple recognition blocks, each of which needs to include the text (entity words and corresponding data values) and position information therein, for example, {"top_left_x":212,"top_left_y":414,"box_h":18,"box_w":122,"str":"Cefuroxime Sodium for Injection"}, wherein {"top_left_x":212, "top_left_y":414} represents the coordinate information of the text in the image, {"box_h":18,"box_w":122} represents the height and width of the text in the image, and {"str":"Cefuroxime Sodium for Injection"} is a key-value pair of entity words and corresponding data values.

[0048] S13: Determine that the entity tag to be expanded is the target entity tag, and randomly modify the entity word corresponding to the target entity tag in the target image to obtain a data expanded image.

[0049] The entity tags to be expanded, i.e., the target entity tags, can be determined in advance according to actual needs, so that only the characters corresponding to the target entity tags are processed when the image data is expanded later. Specifically, the entity words corresponding to the target entity tags in the target image can be randomly modified to expand the target image data.

[0050] For pictures that need data expansion, the present invention first performs character recognition to obtain entity words corresponding to predefined entity tags, and then randomly modifies the entity words corresponding to the entity tags that need to be expanded, so as to obtain pictures after data expansion and realize the expansion of picture data. It can be seen that the technical solution of the present invention is simple, convenient and easy to expand. It is different from the reuse of the same data in upsampling, which can effectively improve the generalization of the model; at the same time, it does not require a large amount of text annotation and data model training, and can efficiently realize picture data expansion while maintaining low labor and computing resource costs.

[0051] A method for expanding image data provided in this embodiment randomly modifies the entity words corresponding to the target entity tags in the target image, which may include:

[0052] Randomly select and delete or replace entity words corresponding to the target entity tag;

[0053] If it is chosen to delete the entity word corresponding to the target entity tag, the entity word corresponding to the target entity tag is directly deleted from the target image;

[0054] If you choose to replace the entity word corresponding to the target entity tag, randomly select an entity word from the target data set, and use the selected entity word to replace the entity word corresponding to the target entity tag in the target image; wherein the target data set is a pre-collected set of all entity words that can correspond to the target entity tag.

[0055] It should be noted that an entity word dataset D (i.e., a target dataset, where the target entity labels correspond one to one to the target dataset) that can be filled with the entity labels that need to be expanded can be collected in advance; although there are few complete public medical record data, there is a large amount of public medical knowledge data, such as department names, diagnosis texts, surgery names, details of medical charges, etc., which can be used to collect entity word datasets.

[0056] Based on this, the embodiment of the present invention can first find the entity tag (target entity tag) that needs to be expanded in the target text data, and then randomly select to delete or replace it; if deleted, the entity word referred to by the target entity tag is directly deleted from the target image; if replaced, a piece of data d is randomly selected from the entity word data set corresponding to the target entity tag (that is, other entity words that can be filled in by the target entity tag except the entity word corresponding to the target entity tag in the target text data), and use the data d to replace the entity word corresponding to the target entity tag in the target image, thereby realizing the processing of the corresponding entity word by deletion and replacement, and completing the expansion of the image data.

[0057] A method for expanding image data provided in this embodiment may further include, before randomly selecting an entity word from a target data set:

[0058] Randomly select whether it is necessary to move the position of the entity word corresponding to the target entity tag. If not, execute the step of randomly selecting an entity word from the target data set. Otherwise, determine the movable range based on the position information of the entity word corresponding to the target entity tag in the target image, move the entity word corresponding to the target entity tag within the movable range, and execute the step of randomly selecting an entity word from the target data set; wherein, the text data of the image obtained by character recognition also includes the position information of the entity word corresponding to the preset entity tag in the image to which it belongs.

[0059] Moving the entity word corresponding to the target entity tag within the movable range may include:

[0060] If the entity word corresponding to the target entity tag in the target text data belongs to a non-table field, and the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag belong to the same row or the same column, then the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag are moved according to the same displacement within the movable range.

[0061] Moving the entity word corresponding to the target entity tag within the movable range may include:

[0062] If the entity word corresponding to the target entity tag in the target text data belongs to a table field, the blank part within the movable range is determined, and the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag are moved in a copying manner to fill the blank part.

[0063] When replacing the entity word corresponding to the target entity tag, the embodiment of the present invention can also be combined with position movement to achieve it, thereby further increasing the complexity of random modification and improving the effectiveness of data expansion.

[0064] In a specific implementation method, if it is determined that the corresponding entity word needs to be replaced, it can be randomly selected whether to move the position. If not, a piece of data d is directly randomly selected from the target data set to replace the corresponding entity word. If the position is moved, the movable range of the corresponding entity word in the four directions of up, down, left and right can be determined by the above-mentioned position information, and the original recognition block size of the corresponding entity word is kept unchanged. The top_left_x or top_left_y is changed to move it, and then the corresponding entity word is replaced.

[0065] Specifically, in most medical scenarios, there are clear boundaries between table and non-table contents in most medical records, such as the detailed list of charges in the expense list and medical invoice, the contents of the medical order in the doctor's order, the tables such as diagnosis and surgery on the front page of the medical record, and non-table contents such as hospitalization number, diagnosis, and department name. Therefore, the embodiment of the present invention uses the above method to process these two situations respectively. For non-table fields, such as Figure 2 In the straight line frame part, there is generally no association between each group (key, value) in the non-table field, so the above method can be used to directly replace the entity word; in particular, when (key, value) belongs to the same row or column, the recognition block needs to be moved according to the same displacement. For table fields, such as Figure 2 The equal-length dashed box (the dashed line contains the same length of segments) in the table can be obtained according to DATAocr. The average height of each row in the table is avg_height = avg(box_h1, box_h2...), where the subscripts 1, 2... represent the first row, the second row... of the table content, and the height of the blank part of the table (the dashed box part with long and short intervals (one long and one short) in the figure below) is blank_height. First, we can determine whether rows can be inserted into the blank part. If so, how many rows can be inserted at most, which can be achieved by the following statements:

[0066] if blank_height>avg_height:

[0067] #math.ceil() points to the integer

[0068] max_insert_num=math.ceil(blank_height / avg_height)

[0069] Secondly, you can randomly choose whether to insert a row. If you insert a row, you can randomly choose the number of rows to insert. This can be achieved by the following statement:

[0070] insert_num=random(range(0,max_insert_num))

[0071] Then copy the content of the existing table row in the long dashed line frame (including the entity word corresponding to the target entity label and its data value) to the blank part according to insert_num; finally, use the above method to replace the corresponding entity word. It should be noted that, unlike non-tables, the same key in the table may correspond to multiple values, and there is an association between different values, so the key in the table is only replaced by the entity word without moving the position; the associated values ​​in the table are grouped as a group, such as (v-itemname, v-price, v-number, v-specs, v-money) in the same row, which correspond to the project name value, unit value, quantity value, specification value and amount value respectively. The entity words in the group are replaced synchronously, and only the upper and lower positions are moved.

[0072] A method for expanding image data provided in this embodiment, using selected entity words to replace entity words corresponding to target entity labels in the target image, may include:

[0073] After replacing the entity word corresponding to the target entity tag with the selected entity word, determine whether the entity word corresponding to the target entity tag will cover other characters in the target image. If so, randomly select another entity word from the target data set again. Otherwise, directly replace the entity word corresponding to the target entity tag in the target image with the selected entity word.

[0074] When the length of the entity word d used for replacement is not equal to the original entity word, assuming that the width of each character in each recognition block is the same, the width of each character is box_w / len(str), and then the width of the recognition block is shortened or lengthened according to the length of d. It should be noted that when the length of the entity word d used for replacement is too long and the replaced recognition block and other recognition blocks have position overlap, the entity word d is randomly selected again.

[0075] The method for expanding picture data provided in this embodiment may further include, after obtaining the picture obtained by data expansion:

[0076] Return to the step of randomly modifying the entity words corresponding to the target entity label in the target image.

[0077] In the embodiment of the present invention, the above method can be used to repeat multiple times for the same picture until the number of pictures required for data expansion is reached, thereby achieving the purpose of data expansion.

[0078] In a specific implementation, a method for expanding image data provided in this embodiment may include the following steps:

[0079] 1. Collect pictures of different layout styles for medical records and annotate them. The entity labels can be customized according to needs.

[0080] 2. Clarify the entity tags that need to be expanded.

[0081] 3. Collect entity word dataset D that can be filled with entity tags that need to be expanded.

[0082] 4. Get the image text data DATAocr after OCR text recognition as input. Each recognition block needs to include text and position information, for example, {"top_left_x":212,"top_left_y":414,"box_h":18,"box_w":122,"str":"Cefuroxime Sodium for Injection"}.

[0083] 5. First find the entity tag that needs to be expanded, and then randomly choose whether to delete or replace. If deleted, directly delete the entity word referred to by this entity tag from the data; if replaced, randomly choose whether to move the position. If not moved, directly randomly select a piece of data d from data D to replace the entity word. If moved, first determine the movable range in the four directions of up, down, left, and right through the position information, keep the original recognition block size unchanged, change top_left_x or top_left_y to move, and then perform the corresponding entity word replacement.

[0084] 5.1 For non-tabular fields, there is generally no association between each group of (key, value) in the non-tabular fields, so the entity words are directly replaced using the method described above; in particular, when (key, value) belongs to the same row or column, the recognition block needs to be moved according to the same displacement.

[0085] 5.2 For table fields, according to DATAocr, we can get the average height of each row in the table: avg_height = avg(box_h1, box_h2...), where the subscripts 1, 2... represent the first row, second row... of the table content, and the blank part in the table ( Figure 2 The height of the dashed box with long and short intervals (here, the dashed line contains the line segments, where there is a short line segment between every two long line segments and a long line segment between every two short line segments) blank_height.

[0086] First, determine whether a row can be inserted into the blank part. If so, determine the maximum number of rows that can be inserted. Secondly, randomly select whether to insert a row. If inserted, randomly select the number of rows to be inserted. Then copy the existing table row content to the blank part according to insert_num. Finally, use the method described above to replace the entity words. Unlike non-tables, the same key in a table may correspond to multiple values, and different values ​​are associated with each other. Therefore, the key in the table is only replaced by entity words without moving the position. The associated values ​​in the table are grouped together, such as (v-itemname, v-price, v-number, v-specs, v-money) in the same row, which correspond to the project name value, unit value, quantity value, specification value, and amount value respectively. The entity words in the group are replaced synchronously, and only the upper and lower positions are moved.

[0087] 6. Repeat the above method for the same image multiple times to achieve the purpose of data expansion.

[0088] The technical solution of the present invention expands the picture data by adding, deleting, moving and other operations on the text content on the picture and collecting real and valid text content. On the one hand, it ensures the authenticity of the expanded data and plays a positive role in subsequent model training; on the other hand, the method is simple, convenient and easy to expand. For new data types or new picture styles, it is only necessary to mark the relevant picture styles and collect relevant data texts, without the need for a large amount of text marking and data model training, thereby reducing labor and computing resource costs and shortening time expenses.

[0089] In this embodiment, a picture data expansion device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0090] This embodiment provides a picture data expansion device, such as Figure 3 may include:

[0091] A determination module 11 is used to: determine that the picture that currently needs to implement data expansion is a target picture;

[0092] The recognition module 12 is used to: perform character recognition on the target image to obtain text data contained in the target image as target text data; wherein the text data of the image contains entity tags and corresponding entity words;

[0093] The expansion module 13 is used to: determine that the entity tag to be expanded is a target entity tag, and randomly modify the entity word corresponding to the target entity tag in the target image to obtain a data expanded image.

[0094] The image data expansion device in this embodiment is presented in the form of a functional module, where the module refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0095] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0096] The embodiment of the present invention also provides a computer device having the above Figure 3 The picture data expansion device shown.

[0097] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 4 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.

[0098] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0099] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0100] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0101] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0102] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0103] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0104] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0105] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for expanding image data, It is characterized in that include: Determine that the picture that currently needs to implement data expansion is the target picture; Performing character recognition on the target image to obtain text data contained in the target image as target text data; wherein the text data of the image obtained by character recognition contains entity words corresponding to predefined entity tags; An entity tag to be expanded is determined to be a target entity tag, and an entity word corresponding to the target entity tag in the target image is randomly modified to obtain a data expanded image.

2. The method according to claim 1, It is characterized in that Randomly modifying the entity word corresponding to the target entity label in the target image, including: Randomly select and delete or replace entity words corresponding to the target entity tag; If it is chosen to delete the entity word corresponding to the target entity tag, the entity word corresponding to the target entity tag is directly deleted from the target image; If you choose to replace the entity word corresponding to the target entity tag, randomly select an entity word from the target data set, and use the selected entity word to replace the entity word corresponding to the target entity tag in the target image; wherein the target data set is a pre-collected set of all entity words that can correspond to the target entity tag.

3. The method according to claim 2, It is characterized in that Before randomly selecting an entity word from the target dataset, it also includes: Randomly select whether it is necessary to move the position of the entity word corresponding to the target entity tag. If not, execute the step of randomly selecting an entity word from the target data set. Otherwise, determine the movable range based on the position information of the entity word corresponding to the target entity tag in the target image, move the entity word corresponding to the target entity tag within the movable range, and execute the step of randomly selecting an entity word from the target data set; wherein, the text data of the image obtained by character recognition also includes the position information of the entity word corresponding to the preset entity tag in the image to which it belongs.

4. The method according to claim 3, It is characterized in that Moving the entity word corresponding to the target entity tag within the movable range includes: If the entity word corresponding to the target entity tag in the target text data belongs to a non-table field, and the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag belong to the same row or the same column, then the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag are moved according to the same displacement within the movable range.

5. The method according to claim 4, It is characterized in that Moving the entity word corresponding to the target entity tag within the movable range includes: If the entity word corresponding to the target entity tag in the target text data belongs to a table field, the blank part within the movable range is determined, and the entity word corresponding to the target entity tag and the data value of the entity word corresponding to the target entity tag are moved in a copying manner to fill the blank part.

6. The method according to claim 5, It is characterized in that Replacing the entity word corresponding to the target entity label in the target image with the selected entity word includes: After replacing the entity word corresponding to the target entity tag with the selected entity word, determine whether the entity word corresponding to the target entity tag will cover other characters in the target image. If so, randomly select another entity word from the target data set again. Otherwise, directly replace the entity word corresponding to the target entity tag in the target image with the selected entity word.

7. The method according to claim 6, It is characterized in that After obtaining the data expansion picture, it also includes: Return to the step of randomly modifying the entity words corresponding to the target entity label in the target image.

8. A device for expanding picture data, It is characterized in that include: A determination module is used to: determine that the picture that currently needs to implement data expansion is the target picture; A recognition module is used to: perform character recognition on the target image to obtain text data contained in the target image as target text data; wherein the text data of the image contains entity tags and corresponding entity words; The expansion module is used to: determine that the entity tag to be expanded is a target entity tag, and randomly modify the entity word corresponding to the target entity tag in the target image to obtain a data expanded image.

9. A computer device, It is characterized in that include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the image data expansion method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the image data expansion method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Named entity identification data enhancement method and device, electronic equipment and medium

    CN113516196A

  • Bill image generation method and device, computer equipment and storage medium

    CN113537229A

  • Credit identification method and device, computer equipment and storage medium

    CN114463767A

  • License information identification method and device and model training method and device

    CN116884009A

  • Method and apparatus of NER-oriented chinese clinical text data augmentation

    US20240013000A1