CN117456532B - Correction method, device, equipment and storage medium for medicine amount - Google Patents

Correction method, device, equipment and storage medium for medicine amount Download PDF

Info

Publication number
CN117456532B
CN117456532B CN202311497001.7A CN202311497001A CN117456532B CN 117456532 B CN117456532 B CN 117456532B CN 202311497001 A CN202311497001 A CN 202311497001A CN 117456532 B CN117456532 B CN 117456532B
Authority
CN
China
Prior art keywords
amount
information
recognition model
optical character
character recognition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311497001.7A
Other languages
Chinese (zh)
Other versions
CN117456532A (en
Inventor
谢方敏
周峰
郭陟
李志权
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Fangyixing Information Technology Co ltd
Original Assignee
Beijing Fangyixing Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Fangyixing Information Technology Co ltd filed Critical Beijing Fangyixing Information Technology Co ltd
Priority to CN202311497001.7A priority Critical patent/CN117456532B/en
Publication of CN117456532A publication Critical patent/CN117456532A/en
Application granted granted Critical
Publication of CN117456532B publication Critical patent/CN117456532B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/12Detection or correction of errors, e.g. by rescanning the pattern
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/1444Selective acquisition, locating or processing of specific regions, e.g. highlighted text, fiducial marks or predetermined fields
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/16Image preprocessing
    • G06V30/168Smoothing or thinning of the pattern; Skeletonisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/19Recognition using electronic means
    • G06V30/19007Matching; Proximity measures
    • G06V30/19013Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/19Recognition using electronic means
    • G06V30/191Design or setup of recognition systems or techniques; Extraction of features in feature space; Clustering techniques; Blind source separation
    • G06V30/1914Determining representative reference patterns, e.g. averaging or distorting patterns; Generating dictionaries, e.g. user dictionaries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/26Techniques for post-processing, e.g. correcting the recognition result
    • G06V30/262Techniques for post-processing, e.g. correcting the recognition result using context analysis, e.g. lexical, syntactic or semantic context
    • G06V30/274Syntactic or semantic context, e.g. balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/412Layout analysis of documents structured with printed lines or input boxes, e.g. business forms or tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/414Extracting the geometrical structure, e.g. layout tree; Block segmentation, e.g. bounding boxes for graphics or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/418Document matching, e.g. of document images

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • Computer Graphics (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Character Discrimination (AREA)

Abstract

The invention discloses a method, a device, equipment and a storage medium for correcting medicine amount, wherein the method comprises the following steps: receiving image data, wherein the content of the image data is a list of medicines purchased from suppliers; inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data; searching original text information belonging to the amount of the medicine as candidate amount information; verifying the legitimacy of the candidate amount information for the amount of the drug; if the validity is illegal, comparing the candidate amount information with a preset dictionary; if the candidate amount information has the first character, replacing the first character of the candidate amount information with the second character in the same mapping relation to obtain the reference amount information. The character dictionary is used for replacing characters, so that detection errors of an optical character recognition model and writing errors of suppliers can be overcome, errors can be effectively reduced, the work of manually checking the medicine amount is reduced, and the efficiency of inputting the medicine amount is improved.

Description

Correction method, device, equipment and storage medium for medicine amount
Technical Field
The present invention relates to the technical field of natural language processing, and in particular, to a method, an apparatus, a device, and a storage medium for correcting an amount of a drug.
Background
The e-commerce platform purchases the medicines from suppliers of the medicines, the suppliers carry a list of the medicines when the medicines are transported, and when a worker of the e-commerce platform checks and accepts the medicines, the list is scanned, text information in the list is identified by using an OCR (Optical Character Recognition ) technology, and the amount of the money in the list is input into the system.
On the one hand, the provider provides the list that the writing errors possibly exist, the writing specification of the amount is violated, the wrong amount is obtained after OCR recognition, and on the other hand, the wrong amount is obtained due to the influences of factors such as font difference (such as Song body, regular script and the like), list folding, ink pollution, seal coverage fonts and the like.
When checking the money, if errors are found, the staff can manually correct the money, the money checking work is complicated, error leakage is easy to occur, and the money inputting efficiency is low.
Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for correcting the amount of a medicine, which are used for solving the problem of how to improve the efficiency of entering the amount of the medicine by using an OCR technology.
According to an aspect of the present invention, there is provided a correction method of a medicine amount, comprising:
Receiving image data, wherein the content of the image data is a list of purchasing the medicines from a supplier;
inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data;
Searching the original text information belonging to the amount of the medicine as candidate amount information;
verifying the validity of the candidate amount information for the amount of the medicine;
if the legitimacy is illegal, comparing the candidate amount information with a preset dictionary, wherein the dictionary is provided with a plurality of mapping relations, the mapping relations represent that a second character is identified as a first character in the optical character identification model, and/or the second character which accords with the amount writing specification is written as a first character which does not accord with the amount writing specification;
And if the candidate amount information has the first character, replacing the first character of the candidate amount information with the second character in the same mapping relation to obtain reference amount information.
According to another aspect of the present invention, there is provided a correction device for a medicine amount, comprising:
the image data receiving module is used for receiving image data, and the content of the image data is a list of purchasing the medicines from a supplier;
An optical character recognition module for inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data;
the candidate amount information searching module is used for searching the original text information belonging to the amount of the medicine and taking the original text information as candidate amount information;
a validity verification module, configured to verify validity of the candidate amount information for an amount of the drug;
The dictionary comparison module is used for comparing the candidate amount information with a preset dictionary if the legitimacy is illegal, wherein the dictionary is provided with a plurality of mapping relations, the mapping relations represent that the second character is identified as a first character in the optical character identification model, and/or the second character which accords with the amount writing specification is written as a first character which does not accord with the amount writing specification;
and the character replacing module is used for replacing the first character of the candidate amount information with the second character in the same mapping relation if the candidate amount information has the first character, so as to obtain the reference amount information.
According to another aspect of the present invention, there is provided an electronic apparatus including:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of correcting the amount of the drug according to any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing a computer program for causing a processor to execute a method of correcting an amount of a drug according to any one of the embodiments of the present invention.
In this embodiment, image data is received, the content of the image data being a list of medicines purchased from a supplier; inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data; searching original text information belonging to the amount of the medicine as candidate amount information; verifying the legitimacy of the candidate amount information for the amount of the drug; if the legitimacy is illegal, comparing the candidate amount information with a preset dictionary, wherein the dictionary is provided with a plurality of mapping relations, and the mapping relations represent that the second character is identified as a first character in an optical character identification model, and/or the second character which accords with the amount writing specification is written as a first character which does not accord with the amount writing specification; if the candidate amount information has the first character, replacing the first character of the candidate amount information with the second character in the same mapping relation to obtain the reference amount information. In the environment of the medicine amount, the dictionary is used for replacing characters, so that the detection errors of the optical character recognition model and the writing errors of suppliers can be overcome, the training of the optical character recognition model is avoided, the cost is low, the performance of the optical character recognition model in other businesses is guaranteed, errors can be effectively reduced, the manual checking of the medicine amount is reduced, the convenience of inputting the medicine amount is greatly improved, and the efficiency of inputting the medicine amount is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for correcting a drug amount according to a first embodiment of the present invention;
FIG. 2 is an exemplary diagram of an entry inventory provided in accordance with a first embodiment of the invention;
FIG. 3 is a diagram illustrating an example of an optical character recognition error according to a first embodiment of the present invention;
FIG. 4 is a flowchart of a method for correcting the amount of a drug product according to a second embodiment of the present invention;
FIG. 5 is a flowchart of a method for correcting the amount of a drug product according to a third embodiment of the present invention;
FIG. 6 is a schematic diagram showing a configuration of a device for correcting an amount of a drug according to a fourth embodiment of the present invention;
Fig. 7 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a method for correcting a drug amount according to an embodiment of the present invention, where the method may be performed by a device for correcting a drug amount, which may be implemented in hardware and/or software, and the device for correcting a drug amount may be configured in an electronic device, where a dictionary is used to correct a common error after OCR is performed on the drug amount. As shown in fig. 1, the method includes:
step 101, receiving image data.
In practical application, the e-commerce platform purchases medicines to a plurality of suppliers, the suppliers send the medicines and the lists of the medicines to addresses appointed by the e-commerce platform in a physical distribution mode, and staff of the e-commerce platform check and accept the medicines so as to store the medicines in a warehouse.
In general, a list of medicines records various information of medicines in the form of a table.
As shown in fig. 2, in the process of checking and accepting a medicine, a worker may collect image data for a list of medicines using an image pickup apparatus such as a high-speed camera, that is, the content of the image data is a list of medicines purchased from a supplier.
Step 102, inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data.
In the present embodiment, an optical character recognition model, that is, an optical character recognition model for performing optical character recognition on image data, may be constructed and trained in advance based on the OCR technology.
The structure of the optical character recognition model is not limited to the artificially designed neural network, but can be optimized by a model quantization method, a neural network searching for characteristics of a drug list by a NAS (Neural Architecture Search, neural network structure search) method, and the like, which is not limited in this embodiment.
Since the background of the list of medicines is clear and standard, the characters in the list of medicines can be considered to belong to a simple scene, a lightweight optical character recognition model (such as Paddle OCR) can be used, characters can be detected in the simple scene by utilizing image morphological operations in computer vision, such as expansion, basic corrosion operation and the like, and higher accuracy is ensured.
In order to reduce the development effort, the optical character recognition model (such as pad OCR) in this embodiment may be a pre-trained optical character recognition model, and the later acquisition content is to take as a sample image data of a list of medicines purchased from a vendor, and fine tuning (fine tuning) is performed on the optical character recognition model.
The image data is input into an optical character recognition model, the optical character recognition model performs optical character recognition on the image data, and a plurality of independent original text information is recognized on the image data, wherein the optical character recognition model marks one independent original text information in a detection frame mode, and one or more characters can be contained in one independent original text information, and the characters comprise characters (such as Chinese characters, english, arabic numerals and the like), punctuation marks (such as dots, periods, brackets and the like) and the like.
Step 103, searching original text information belonging to the amount of the medicine as candidate amount information.
In practical use, as shown in fig. 2, the list of medicines has various semantic information such as the title of the medicines, the specifications of the medicines, the name of the manufacturer, the unit of the medicines, the number of the medicines, the unit price of the medicines, the amount of the medicines, the lot or approval number of the medicines, the date and validity of the production of the medicines, the retail price of the medicines, and the like.
In general, as shown in fig. 2, typesetting of various semantic information in a list provided by a provider has a relatively stable rule, so that when the amount of a medicine is input, the original text information with the semantic meaning of the amount of the medicine can be searched in all original text information according to the typesetting rule and recorded as candidate amount information.
Further, the optical character recognition model usually recognizes the line feed information as at least two independent original text messages, and the amount of the medicine is relatively low and is relatively important, and the amount of the medicine is mostly not line fed in the list, so that the amount of the medicine is clearly checked, and therefore, when the independent original text messages are recognized as candidate amount information, the independent original text messages can generally contain the complete amount of the medicine.
In a way of searching the amount of the medicine, the typesetting way of the list of the medicine of different suppliers has higher stability, so that the typesetting rule of the list of the medicine of different suppliers can be analyzed, thereby creating a template, wherein the template is marked with a target frame belonging to the amount, and a mapping relation between the identification information (such as the name of the supplier and the like) of the supplier and the template is created.
Then, in the method, the identification information of the provider can be searched in the original text information by means of keyword (i.e. name of the provider) matching and the like, and in the mapping relation, templates created for the provider are queried according to the identification information.
The template is mapped onto the image data and then, on the same image data (coordinate system), the template overlaps with the original text information.
And searching original text information overlapped with the target frame on the image data, and if the degree of the overlapped part (shown in IoU (Intersection over Union, cross-over ratio) and other modes) between the target frame and certain original amount information is larger than a preset first overlapped threshold value, and the degree of the overlapped part between the target frame and the original text information is higher, determining the amount of the original text information belonging to the medicine as candidate amount information.
In another way of searching for the amount of the drug, as shown in fig. 2, the identification information of the provider may be searched for in the original text information using keyword (i.e., name of the provider) matching or the like.
The image data is input to a table identification model such as table_ recognition, cycle-CENTERNET in Modelscope, and cells are identified in the image data, wherein the cells have a plurality of vertices therein.
If the overlapping degree (IoU or the like) between the two cells is greater than the preset second overlapping threshold (e.g., 90%), which means that the overlapping degree between the two cells is higher, and the two cells belong to the nested abnormality, the cell with the smallest area can be deleted from the two cells;
If deletion is completed, the cells (including vertices) may be ordered in the order of rows and columns, so as to align the cells (including vertices), and in the case of alignment, adjacent vertices are merged, where the distance between the vertices (such as the euclidean distance) may be smaller than a preset pitch threshold, and the adjacent vertices are more errors that are detected by the table recognition model, and the merged vertices may enable the split cells to be merged into the same table.
If merging is completed, the vertices may be complemented in the order of rows and columns (e.g., top-down, left-to-right, etc.) using interpolation or the like, taking into account that a normal cell has four vertices.
If the completion is completed, the isolated vertices may be removed in the order of rows and columns, and the isolated vertices may not form normal cells, i.e., the isolated order belongs to noise for the cells.
If the removal is completed, a plurality of cells having the largest connected areas are extracted as a table.
Mapping a table onto image data, then, on the same image data (coordinate system), the table overlaps with the original text information such that part of the original text information falls into individual cells of the table.
And determining the amount of the drug belonging to the original text information on the row or column designated in the table according to the identification information, and taking the original text information as candidate amount information.
Further, in the drug list of the provider, it is customary to arrange the amount of the drug in a certain row or a certain column (e.g. column 7), and there is a certain difference between the rows or columns of the amounts of the drugs arranged by different providers, but most of the default is to arrange the amounts of the drugs in a certain row or a certain column (e.g. column 7) so as to meet certain typesetting specifications, so that whether to mark the rows or columns of the amounts of the drugs of the provider indicated by the identification information can be queried.
If the line or column in which the amount of the medicine is located is marked for the supplier, it is determined that the original text information in the line or column in the table belongs to the amount of the medicine as candidate amount information.
If the post-worker checks that the line or the column is not the amount of the recorded medicine and designates a certain line or a certain column, the information (such as the number of lines or the number of columns) of the line or the column designated by the worker is marked as the amount of the medicine by taking the identification of the supplier as an index.
If the line or column of the amount of the medicine is not marked on the supplier, the original text information on the default line or default column (such as column 7) in the table is determined to belong to the amount of the medicine, and is taken as candidate amount information.
If the post-worker checks the amount of the recorded medicine in the row or the column normally, the information (such as the number of rows or the number of columns) of the row or the column is marked by taking the identification of the supplier as an index.
If the post-worker checks that the line or the column is not the amount of the recorded medicine and designates a certain line or a certain column, the information (such as the number of lines or columns) of the line or the column designated by the worker is marked with the identification of the supplier as an index.
The template is used for extracting candidate amount information, the accuracy is higher, but the cost for manufacturing the template is higher, and when the list of the supplier is newly added and the list is updated by the original supplier, the template is newly added, so that the cost for maintaining the template is higher.
The candidate amount information is extracted by using a form mode, although the accuracy is reduced, the method can be suitable for most suppliers, can be suitable for the conditions of newly added suppliers and original suppliers for updating the list to a certain extent, and effectively controls the cost.
The candidate amount information may be extracted by using a template and the candidate amount information may be extracted by using a table, or may be used alone or in combination (e.g., distinguished according to identification information of a provider), so that the candidate amount information may be extracted by selecting a template and/or a table according to actual requirements (e.g., accuracy, cost, etc.) of a service.
Step 104, verifying the validity of the candidate amount information for the amount of the medicine.
As the amount of the medicine is taken as a bill and a certificate of settlement and has standardized and normalized writing specifications, the validity of the candidate amount information on the amount of the medicine can be preliminarily verified according to the writing specifications for each candidate amount information, namely, whether the candidate amount information accords with the writing specifications of the amount of the medicine or not can be preliminarily verified, if so, the validity of the candidate amount information on the amount of the medicine is determined to be legal, and if not, the validity of the candidate amount information on the amount of the medicine is determined to be illegal.
In a specific implementation, considering that the amount of the medicine is small in number of language types, if the amount of the medicine is the amount of a single item, the language type is usually Arabic numerals, and if the amount of the medicine is the amount of the single item, the amount is total or pre-tax amount, the language type is usually Chinese numerals.
Therefore, a conversion function for converting the amount of the medicine into a floating point number for checking whether or not the amount of the individual class, the pre-tax amount, and the total amount are accurate in checking the medicine can be set for the language type of the amount of the medicine.
For example, convertDouble or the like is configured as an Arabic numeral conversion function, and a custom function is used as a Chinese numeral conversion function.
Then, the language type (e.g., arabic numerals or Chinese numerals, etc.) of the candidate amount information may be queried.
And calling a conversion function (such as Arabic numerals or Chinese numerals) configured for the language type to convert the candidate amount information into the floating point number.
If the candidate amount information is the amount information under the language type, the conversion is correct; if the candidate amount information exists outside the amount under the language type, an error is converted.
If the conversion is correct, determining that the legitimacy of the candidate amount information on the amount of the medicine is legal, and continuing to execute the operation of subsequently checking and accepting the medicine.
Further, if the legitimacy is legal, the amount of the single-item medicine, the pre-tax amount of the medicine, and the total amount of the medicine are distinguished in the candidate amount information, and the amount of the single-item medicine, the pre-tax amount of the medicine, and the total amount of the medicine are self-checked, for example, the amount of the single-item medicine is multiplied by the tax rate to verify whether the pre-tax amount of the medicine is accurate, the amount of the single-item medicine is multiplied by the number of the medicine and then summed to verify whether the total amount of the medicine is accurate, and vice versa.
If the conversion is wrong, the validity of the candidate amount information on the amount of the medicine is determined to be illegal, the operation of subsequently checking and accepting the medicine is stopped, and the candidate amount information is waited for correction.
And 105, if the validity is illegal, comparing the candidate amount information with a preset dictionary.
Since errors in the amount of the medicine mainly originate from the optical character recognition model and the supplier, a dictionary may be constructed in advance for the characteristics of the optical character recognition model to detect errors and the characteristics of the supplier to write errors (i.e., write specifications of the amount of the medicine are not satisfied), and this field may be maintained continuously depending on the optical character recognition model and the circumstances of the supplier.
The dictionary is provided with a plurality of mapping relations, the mapping relations represent that the second character is identified as the first character in the optical character identification model, and/or the mapping relations represent that the second character which accords with the monetary writing standard is written as the first character which does not accord with the monetary writing standard.
Further, the dictionary is used for recording the typical detection errors of the optical character recognition model (namely, the mapping relation indicates that the second character is recognized as the first character in the optical character recognition model) and the typical writing errors of the provider (namely, the mapping relation indicates that the second character meeting the monetary writing standard is written as the first character not meeting the monetary writing standard), so that the atypical detection errors of the optical character recognition model and the atypical writing errors of the provider can be ignored.
For example, as shown in fig. 3, the amount of a certain medicine is "3.850", and the result of the detection by the optical character recognition model is "3.b50", and the optical character recognition model recognizes the number "8" as the letter "B" because the number "8" is similar to the letter "B".
In addition, the detection error of the optical character recognition model and the writing error of the provider are information of the business layer of the coefficient of the electronic commerce platform, in the data bottom layer of the coefficient of the electronic commerce platform, the detection error of the optical character recognition model and the writing error of the provider can not be represented, namely, the mapping relation of the second character recognized as the first character in the optical character recognition model, the mapping relation of the second character written as the first character which does not meet the amount writing specification and the mapping relation of the second character written as the first character which does not meet the amount writing specification can be unified.
Illustratively, some of the fields of the dictionary are as follows:
s_double replace 。#.
s_double replace ,#.
s_double replace B#8
s_money replace Y#¥
s_money replace Yuan # circle
s_money replace Round # circle
s_money replace Circle # circle
Wherein s_double is a conversion identifier of an Arabic digital amount, s_money is a conversion identifier of a Chinese digital amount, replace is an operation identifier representing replacement, a field of a third column is a mapping relationship, "#" represents a replacement symbol, a first character is located before "#", and a second character is located after "#", i.e., the mapping relationship can be expressed as "first character #second character".
The mapping relation of the first row, the second row and the third row is mostly the detection error from the optical character recognition model, the mapping relation of the fifth row, the sixth row and the seventh row is mostly the writing error from the supplier, and the mapping relation of the fourth row is either the detection error from the optical character recognition model or the writing error from the supplier.
If the current candidate amount information is illegal for the amount of the medicine, the current candidate amount information is indicated to have errors, and at the moment, the candidate amount information can be compared with the first characters of each mapping relation in the dictionary, and whether the first characters in the dictionary exist in the candidate amount information is judged.
Further, the mapping relation in the dictionary is divided into an effective mapping relation and an ineffective mapping relation, and in an on-line running environment, the mapping relation compared with the candidate amount information in the dictionary is the effective mapping relation, and the ineffective mapping relation is not compared with the candidate amount information.
If the first character in the dictionary does not exist in the candidate amount information, alarm information is generated for the candidate amount information, and workers are prompted to correct the candidate amount information.
And 106, if the candidate amount information has the first character, replacing the first character of the candidate amount information with the second character in the same mapping relation to obtain the reference amount information.
If the first character in the dictionary exists in the candidate amount information, the candidate amount information is indicated to have the detection error of the optical character recognition model or the writing error of the supplier, and at this time, the first character of the candidate amount information can be replaced by the second character according to the operation expression (such as replacement) in the mapping relation, wherein the replaced first character and the replaced second character are in the same mapping relation, so that the candidate amount information is corrected to be the reference amount information, and the reference amount information is provided for staff as the reference for inputting the amount of the medicine.
When the staff records the amount of the medicine, the staff can further check whether the reference amount information is wrong according to the image data or the list.
If the staff checks the reference amount information, the reference amount information is used as the amount of the medicine to be input into the coefficient of the e-commerce platform and is recorded as target amount information.
If the staff checks the reference amount information, the reference amount information is corrected according to the image data or the list, the corrected reference amount information is used as the amount of the medicine to be input into the coefficient of the e-commerce platform, and the corrected reference amount information is recorded as target amount information.
In general, the detection error of the optical character recognition model is a long tail phenomenon, if a large number of samples are collected to train the optical character recognition model in order to overcome the detection error of the optical character recognition model in recognizing the amount of medicine, the cost of collecting the samples and labeling the samples is high, and the over fitting is easy to cause, so that the performance of the optical character recognition model in other businesses is affected.
In addition, suppliers are widely available, and writing errors of the suppliers are difficult to correct from the source.
In this embodiment, image data is received, the content of the image data being a list of medicines purchased from a supplier; inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data; searching original text information belonging to the amount of the medicine as candidate amount information; verifying the legitimacy of the candidate amount information for the amount of the drug; if the legitimacy is illegal, comparing the candidate amount information with a preset dictionary, wherein the dictionary is provided with a plurality of mapping relations, and the mapping relations represent that the second character is identified as a first character in an optical character identification model, and/or the second character which accords with the amount writing specification is written as a first character which does not accord with the amount writing specification; if the candidate amount information has the first character, replacing the first character of the candidate amount information with the second character in the same mapping relation to obtain the reference amount information. In the environment of the medicine amount, the dictionary is used for replacing characters, so that the detection errors of the optical character recognition model and the writing errors of suppliers can be overcome, the training of the optical character recognition model is avoided, the cost is low, the performance of the optical character recognition model in other businesses is guaranteed, errors can be effectively reduced, the manual checking of the medicine amount is reduced, the convenience of inputting the medicine amount is greatly improved, and the efficiency of inputting the medicine amount is improved.
Example two
Fig. 4 is a flowchart of a method for correcting the amount of a drug according to a second embodiment of the present invention, in which the operation of maintaining a dictionary is added on the basis of the foregoing embodiment. As shown in fig. 4, the method includes:
step 401, receiving image data.
Wherein the content of the image data is a list of medicines purchased from a supplier.
Step 402, inputting image data into an optical character recognition model to recognize a plurality of original text information on the image data.
Step 403, searching the original text information belonging to the amount of the medicine as candidate amount information.
Step 404, verifying the validity of the candidate amount information for the amount of the medicine.
And step 405, if the validity is illegal, comparing the candidate amount information with a preset dictionary.
The dictionary is provided with a plurality of mapping relations, wherein the mapping relations represent that the second character is identified as the first character in the optical character identification model, and/or the second character which accords with the monetary writing specification is written as the first character which does not accord with the monetary writing specification.
Step 406, if the candidate amount information has the first character, replacing the first character of the candidate amount information with the second character in the same mapping relation to obtain the reference amount information.
Step 407, inquiring target amount information for inputting the amount of the medicine.
Since the list of medicines provided by the supplier may vary in font, typesetting, operator, etc., the optical character recognition model may have new detection errors and the supplier may have new writing errors.
In order to be compatible with new detection errors possibly occurring in the optical character recognition model and new writing errors possibly occurring in the supplier, the embodiment can continuously analyze the condition of inputting the amount of the medicine, so that a new mapping relation is added in the dictionary, and the efficiency of inputting the amount of the medicine is improved.
When offline, the target amount information recorded for the medicine can be queried from the coefficient database of the electronic commerce platform at intervals according to the information (such as the ID of the medicine, the ID of the order, and the like) of the medicine.
For the same medicine (including the same kind of medicine, the same lot of medicine), the target amount information is the accurate medicine amount, the reference amount information is the reference medicine amount, and considering that the amount is generally a character-level error, the target amount information and the reference amount information can be compared character by character.
Step 408, if the character of the target amount information is different from the character of the reference amount information, the character of the target amount information is used as the second character, and the character of the reference amount information is used as the first character, so as to generate a new mapping relation.
If the character located at the position in the target amount information is different from the character located at the position in the reference amount information, the character located at the position in the reference amount information of the staff is replaced by the character located at the position in the target amount information, the character located at the position in the target amount information can be used as a second character, the character located at the position in the reference amount information can be used as a first character, and a new mapping relation can be generated, wherein the new mapping relation indicates that the first character is replaced by the second character and can be used as a candidate mapping relation in a dictionary.
Step 409, if the first frequency of occurrence of the new mapping relationship is greater than or equal to the preset frequency threshold, writing the new mapping relationship into the dictionary.
In a preset time period, the first frequency of the new mapping relation can be counted, and the first frequency of the new mapping relation is compared with a preset frequency threshold.
If the first frequency of occurrence of the replacement relationship is smaller than the frequency threshold, the first frequency of occurrence of the new mapping relationship is lower, and the new mapping relationship may be atypical detection error of the character recognition model or atypical writing error of the supplier, and at this time, the new mapping relationship may be ignored.
If the first frequency of occurrence of the new mapping relationship is greater than or equal to the frequency threshold, the first frequency of occurrence of the new mapping relationship is higher, and the new mapping relationship may be a detection error typical of a learning character recognition model or a writing error typical of a provider, and at this time, the new mapping relationship may be written into the dictionary to take effect.
In order to ensure the accuracy of the replacement relationship, a new mapping relationship in the dictionary can be validated after manual verification.
Step 410, counting the second frequency of using the mapping relation in the dictionary.
Since the list of medicines provided by the supplier may vary in font, typesetting, operator, etc., the original detection errors of the optical character recognition model may disappear, and the original writing errors of the supplier may disappear.
In order to be compatible with the original detection errors that the optical character recognition model may disappear and the original writing errors that the provider may disappear, the embodiment can continuously analyze the condition of inputting the amount of the medicine, so that the original mapping relation is deleted in the dictionary, and the efficiency of inputting the amount of the medicine is improved.
For each valid mapping in the dictionary, the second frequency of use of the mapping in the dictionary may be counted at intervals.
The use of the mapping relation may mean that if the candidate amount information has a first character, the first character of the candidate amount information is replaced with a second character in the same mapping relation, and the reference amount information is obtained.
In step 411, if the second frequency is greater than 0, the mapping relationship is maintained valid.
In step 412, if the second frequency is 0, the tag mapping relationship is invalid.
If the second frequency is greater than 0, the detection error of the optical character recognition model represented by the mapping relation and/or the writing error of the provider still exist, and at this time, the mapping relation is maintained to be valid.
If the second frequency is 0, the detection error of the optical character recognition model represented by the mapping relation and/or the writing error of the provider do not exist, and at the moment, the mapping relation is marked invalid, so that logic deletion is realized.
Example III
Fig. 5 is a flowchart of a method for correcting the amount of a drug according to a third embodiment of the present invention, in which the operation of upgrading the optical character recognition model is refined on the basis of the foregoing embodiment. As shown in fig. 5, the method includes:
Step 501, determining that an optical character recognition model is to be upgraded from an old version to a new version.
In this embodiment, the development of the optical character recognition model may be continued, and when the optical character recognition model is to be upgraded from the old version to the new version, the optical character recognition model of the new version may be tested to compare the performance difference between the optical character recognition model of the old version and the optical character recognition model of the new version.
Further, the old version of the optical character recognition model is to be the same as the new version of the optical character recognition model, for example, the old version of the optical character recognition model is continuously trained to generate the new version of the optical character recognition model by using more samples, or may be different, for example, the optical character recognition model with a self-grinding structure is used to replace the open source optical character recognition model, etc., which is not limited in this embodiment.
Step 502, receiving image data as a test sample.
Wherein the content of the image data is a list of medicines purchased from a supplier.
In the test environment, a batch of image data, which is the correct amount of the medicine (i.e., historical target amount information) may be collected in advance as a test sample, so as to be compared with candidate amount information (candidate amount legal) and reference amount information (candidate amount illegal).
Step 503, inputting the image data into the optical character recognition models of the new version and the old version respectively to recognize a plurality of original text information on the image data.
In one aspect, frames of image data are input into a new version of an optical character recognition model to recognize a plurality of original text information on the image data.
On the other hand, each frame of image data is input into an old version of the optical character recognition model to recognize a plurality of original text information on the image data.
Step 504, searching original text information belonging to the amount of the medicine as candidate amount information.
Step 505, verifying the validity of the candidate amount information with respect to the amount of the medicine.
And step 506, if the validity is illegal, comparing the candidate amount information with a preset dictionary.
The dictionary is provided with a plurality of mapping relations, wherein the mapping relations represent that the second character is identified as the first character in the optical character identification model, and/or the second character which accords with the monetary writing specification is written as the first character which does not accord with the monetary writing specification.
In the test environment, the valid mapping relation and the invalid mapping relation in the dictionary can be compared with candidate amount information.
Step 507, if the candidate amount information has the first character, replacing the first character of the candidate amount information with the second character in the same mapping relation to obtain the reference amount information.
Step 508, counting the first correction information recorded when using dictionary for the old version of the optical character recognition model.
For the old version of the optical character recognition model, the dictionary result can be used as the first correction information when detecting the amount of the medicine in the image data.
Illustratively, the first correction information includes information of a mapping relation valid for the hit dictionary.
Step 509, counting the second correction information recorded when using dictionary for the new version of optical character recognition model.
For the new version of the optical character recognition model, the dictionary result can be used as second correction information when the amount of the medicine in the image data is detected.
Illustratively, the second correction information includes information of a mapping relation for which the hit dictionary is invalid, the mapping relation for which the hit dictionary is valid, and information of a character which is wrong and is not recorded in the dictionary is identified.
Step 510, determining whether to allow the optical character recognition model to be upgraded from the old version to the new version according to the first correction information and the second correction information.
In this embodiment, the first correction information and the second correction information may be compared, and the performance difference between the old version and the new version of the optical character recognition model may be mined, so as to determine whether to allow the optical character recognition model to be upgraded from the old version to the new version, and ensure the upgrade effect of the optical character recognition model.
It should be noted that, the list of purchased medicines has various information, and the optical character recognition model may be used to input other information besides the amount of the medicines, for example, input the title of the medicines, input the name of the manufacturer, etc., so that whether to allow the optical character recognition model to be upgraded from the old version to the new version is determined in the dimension of the amount of the medicines, which is usually the result of one dimension, and whether to allow the optical character recognition model to be upgraded from the old version to the new version may be finally determined in combination with the result of different dimensions.
In a specific implementation, the upgrade of the optical character recognition model from the old version to the new version satisfies the following three conditions:
1. Controllable performance weakness
To some extent, dictionary-invalid mappings may be considered performance flaws that are overcome by older versions of optical character recognition models.
And reading the first times of the invalid mapping relation of the hit dictionary from the second correction information, and comparing the first times with a preset first performance threshold.
The mapping relation of hit dictionary invalidation may refer to a first character in the mapping relation of invalidation exists in the candidate amount information, and then the first character of the candidate amount information is replaced by a second character in the same invalid mapping relation, so as to obtain the reference amount information.
And if the first time number is smaller than or equal to a preset first performance threshold value, determining that the new version of the optical character recognition model meets a first condition for representing the controllable performance weakness.
If the first time number is larger than a preset first performance threshold value, determining that the new version of the optical character recognition model does not meet a first condition for representing the controllable performance weakness.
2. Performance optimization
To some extent, the dictionary-efficient mapping (particularly the mapping representing the recognition of the second character as the first character in the optical character recognition model) may be regarded as a performance deficiency that is not overcome by the old version of the optical character recognition model.
In one aspect, a second number of mappings that hit dictionary is valid is read from the first correction information.
On the other hand, the third number of times of the valid mapping relation of the hit dictionary is read from the second correction information.
The valid mapping relation of the hit dictionary may refer to a first character in the valid mapping relation of the candidate amount information, and then the first character of the candidate amount information is replaced by a second character in the same valid mapping relation, so as to obtain the reference amount information.
The second number is compared with the third number.
And if the third times are smaller than the second times, determining that the new version of the optical character recognition model meets a second condition for representing performance optimization.
And if the third times are greater than or equal to the second times, determining that the new version of the optical character recognition model does not meet the second condition for representing the performance optimization.
3. Unknown performance vulnerability controllability
To some extent, unrecorded errors in the dictionary may be considered performance weaknesses unknown to the optical character recognition model.
And reading a fourth number of characters which are wrong in recognition and are not recorded in the dictionary from the second correction information, and comparing the fourth number with a preset second performance threshold.
The recognition error is a difference between the result (candidate amount information or reference amount information) of the recognition by the optical character recognition model and the correct amount of the medicine.
If the fourth number is less than or equal to the preset second performance threshold, it may be determined that the new version of the optical character recognition model satisfies a third condition that indicates that the unknown performance vulnerability is controllable.
If the new version of the optical character recognition model meets the first condition, the second condition and the third condition at the same time, the optical character recognition model is determined to be allowed to be upgraded from the old version to the new version.
If the new version of the optical character recognition model does not meet any one of the first condition, the second condition and the third condition, determining to prohibit the optical character recognition model from being upgraded from the old version to the new version.
Example IV
Fig. 6 is a schematic structural diagram of a device for correcting drug amount according to a fourth embodiment of the present invention. As shown in fig. 6, the apparatus includes:
An image data receiving module 601, configured to receive image data, where content of the image data is a list of medicines purchased from a supplier;
an optical character recognition module 602 for inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data;
A candidate amount information searching module 603, configured to search the original text information belonging to the amount of the drug as candidate amount information;
A validity verification module 604, configured to verify validity of the candidate amount information for an amount of the drug;
The dictionary comparing module 605 is configured to compare the candidate amount information with a preset dictionary if the validity is illegal, where the dictionary has a plurality of mapping relations, and the mapping relations indicate that the second character is identified as the first character in the optical character identification model, and/or that the second character meeting the amount writing specification is written as the first character not meeting the amount writing specification;
And a character replacing module 606, configured to replace the first character of the candidate amount information with the second character in the same mapping relationship if the candidate amount information has the first character, so as to obtain reference amount information.
In one embodiment of the present invention, the candidate amount information search module 603 includes:
the identification information searching module is used for searching the identification information of the supplier in the original text information;
the template inquiry module is used for inquiring a template created for the provider according to the identification information, and a target frame belonging to the amount is marked in the template;
a template mapping module for mapping the template onto the image data;
The overlapping determining module is used for determining that the original text information belongs to the amount of the medicine and is used as candidate amount information if the overlapping degree between the target frame and certain original amount information is larger than a preset first overlapping threshold value;
And/or
The identification information searching module is used for searching the identification information of the supplier in the original text information;
A cell identification module for identifying a cell in the image data, the cell having a plurality of vertices therein;
The cell deleting module is used for deleting the cell with the smallest area from the two cells if the overlapping degree of the two cells is larger than a preset second overlapping threshold value;
the vertex merging module is used for merging adjacent vertexes if deletion is completed;
the vertex completion module is used for completing the vertex according to the sequence of the rows and the columns if the combination is completed;
The vertex removing module is used for removing the isolated vertexes according to the sequence of the rows and the columns if the completion is completed;
The table extraction module is used for extracting a plurality of cells with the largest connected areas as tables if the removal is completed;
a table mapping module for mapping the table onto the image data;
And the row and column determining module is used for determining the amount of the medicine to which the original text information belongs on the appointed row or column in the table according to the identification information, and the amount is used as candidate amount information.
In one embodiment of the present invention, the validity verification module 604 includes:
The language type query module is used for querying the language type of the candidate amount information;
the floating point number conversion module is used for calling a conversion function configured for the language type to convert the candidate amount information into a floating point number;
The legal determining module is used for determining that the legitimacy of the candidate amount information to the amount of the medicine is legal if the conversion is correct;
and the illegal determining module is used for determining that the legitimacy of the candidate amount information to the amount of the medicine is illegal if the conversion is wrong.
In one embodiment of the invention, the apparatus further comprises:
the amount distinguishing module is used for distinguishing the amount of the single product type medicine, the pre-tax amount of the medicine and the total amount of the medicine in the candidate amount information if the legitimacy is legal;
And the amount self-checking module is used for carrying out self-checking on the amount of the medicine, the pre-tax amount of the medicine and the total amount of the medicine for single products.
In one embodiment of the invention, the apparatus further comprises:
the target amount information inquiry module is used for inquiring target amount information input into the amount of the medicine;
A replacement relation generating module, configured to generate a new mapping relation by using, if the character of the target amount information is different from the character of the reference amount information, the character of the target amount information as a second character and the character of the reference amount information as a first character;
The dictionary writing module is used for writing the new mapping relation into the dictionary if the first frequency of occurrence of the new mapping relation is larger than or equal to a preset frequency threshold value;
the frequency-of-use statistics module is used for counting the second frequency of the mapping relation in the dictionary;
An effective determining module, configured to maintain the mapping relationship effective if the second frequency is greater than 0;
and the invalidation determining module is used for marking that the mapping relation is invalid if the second frequency is 0.
In one embodiment of the invention, the apparatus further comprises:
the to-be-upgraded determining module is used for determining that the optical character recognition model is to be upgraded from an old version to a new version;
the first correction information statistics module is used for counting the first correction information recorded when the dictionary is used for the optical character recognition model of the old version;
the second correction information statistics module is used for counting second correction information recorded when the dictionary is used for the new version of the optical character recognition model;
and the upgrade selection module is used for determining whether to allow the optical character recognition model to be upgraded from the old version to the new version according to the first correction information and the second correction information.
In one embodiment of the present invention, the upgrade selection module includes:
a first time number reading module, configured to read, from the second correction information, a first time number of times that hits the mapping relationship that the dictionary is invalid;
The first condition satisfaction determining module is used for determining that the new version of the optical character recognition model meets a first condition representing controllable performance weakness if the first time number is smaller than or equal to a preset first performance threshold value;
A second number reading module, configured to read, from the first correction information, a second number of times that hits the mapping relationship valid by the dictionary;
A third number reading module, configured to read, from the second correction information, a third number of times that hits the mapping relationship valid by the dictionary;
A second condition satisfaction determining module, configured to determine that the new version of the optical character recognition model satisfies a second condition that represents performance optimization if the third number of times is smaller than the second number of times;
a fourth number reading module for reading a fourth number of characters which are wrong in recognition and are not recorded in the dictionary from the second correction information;
The third condition satisfaction determining module is configured to determine that the new version of the optical character recognition model satisfies a third condition that indicates that the unknown performance vulnerability is controllable if the fourth number is less than or equal to a preset second performance threshold;
an upgrade permission module, configured to determine to allow the optical character recognition model to upgrade from an old version to a new version if the new version of the optical character recognition model satisfies the first condition, the second condition, and the third condition at the same time;
and the update prohibition module is used for determining that the optical character recognition model is prohibited from being updated from the old version to the new version if the optical character recognition model of the new version does not meet any one of the first condition, the second condition and the third condition.
The medicine amount correction device provided by the embodiment of the invention can execute the medicine amount correction method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the medicine amount correction method.
Example five
Fig. 7 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 7, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the respective methods and processes described above, such as the correction method of the medicine amount.
In some embodiments, the method of correcting the drug amount may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the above-described correction method of the drug amount may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the correction method of the drug amount by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
Example six
Embodiments of the present invention also provide a computer program product comprising a computer program which, when executed by a processor, implements a method of correcting a drug amount as provided by any of the embodiments of the present invention.
Computer program product in the implementation, the computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (7)

1. A method of correcting a drug amount, comprising:
Receiving image data, wherein the content of the image data is a list of purchasing the medicines from a supplier;
inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data;
Searching the original text information belonging to the amount of the medicine as candidate amount information;
verifying the validity of the candidate amount information for the amount of the medicine;
if the legitimacy is illegal, comparing the candidate amount information with a preset dictionary, wherein the dictionary is provided with a plurality of mapping relations, the mapping relations represent that a second character is identified as a first character in the optical character identification model, and/or the second character which accords with the amount writing specification is written as a first character which does not accord with the amount writing specification;
If the candidate amount information has the first character, replacing the first character of the candidate amount information with the second character in the same mapping relation to obtain reference amount information;
inquiring target amount information recorded into the amount of the medicine;
If the character of the target amount information is different from the character of the reference amount information, the character of the target amount information is used as a second character, and the character of the reference amount information is used as a first character, so that a new mapping relation is generated;
if the first frequency of occurrence of the new mapping relation is greater than or equal to a preset frequency threshold, writing the new mapping relation into the dictionary;
Counting the second frequency of using the mapping relation in the dictionary;
If the second frequency is greater than 0, the mapping relation is maintained to be effective;
if the second frequency is 0, marking that the mapping relation is invalid;
determining that the optical character recognition model is to be upgraded from an old version to a new version;
Counting first correction information recorded when the dictionary is used for the optical character recognition model of the old version;
counting second correction information recorded when the dictionary is used for the new version of the optical character recognition model;
determining whether to allow the optical character recognition model to be upgraded from an old version to a new version according to the first correction information and the second correction information;
wherein determining whether to allow the optical character recognition model to be upgraded from an old version to a new version according to the first correction information and the second correction information comprises:
Reading a first number of times of hit of the mapping relation, which is invalid by the dictionary, from the second correction information;
if the first time number is smaller than or equal to a preset first performance threshold value, determining that the new version of the optical character recognition model meets a first condition for representing controllable performance weaknesses;
reading a second number of times of hits to the mapping relation valid by the dictionary from the first correction information;
reading a third number of times of hitting the mapping relation valid by the dictionary from the second correction information;
If the third frequency is smaller than the second frequency, determining that the new version of the optical character recognition model meets a second condition for representing performance optimization;
reading a fourth number of characters which are wrong in recognition and are not recorded in the dictionary from the second correction information;
If the fourth time number is smaller than or equal to a preset second performance threshold value, determining that the new version of the optical character recognition model meets a third condition of representing that the unknown performance weakness is controllable;
if the new version of the optical character recognition model meets the first condition, the second condition and the third condition at the same time, determining to allow the optical character recognition model to be upgraded from the old version to the new version;
And if the new version of the optical character recognition model does not meet any one of the first condition, the second condition and the third condition, determining to prohibit the optical character recognition model from being upgraded from the old version to the new version.
2. The method according to claim 1, wherein said finding said original text information belonging to the amount of said medicine as candidate amount information includes:
searching the identification information of the supplier in the original text information;
inquiring a template created for the provider according to the identification information, wherein a target frame belonging to the amount is marked in the template;
Mapping the template onto the image data;
if the overlapping degree between the target frame and a certain piece of original text information is larger than a preset first overlapping threshold value, determining that the original text information belongs to the amount of the medicine, and taking the amount as candidate amount information;
and/or the number of the groups of groups,
Searching the identification information of the supplier in the original text information;
identifying a cell in the image data, the cell having a plurality of vertices therein;
if the overlapping degree between the two cells is larger than a preset second overlapping threshold value, deleting the cell with the smallest area from the two cells;
if the deletion is completed, merging the adjacent vertexes;
If the merging is completed, the vertexes are complemented according to the sequence of the rows and the columns;
if the completion is completed, removing the isolated vertexes according to the sequence of the rows and the columns;
If the removal is completed, extracting a plurality of cells with the largest connected areas as a table;
Mapping the table onto the image data;
And determining the amount of the medicine belonging to the original text information on the row or column designated in the table according to the identification information, and taking the original text information as candidate amount information.
3. The method of claim 1, wherein the verifying the legitimacy of the candidate monetary information for the monetary value of the pharmaceutical product comprises:
Inquiring the language type of the candidate amount information;
Calling a conversion function configured for the language type to convert the candidate amount information into floating point numbers;
if the conversion is correct, determining that the legitimacy of the candidate amount information for the amount of the medicine is legal;
if the conversion is wrong, determining that the legitimacy of the candidate amount information on the amount of the medicine is illegal.
4. A method according to claim 3, further comprising:
if the legitimacy is legal, distinguishing the amount of the single product type medicine, the pre-tax amount of the medicine and the total amount of the medicine in the candidate amount information;
and carrying out self-checking on the sum of the medicines, the pre-tax sum of the medicines and the total sum of the medicines for single products.
5. A correction device for a drug amount, comprising:
the image data receiving module is used for receiving image data, and the content of the image data is a list of purchasing the medicines from a supplier;
An optical character recognition module for inputting the image data into an optical character recognition model to recognize a plurality of original text information on the image data;
the candidate amount information searching module is used for searching the original text information belonging to the amount of the medicine and taking the original text information as candidate amount information;
a validity verification module, configured to verify validity of the candidate amount information for an amount of the drug;
The dictionary comparison module is used for comparing the candidate amount information with a preset dictionary if the legitimacy is illegal, wherein the dictionary is provided with a plurality of mapping relations, the mapping relations represent that the second character is identified as a first character in the optical character identification model, and/or the second character which accords with the amount writing specification is written as a first character which does not accord with the amount writing specification;
The character replacing module is used for replacing the first character of the candidate amount information with the second character in the same mapping relation if the first character exists in the candidate amount information, so as to obtain reference amount information;
the target amount information inquiry module is used for inquiring target amount information input into the amount of the medicine;
A replacement relation generating module, configured to generate a new mapping relation by using, if the character of the target amount information is different from the character of the reference amount information, the character of the target amount information as a second character and the character of the reference amount information as a first character;
The dictionary writing module is used for writing the new mapping relation into the dictionary if the first frequency of occurrence of the new mapping relation is larger than or equal to a preset frequency threshold value;
the frequency-of-use statistics module is used for counting the second frequency of the mapping relation in the dictionary;
An effective determining module, configured to maintain the mapping relationship effective if the second frequency is greater than 0;
An invalidation determining module, configured to mark that the mapping relationship is invalid if the second frequency is 0;
the to-be-upgraded determining module is used for determining that the optical character recognition model is to be upgraded from an old version to a new version;
the first correction information statistics module is used for counting the first correction information recorded when the dictionary is used for the optical character recognition model of the old version;
the second correction information statistics module is used for counting second correction information recorded when the dictionary is used for the new version of the optical character recognition model;
The upgrade selection module is used for determining whether the optical character recognition model is allowed to be upgraded from an old version to a new version according to the first correction information and the second correction information;
Wherein, the upgrade selection module comprises:
a first time number reading module, configured to read, from the second correction information, a first time number of times that hits the mapping relationship that the dictionary is invalid;
The first condition satisfaction determining module is used for determining that the new version of the optical character recognition model meets a first condition representing controllable performance weakness if the first time number is smaller than or equal to a preset first performance threshold value;
A second number reading module, configured to read, from the first correction information, a second number of times that hits the mapping relationship valid by the dictionary;
A third number reading module, configured to read, from the second correction information, a third number of times that hits the mapping relationship valid by the dictionary;
A second condition satisfaction determining module, configured to determine that the new version of the optical character recognition model satisfies a second condition that represents performance optimization if the third number of times is smaller than the second number of times;
a fourth number reading module for reading a fourth number of characters which are wrong in recognition and are not recorded in the dictionary from the second correction information;
The third condition satisfaction determining module is configured to determine that the new version of the optical character recognition model satisfies a third condition that indicates that the unknown performance vulnerability is controllable if the fourth number is less than or equal to a preset second performance threshold;
an upgrade permission module, configured to determine to allow the optical character recognition model to upgrade from an old version to a new version if the new version of the optical character recognition model satisfies the first condition, the second condition, and the third condition at the same time;
and the update prohibition module is used for determining that the optical character recognition model is prohibited from being updated from the old version to the new version if the optical character recognition model of the new version does not meet any one of the first condition, the second condition and the third condition.
6. An electronic device, the electronic device comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of correcting a drug amount as claimed in any one of claims 1 to 4.
7. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program for causing a processor to execute the correction method of the drug amount according to any one of claims 1-4.
CN202311497001.7A 2023-11-10 2023-11-10 Correction method, device, equipment and storage medium for medicine amount Active CN117456532B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311497001.7A CN117456532B (en) 2023-11-10 2023-11-10 Correction method, device, equipment and storage medium for medicine amount

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311497001.7A CN117456532B (en) 2023-11-10 2023-11-10 Correction method, device, equipment and storage medium for medicine amount

Publications (2)

Publication Number Publication Date
CN117456532A CN117456532A (en) 2024-01-26
CN117456532B true CN117456532B (en) 2024-05-31

Family

ID=89588960

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311497001.7A Active CN117456532B (en) 2023-11-10 2023-11-10 Correction method, device, equipment and storage medium for medicine amount

Country Status (1)

Country Link
CN (1) CN117456532B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109784341A (en) * 2018-12-25 2019-05-21 华南理工大学 A kind of medical document recognition methods based on LSTM neural network
CN112712436A (en) * 2020-12-31 2021-04-27 天津幸福生命科技有限公司 Medical data processing method, device, medium and electronic equipment
CN112819004A (en) * 2021-02-03 2021-05-18 杭州海量信息技术有限公司 Image preprocessing method and system for OCR recognition of medical bills
CN116912832A (en) * 2023-06-30 2023-10-20 渤海银行股份有限公司 Error correction method, error correction device, equipment and medium for image character recognition

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111859907B (en) * 2020-06-11 2023-06-23 北京百度网讯科技有限公司 Text error correction method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109784341A (en) * 2018-12-25 2019-05-21 华南理工大学 A kind of medical document recognition methods based on LSTM neural network
CN112712436A (en) * 2020-12-31 2021-04-27 天津幸福生命科技有限公司 Medical data processing method, device, medium and electronic equipment
CN112819004A (en) * 2021-02-03 2021-05-18 杭州海量信息技术有限公司 Image preprocessing method and system for OCR recognition of medical bills
CN116912832A (en) * 2023-06-30 2023-10-20 渤海银行股份有限公司 Error correction method, error correction device, equipment and medium for image character recognition

Also Published As

Publication number Publication date
CN117456532A (en) 2024-01-26

Similar Documents

Publication Publication Date Title
US20230021040A1 (en) Methods and systems for automated table detection within documents
CN110765770A (en) Automatic contract generation method and device
US11055327B2 (en) Unstructured data parsing for structured information
US11182544B2 (en) User interface for contextual document recognition
EP3380958A1 (en) System and method for automatic validation
US20190286896A1 (en) System and method for automatic detection and verification of optical character recognition data
WO2018003153A1 (en) Recognition device and recognition method
CN111428599A (en) Bill identification method, device and equipment
WO2018217891A1 (en) System and method for identification of missing data elements in electronic documents
WO2020082673A1 (en) Invoice inspection method and apparatus, computing device and storage medium
CN111914729A (en) Voucher association method and device, computer equipment and storage medium
WO2021077168A1 (en) Docket analysis methods and systems
CN115223188A (en) Bill information processing method, device, electronic equipment and computer storage medium
US20230205800A1 (en) System and method for detection and auto-validation of key data in any non-handwritten document
CN117456532B (en) Correction method, device, equipment and storage medium for medicine amount
US11256760B1 (en) Region adjacent subgraph isomorphism for layout clustering in document images
US20230113578A1 (en) Transaction and ownership information document extraction
CN113627892B (en) BOM data identification method and electronic equipment thereof
CN113298632B (en) Intelligent financial management system based on mobile internet and data characteristic analysis
CN115294593A (en) Image information extraction method and device, computer equipment and storage medium
CN117523590B (en) Method, device, equipment and storage medium for checking manufacturer name
CN117523570B (en) Correction method, device, equipment and storage medium for medicine title
CN116959018B (en) OCR-based intelligent checking method, system and equipment
US20240143632A1 (en) Extracting information from documents using automatic markup based on historical data
CN115311669A (en) Extraction method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20240506

Address after: 6/F, Building 1-3, No. 33 Anding Road, Chaoyang District, Beijing, 100000

Applicant after: Beijing Fangyixing Information Technology Co.,Ltd.

Country or region after: China

Address before: Room 206-208, Building 4, No. 2 Tiantai 1st Road, Huangpu District, Guangzhou City, Guangdong Province, 510700

Applicant before: Guangzhou Fangzhou Information Technology Co.,Ltd.

Country or region before: China

GR01 Patent grant
GR01 Patent grant