Image classification method, device, electronic device and storage medium

By obtaining the text strings in the image and matching them with the template vocabulary list, the problems of low accuracy, long training and insufficient universality in the prior art are solved, and an efficient and general image classification method is realized.

CN111860657BActive Publication Date: 2024-12-24CHINA CONSTRUCTION BANK
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202010717294.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-23
Publication Date
2024-12-24
Estimated Expiration
2040-07-23

AI Technical Summary

Technical Problem

In real application scenarios, existing image classification methods are difficult to obtain sufficient images due to data confidentiality and other reasons, resulting in low accuracy of image classification models, long training models, low development efficiency, and only one type can be judged. The pictures are not very versatile.

Method used

By obtaining the text string in the image to be classified, determining the phrase to be matched, and matching it with the phrase in the template vocabulary, classifying the image according to the degree of matching, and reducing dependence on a large amount of training data using the preset template vocabulary , improve the accuracy, efficiency and versatility of image classification.

Benefits of technology

It realizes improving the accuracy and efficiency of image classification without relying on a large amount of training data, enhancing the universality of image classification, simplifying the development process, and effectively identifying multiple image types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111860657B_ABST
    Figure CN111860657B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses an image classification method, device, electronic device and storage medium. The method comprises: obtaining all text strings in the image to be classified; determining a phrase to be matched according to the text string; wherein the phrase to be matched is composed of a preset number of characters in the text string; matching the phrase to be matched with a phrase in a template vocabulary to determine the degree of match between the phrase to be matched and the phrase in the template vocabulary; and classifying the image according to the degree of match. By running the technical solution provided by the embodiment of the present invention, the problems that the image classification model trained in a targeted manner by the existing method is not accurate; the training of a targeted deep learning model is time-consuming and the development efficiency is low; and the problem that only one type of picture can be judged and the versatility is not strong can be solved, thereby achieving the effect of improving the accuracy, efficiency and versatility of image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to computer technology, and in particular to an image classification method, device, electronic device and storage medium. Background Art

[0002] With the development of computer technology, image classification is now often completed through image recognition technology.

[0003] At present, the main method used to judge the image type is image classification technology based on deep learning. First, the existing method needs to collect a large number of sample images as training data, but in real application scenarios, due to data confidentiality and other reasons, it is difficult to obtain sufficient images, resulting in low accuracy of the targeted image classification model; secondly, the existing method requires training of targeted deep learning models, which is usually time-consuming and inefficient; finally, the deep learning model trained by the existing method can only judge one type of image, and adding new image types requires re-collecting data, annotating data, and training models, so this method is not very universal. Summary of the invention

[0004] The embodiments of the present invention provide an image classification method, an apparatus, an electronic device and a storage medium to achieve the effect of improving the accuracy, efficiency and versatility of image classification.

[0005] In a first aspect, an embodiment of the present invention provides an image classification method, the method comprising:

[0006] Get all the text strings in the image to be classified;

[0007] Determining a phrase to be matched according to the character string; wherein the phrase to be matched is composed of a preset number of consecutive characters in the character string;

[0008] Matching the phrase to be matched with the phrases in the template vocabulary to determine the degree of match between the phrase to be matched and the phrases in the template vocabulary;

[0009] The images are classified according to the matching degree.

[0010] Optionally, the process of establishing the template vocabulary includes:

[0011] Obtaining all template text strings in a template image; wherein the template image is associated with a template category;

[0012] Optionally, template phrases are determined based on the template text string to form a template vocabulary of the template category.

[0013] Classifying the image according to the matching degree includes:

[0014] If the matching degree is greater than a preset threshold, determining that the image to be classified matches the template image;

[0015] The template category associated with the template image is determined as the type of the image to be classified.

[0016] Optionally, determining the degree of matching between the phrase to be matched and the phrase in the template vocabulary includes:

[0017] Determine whether there is a phrase in the template word list that is the same as the phrase to be matched;

[0018] If yes, the matching degree is increased by a fixed unit;

[0019] The phrases to be matched are traversed to determine the matching degree.

[0020] Optionally, obtain all text strings in the image to be classified, including:

[0021] Obtaining the rectangular frame position of the characters in the image to be classified;

[0022] All text contents in the rectangular frame position are obtained to obtain the text string.

[0023] In a second aspect, an embodiment of the present invention further provides an image classification device, the device comprising:

[0024] A first character string acquisition module is used to acquire all character strings in the image to be classified;

[0025] A to-be-matched phrase determination module, used to determine a to-be-matched phrase according to the character string; wherein the to-be-matched phrase is composed of a preset number of consecutive characters in the character string;

[0026] A matching degree determination module, used for matching the phrase to be matched with the phrase in the template vocabulary to determine the matching degree between the phrase to be matched and the phrase in the template vocabulary;

[0027] The image classification module is used to classify the image according to the matching degree.

[0028] Optionally, a template vocabulary building module, the template vocabulary building module includes:

[0029] A second character string acquisition unit is used to acquire all template character strings in the template image; wherein the template image is associated with a template category;

[0030] The template phrase determination unit is used to determine the template phrase according to the template text string to form a template word list of the template category.

[0031] Optionally, the image classification module includes:

[0032] An image matching determination unit, configured to determine that the image to be classified matches the template image if the matching degree is greater than a preset threshold;

[0033] The image type determination unit is used to determine the template category associated with the template image as the type of the image to be classified.

[0034] Optionally, the matching degree determination module includes:

[0035] A phrase determination unit, used to determine whether there is a phrase in the template word list that is the same as the phrase to be matched;

[0036] A matching degree increasing unit, configured to increase the matching degree by a fixed unit if the phrase determining unit determines that the matching degree is yes;

[0037] The matching degree determining unit is used to traverse the phrase to be matched to determine the matching degree.

[0038] Optionally, the first character string acquisition module includes:

[0039] A rectangular frame position acquisition unit, used to acquire the rectangular frame position of the characters in the image to be classified;

[0040] The character string acquisition unit is used to acquire all the text contents in the rectangular frame position to acquire the character string.

[0041] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0042] one or more processors;

[0043] a storage device for storing one or more programs,

[0044] When the one or more programs are executed by the one or more processors, the one or more processors implement the image classification method as described above.

[0045] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which implements the image classification method as described above when executed by a processor.

[0046] The embodiment of the present invention obtains all the text strings in the image to be classified; determines the phrase to be matched according to the text string; wherein the phrase to be matched is composed of a preset number of characters in the text string; matches the phrase to be matched with the phrase in the template vocabulary to determine the degree of match between the phrase to be matched and the phrase in the template vocabulary; and classifies the image according to the degree of match. The existing method solves the problems that the image classification model trained in a targeted manner is not accurate; the training of a targeted deep learning model is time-consuming and the development efficiency is low; and the only type of image can be judged and the versatility is not strong, thereby achieving the effect of improving the accuracy, efficiency and versatility of image classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 A flowchart of an image classification method provided in Embodiment 1 of the present invention;

[0048] Figure 2 A schematic diagram of a reimbursement form provided in the first embodiment of the present invention;

[0049] Figure 3 A flowchart of an image classification method provided in Embodiment 2 of the present invention;

[0050] Figure 4 A schematic diagram of the structure of an image classification device provided in Embodiment 3 of the present invention;

[0051] Figure 5 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0052] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0053] Embodiment 1

[0054] Figure 1 This is a flowchart of an image classification method provided in the first embodiment of the present invention. This embodiment is applicable to the case where images are classified by templates. The method can be executed by the image classification device provided in the embodiment of the present invention. The device can be implemented by software and / or hardware. Figure 1 , the image classification method provided in this embodiment includes:

[0055] Step 110: Obtain all text strings in the image to be classified.

[0056] The image to be classified is a text image, for example, an expense reimbursement form, a leave request form, etc.

[0057] The text content of all text parts in the image to be classified is obtained and stored in the form of a string. The text content includes the picture title and the column name, and may also include the specific content filled in after the column name, which is not limited in this embodiment.

[0058] Figure 2 This is a schematic diagram of a reimbursement form provided in Example 1 of the present invention. Figure 2 As shown:

[0059] The text string content is: Handan branch headquarters, reimbursement form, reimbursement form number, number of attachments, reimbursement items, payment method, electronic payment, receipt email address, whether it is international balance of payments, supplier number, supplier name, etc.

[0060] In this embodiment, optionally, all text strings in the image to be classified are obtained, including:

[0061] Obtaining the rectangular frame position of the characters in the image to be classified;

[0062] All text contents in the rectangular frame position are obtained to obtain the text string.

[0063] The rectangular frame where the text is located is the smallest circumscribed rectangular frame of the text. The position of the rectangular frame can be the coordinate position of the vertex in the rectangular frame, which can be obtained through a deep learning model of image positioning, and this embodiment does not limit this.

[0064] Then, the text content in each rectangular box is obtained and saved as a string using a deep learning model of image recognition. The deep learning model is used to learn the inherent rules and representation levels of the sample data, calculate and train the final model, so that the machine can predict the results based on the model.

[0065] By acquiring the rectangular frame position of the characters in the image to be classified, the character string is acquired, thereby improving the accuracy of acquiring the character string in the image to be classified.

[0066] Step 120: Determine a phrase to be matched according to the text string; wherein the phrase to be matched is composed of a preset number of consecutive characters in the text string.

[0067] The phrase to be matched is a phrase consisting of a preset number of characters in each character string in the image to be classified, without repeated parts. For example, if the preset number is two, the headquarters of Handan Branch can be divided into Handan, Dan Branch, Branch, Branch, Headquarters, and the reimbursement form can be divided into reimbursement, reimbursement form, etc.

[0068] Step 130: Match the phrase to be matched with the phrases in the template vocabulary to determine the degree of match between the phrase to be matched and the phrases in the template vocabulary.

[0069] The template word list is a pre-set word list, and each template word list corresponds to an image type. For example, if the reimbursement form of the Handan branch headquarters is used as the reimbursement form template, the phrases in the template word list corresponding to the reimbursement form include Handan, Dan branch, branch, branch, headquarters, reimbursement, etc. The phrases in the template word list are matched with the phrases to be matched to obtain the matching degree between the phrases to be matched and the phrases in the template word list. The matching algorithm can be an algorithm that can realize string matching, such as the KMP matching algorithm, which is not limited in this embodiment.

[0070] The matching degree is the similarity between the phrase to be matched and the phrase in the template vocabulary, which can be expressed in the form of a numerical value, and this embodiment does not impose a limitation on this.

[0071] In this embodiment, optionally, determining the degree of matching between the phrase to be matched and the phrase in the template vocabulary includes:

[0072] Determine whether there is a phrase in the template word list that is the same as the phrase to be matched;

[0073] If yes, the matching degree is increased by a fixed unit;

[0074] The phrases to be matched are traversed to determine the matching degree.

[0075] It is determined whether there are phrases in the template vocabulary that are identical to the phrases to be matched, for example, it is determined whether the phrases such as "reimbursement", "amount", "reimbursement" in the phrases to be matched appear in the phrases in the template vocabulary. If an identical phrase appears, the matching degree increases by a fixed unit. For example, if the fixed unit is 1, when "reimbursement", "amount", and "reimbursement" all appear in the phrases in the reimbursement form template vocabulary, the matching degree between the phrase to be matched and the template vocabulary increases by 3. If the phrase to be matched does not appear in the phrases in the template vocabulary, the matching degree remains unchanged. For example, if the phrase to be matched "Chengde" does not appear in the phrases in the template vocabulary, the matching degree remains unchanged.

[0076] For each template word list, the initial value of the matching degree is 0, and the phrase to be matched is traversed to obtain the matching degree of the phrase to be matched for a single template word list. All template word lists are traversed to obtain the matching degree of the phrase to be matched for all template word lists.

[0077] The matching degree is obtained by judging whether there is a phrase in the template vocabulary that is the same as the phrase to be matched, which directly reflects the image similarity to improve the accuracy of subsequent image classification.

[0078] Step 140: classify the images according to the matching degree.

[0079] The image is classified according to the matching degree. If the matching degree between the phrase to be matched and the phrase in the template vocabulary is greater than a preset threshold, the category of the image to be classified is the image type corresponding to the template vocabulary.

[0080] The application scenario may be to obtain a certain number of images to be classified, and obtain images of a specified image category from the images to be classified, which is not limited in this embodiment.

[0081] Optionally, if the template vocabulary satisfying the matching degree greater than a preset threshold is not unique, the matching degrees are sorted according to the matching degrees, and the image type corresponding to the template vocabulary ranked first is used as the image type of the image to be classified.

[0082] In the prior art, the process of image classification is often to collect a large number of diverse sample images; then label each image "yes" or "no" to indicate whether it is the currently specified image type, usually saved in the form of a text file, one image corresponds to a text file with the same name; finally, the labeled data (images and text files) is used as training data. Select a suitable image classification deep learning algorithm, conduct targeted training on the collected training data, and save the trained model. When classifying images, directly call the saved model to determine whether the input image is a specific type of image that needs to be identified by the current application. This technology requires the preparation of a large number of real images as training data to train the image classification model, which is time-consuming and has poor versatility. In addition, due to reasons such as data confidentiality, it is difficult to obtain a sufficient number of images, resulting in a low accuracy rate for the targeted training image classification model.

[0083] The embodiment of the present invention obtains all the text strings in the image to be classified; determines the phrase to be matched according to the text string; wherein the phrase to be matched is composed of a preset number of characters in the text string; matches the phrase to be matched with the phrase in the template vocabulary to determine the degree of match between the phrase to be matched and the phrase in the template vocabulary; and classifies the image according to the degree of match. The existing method solves the problems that the image classification model trained in a targeted manner is not accurate; the training of a targeted deep learning model is time-consuming and the development efficiency is low; and the only type of image can be judged and the versatility is not strong, thereby achieving the effect of improving the accuracy, efficiency and versatility of image classification.

[0084] Embodiment 2

[0085] Figure 3 This is a flowchart of an image classification method provided in Embodiment 2 of the present invention. This technical solution is to supplement the process of classifying images according to the matching degree. Compared with the above solution, this solution is specifically optimized to classify images according to the matching degree, including:

[0086] If the matching degree is greater than a preset threshold, it is determined that the image to be classified matches the template image;

[0087] The template category associated with the template image is determined as the type of the image to be classified. Specifically, the flowchart of the image classification method is as follows: Figure 3 As shown:

[0088] Step 310: Obtain all text strings in the image to be classified.

[0089] The image to be classified is a text image, for example, an expense reimbursement form, a leave request form, etc.

[0090] The text content of all text parts in the image to be classified is obtained and stored in the form of a string. The text content includes the picture title and the column name, and may also include the specific content filled in after the column name, which is not limited in this embodiment.

[0091] Step 320: determine a phrase to be matched according to the text string; wherein the phrase to be matched is composed of a preset number of consecutive characters in the text string.

[0092] The phrase to be matched is a phrase consisting of a preset number of characters in each character string in the image to be classified, without repeated parts. For example, if the preset number is two, the headquarters of Handan Branch can be divided into Handan, Dan Branch, Branch, Branch, Headquarters, and the reimbursement form can be divided into reimbursement, reimbursement form, etc.

[0093] Step 330: Match the phrase to be matched with the phrases in the template vocabulary to determine the degree of match between the phrase to be matched and the phrases in the template vocabulary.

[0094] The template word list is a pre-set word list, and each template word list corresponds to an image type. For example, if the reimbursement form of the Handan branch headquarters is used as the reimbursement form template, the phrases in the template word list corresponding to the reimbursement form include Handan, Dan branch, branch, branch, headquarters, reimbursement, etc. The phrases in the template word list are matched with the phrases to be matched to obtain the matching degree between the phrases to be matched and the phrases in the template word list. The matching algorithm can be an algorithm that can realize string matching, such as the KMP matching algorithm, which is not limited in this embodiment.

[0095] The matching degree is the similarity between the phrase to be matched and the phrase in the template vocabulary, which can be expressed in the form of a numerical value, and this embodiment does not impose a limitation on this.

[0096] In this embodiment, optionally, the process of establishing the template vocabulary includes:

[0097] Obtaining all template text strings in a template image; wherein the template image is associated with a template category;

[0098] A template phrase is determined according to the template text string to form a template vocabulary of the template category.

[0099] The template image is used to create a template vocabulary. For example, the unfilled reimbursement form of the Handan branch headquarters is used as the template image of the reimbursement form to create a template vocabulary of the reimbursement form category.

[0100] The template image must be clear enough and without tilt. A template file can be created for each type of image, usually in .txt format. The template file is used to record the content of all title-type text in the template image, that is, the image title and field name. The content is stored in the form of a string, and a line of string represents a text box. Taking the expense report image as an example, the template file content includes: Handan Branch Headquarters, Expense Report, Expense Report Number, Number of Attachments and other text strings.

[0101] Determine the template phrase according to the template text string, and read the corresponding template file for each type of image. Read each line of the string in the template file in turn, take the consecutive preset characters each time as a word and store them in the vocabulary, and finally remove the repeated words to get the vocabulary. Exemplarily, if the consecutive preset characters are two, the string in the template file of the reimbursement form is split into Handan, Danfen, Branch, Xingben, Headquarters, Reimbursement, etc., remove the repeated parts, and form the template vocabulary of the reimbursement form. Only one sample picture is needed as the template image, and there is no need to collect and annotate a large amount of training data for training, which reduces the preliminary development work and improves the development efficiency.

[0102] Step 340: If the matching degree is greater than a preset threshold, it is determined that the image to be classified matches the template image.

[0103] The preset threshold value may be a preset ratio of the degree of matching to the total number of phrases in the template vocabulary. For example, the degree of matching is 25, the number of phrases in the vocabulary is 30, and the degree of matching accounts for five-sixths of the total number of phrases in the template vocabulary, which is greater than four-thirds of the preset threshold value, and the image to be classified is determined to match the template image. The degree of matching is 10, the number of phrases in the vocabulary is 30, and the degree of matching accounts for one-third of the total number of phrases in the template vocabulary, which is less than four-thirds of the preset threshold value, and the image to be classified is determined to not match the template image. The preset threshold value may be changed according to actual conditions.

[0104] Step 350: Determine the template category associated with the template image as the type of the image to be classified.

[0105] The category of the image to be classified is the image type associated with the matching template image.

[0106] The application scenario may be to obtain a certain number of images to be classified, and obtain images of a specified image category from the images to be classified, which is not limited in this embodiment.

[0107] Optionally, if the template vocabulary satisfying the matching degree greater than a preset threshold is not unique, the matching degrees are sorted according to the matching degrees, and the image type corresponding to the template vocabulary ranked first is used as the image type of the image to be classified.

[0108] Exemplarily, the matching degree of the image to be classified accounts for five-sixths of the total number of phrases in template vocabulary 1 and six-sevenths of the total number of phrases in template vocabulary 2, both of which are greater than the preset threshold. In this case, the image type associated with template vocabulary 2 with a higher proportion is used as the image type of the image to be classified.

[0109] The embodiment of the present invention performs image classification by making templates, which is not dependent on the amount of collected training data, thereby improving the accuracy. When a new image type is needed, only a new template image needs to be added to make a template word list, thereby enhancing the versatility of image classification.

[0110] Embodiment 3

[0111] Figure 4 This is a schematic diagram of the structure of an image classification device provided in Embodiment 3 of the present invention. The device can be implemented by hardware and / or software, can execute an image classification method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. Figure 4 The device comprises:

[0112] A first character string acquisition module 410 is used to acquire all character strings in the image to be classified;

[0113] A to-be-matched phrase determination module 420 is used to determine a to-be-matched phrase according to the text string; wherein the to-be-matched phrase is composed of a preset number of consecutive characters in the text string;

[0114] A matching degree determination module 430, configured to match the phrase to be matched with a phrase in a template vocabulary to determine a matching degree between the phrase to be matched and a phrase in the template vocabulary;

[0115] The image classification module 440 is used to classify the image according to the matching degree.

[0116] The embodiment of the present invention obtains all the text strings in the image to be classified; determines the phrase to be matched according to the text string; wherein the phrase to be matched is composed of a preset number of characters in the text string; matches the phrase to be matched with the phrase in the template vocabulary to determine the degree of match between the phrase to be matched and the phrase in the template vocabulary; and classifies the image according to the degree of match. The existing method solves the problems that the image classification model trained in a targeted manner is not accurate; the training of a targeted deep learning model is time-consuming and the development efficiency is low; and the only type of image can be judged and the versatility is not strong, thereby achieving the effect of improving the accuracy, efficiency and versatility of image classification.

[0117] On the basis of the above technical solutions, optionally, a template vocabulary building module is provided, wherein the template vocabulary building module includes:

[0118] A second character string acquisition unit is used to acquire all template character strings in the template image; wherein the template image is associated with a template category;

[0119] The template phrase determination unit is used to determine the template phrase according to the template text string to form a template word list of the template category.

[0120] On the basis of the above technical solutions, optionally, the image classification module includes:

[0121] An image matching determination unit, configured to determine that the image to be classified matches the template image if the matching degree is greater than a preset threshold;

[0122] The image type determination unit is used to determine the template category associated with the template image as the type of the image to be classified.

[0123] On the basis of the above technical solutions, optionally, the matching degree determination module includes:

[0124] A phrase determination unit, used to determine whether there is a phrase in the template word list that is the same as the phrase to be matched;

[0125] A matching degree increasing unit, configured to increase the matching degree by a fixed unit if the phrase determining unit determines that the matching degree is yes;

[0126] The matching degree determining unit is used to traverse the phrase to be matched to determine the matching degree.

[0127] Based on the above technical solutions, optionally, the first character string acquisition module includes:

[0128] A rectangular frame position acquisition unit, used to acquire the rectangular frame position of the characters in the image to be classified;

[0129] The character string acquisition unit is used to acquire all the text contents in the rectangular frame position to acquire the character string.

[0130] Embodiment 4

[0131] Figure 5 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention is shown in FIG. Figure 5 As shown, the electronic device includes a processor 50, a memory 51, an input device 52 and an output device 53; the number of processors 50 in the electronic device can be one or more. Figure 5 A processor 50 is taken as an example; the processor 50, the memory 51, the input device 52 and the output device 53 in the electronic device can be connected by a bus or other means. Figure 5 The example of connecting through bus is taken in the following.

[0132] The memory 51 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the image classification method in the embodiment of the present invention. The processor 50 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 51, that is, implements the above-mentioned image classification method.

[0133] The memory 51 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 51 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 51 may further include a memory remotely arranged relative to the processor 50, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0134] Embodiment 5

[0135] Embodiment 5 of the present invention further provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to perform an image classification method when executed by a computer processor, the method comprising:

[0136] Get all the text strings in the image to be classified;

[0137] Determining a phrase to be matched according to the character string; wherein the phrase to be matched is composed of a preset number of consecutive characters in the character string;

[0138] Matching the phrase to be matched with the phrases in the template vocabulary to determine the degree of match between the phrase to be matched and the phrases in the template vocabulary;

[0139] The images are classified according to the matching degree.

[0140] Of course, the storage medium containing computer executable instructions provided by an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in the image classification method provided by any embodiment of the present invention.

[0141] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0142] It is worth noting that in the embodiment of the above-mentioned image classification device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0143] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. An image classification method, characterized in that: include: Get all the text strings in the image to be classified; Determine a phrase to be matched according to the character string; wherein the phrase to be matched is a phrase consisting of a preset number of consecutive characters in each character string in the image to be classified, excluding repeated parts; Matching the phrase to be matched with the phrases in the template vocabulary to determine the degree of match between the phrase to be matched and the phrases in the template vocabulary; classifying the images according to the matching degree; The step of obtaining all text strings in the image to be classified includes: Obtaining the text content of all text parts in the image to be classified and storing them in the form of a text string; wherein the text content at least includes the picture title, the column name and the content filled after the column name; The process of establishing the template vocabulary includes: Obtaining all template text strings in a template image; wherein the template image is associated with a template category; Determining template phrases according to the template text string to form a template vocabulary of the template category; The step of determining the template phrases according to the template text string to form a template vocabulary of the template category includes: Read each line of the character string in the entire template character string in sequence, and take a preset number of characters as a word and store them in a word table each time the characters are read, and finally remove the repeated words to obtain the template word table; wherein each template word table corresponds to an image type; Wherein, classifying the images according to the matching degree includes: If the matching degree is greater than a preset threshold, it is determined that the image to be classified matches the template image; wherein the matching degree is the degree of similarity between the phrase to be matched and the phrase in the template vocabulary; Determining the template category associated with the template image as the type of the image to be classified; Wherein, determining the degree of matching between the phrase to be matched and the phrase in the template vocabulary includes: Determine whether there is a phrase in the template word list that is the same as the phrase to be matched; If yes, the matching degree is increased by a fixed unit; The phrases to be matched are traversed to determine the matching degree.

2. The method according to claim 1, characterized in that Get all text strings in the image to be classified, including: Obtaining the rectangular frame position of the characters in the image to be classified; All text contents in the rectangular frame position are obtained to obtain the text string.

3. An image classification device, characterized in that: include: The first character string acquisition module is used to acquire all the character strings in the image to be classified, including: acquiring the character contents of all the character parts in the image to be classified and storing them in the form of character strings; wherein the character contents at least include the picture title, the column name and the content filled after the column name; A to-be-matched phrase determination module is used to determine a to-be-matched phrase according to the character string; wherein the to-be-matched phrase is a phrase consisting of a preset number of consecutive characters in each character string in the image to be classified, with repeated parts removed; A matching degree determination module, used for matching the phrase to be matched with the phrase in the template vocabulary to determine the matching degree between the phrase to be matched and the phrase in the template vocabulary; An image classification module, used for classifying images according to the matching degree; A template vocabulary building module, the template vocabulary building module comprising: A second character string acquisition unit is used to acquire all template character strings in the template image; wherein the template image is associated with a template category; a template phrase determination unit, configured to determine a template phrase according to the template text string to form a template word list of the template category; Wherein, the template phrase determination unit includes: The template word list acquisition subunit is used to read each line of the character string in the entire template text string in sequence, and take a preset number of characters as a word and store them in the word list each time the character string is read, and finally remove the repeated words to obtain the template word list; wherein each template word list corresponds to an image type; Wherein, the image classification module includes: An image matching determination unit, configured to determine that the image to be classified matches the template image if the matching degree is greater than a preset threshold; wherein the matching degree is the degree of similarity between the phrase to be matched and the phrase in the template vocabulary; An image type determination unit, configured to determine a template category associated with the template image as the type of the image to be classified; Wherein, the matching degree determination module includes: A phrase determination unit, used to determine whether there is a phrase in the template word list that is the same as the phrase to be matched; A matching degree increasing unit, configured to increase the matching degree by a fixed unit if the phrase determining unit determines that the matching degree is yes; The matching degree determining unit is used to traverse the phrase to be matched to determine the matching degree.

4. The device according to claim 3, characterized in that The first character string acquisition module includes: A rectangular frame position acquisition unit, used to acquire the rectangular frame position of the characters in the image to be classified; The character string acquisition unit is used to acquire all the text contents in the rectangular frame position to acquire the character string.

5. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the image classification method as described in any one of claims 1-2.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image classification method as described in any one of claims 1-2 is implemented.

Citation Information

Patent Citations

  • Digital string fuzzy match method

    CN101079032A

  • Document classification method and device and electronic equipment

    CN107844559A

  • Image classification method and apparatus, electronic device, and readable storage medium

    CN108090511A

  • Character recognition method and device, equipment and storage medium

    CN109657738A

  • File classification method and device for electronic file and electronic equipment

    CN110826619A