Image classification method, device, equipment and medium
Through the combination of the preset recognition model and the stroke equal width algorithm, the problems of low efficiency and poor accuracy of image classification in the existing technology are solved, the key information in the image is quickly extracted, and the accuracy and efficiency of classification are improved.
Patent Information
- Application Number
- CN202210581590.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-26
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-05-26
AI Technical Summary
Existing technologies have low efficiency and poor accuracy in image classification, require manual intervention, and are difficult to quickly identify key information in images.
Screen information pictures through the preset recognition model, use the stroke equal width algorithm to identify the title content, and perform classification processing according to the title content and classification rules to quickly extract key information in the picture.
It improves the accuracy of text recognition and the efficiency of image classification, reduces manual intervention, and improves user experience.
Smart Images

Figure CN115082728B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image classification, and in particular to a method, device, equipment and medium for image classification. Background Art
[0002] With the continuous development of science and technology, pictures are used as carriers of information dissemination in more and more scenarios, and the requirements for image processing (such as image text recognition, image classification, etc.) are becoming higher and higher. For example, in the field of data review, it is often necessary to extract the text content of data pictures or classify the data pictures.
[0003] Existing technologies often use OCR (Optical Character Recognition) technology to extract key information from bill images and ID photos. However, the traditional OCR processing process needs to split the process into multiple links and introduce manual intervention at each link, making it difficult to achieve rapid recognition and the accuracy of text recognition difficult to guarantee, resulting in low efficiency and accuracy in image classification. Summary of the invention
[0004] The present invention provides a method, device, equipment and medium for image classification, which realizes rapid extraction of key information in an image, improves the accuracy of text recognition, and enhances the efficiency and accuracy of image classification.
[0005] A method for classifying an image, comprising:
[0006] Get relevant pictures;
[0007] Performing picture content recognition on all relevant pictures through a preset recognition model to filter out data pictures from all the relevant pictures;
[0008] Performing title recognition on the data picture based on a stroke equal width algorithm to determine the content of the picture title corresponding to the data picture;
[0009] The data picture is classified according to the picture title content and preset classification rules to obtain a classification result.
[0010] A picture classification device, comprising:
[0011] Acquisition module, used to acquire relevant pictures;
[0012] A screening module, used to perform picture content recognition on all relevant pictures through a preset recognition model, so as to screen out material pictures from all the relevant pictures;
[0013] A recognition module, used for performing title recognition on the data picture based on a stroke equal width algorithm to determine the picture title content corresponding to the data picture;
[0014] The classification module is used to classify the data pictures according to the picture title content and preset classification rules to obtain classification results.
[0015] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned image classification method when executing the computer program.
[0016] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image classification method described above is implemented.
[0017] The image classification method, device, equipment and medium provided by the present invention obtain relevant images; perform image content recognition on all relevant images through a preset recognition model to filter out data images from all the relevant images; perform title recognition on the data images based on a stroke equal width algorithm to determine the image title content corresponding to the data images; classify the data images according to the data image titles and preset classification rules to obtain classification results, thereby achieving rapid extraction of key information in the images, accelerating the speed of data review, improving the accuracy of text recognition, improving the efficiency and accuracy of image classification, and further improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0019] Figure 1 is a schematic diagram of an application environment of a picture classification method according to an embodiment of the present invention;
[0020] Figure 2 is a flow chart of a method for classifying pictures in one embodiment of the present invention;
[0021] Figure 3 is a flow chart of step S20 of the image classification method in one embodiment of the present invention;
[0022] Figure 4 is a flow chart of step S201 of the image classification method in one embodiment of the present invention;
[0023] Figure 5 is a flow chart of step S202 of the image classification method in one embodiment of the present invention;
[0024] Figure 6 is a flowchart of step S2021 of the image classification method in one embodiment of the present invention;
[0025] Figure 7 is a flow chart of step S30 of the image classification method in one embodiment of the present invention;
[0026] Figure 8 is a flowchart of step S303 of the picture classification method in one embodiment of the present invention;
[0027] Fig. 9 is a principle block diagram of a picture classification device in one embodiment of the present invention;
[0028] Fig.10 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] The image classification method provided by the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the image classification method is applied in an image classification device, which includes: Figure 1 The client and server shown in the figure communicate with each other through the network to solve the problem of low efficiency of image classification in the prior art. The server can be implemented by an independent server or a server cluster composed of multiple servers, wherein the server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The client can be installed on, but not limited to, various personal computers, laptops, smart phones, tablets, and portable wearable devices.
[0031] In one embodiment, if Figure 2 As shown, a picture classification method is provided, and the method is applied in Figure 1The server in the example is used as an example to illustrate the process, including the following steps:
[0032] S10, obtaining relevant pictures.
[0033] It can be understood that the relevant pictures are pictures taken after taking photos of the relevant information, and the relevant information is the information that the user needs to upload, such as the insured person's identity certificate, medical expense receipts, medical expense detailed list, outpatient medical records and inpatient medical records; further, after the user takes photos of all relevant information to form relevant pictures, all relevant pictures of adjacent time can be uploaded at one time; if the shooting time is different, the relevant pictures can be uploaded in batches according to the shooting time, or all relevant pictures can be uploaded in batches according to the classification method of different picture types.
[0034] S20, performing picture content recognition on all relevant pictures through a preset recognition model to filter out material pictures from all the relevant pictures.
[0035] Understandably, the image contents of all the relevant images are identified by means of a preset recognition model, that is, all the relevant images are screened, and non-data images uploaded by users are deleted to prevent user privacy leakage. The portrait ratio in the relevant images is first calculated to obtain the portrait ratio value corresponding to the relevant images, and the relevant images corresponding to the portrait ratio values lower than or equal to the preset portrait ratio threshold are determined as portrait screening images. Then, the color ratio in the relevant images is calculated to obtain the color ratio values corresponding to the relevant images, and the relevant images corresponding to the color ratio values lower than or equal to the preset color ratio threshold are determined as color screening images. The relevant images corresponding to the portrait ratio values lower than or equal to the preset portrait ratio threshold and the color ratio values lower than or equal to the preset color ratio threshold are determined as color screening images. The relevant pictures corresponding to the value are recorded as data pictures, that is, the data pictures are screened out from all the relevant pictures. The recognition model is a neural network model that can recognize the content of the picture, which is obtained by training with a large number of pictures in advance. When the training result reaches the preset accuracy, the training is ended to complete the model construction. The recognition model includes a portrait recognition model and a color recognition model. The non-data picture is a picture that is not related to the relevant data, and the data picture is a picture related to the relevant data. The portrait ratio is the ratio of the portrait in the relevant picture, and the portrait ratio value represents the size value of the ratio of the portrait in the corresponding relevant picture. The color ratio is the ratio of the color richness in the relevant picture, and the color ratio value represents the size value of the ratio of the color richness in the relevant picture.
[0036] S30, performing title recognition on the data picture based on a stroke equal width algorithm to determine the picture title content corresponding to the data picture.
[0037] It can be understood that the title of the recorded data picture is identified through the stroke equal-width algorithm, the title area of the data picture is determined, and then the content in the title area is identified. The stroke equal-width algorithm recognition process starts from a point on a high-contrast edge in the picture, and by exploring pixels in a direction perpendicular to the edge, a point on another edge parallel to it can be found. The points on these two edges form a stroke cross-section, and by connecting many stroke cross-sections of similar widths, a complete stroke is generated. The above process is repeated to complete the recognition of the picture content, thereby determining the picture title content corresponding to the data picture. The stroke equal-width algorithm is a picture area detection algorithm that can extract picture content from noisy pictures. It is achieved by extracting targets with consistent width, so that text can be recognized well.
[0038] S40, classifying the data picture according to the picture title content and preset classification rules to obtain a classification result.
[0039] Understandably, the obtained picture title content is used to classify the data picture according to the classification rules, and the classification result is determined. For example, the title of the data picture is identified as a diagnosis certificate. According to the preset classification rules, it can be known that the data picture corresponding to the diagnosis certificate should belong to the category of hospital diagnosis certificate. The title of the data picture is identified as a resident identity card. According to the preset classification rules, it can be known that the data picture corresponding to the resident identity card should belong to the category of identity proof. In this way, all data pictures are classified and the classification result is obtained. The classification rule is to assign the corresponding data picture to the corresponding position according to the obtained picture title content, and the classification result is the result after assigning the data picture to the corresponding position or major category.
[0040] The embodiment of the present invention achieves the deletion of non-data images through image screening, thereby avoiding the leakage of user privacy images, realizes the rapid extraction of key information in the image through image title recognition, speeds up the data review, improves the accuracy of text recognition by using the stroke equal width algorithm, and classifies the data images through the data image titles and preset classification rules, thereby improving the efficiency and accuracy of image classification and further improving the user experience.
[0041] In one embodiment, if Figure 3 As shown, in step S20, the image content of all relevant images is recognized by a preset recognition model to filter out the data images from all the relevant images, including:
[0042] S201, performing a screening process on the relevant pictures based on the portrait ratio by using the preset recognition model, so as to screen out portrait screening pictures from all the relevant pictures.
[0043] It can be understood that the preset recognition model includes a portrait recognition model, and the relevant pictures are input into the portrait recognition model for picture content recognition, and all relevant pictures are screened according to the recognized picture content. The screening is based on the portrait ratio to determine the portrait screening pictures from all the relevant pictures, that is, to screen out the relevant pictures that meet the portrait ratio. For example, the relevant pictures are screened for portrait ratio, the portrait ratio on the ID card is 0.2, the portrait ratio of the proof material picture is 0, the portrait ratio of the selfie picture or the picture of others taken is 0.8, and the portrait ratio of the landscape picture is 0. The preset portrait ratio threshold is 0.25, and the pictures corresponding to the portrait ratio higher than the preset portrait ratio threshold are deleted, that is, the selfie pictures or the pictures of others taken are deleted, and the ID card, landscape pictures and proof material pictures are retained. The portrait recognition model is a neural network model that calculates the portrait ratio in the picture.
[0044] S202: Perform color ratio-based screening processing on the relevant pictures through the preset recognition model to screen out color screening pictures from all the relevant pictures.
[0045] It can be understood that the preset recognition model includes a color recognition model, and the relevant pictures are input into the color recognition model for picture content recognition, and all relevant pictures are screened according to the recognized picture content. The screening is based on the color ratio to determine the color screening picture from all the relevant pictures, that is, to screen out the relevant pictures that meet the color ratio. For example, the relevant pictures are screened for color ratio, the color ratio on the identity card is 0.25, the color ratio of the proof material picture is 0.1, the color ratio of the selfie picture or the picture taken of others is 0.4, and the color ratio of the landscape picture is 0.8. The preset color ratio threshold is 0.3, and the pictures corresponding to the color ratio higher than the preset color ratio threshold are deleted, that is, the selfie pictures or the pictures taken of others and the landscape pictures are deleted, and the identity card and proof material pictures are retained. The color recognition model is a neural network model that calculates the color richness ratio in the picture.
[0046] S203: Record the related pictures belonging to the portrait screening pictures and the color screening pictures as the data pictures.
[0047] Understandably, relevant pictures that meet both the portrait ratio value lower than the preset portrait ratio threshold and the color ratio value lower than the preset color ratio threshold are recorded as data pictures, that is, pictures that meet both ratio thresholds are screened out from all the relevant pictures. For example, in the above two specific embodiments, the pictures that meet the requirements include identity cards and certification materials, while other pictures do not meet the requirements. Among them, the relevant pictures may all meet the screening requirements, that is, the relevant pictures are all data pictures, and the relevant pictures may also partially meet the screening requirements, that is, only a part of the relevant pictures are data pictures, and the other part are non-data pictures that have been uploaded incorrectly.
[0048] The embodiment of the present invention realizes the screening of data pictures that meet the requirements from all the relevant pictures, realizes the deletion of non-data pictures, avoids the leakage of user privacy, realizes the rapid extraction of key information in the picture through the recognition model, speeds up the data review speed, and further improves the user experience.
[0049] In one embodiment, if Figure 4 As shown, in step S201, the relevant pictures are screened based on the portrait ratio by using the preset recognition model to screen out portrait screening pictures from all the relevant pictures, including:
[0050] S2011, performing portrait ratio recognition on the relevant pictures through a portrait recognition model to obtain a portrait ratio value corresponding to the relevant pictures; one relevant picture is associated with one portrait ratio value.
[0051] It can be understood that the portrait proportions of all the relevant pictures are identified by a preset portrait recognition model, and the portrait recognition model outputs a portrait proportion value corresponding to the relevant picture, that is, the portrait proportion value represents the numerical value of the proportion of the portrait in the corresponding relevant picture, wherein one relevant picture is associated with one portrait proportion value, for example, when an identity card picture is input into the portrait recognition model, the model outputs a portrait proportion value of 0.2, when a landscape picture is input into the portrait recognition model, the model outputs a portrait proportion value of 0, when an ID photo picture is input into the portrait recognition model, the model outputs a portrait proportion value of 0.9, and the portrait recognition model is a neural network model that identifies the portrait proportions in data pictures.
[0052] S2012: Obtain a preset portrait ratio threshold, and compare the portrait ratio value with the preset portrait ratio threshold.
[0053] It can be understood that the preset portrait ratio threshold is obtained, and then the portrait ratio value is compared with the preset portrait ratio threshold, and two comparison results will be obtained, namely greater than the portrait ratio threshold and less than or equal to the portrait ratio threshold. The portrait ratio threshold is used to limit the proportion of the portrait in the relevant picture, that is, the portrait ratio value in the relevant picture should be less than or equal to the preset portrait ratio threshold. For example, the portrait ratio threshold can be set to 0.3 or 0.25, and the portrait ratio threshold can be set according to actual needs.
[0054] S2013, recording relevant pictures corresponding to portrait ratio values that are lower than or equal to a preset portrait ratio threshold as the portrait screening pictures.
[0055] It can be understood that the relevant pictures corresponding to the portrait ratio values higher than the preset portrait ratio threshold are deleted, and the relevant pictures corresponding to the portrait ratio values lower than or equal to the preset portrait ratio threshold are recorded as the portrait screening pictures, wherein the portrait ratio in the picture of the uploaded material is higher than that in the insured person's identity proof picture, and other materials do not involve portraits. Therefore, according to actual needs, the portrait ratio threshold can be set to a lower value.
[0056] The embodiment of the present invention realizes the screening of pictures that meet the portrait ratio, deletes the related pictures that are higher than the portrait ratio threshold, avoids the leakage of user privacy pictures, and realizes accurate screening of the portrait screening pictures by setting the portrait ratio threshold.
[0057] In yet another embodiment, Figure 5 As shown, in the step S202, the relevant pictures are screened based on the color ratio by using the preset recognition model to screen out color screened pictures from all the relevant pictures, including:
[0058] S2021, performing color ratio recognition on the related pictures through a color recognition model to obtain color ratio values corresponding to the related pictures; one related picture is associated with one color ratio value.
[0059] It can be understood that the color ratios of all the related pictures are identified through a preset color recognition model, and the color recognition model outputs a color ratio value corresponding to the related picture, that is, the color ratio value represents the numerical value of the proportion of color richness in the corresponding related picture, wherein one related picture is associated with one color ratio value, the color ratio is the proportion of color richness in the related picture, and the color ratio value is the numerical value of the proportion of color richness in the related picture, and the color recognition model is a neural network model that identifies the proportion of color richness in the data picture.
[0060] S2022: Obtain a preset color ratio threshold, and compare the color ratio value with the preset color ratio threshold.
[0061] It can be understood that the preset color ratio threshold is obtained, and then the color ratio value is compared with the preset color ratio threshold, and two comparison results will be obtained, namely greater than the color ratio threshold and less than or equal to the color ratio threshold. The color ratio threshold is used to limit the proportion of color richness in the relevant picture, that is, the color ratio value in the relevant picture should be less than or equal to the preset color ratio threshold. For example, the color ratio threshold can be set to 0.3 or 0.2, and the color ratio threshold can be set according to actual needs.
[0062] S2023, recording the relevant pictures corresponding to the color ratio values that are lower than or equal to the preset color ratio threshold as the color screening pictures.
[0063] It can be understood that the relevant pictures corresponding to the color ratio values higher than the preset color ratio threshold are deleted, and the relevant pictures corresponding to the color ratio values lower than or equal to the preset color ratio threshold are recorded as the color screening pictures, among which the color ratio in the picture of the uploaded material is higher than that in the insured person's identity proof picture, and the material pictures with black text on a white background in other materials do not involve color richness. Therefore, the color ratio threshold can be set to a lower value according to actual needs.
[0064] The embodiment of the present invention realizes the screening of pictures that meet the color ratio, realizes accurate screening of the color screening pictures by setting the color ratio threshold, realizes the deletion of related pictures with a color ratio higher than the color ratio threshold, and avoids the leakage of user privacy pictures.
[0065] In one embodiment, if Figure 6 As shown, in step S2021, color ratio recognition is performed on the relevant picture by using a color recognition model to obtain a color ratio value corresponding to the relevant picture, including:
[0066] S20211, perform edge detection on the relevant picture, determine the target detection area in the relevant picture, and extract the target area picture from the target detection area of the relevant picture.
[0067] Understandably, when taking photos of materials, the surrounding environment is often photographed. Before calculating the portrait ratio and color ratio of the photo, the edges of the relevant pictures should be detected, the target detection area in the relevant pictures should be determined, and the corresponding target area pictures should be extracted from the target detection area of the relevant pictures. The edge detection can adopt algorithms such as Roberts edge detection algorithm, Sobel edge detection algorithm, Prewitt edge detection algorithm and Canny edge detection algorithm. The process of the Canny edge detection algorithm is to apply Gaussian filtering to smooth the image in order to remove noise, find the intensity gradient of the image, apply non-maximum suppression technology to eliminate edge false detection, and apply double thresholds. The method is used to determine the boundary. The purpose is to complete non-maximum suppression. What is displayed on the image is many discrete points. Therefore, the points that are truly edges should be connected, isolated noise points should be removed, and hysteresis technology should be used to track the boundary. The advantages are low error rate, that is, the real edge points are extracted as much as possible, and non-edge points are not extracted as much as possible; high position accuracy, the detected edge should be as close to the real edge as possible; there is a unique response to each edge point, that is, an edge with a single pixel width is obtained. For example, when taking a photo of an ID card placed on a table, a part of the desktop may be photographed. Therefore, the edge of the ID card in the picture is detected to determine the target detection area, that is, the area of the ID card part, and extract a picture containing only the ID card from the area of the ID card part.
[0068] S20212: Process the target area image through a color comparison table to obtain an RGB value corresponding to the target area image.
[0069] Understandably, an RGB color space model is generated based on a color comparison table, the values of the RGB color space model correspond one-to-one to the colors of the color comparison table, the target area image is scanned by the RGB color space model, the values of the RGB color space model are matched with the pixels of the target area image, and the RGB values corresponding to the pixels of the target area image are obtained, wherein the RGB color comparison table is a preferred scheme, including but not limited to the RGB color comparison table, and can also be a CMYK color comparison table, a color code table, etc. The RGB color space model is a model constructed by a method of realizing color mixing by superimposing RGB three-color lights on each other.
[0070] S20213, calculating the RGB value corresponding to the target area image by a distance measurement method to obtain a color ratio value corresponding to the target area image.
[0071] It can be understood that, through the distance measurement method, the RGB values corresponding to the pixels of the target area image are calculated to obtain the color ratio value corresponding to the target area image. For example, the distance measurement method is Euclidean distance, and the Euclidean distance is used to calculate the RGB values corresponding to the pixels of the target area image. The Euclidean distance in two-dimensional space is the straight line segment distance between two points. The value of a pixel at a certain position in an image is converted into the value of the background point pixel at the closest distance to the point. The distance measurement method is a method for calculating the distance between two points in space, and the RGB value of the pixel corresponding to this point is converted into the RGB value of the pixel corresponding to another point.
[0072] The embodiments of the present invention realize the detection of the edges of the relevant pictures, avoid the distortion of recognition accuracy during the recognition process due to non-standard pictures, obtain the RGB values of the pixels of the relevant pictures through a color comparison table, and calculate the color ratio values corresponding to the target area pictures through a distance measurement method, thereby improving the accuracy of color ratio calculation.
[0073] In one embodiment, if Figure 7 As shown, in step S30, the title recognition is performed on the data picture based on the stroke equal width algorithm to determine the picture title content corresponding to the data picture, including:
[0074] S301, performing page analysis on the data picture by using a stroke equal width algorithm to obtain a standard data picture, and scanning and dividing the content of the standard data picture by using a projection histogram method to obtain at least one decomposed data picture.
[0075] Understandably, the data picture is analyzed on a page by the stroke equal width algorithm to obtain a standard data picture, the data picture page is scanned to check whether the content of the data picture is printed text, the data picture corresponding to the printed text is determined as a standard data picture, the data picture corresponding to the non-printed text is determined as a non-standard data picture, the non-standard data picture is annotated, and its content picture is manually reviewed, and the standard data picture is scanned and divided by the projection histogram method. The projection histogram method process is to scan the picture from the upper left corner, step by step from left to right, and from top to bottom, and then disassemble the content corresponding to the data picture by projection. The content is divided into lines, so that a decomposed data picture corresponding to the standard data picture can be obtained, wherein the standard data picture corresponds to at least one decomposed data picture, the page analysis is to analyze whether the content of the data picture is printed text, the standard data picture is the data picture content is printed text, the non-standard data picture is the data picture content is not printed text, the projection histogram is a series of vertical stripes of unequal heights representing the text distribution, that is, the data is disassembled into lines of content and then represented by a histogram, and then the content corresponding to the data picture is scanned and divided by projection, and the decomposed data picture is a picture that divides the data content into lines of content.
[0076] S302, dividing all the decomposed data pictures into equal widths by a connected domain analysis method to obtain character content pictures corresponding to the decomposed data pictures.
[0077] It can be understood that all the decomposed data pictures obtained by the connected domain analysis method are divided into equal widths, that is, the characters of the divided lines are cut into characters one by one, so as to obtain the character content picture corresponding to the decomposed data picture, wherein one decomposed data picture corresponds to at least one character content picture, and the connected domain is an area composed of pixels with the same pixel value and adjacent positions in the picture, and the connected domain analysis is to find out the connected domains independent of each other and mark them through four-connectivity or eight-connectivity, and the four-connectivity is the four adjacent positions of the upper, lower, left and right of the corresponding pixel position, and the eight-connectivity area is the eight adjacent positions and diagonally adjacent positions of the upper, lower, left, right, upper left, upper right, lower left and lower right of the corresponding position, and the character content picture is a picture in which the data content is divided into characters one by one.
[0078] S303, performing width recognition on the character content picture to obtain a title area corresponding to the character content picture, and extracting picture title content from the title area.
[0079] It can be understood that the obtained character content image is subjected to width recognition, and the character area with the widest character width or the largest font size is used as the title area of the data image, and the image title content corresponding to the data image is extracted from the text in the title area. The image width is the width value from the leftmost to the rightmost side of the character, and the font size is the value of the text size. The title area is the character area with the widest character width or the largest font size, and the image title content is the content of the characters in the title area. For example, after identifying the front of the ID card, the corresponding content can be obtained, such as the country name, resident ID card, issuing agency and issuing time. These contents are identified and the character area with the widest character width or the largest font size is determined as the title area. Through comparison, it is found that the character width corresponding to the resident ID card is the widest and the font size is the largest. This area is used as the title area, and the text resident ID card in the title area is extracted, and the resident ID card is used as the image title content.
[0080] The embodiment of the present invention realizes the recognition and division of the content of the data picture through the stroke equal width algorithm and the projection histogram method, realizes the accurate division of the characters in the content picture through the connected domain analysis method, realizes the extraction of the picture title content through the recognition of character width, facilitates the recognition and understanding of the picture content, realizes the extraction of key information in the picture, and improves the accuracy of text recognition.
[0081] In one embodiment, if Figure 8 As shown, in step S303, width recognition is performed on the character content picture to obtain a title area corresponding to the character content picture, and the picture title content is extracted from the title area, including:
[0082] S3031, performing convolution feature extraction on the title area to obtain a convolution feature map corresponding to the title area.
[0083] It can be understood that after obtaining the title area, the CNN convolutional network (Convolutional Neural Network) in the CRNN algorithm is used to perform convolutional feature extraction on the title area to obtain a convolutional feature map corresponding to the title area, and the size of the input image is converted into the corresponding convolutional feature map, for example, a picture of size (32, 100, 3) is converted into a convolutional feature matrix of size (1, 25, 512). The core of the convolutional network is the convolutional layer, each convolutional layer is composed of several convolutional units, and the parameters of each convolutional unit are optimized by the back propagation algorithm. The purpose of the convolution operation is to extract different features of the input. The first convolutional layer may only extract some low-level features such as edges, lines, and corners. Networks with more layers can iteratively extract more complex features from low-level features.
[0084] S3032, performing text sequence feature extraction on the convolution feature map to obtain a text sequence feature map corresponding to the convolution feature map, and extracting a title content image of a title area from the text sequence feature map.
[0085] It can be understood that the convolution feature map is input into the LSTM recurrent network (Long Short Term Memory, recurrent neural network), and the text sequence feature is extracted from the convolution feature map through the LSTM recurrent network, that is, the text sequence feature is further extracted on the basis of the convolution feature to obtain a text sequence feature map corresponding to the convolution feature map, and the text in the text sequence feature map is recognized to obtain a title content picture corresponding to the title area, and the title content picture corresponding to the title area is the text content picture of the title area. The LSTM recurrent network introduces the sigmoid function through the input gate, the forget gate, and the output gate and combines it with the tanh function, and adds a summation operation to reduce the possibility of gradient vanishing and gradient exploding. The sigmoid function is the activation function of the neural network, and the tanh function is the activation function of the neural network.
[0086] S3033, performing character alignment processing on the title content picture in the title area to obtain the picture title content corresponding to the data picture.
[0087] It is understandable that the characters in the title content picture corresponding to the title area obtained by CRNN (Convolutional Recurrent Neural Network) are not aligned, and it is necessary to perform character alignment processing on the obtained title content picture through CTC (Connectionist Temporal Classification) and perform prediction sequence processing on the text sequence feature map, and determine the title content picture of the title area as the picture title content corresponding to the data picture. The CTC is mainly used to solve the alignment problem of input features and output labels.
[0088] The embodiment of the present invention realizes the extraction of the convolution feature map of the text content in the title area through the CNN convolutional network, realizes the extraction of the text sequence feature map of the convolution feature map through the LSTM recurrent network, realizes the alignment of the characters of the output title content image through CTC, realizes the extraction of key information in the image, improves the accuracy of text recognition, and further improves the user experience.
[0089] In one embodiment, after step S40, that is, according to the picture title content and the preset classification rules, the data picture is classified and processed, and after the classification result is obtained, the following steps are included:
[0090] According to the classification result, the classified data picture is checked for completeness, and when it is found that the data picture is incomplete, the user is reminded to supplement the missing data picture.
[0091] Understandably, after the data images are classified according to the classification rules, the classification results are checked for completeness, and the number of data images in all the proof materials is checked. When it is detected that the number of data images in all the proof materials is complete, the current review of the data is terminated and the next process is entered. When it is detected that the data images in a part of the proof materials are incomplete, that is, the relevant data images are missing, the user is reminded to supplement the missing data images. For example, in a specific embodiment, the classification rules are 5 categories and 16 data images, among which the original voucher of medical expenses is 6 data images, the detailed list of medical expenses is 2 data images, the outpatient medical record or emergency medical record is 3 data images, the insured person's identity certificate is 2 data images, and the hospitalization medical record is 3 data images. The number of data images in each category is checked. When the number of data images of all the proof materials is the same as the set number, the current process is terminated and the next process is entered. When it is detected that the number of data images of a certain type of proof materials is insufficient, the user is reminded to supplement the missing data images, that is, when it is detected that there are only 2 data images in the hospitalization medical record, the user is reminded to supplement the missing data images of the hospitalization medical record.
[0092] The embodiment of the present invention realizes the detection of the integrity of the classified data picture, and realizes reminding the user to supplement the data picture when the data picture is missing, thereby avoiding the user's review process time being extended due to the missing data picture, and further improving the user experience.
[0093] In one embodiment, after step S301, that is, after the data picture is analyzed by the stroke equal width algorithm to obtain the standard data picture, the following steps are included:
[0094] The non-standard data picture is marked and transmitted to the next process for review.
[0095] It can be understood that the non-standard data picture is a related picture whose content is non-printed text. After the uploaded data picture is analyzed on the page, the corresponding standard data picture and non-standard data picture will be obtained. The non-standard data picture cannot be analyzed by the stroke equal width algorithm to obtain the corresponding title content picture. The non-standard data picture will be marked and passed to the next process for manual title review, and the reviewed data picture will be allocated according to the allocation rules.
[0096] The embodiment of the present invention realizes the marking and review of non-standard data images. The staff only needs to review the marked data images, which improves the efficiency of manual review, reduces the investment cost of manual review, and speeds up the data review process.
[0097] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0098] In one embodiment, a picture classification device is provided, which corresponds one-to-one to the picture classification method in the above embodiment. Fig. 9 As shown, the image classification device includes an acquisition module 11, a screening module 12, a recognition module 13 and a classification module 14. The functional modules are described in detail as follows:
[0099] An acquisition module 11 is used to acquire relevant pictures;
[0100] A screening module 12 is used to perform picture content recognition on all relevant pictures by using a preset recognition model, so as to screen out material pictures from all the relevant pictures;
[0101] An identification module 13 is used to perform title identification on the data picture based on a stroke equal width algorithm to determine the picture title content corresponding to the data picture;
[0102] The classification module 14 is used to classify the data pictures according to the picture title content and preset classification rules to obtain classification results.
[0103] In one embodiment, the screening module 12 includes:
[0104] A portrait screening unit, configured to perform screening processing on the relevant pictures based on the portrait proportions by using the preset recognition model, so as to screen out portrait screening pictures from all the relevant pictures;
[0105] A color screening unit, configured to perform a color ratio-based screening process on the relevant pictures by using the preset recognition model, so as to screen out color screening pictures from all the relevant pictures;
[0106] The picture recording unit is used to record related pictures belonging to the portrait screening picture and the color screening picture as the data pictures.
[0107] In one embodiment, the portrait screening unit includes:
[0108] A portrait recognition unit, configured to perform portrait ratio recognition on the relevant pictures through a portrait recognition model to obtain a portrait ratio value corresponding to the relevant pictures; one relevant picture is associated with one portrait ratio value;
[0109] A portrait comparison unit, used to obtain a preset portrait ratio threshold, and compare the portrait ratio value with the preset portrait ratio threshold;
[0110] The portrait determination unit is used to record the relevant pictures corresponding to the portrait ratio values less than or equal to the preset portrait ratio threshold as the portrait screening pictures.
[0111] In one embodiment, the color screening unit includes:
[0112] A color recognition unit, configured to perform color ratio recognition on the related pictures through a color recognition model to obtain a color ratio value corresponding to the related pictures; one related picture is associated with one color ratio value;
[0113] A color comparison unit, used to obtain a preset color ratio threshold, and compare the color ratio value with the preset color ratio threshold;
[0114] The color determination unit is used to record the relevant pictures corresponding to the color ratio values lower than or equal to the preset color ratio threshold as the color screening pictures.
[0115] In one embodiment, the color recognition unit includes:
[0116] A detection subunit, configured to perform edge detection on the relevant picture, determine a target detection area in the relevant picture, and extract a target area picture from the target detection area of the relevant picture;
[0117] A comparison subunit, used to process the target area image through a color comparison table to obtain an RGB value corresponding to the target area image;
[0118] The calculation subunit is used to calculate the RGB value corresponding to the target area image by using a distance measurement method to obtain a color ratio value corresponding to the target area image.
[0119] In one embodiment, the identification module 13 includes:
[0120] An analysis unit, configured to perform page analysis on the data picture by using a stroke equal width algorithm to obtain a standard data picture, and to scan and divide the content of the standard data picture by using a projection histogram method to obtain at least one decomposed data picture;
[0121] A segmentation unit, used for segmenting all the decomposed data pictures into equal widths by a connected domain analysis method to obtain character content pictures corresponding to the decomposed data pictures;
[0122] The recognition unit is used to perform width recognition on the character content picture, obtain a title area corresponding to the character content picture, and extract the picture title content from the title area.
[0123] In one embodiment, the identification unit comprises:
[0124] A convolution subunit, configured to perform convolution feature extraction on the title area to obtain a convolution feature map corresponding to the title area;
[0125] A sequence subunit, configured to extract text sequence features from the convolution feature map to obtain a text sequence feature map corresponding to the convolution feature map, and extract a title content image of a title area from the text sequence feature map;
[0126] The alignment subunit is used to perform character alignment processing on the title content picture in the title area to obtain the picture title content corresponding to the data picture.
[0127] For the specific definition of the image classification device, please refer to the definition of the image classification method above, which will not be repeated here. Each module in the above-mentioned image classification device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0128] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium and an internal memory. The readable storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the readable storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for classifying images is implemented.
[0129] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the image classification method in the above embodiment is implemented when the processor executes the computer program.
[0130] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the image classification method in the above embodiment is implemented.
[0131] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0132] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0133] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for image classification, characterized in that: include: Get relevant pictures; Performing picture content recognition on all relevant pictures through a preset recognition model to filter out data pictures from all the relevant pictures; Performing title recognition on the data picture based on a stroke equal width algorithm to determine the content of the picture title corresponding to the data picture; Classify the data picture according to the picture title content and preset classification rules to obtain a classification result; The process of performing picture content recognition on all relevant pictures by using a preset recognition model to filter out data pictures from all relevant pictures includes: Performing a screening process on the relevant pictures based on the portrait ratio by using the preset recognition model, so as to screen out the portrait screening pictures from all the relevant pictures; Performing a color ratio-based screening process on the relevant pictures by using the preset recognition model to screen out color screening pictures from all the relevant pictures; Recording related pictures belonging to the portrait screening picture and the color screening picture as the data pictures; The screening process based on the portrait ratio is performed on the relevant pictures by using the preset recognition model to screen out the portrait screening pictures from all the relevant pictures, including: Performing portrait ratio recognition on the relevant pictures through a portrait recognition model to obtain a portrait ratio value corresponding to the relevant pictures; one relevant picture is associated with one portrait ratio value; Obtaining a preset portrait ratio threshold, and comparing the portrait ratio value with the preset portrait ratio threshold; Recording relevant pictures corresponding to portrait ratio values that are lower than or equal to a preset portrait ratio threshold as the portrait screening pictures; The performing a screening process based on a color ratio on the relevant pictures by using the preset recognition model to screen out a color screening picture from all the relevant pictures includes: Performing color ratio recognition on the related pictures through a color recognition model to obtain a color ratio value corresponding to the related pictures; one related picture is associated with one color ratio value; Obtaining a preset color ratio threshold, and comparing the color ratio value with the preset color ratio threshold; The relevant pictures corresponding to the color ratio values lower than or equal to the preset color ratio threshold are recorded as the color screening pictures.
2. The image classification method according to claim 1, characterized in that: The step of performing color ratio recognition on the relevant picture by using a color recognition model to obtain a color ratio value corresponding to the relevant picture includes: Performing edge detection on the relevant picture, determining a target detection area in the relevant picture, and extracting a target area picture from the target detection area of the relevant picture; Processing the target area image through a color comparison table to obtain an RGB value corresponding to the target area image; The RGB value corresponding to the target area image is calculated by a distance measurement method to obtain a color ratio value corresponding to the target area image.
3. The image classification method according to claim 1, characterized in that: The performing title recognition on the data picture based on the stroke equal width algorithm to determine the picture title content corresponding to the data picture includes: Performing page analysis on the data picture by using a stroke equal width algorithm to obtain a standard data picture, and scanning and dividing the content of the standard data picture by using a projection histogram method to obtain at least one decomposed data picture; All the decomposed data pictures are segmented into equal widths by a connected domain analysis method to obtain character content pictures corresponding to the decomposed data pictures; The character content picture is subjected to width recognition to obtain a title area corresponding to the character content picture, and the picture title content is extracted from the title area.
4. The image classification method according to claim 3, characterized in that: The step of obtaining a title area corresponding to the character content picture and extracting the picture title content from the title area includes: Performing convolution feature extraction on the title area to obtain a convolution feature map corresponding to the title area; Performing text sequence feature extraction on the convolution feature map to obtain a text sequence feature map corresponding to the convolution feature map, and extracting a title content image of a title area from the text sequence feature map; Character alignment is performed on the title content image in the title area to obtain the image title content corresponding to the data image.
5. A picture classification device, characterized in that: include: Acquisition module, used to acquire relevant pictures; A screening module, used to perform picture content recognition on all relevant pictures through a preset recognition model, so as to screen out material pictures from all the relevant pictures; A recognition module, used for performing title recognition on the data picture based on a stroke equal width algorithm to determine the picture title content corresponding to the data picture; A classification module, used to classify the data picture according to the picture title content and preset classification rules to obtain a classification result; The screening module comprises: A portrait screening unit, configured to perform screening processing on the relevant pictures based on the portrait proportions by using the preset recognition model, so as to screen out portrait screening pictures from all the relevant pictures; A color screening unit, configured to perform a color ratio-based screening process on the relevant pictures by using the preset recognition model, so as to screen out color screening pictures from all the relevant pictures; A picture recording unit, used for recording related pictures belonging to the portrait screening picture and the color screening picture as the data picture; The portrait screening unit comprises: A portrait recognition unit, configured to perform portrait ratio recognition on the relevant pictures through a portrait recognition model to obtain a portrait ratio value corresponding to the relevant pictures; one relevant picture is associated with one portrait ratio value; A portrait comparison unit, used to obtain a preset portrait ratio threshold, and compare the portrait ratio value with the preset portrait ratio threshold; A portrait determination unit, configured to record relevant pictures corresponding to portrait ratio values lower than or equal to a preset portrait ratio threshold as the portrait screening pictures; The color screening unit comprises: A color recognition unit, configured to perform color ratio recognition on the related pictures through a color recognition model to obtain a color ratio value corresponding to the related pictures; one related picture is associated with one color ratio value; A color comparison unit, used to obtain a preset color ratio threshold, and compare the color ratio value with the preset color ratio threshold; The color determination unit is used to record the relevant pictures corresponding to the color ratio values lower than or equal to the preset color ratio threshold as the color screening pictures.
6. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the image classification method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the image classification method according to any one of claims 1 to 4 is implemented.
