Bank card number identification method and device, equipment, storage medium and program product
The bank card area contour is extracted through a fully convolutional neural network, combined with clustering segmentation and image text recognition algorithms, the problem of insufficient accuracy in identifying bank card numbers is solved, and efficient and accurate bank card numbers are achieved.
Patent Information
- Application Number
- CN202411880482.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-03-21
AI Technical Summary
When the prior art recognizes complex backgrounds and diverse bank cards, the bank card number identification accuracy is insufficient, making it difficult to meet the demand for fast and accurate identification in the financial technology field.
By inputting the image to be identified into a fully convolutional neural network, the bank card area outline information is extracted, and the bank card number character image is further extracted in combination with the clustering segmentation algorithm, and finally the image text recognition algorithm is used to identify the bank card number.
It significantly improves the robustness and accuracy of bank card number recognition, effectively isolates complex background interference, ensures the integrity and clarity of characters, and meets the needs of fast and accurate identification in the financial technology field.
Smart Images

Figure CN119672728A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of financial technology and other technical fields, and in particular to a bank card number recognition method, device, equipment, storage medium and program product. Background Art
[0002] With the rapid development of financial technology, bank card styles are becoming more diverse, and the complexity of the card surface is becoming higher and higher. How to obtain bank card number information faster and more accurately has become a focus of the financial industry. Common deep learning methods can obtain bank card numbers from ordinary card surfaces, but if the background is complex, the accuracy is relatively low.
[0003] In the related art, there are two methods for identifying bank card numbers: using OCR technology to identify and inputting bank card images into a neural network for identification. However, the styles of different bank cards vary greatly, and the recognition effects of these two methods cannot guarantee the accuracy of bank card number recognition. Summary of the invention
[0004] The present application provides a bank card number recognition method, device, equipment, storage medium and product to solve the problem of insufficient recognition accuracy of bank card numbers in related technologies.
[0005] In a first aspect, the present application provides a bank card number recognition method, comprising:
[0006] The image to be identified is input into a fully convolutional neural network, and the contour information of the area where the bank card is located in the image to be identified is output, where the image to be identified is an image of a bank card containing the bank card number to be extracted;
[0007] Combine the contour information with the image to be recognized to obtain a target area image of the area where the bank card number is located;
[0008] Input the target area image into the clustering segmentation algorithm, and output the character image corresponding to the bank card number in the target area image;
[0009] Based on the image text recognition algorithm, identify the bank card number corresponding to the character image.
[0010] In a second aspect, the present application provides a bank card number recognition device, comprising:
[0011] An extraction module, used for inputting the image to be identified into a fully convolutional neural network, and outputting contour information of the area where the bank card is located in the image to be identified, wherein the image to be identified is an image of a bank card containing the bank card number to be extracted;
[0012] A combining module is used to combine the contour information with the image to be identified to obtain a target area image of the area where the bank card number is located;
[0013] A segmentation module, used to input the target area image into the clustering segmentation algorithm and output the character image corresponding to the bank card number in the target area image;
[0014] The recognition module is used to recognize the bank card number corresponding to the character image based on the image text recognition algorithm.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0016] The memory stores computer-executable instructions;
[0017] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.
[0019] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0020] The bank card number recognition method, device, equipment, storage medium and program product provided by the embodiment of the present disclosure input the image to be recognized into a full convolutional neural network, output the contour information of the area where the bank card is located in the image to be recognized, and then combine the contour information with the image to be recognized to obtain the target area image of the area where the bank card number is located, and then input the target area image into the clustering segmentation algorithm, output the character image corresponding to the bank card number in the target area image, and finally recognize the bank card number corresponding to the character image based on the image text recognition algorithm. Thus, the image to be recognized is processed by the full convolutional neural network, and the contour of the area where the bank card is located is accurately extracted, thereby effectively isolating the interference of the complex background. By using the clustering segmentation algorithm to process the target area image, the character image corresponding to the bank card number is further extracted to ensure the integrity and clarity of the characters. Finally, the character image is recognized by the image text recognition algorithm to accurately extract the bank card number information. By combining multiple algorithms, the problem of insufficient recognition accuracy caused by background complexity and style diversity is effectively solved, the robustness and accuracy of bank card number recognition are significantly improved, and the demand for fast and accurate recognition in the field of financial technology is met. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0022] Figure 1 An application scenario diagram of the bank card number recognition method provided by the embodiment of the present disclosure;
[0023] Figure 2 A flow chart of a bank card number recognition method provided by one embodiment of the present disclosure;
[0024] Figure 3 A flow chart of a bank card number recognition method provided by yet another embodiment of the present disclosure;
[0025] Figure 4 A schematic diagram of the structure of a bank card number recognition device provided by another embodiment of the present disclosure;
[0026] Figure 5 A schematic diagram of the structure of an electronic device provided by one embodiment of the present disclosure.
[0027] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0028] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0029] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0030] In addition, this application involves conducting big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and using artificial intelligence technology to make automated decisions, and making technical solutions that have a significant impact on personal rights and interests based on the results of automated decisions. The application provides users with corresponding operation entrances for them to choose to agree or reject the results of automated decisions; if the user chooses to reject, the expert decision-making process will be entered.
[0031] It should be noted that the bank card number identification method, device, equipment, storage medium and product provided in this application can be used in the field of financial technology, and can also be used in any field other than the field of financial technology. The application field of the bank card number identification method, device, equipment, storage medium and product in this application is not limited.
[0032] Figure 1 A schematic diagram of an application scenario of the bank card number recognition method provided in this application, such as Figure 1 As shown, during the bank card number recognition process, the server 100 receives the uploaded bank card image 110 and recognizes the bank card number 120 therein, thereby completing the bank card number recognition process.
[0033] It should be noted that Figure 1 The scene shown includes only one or a specific number of servers, bank card images, and bank card numbers for illustration, but the present disclosure is not limited to this, that is, the number of servers, bank card images, and bank card numbers can be arbitrary.
[0034] With the rapid development of financial technology, the design of bank cards has become more diverse, and the complexity of the card surface has continued to increase. This change is not only reflected in the diversity of colors and patterns, but also in the differences in design elements such as fonts, font sizes, and card number positions. These changes have brought challenges to the automatic recognition of bank card numbers, especially in complex backgrounds, where traditional methods are easily disturbed, resulting in a decrease in recognition accuracy.
[0035] In the existing technology, although the deep learning method performs well when processing ordinary card images, its recognition effect is still unsatisfactory when facing bank cards with complex backgrounds and various styles. In addition, bank card images may be affected by factors such as lighting conditions, shooting angles, partial occlusion and wear in actual applications, which increase the difficulty of recognition. Therefore, how to quickly and accurately obtain bank card number information in a changing environment has become a technical problem that needs to be solved urgently in the financial industry.
[0036] In addition, due to the limited system performance in the banking-related field, it is very difficult to achieve automatic recognition of bank card numbers while meeting the requirements of practical applications in terms of processing speed and resource consumption. Therefore, there is a lack of solutions in the existing technology that can effectively achieve fast and accurate bank card number recognition.
[0037] The bank card number recognition method provided in this application accurately extracts the bank card area through a fully convolutional neural network, overcomes the interference of complex backgrounds, and ensures the focus of recognition. Subsequently, combined with the clustering segmentation algorithm, the bank card number character image is further extracted to ensure the integrity and clarity of the characters. Finally, the image text recognition algorithm is used to accurately identify the bank card number information. This solution gradually reduces background interference through step-by-step processing, improves the robustness and accuracy of recognition, and effectively solves the recognition problems caused by the diversity of bank card styles and background complexity.
[0038] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0039] Figure 2 Schematic diagram of the bank card number recognition method provided for this application Figure 1 ,like Figure 2 As shown, the method includes:
[0040] S201, input the image to be identified into a fully convolutional neural network, and output the contour information of the area where the bank card is located in the image to be identified.
[0041] The image to be identified is an image of a bank card containing a bank card number to be extracted.
[0042] Specifically, this step is used to summarize the main steps of the bank card number recognition process.
[0043] The executor of the embodiment of the present disclosure is a computer or a data processing system in a server that recognizes and processes bank card number images. For the sake of convenience, they are collectively referred to as servers below.
[0044] Banks can use various devices (such as self-service equipment, ATM machines, scanners, etc.) to take images of bank cards whose bank card numbers need to be identified and upload them to the server. Users with business needs can also take photos of their bank cards and upload them to the server. After receiving the corresponding image, the server will determine it as an image to be identified.
[0045] When performing recognition, the server first inputs the image to be recognized into a fully convolutional neural network (FCN in English) to output the contour information of the area where the bank card is located.
[0046] The fully convolutional neural network is a deep learning model, which is a pre-trained neural network specifically used for pixel-level prediction of images. Compared with the traditional convolutional neural network (CNN), FCN can process input images of any size and output prediction results of the same size as the input image, thus ensuring its processing effect in image segmentation tasks.
[0047] In this step, the role of FCN is to identify the location of the bank card in the image, determine the area of the bank card number in the image, and then extract the contour information of the area (target area).
[0048] To ensure its recognition accuracy, images including diverse bank card images and their corresponding annotated contours can be used as training data sets to train FCN to ensure that the model can adapt to different bank card styles and background complexities.
[0049] S202: Combine the contour information with the image to be recognized to obtain a target area image of the area where the bank card number is located.
[0050] Specifically, after the FCN performs preliminary contour recognition, the server needs to combine the obtained contour information with the original image to be recognized to generate a target area image of the bank card number area. Thus, by using the contour information, the bank card area can be accurately extracted from the complex background, thereby reducing the interference of the background on subsequent processing steps.
[0051] A specific combination method is to apply the contour information as a mask to the original image, and the area marked as foreground in the mask is the area where the bank card is located. The image within the contour range can also be extracted based on the contour information to obtain the target area image.
[0052] Thus, a target area image containing only the relevant part of the bank card can be generated, thereby improving the accuracy of subsequent character extraction, reducing the waste of computing resources, and improving image processing efficiency.
[0053] S203: Input the target area image into a clustering segmentation algorithm, and output a character image corresponding to the bank card number in the target area image.
[0054] Specifically, since the bank card number characters in the target area image may be the same or similar in color to the background color of the target area, the server will then input the target area image into a clustering segmentation algorithm to output a character image corresponding to the bank card number. The goal of the clustering segmentation algorithm is to identify and separate the individual characters of the bank card number.
[0055] The specific clustering segmentation algorithm may adopt K-means clustering or a segmentation method based on image gradient, which is not limited here.
[0056] S204: Based on an image text recognition algorithm, identify the bank card number corresponding to the character image.
[0057] Specifically, the character image only includes the characters of the bank card number that need to be recognized, but does not include the background. At this time, recognition through the image text recognition (OCR) algorithm can maximize the accuracy and robustness of extracting the bank card number information from the character image.
[0058] Since the bank card number recognition difficulty is relatively low at this time, those skilled in the art may choose any existing OCR algorithm, and no limitation is made here.
[0059] In some embodiments, to ensure the accuracy and completeness of the recognition results, post-processing steps such as verification and validation may be combined after recognition by the OCR algorithm to further improve the reliability of bank card number recognition.
[0060] The bank card number recognition method provided in the embodiment of the present application is to input the image to be recognized into a fully convolutional neural network, output the contour information of the area where the bank card is located in the image to be recognized, and then combine the contour information with the image to be recognized to obtain the target area image of the area where the bank card number is located, and then input the target area image into the clustering segmentation algorithm, output the character image corresponding to the bank card number in the target area image, and finally recognize the bank card number corresponding to the character image based on the image text recognition algorithm. Thus, the image to be recognized is processed by the fully convolutional neural network, and the contour of the area where the bank card is located is accurately extracted, thereby effectively isolating the interference of the complex background. By using the clustering segmentation algorithm to process the target area image, the character image corresponding to the bank card number is further extracted to ensure the integrity and clarity of the characters. Finally, the character image is recognized by the image text recognition algorithm to accurately extract the bank card number information. By combining multiple algorithms, the problem of insufficient recognition accuracy caused by background complexity and style diversity is effectively solved, the robustness and accuracy of bank card number recognition are significantly improved, and the demand for fast and accurate recognition in the field of financial technology is met.
[0061] Figure 3 Schematic diagram of the bank card number recognition process provided for this application Figure 2 ,like Figure 3 As shown, in this embodiment Figure 2 Based on the embodiment, the specific process of the bank card number recognition method is described in detail. The method includes:
[0062] S301, input the image to be recognized into the input layer of the full convolutional neural network, and perform convolution processing on the image to be recognized through convolution blocks in sequence to obtain an image after convolution processing.
[0063] Specifically, this embodiment is used to illustrate the detailed process of bank card number recognition.
[0064] In the disclosed embodiment, the fully convolutional neural network includes an input layer, five convolution blocks and three convolution layers connected in sequence, each convolution block includes at least two convolution layers, and the convolution layer in each convolution block uses a convolution kernel of size 3*3 (actually also including the output layer, classifier, pooling layer between convolution layers, etc., these parts are the same as the existing common FCN network, so they are not described separately here).
[0065] Specifically, compared with other FCN networks, in this scheme, in order to reduce the number of parameters while ensuring the feature extraction effect, making the calculation cost smaller and the convergence speed faster, the network uses 3*3 convolution kernels to perform network layer convolution operations.
[0066] In some embodiments, the FCN network can adopt the VGG19 basic network model (VGG19 is a common model in the art and is not further explained here) to take advantage of the 11-19 layer structure of the VGG19 model. The increase in network depth will make the feature extraction during training more accurate, and the image top-1 and top-5 error rates will decrease more significantly (the top-N error rate refers to the probability that one of the top N answers given by the image recognition algorithm is wrong).
[0067] Compared with the VGG19 model, the FCN network in this scheme removes the last three fully connected layers of the VGG19 model and replaces them with three convolutional layers, so as to retain the spatial characteristics of the original image to adapt to the different sizes of bank card number X-ray images and the large distribution range of pixel sizes contained in a single bank card, thereby improving the accuracy and reliability of image processing.
[0068] The image to be recognized will be convolved and pooled multiple times through each convolution block in the FCN network. In this process, the output image will become smaller and smaller, and the resolution will become lower and lower, and finally a rough image will be obtained. In order to restore this low-resolution rough image to the original resolution so as to accurately extract its contour, it is necessary to upsample the image after convolution and pooling, which is further explained below.
[0069] For the convenience of explanation, the five convolution blocks include a first convolution block, a second convolution block, a third convolution block, a fourth convolution block, and a fifth convolution block connected in sequence; the three convolution layers include a first convolution layer, a second convolution layer, and a third convolution layer connected in sequence.
[0070] The hierarchical structure of the convolutional block includes the first to fifth convolutional blocks (the composition structure is the same as the convolutional block structure in the existing VGG19 network) to gradually extract the feature information of the image. The convolutional layer in the convolutional block extracts feature maps of different levels by performing convolution operations on the input image.
[0071] Through this multi-level convolution processing, FCN can effectively extract complex features in bank card images, laying the foundation for subsequent deconvolution and fusion processing. In the implementation process, the convolution operation performs pixel-by-pixel calculations on the image by sliding the convolution kernel to generate a feature map. The output of each convolution block is used as the input of the next convolution block to gradually extract higher-level features.
[0072] In actual operation, you can also add a pooling layer between convolution blocks to reduce the size of the feature map and improve computational efficiency. And you can add batch normalization and activation functions (such as ReLU) after the convolution layer to enhance the nonlinear expression ability and training stability of the model.
[0073] S302: Input the image output by the fifth convolution block to the first convolution layer, and output the image after the first deconvolution processing.
[0074] Among them, the first convolution layer is used to perform double deconvolution processing on the image after convolution processing.
[0075] Specifically, deconvolution (or transposed convolution) is an upsampling operation used to restore the spatial information lost during the convolution process.
[0076] In this step, the deconvolution operation can double the size of the image output by the fifth convolution block through interpolation and the inverse operation of the convolution kernel, thereby generating a higher resolution image, and then gradually restoring the spatial information of the bank card area, so as to provide higher quality input for subsequent fusion processing.
[0077] S303, performing a first fusion process on the image after the first deconvolution processing and the image output by the fourth convolution block, inputting the image after the first fusion processing into the second convolution layer, and outputting the image after the second deconvolution processing.
[0078] Among them, the second volume base layer is used to perform double deconvolution processing on the image after the first fusion processing.
[0079] Specifically, the fusion process combines feature maps of different levels (i.e., the images output by the convolutional blocks and convolutional layers) to enhance the image's detail information and feature expression capabilities. As a result, FCN can more accurately extract the contour information of the bank card area.
[0080] The specific fusion processing can be achieved by splicing or weighted averaging of feature maps, thereby combining feature information at different levels to enhance the detail expression of the image. The double deconvolution process further expands the size of the image and further restores the spatial information. In this way, the high resolution and detail retention of the feature map are ensured, providing a clearer input for subsequent processing.
[0081] In some embodiments, an activation function and batch normalization may be added after the deconvolution operation to improve the nonlinear expression capability and training stability of the model.
[0082] S304: Perform a second fusion process on the image after the second deconvolution process and the image output by the third convolution block, and input the image after the second fusion process into the third convolution layer to output contour information.
[0083] Among them, the second volume base layer is used to perform eight-fold deconvolution processing on the image after the second fusion processing.
[0084] Specifically, through a larger deconvolution operation, the spatial resolution of the image is significantly restored, making the image information of the bank card area clearer and more complete. Through the second fusion process, the detail expression of the feature map is further enhanced to ensure the accuracy of the contour information extracted from it.
[0085] Through this multi-level fusion and deconvolution operation, FCN can effectively extract the contour information of the bank card area, providing a reliable basis for subsequent target area image generation.
[0086] In some embodiments, regularization techniques are added to the deconvolution process to prevent overfitting and improve the generalization ability of the model, and different feature combination strategies can be used in the fusion process to optimize the expression effect of the feature map.
[0087] In some embodiments, the fully convolutional neural network is trained in the following manner:
[0088] Step A1: Use the image data containing the bank card as sample data to obtain a training data set for training a fully convolutional neural network.
[0089] Specifically, to ensure the training effect, a data set with bank card number labels or annotated with the outline information of the area where the bank card is located can be used as a training data set to ensure the diversity and representativeness of the training data to improve the generalization ability of the model.
[0090] Step A2: Input the sample data in the training data set into the pre-trained fully convolutional neural network in sequence, and output the predicted segmentation results corresponding to the sample data.
[0091] Specifically, in this solution, a pre-trained model can be used to speed up training and reduce overfitting. The fully convolutional neural network can be first trained using the commonly used ImageNet dataset.
[0092] In some embodiments, in order to prevent the gradient explosion of the full convolutional network model during training and cause the Loss value to be Nan, and to prevent the overfitting phenomenon that may occur when the full convolutional network is solved, this solution can set the batch size (used to refer to the number of data samples processed by the model, which is a common concept in model training, and the learning rate and the number of training times are not explained here) in the training process to 2, and the learning rate to 10 -4 The number of training times is set to 10. 4 Second-rate.
[0093] In actual training, the loss function of the model decreases rapidly at the beginning of training. After 8000 iterations, the loss function tends to be stable, and the final iteration termination error converges to about 0.003.
[0094] Step A3: Based on the regional area average value algorithm, filter the areas corresponding to non-bank card numbers in the predicted segmentation results.
[0095] Specifically, in order to improve recognition accuracy, the predicted segmentation results (in actual application, that is, the rough segmentation results or the preliminary segmentation results) are optimized. Since incomplete bank cards are not considered for recognition, the incomplete bank card area is calculated and the area average algorithm is used to eliminate the incomplete bank card area.
[0096] The region area average algorithm calculates the area of each connected region in the predicted segmentation result and filters out regions that are too small or too large, because these regions are usually the result of noise or mis-segmentation. This can significantly improve the purity and accuracy of the segmentation result.
[0097] During the implementation, an area threshold can be set based on actual test results to distinguish valid bank card areas from invalid noise areas. The area threshold can be determined by statistical analysis of the training data set to ensure that it is applicable to most samples.
[0098] Step A4: Based on the mathematical morphology opening method, filter the interference points in the predicted segmentation results.
[0099] Specifically, due to the influence of the tailing of the bank card recognition in the original image, the roughly segmented bank card area has tiny noise interference. The server can further filter the interference points in the predicted segmentation result based on the mathematical morphology opening method to ensure the purity of the segmentation result.
[0100] The opening operation includes two steps: erosion and dilation. First, small noise is removed by erosion, and then the overall structure of the image is restored by dilation.
[0101] In this step, the opening operation can effectively remove interference points and small artifacts in the predicted segmentation results, further improving the accuracy and clarity of the segmentation results.
[0102] In some embodiments, the server may also combine other morphological operations, such as closing operations, to enhance the edges and details of the image.
[0103] Step A5: Based on the predicted segmentation result after filtering, the pre-trained fully convolutional neural network is optimized to obtain a trained fully convolutional neural network.
[0104] Specifically, the server adjusts the weights and biases of the network so that it exhibits higher segmentation accuracy and generalization ability on the training dataset.
[0105] In the specific implementation process, the back propagation algorithm and gradient descent optimizer, such as Adam or SGD, can be used to iteratively update the network parameters. In each iteration, the loss between the predicted segmentation result and the true annotation is calculated, and the network parameters are updated according to the loss gradient, thereby completing the training of the FCN model.
[0106] S305: Combine the contour information with the image to be recognized to obtain a target area image of the area where the bank card number is located.
[0107] Specifically, the result of the rough segmentation of the FCN network may be an image including the target area and the non-target area, from which the contour information of the target area may be extracted (because the image output by the FCN network is processed multiple times, image information may be lost, and therefore, only the contour information is used).
[0108] The server maps the extracted contour information with the image to be identified, thereby completely extracting the area where the bank card number is located from the original bank card image, providing support for the subsequent extraction and segmentation to remove interference from factors such as background noise and incomplete bank card numbers.
[0109] S306: Input the target area image into a homomorphic filtering algorithm, and output the target area image after filtering.
[0110] Specifically, the homomorphic filtering algorithm enhances the visibility and clarity of the bank card number characters by processing the image in the frequency domain, providing a better input for subsequent clustering segmentation. Its specific implementation process includes converting the image to the frequency domain, enhancing the high-frequency components through a high-pass filter, and then converting the image back to the spatial domain. In this way, the uneven lighting effect can be effectively removed and the details and contrast of the image can be enhanced.
[0111] In some embodiments, other image enhancement techniques, such as histogram equalization, may be combined to further improve the quality and recognizability of the image.
[0112] S307 , input the filtered target area image into a clustering segmentation algorithm, and output a character image.
[0113] Specifically, after the above steps, the target area image needs to be further segmented by a clustering algorithm (ie, the fine segmentation stage).
[0114] In this embodiment, the clustering segmentation algorithm adopts the K-means clustering algorithm, so the processing process is to input the target area image into the K-means clustering algorithm, and output the character image corresponding to the bank card number in the target area image, wherein the initial cluster center in the K-means clustering algorithm is determined based on the K-means algorithm and the center initialization algorithm, and the clustering feature selection method in the K-means clustering algorithm is determined based on the Euclidean distance between the sample and the cluster center, and the iteration termination condition in the K-means clustering algorithm is to reach the maximum number of clustering times or the clustering result reaches the set accuracy value.
[0115] In some embodiments, in order to reduce the running time of the clustering operation while ensuring accuracy, the number of clusters K in the K-means clustering parameters can be set to 4, the number of iterations to 3, and the precision to 1.0.
[0116] In this way, the Kmeans clustering segmentation algorithm is used to cluster the bank card number and background area in the target area image obtained in the previous step to ensure the accuracy of character image segmentation. In the implementation process, the K-means algorithm iteratively updates the cluster center and assigns samples to the nearest cluster center, gradually optimizing the clustering results to ensure the accuracy of character image extraction.
[0117] S308: Binarize the character image to obtain a target image for text recognition.
[0118] Specifically, binarization converts the pixel values in the image into black and white, which enhances the contrast and edge clarity of the characters. This step provides clearer input for subsequent text recognition and ensures the accuracy of recognition.
[0119] S309: Based on the image text recognition algorithm, identify the bank card number corresponding to the target image.
[0120] Specifically, the server can use an OCR model based on deep learning, such as a convolutional recurrent neural network (CRNN) or a text recognition model combined with an attention mechanism, to perform the final card number recognition process and effectively handle the problems of uneven character spacing and character morphology changes.
[0121] By integrating multiple segmentation processing algorithms, image processing algorithms and OCR models, the robustness and accuracy of recognition can be maximized, and the amount of calculation and efficiency can be controlled to meet the high requirements of the financial technology field for bank card number recognition.
[0122] The bank card number recognition method provided by the disclosed embodiment significantly improves the accuracy and robustness of bank card number recognition through multi-level convolution and deconvolution processing, combined with technologies such as feature fusion and homomorphic filtering. The multi-layer convolution block of the fully convolutional neural network effectively extracts complex features in the image, while the deconvolution and feature fusion steps gradually restore the spatial information of the image, making the contour information of the bank card area clearer. Homomorphic filtering further enhances the contrast and visibility of the characters, providing high-quality input for subsequent K-means clustering segmentation. Through regional area filtering and morphological opening operations, the noise and interference points in the segmentation results are removed to ensure the purity of the character image. Finally, combined with the deep learning OCR algorithm, high-precision recognition of bank card numbers is achieved. The overall solution performs well in bank card images with complex backgrounds and diverse styles, meeting the needs of the financial technology field for fast and accurate recognition.
[0123] Figure 4 A schematic diagram of the structure of the bank card number recognition device provided in this application, such as Figure 4 As shown, the bank card number recognition device 400 provided in this embodiment includes:
[0124] The extraction module 410 is used to input the image to be identified into the fully convolutional neural network and output the contour information of the area where the bank card is located in the image to be identified, where the image to be identified is an image of the bank card containing the bank card number to be extracted;
[0125] A combining module 420 is used to combine the contour information with the image to be recognized to obtain a target area image of the area where the bank card number is located;
[0126] The segmentation module 430 is used to input the target area image into the cluster segmentation algorithm and output the character image corresponding to the bank card number in the target area image;
[0127] The recognition module 440 is used to recognize the bank card number corresponding to the character image based on the image text recognition algorithm.
[0128] In one possible implementation, the extraction module 410 specifically includes a fully convolutional neural network including an input layer, five convolution blocks and three convolution layers connected in sequence, each convolution block includes at least two convolution layers, and the convolution layer in each convolution block uses a convolution kernel of size 3*3.
[0129] In a possible implementation, the extraction module 410 is specifically used for: if the five convolution blocks include a first convolution block, a second convolution block, a third convolution block, a fourth convolution block and a fifth convolution block connected in sequence; the three convolution layers include a first convolution layer, a second convolution layer and a third convolution layer connected in sequence; the image to be recognized is input into the input layer of the full convolution neural network, and the image to be recognized is convolved through the convolution blocks in sequence to obtain a convolution processed image; the image output by the fifth convolution block is input into the first convolution layer, and the image after the first deconvolution processing is output, and the first convolution layer is used to convolve the image after the convolution processing Perform double deconvolution processing; perform a first fusion processing on the image after the first deconvolution processing and the image output by the fourth convolution block, and input the image after the first fusion processing into the second convolution layer, output the image after the second deconvolution processing, and the second volume base layer is used to perform double deconvolution processing on the image after the first fusion processing; perform a second fusion processing on the image after the second deconvolution processing and the image output by the third convolution block, and input the image after the second fusion processing into the third convolution layer, output contour information, and the second volume base layer is used to perform eight times deconvolution processing on the image after the second fusion processing.
[0130] In one possible implementation, the extraction module 410 is specifically used to train a fully convolutional neural network in the following manner: using image data containing a bank card as sample data to obtain a training data set for training the fully convolutional neural network; inputting the sample data in the training data set into the pre-trained fully convolutional neural network in sequence, and outputting the predicted segmentation results corresponding to the sample data; filtering the areas corresponding to non-bank card numbers in the predicted segmentation results based on the regional area average algorithm; filtering the interference points in the predicted segmentation results based on the mathematical morphology opening method; and optimizing the pre-trained fully convolutional neural network based on the predicted segmentation results after filtering to obtain a trained fully convolutional neural network.
[0131] In one possible implementation, the combining module 420 is also used to combine the contour information with the image to be identified, and after obtaining the target area image of the area where the bank card number is located, input the target area image into the homomorphic filtering algorithm, and output the filtered target area image; the segmentation module 430 is also used to input the filtered target area image into the clustering segmentation algorithm, and output the character image.
[0132] In one possible implementation, the segmentation module 430 is specifically used to input the target area image into a K-means clustering algorithm, and output a character image corresponding to the bank card number in the target area image, wherein the initial cluster center in the K-means clustering algorithm is determined based on the K-means algorithm and the center initialization algorithm, the cluster feature selection method in the K-means clustering algorithm is determined based on the Euclidean distance between the sample and the cluster center, and the iteration termination condition in the K-means clustering algorithm is reaching the maximum number of clustering times or the clustering result reaches a set accuracy value.
[0133] In a possible implementation, the recognition module 440 is specifically used to perform binarization processing on the character image to obtain a target image for text recognition; and to recognize the bank card number corresponding to the target image based on an image text recognition algorithm.
[0134] The bank card number recognition device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail in this embodiment.
[0135] Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 5 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.
[0136] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.
[0137] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0138] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.
[0139] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0140] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0141] The present application also provides a computer program product, including a computer program, which implements the method in any of the above embodiments when executed by a processor.
[0142] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method in any of the above embodiments is implemented.
[0143] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0144] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0145] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0146] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0148] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0149] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0150] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0151] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0152] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0153] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless otherwise specified, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.
[0154] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0155] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0156] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0157] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A bank card number recognition method, characterized in that: The steps include: Inputting the image to be identified into a fully convolutional neural network, and outputting the contour information of the area where the bank card is located in the image to be identified, wherein the image to be identified is an image of a bank card containing the bank card number to be extracted; Combining the outline information with the image to be recognized to obtain a target area image of the area where the bank card number is located; Inputting the target area image into a clustering segmentation algorithm, and outputting a character image corresponding to the bank card number in the target area image; Based on an image text recognition algorithm, the bank card number corresponding to the character image is identified.
2. The method according to claim 1, characterized in that: The fully convolutional neural network includes an input layer, five convolution blocks and three convolution layers connected in sequence, each convolution block includes at least two convolution layers, and the convolution layers in each convolution block use a convolution kernel of size 3*3.
3. The method according to claim 2, characterized in that The five convolution blocks include a first convolution block, a second convolution block, a third convolution block, a fourth convolution block and a fifth convolution block connected in sequence; the three convolution layers include a first convolution layer, a second convolution layer and a third convolution layer connected in sequence; The step of inputting the image to be identified into a fully convolutional neural network and outputting contour information of the area where the bank card is located in the image to be identified includes: Inputting the image to be recognized into the input layer of the fully convolutional neural network, and sequentially performing convolution processing on the image to be recognized through the convolution blocks to obtain a convolution-processed image; Inputting the image output by the fifth convolution block into the first convolution layer, and outputting the image after the first deconvolution processing, wherein the first convolution layer is used to perform double deconvolution processing on the image after the convolution processing; Performing a first fusion process on the image after the first deconvolution process and the image output by the fourth convolution block, and inputting the image after the first fusion process into the second convolution layer, outputting the image after the second deconvolution process, and the second convolution layer is used to perform a double deconvolution process on the image after the first fusion process; The image after the second deconvolution processing is fused for the second time with the image output by the third convolution block, and the image after the second fusion processing is input into the third convolution layer to output the contour information. The second convolution layer is used to perform eightfold deconvolution processing on the image after the second fusion processing.
4. The method according to claim 1, characterized in that The fully convolutional neural network is trained in the following way: Using the image data containing the bank card as sample data, a training data set for training the fully convolutional neural network is obtained; Input the sample data in the training data set into the pre-trained fully convolutional neural network in sequence, and output the predicted segmentation results corresponding to the sample data; Based on the regional area average value algorithm, filtering the area corresponding to the non-bank card number in the predicted segmentation result; Based on the mathematical morphology opening method, filtering interference points in the predicted segmentation result; Based on the predicted segmentation result after filtering processing, the pre-trained fully convolutional neural network is optimized to obtain a trained fully convolutional neural network.
5. The method according to claim 1, characterized in that After combining the contour information with the image to be recognized to obtain a target area image of the area where the bank card number is located, the method further includes: Inputting the target area image into a homomorphic filtering algorithm, and outputting the target area image after filtering; The step of inputting the target area image into a clustering segmentation algorithm and outputting a character image corresponding to the bank card number in the target area image comprises: The filtered target area image is input into a clustering segmentation algorithm, and the character image is output.
6. The method according to claim 1, characterized in that The step of inputting the target area image into a clustering segmentation algorithm and outputting a character image corresponding to the bank card number in the target area image comprises: The target area image is input into a K-means clustering algorithm, and a character image corresponding to the bank card number in the target area image is output, wherein the initial cluster center in the K-means clustering algorithm is determined based on the K-means algorithm and the center initialization algorithm, the cluster feature selection method in the K-means clustering algorithm is determined based on the Euclidean distance between the sample and the cluster center, and the iteration termination condition in the K-means clustering algorithm is reaching the maximum number of clustering times or the clustering result reaches a set accuracy value.
7. The method according to any one of claims 1 to 6, characterized in that The method of identifying the bank card number corresponding to the character image based on the image character recognition algorithm includes: Binarizing the character image to obtain a target image for character recognition; Based on the image text recognition algorithm, the bank card number corresponding to the target image is identified.
8. A bank card number recognition device, characterized in that: include: An extraction module, used for inputting an image to be identified into a fully convolutional neural network, and outputting contour information of a region where a bank card is located in the image to be identified, wherein the image to be identified is an image of a bank card containing a bank card number to be extracted; A combining module, used for combining the outline information with the image to be identified to obtain a target area image of the area where the bank card number is located; A segmentation module, used for inputting the target area image into a cluster segmentation algorithm, and outputting a character image corresponding to the bank card number in the target area image; The recognition module is used to recognize the bank card number corresponding to the character image based on an image text recognition algorithm.
9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.