Bank card number extraction method and related device
By applying the card number positioning algorithm and two-dimensional discrete wavelet transform image super-resolution model in the bank card number extraction system, the problem of high failure rate of bank card number extraction is solved, and higher recognition accuracy and extraction success rate are achieved.
Patent Information
- Application Number
- CN202411743698.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the failure rate of bank card number extraction is high, mainly due to equipment hardware differences, room temperature environment and background information, the bank card image blur and distortion.
The card number positioning algorithm is used to locate the bank card number information area on the bank card image, and input it into the image super-resolution model based on two-dimensional discrete wavelet transformation. The preset number of two-dimensional discrete wavelet transformation convolution modules is processed into a high-resolution bank card number information area image, and finally the scene text recognition is used to extract the bank card number information.
Through image super-resolution technology, the bank card number information in the bank card number information area image is effectively reconstructed, and the recognition accuracy is improved, thereby significantly improving the success rate of bank card number extraction.
Smart Images

Figure CN119600633A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method for extracting a bank card number and a related device. Background Art
[0002] With the development of my country's economy and society and the improvement of people's living standards, high-tech has had an increasingly greater impact on people's lives, and terminal devices with shooting functions are becoming increasingly popular.
[0003] In banking business scenarios, facial payment, smart monitoring, and bank card recognition all rely on images as a medium. Among them, many businesses need to extract bank card numbers based on bank card images. However, differences in device hardware, room temperature, background information, and many other reasons can cause bank card images to be blurred and distorted to varying degrees, resulting in failure to extract bank card numbers.
[0004] It can be seen that the failure rate of extracting bank card numbers in the known technology is high. Summary of the invention
[0005] In view of the above problems, the present application provides a bank card number extraction method and related devices to achieve the purpose of improving the success rate of bank card number extraction. The specific scheme is as follows:
[0006] The first aspect of the present application provides a method for extracting a bank card number, comprising:
[0007] Get the bank card image to be extracted;
[0008] The bank card number information area on the bank card image is located by using a card number positioning algorithm, and the bank card image is cropped to obtain a bank card number information area image;
[0009] Inputting the bank card number information region image into an image super-resolution model based on two-dimensional discrete wavelet transform to obtain a high-resolution bank card number information region image; the image super-resolution model is configured to: process the bank card number information region image into a high-resolution bank card number information region image through a preset number of two-dimensional discrete wavelet transform convolution modules;
[0010] Scene text recognition is used to extract bank card number information from high-resolution bank card number area images.
[0011] In a possible implementation, a card number positioning algorithm is used to locate the bank card number information area on the bank card image, including:
[0012] The bank card image to be extracted is input into the highly accurate text detector EAST, and after feature extraction and feature fusion, a pixel prediction image is output; the pixel prediction image is an image of the bank card number information area; the pixel prediction image is a rectangular shape image or a polygonal shape image.
[0013] In one possible implementation, the feature extraction process is completed based on the performance and accuracy PVANet network;
[0014] The feature fusion process uses a U-shape structure for feature fusion.
[0015] In one possible implementation, the process of processing the bank card number information area image by the image super-resolution model includes:
[0016] Convert the bank card number information area image into a YCbCr color space to obtain a bank card number information area image including three channels; the three channels include a brightness channel, a blue difference chromaticity channel, and a red difference chromaticity channel;
[0017] After upsampling the luminance channel, it is input into the first convolutional layer to obtain the first feature map; upsampling the blue difference chroma channel and the red difference chroma channel to obtain a high-resolution blue difference chroma channel and a high-resolution red difference chroma channel;
[0018] Inputting the first feature map into a preset number of two-dimensional discrete wavelet transform convolution modules connected in series to obtain a high-resolution second feature map; the second feature map has the same dimension as the first feature map;
[0019] Input the second feature map into the second convolutional layer to obtain a third feature map consistent with the dimension of the brightness channel;
[0020] The high-resolution blue difference chromaticity channel, the high-resolution red difference chromaticity channel and the third feature map are connected in series to obtain a connection result, and the connection result is converted into an RGB color space to obtain a high-resolution bank card number information area image.
[0021] In one possible implementation, the processing of the 2D discrete wavelet transform convolution module includes:
[0022] Input the fourth feature map into the convolution layer to obtain a fifth feature map with an enlarged channel dimension;
[0023] After processing the fourth characteristic dimension graph using a preset number of wavelet filters, outputting each characteristic dimension graph corresponding to the wavelet filter one by one;
[0024] After concatenating the feature dimension maps, they are input into the multi-layer perceptron, transposed convolution, and batch normalization in sequence, and then the output feature dimension map with the same dimension as the fourth feature map is output.
[0025] In one possible implementation, Haar wavelet is used as mother wavelet in the wavelet filter in the two-dimensional discrete wavelet transform convolution module.
[0026] A second aspect of the present application provides a bank card number extraction device, comprising:
[0027] An acquisition unit, a positioning unit, a model processing unit and an extraction unit; wherein:
[0028] An acquisition unit, used for acquiring a bank card image to be extracted;
[0029] A positioning unit, used to locate the bank card number information area on the bank card image by using a card number positioning algorithm, and to crop the bank card image to obtain an image of the bank card number information area;
[0030] The model processing unit is used to input the bank card number information area image into the image super-resolution model based on two-dimensional discrete wavelet transform to obtain a high-resolution bank card number information area image; the image super-resolution model is configured to: process the bank card number information area image into a high-resolution bank card number information area image through a preset number of two-dimensional discrete wavelet transform convolution modules;
[0031] The extraction unit is used to extract bank card number information from the high-resolution bank card number area image by using scene text recognition.
[0032] A third aspect of the present application provides a computer program product, comprising computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements a bank card number extraction method as described in any one of the above.
[0033] A fourth aspect of the present application provides a bank card number extraction device, comprising at least one processor and a memory connected to the processor, wherein:
[0034] The memory is used to store computer programs;
[0035] The processor is used to execute the computer program so that the bank card number extraction device can implement the bank card number extraction method as described in any one of the above.
[0036] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement a bank card number extraction method as described in any one of the above.
[0037] By means of the above technical scheme, the bank card number extraction method and related device provided in the present application obtain the bank card image to be extracted, use the card number positioning algorithm to determine the bank card number information area image, and then input the image into the image super-resolution model based on the two-dimensional discrete wavelet transform, and process the bank card number information area image into a high-resolution bank card number information area image through a preset number of two-dimensional discrete wavelet transform convolution modules, and finally use scene text recognition to extract the bank card number information from the high-resolution card number area image. The two-dimensional discrete wavelet transform technology used in the present application can perform image super-resolution on the basis of low computing power, effectively reconstruct the bank card number information in the bank card number information area image, improve recognition accuracy, and thus improve the success rate of bank card number extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0039] Figure 1 A flow chart of a method for extracting a bank card number provided in this application;
[0040] Figure 2 An example diagram of the network structure of the EAST network provided for this application;
[0041] Figure 3 A processing flow chart of an image super-resolution model based on two-dimensional discrete wavelet transform and a processing flow chart of a two-dimensional discrete wavelet transform convolution module provided in this application;
[0042] Figure 4 A flowchart of a method for extracting a bank card number provided in this application;
[0043] Figure 5 A schematic diagram of the structure of the device for extracting bank card numbers provided in this application;
[0044] Figure 6 A schematic diagram of the structure of the bank card number extraction device provided in this application. DETAILED DESCRIPTION
[0045] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0046] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0047] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0048] With the development of the banking system and the financial industry, accurate recognition of sensitive information such as bank card numbers has become particularly important. However, due to the blurriness of some bank card photos, the accuracy of scene text recognition or manual recognition is low, which in turn affects the normal processing of banking services and user experience.
[0049] Image super-resolution technology is generally used in known technologies to improve image quality. Specifically, image super-resolution technology is an image processing technology that aims to improve low-resolution images to high-resolution processes. Generally, the resolution of an image is determined by the number of its pixels. The more pixels, the clearer the image. Image super-resolution technology uses algorithms and mathematical models to recover more details from known low-resolution images, making the output image visually clearer and more detailed. This type of technology can be implemented using local features, statistical information, interpolation technology, or deep learning methods in the image.
[0050] Specifically, after the bank obtains the bank card image, it will locate the bank card number area. Since the card number area only occupies a small part of the image area, the resolution of the captured image is relatively low. In addition, due to differences between hardware devices, image compression algorithms such as JPEG, and data transmission limitations, low-resolution images are generated. It is difficult for existing network models to effectively extract the feature expression of text from low-quality images, so there are certain difficulties in text recognition in the bank card number area, and the recognition accuracy is insufficient. The lack of accuracy in bank card number information recognition may require users to upload bank card images multiple times, affecting the user experience. On the other hand, errors in bank card number recognition may result in wrong accounts.
[0051] Therefore, the bank card number extraction method in the known technology is not ideal in practical application and cannot fully consider the particularity of texts in different scenarios.
[0052] Therefore, the failure rate of bank card number extraction in the prior art is relatively high. In order to solve the above problem, the present application proposes a bank card number extraction method and related device.
[0053] Optional, see Figure 1 , a flow chart of a method for extracting a bank card number provided in this application.
[0054] like Figure 1 As shown, the method for extracting a bank card number includes the following steps:
[0055] Step 101: Obtain a bank card image to be extracted.
[0056] It should be noted that the bank card image to be extracted is the bank card image of the bank card number information to be extracted. When a customer handles a specific business, the bank will ask the customer to provide a bank card image, and at this time, the extraction of bank card number information may be involved. Exemplary scenarios where users are required to provide bank card images include: when a customer goes to a bank to open a new account, the bank usually requires the customer to provide images of their ID and bank card for identity verification and record keeping; when setting up an account on an online payment platform or binding a bank card, the platform may require uploading images of the front and back of the bank card to verify the card information and cardholder identity; and so on.
[0057] Optionally, obtain a bank card image whose bank card number information is to be extracted.
[0058] Step 102: Use a card number positioning algorithm to locate the bank card number information area on the bank card image, and crop the bank card image to obtain a bank card number information area image.
[0059] It should be noted that the card number positioning algorithm is implemented based on the EAST (Efficient and Accurate Scene Text detector) network. The network mainly includes three parts: feature extraction, feature fusion and network output. The output is a pixel prediction image, that is, the bank card number information area image. Specifically, the shape of the bank card number information area image can be a rectangle or a polygon.
[0060] Optional, see Figure 2 , an example diagram of the network structure of the EAST network provided in this application.
[0061] like Figure 2 As shown in the figure, the EAST network mainly includes three parts: feature extraction, feature fusion and network output.
[0062] Among them, the feature extraction layer is based on the backbone feature extraction network, and specifically adopts the performance and accuracy PVANet network to increase the receptive field, making this part conducive to detecting long texts.
[0063] The feature fusion layer uses a U-shape structure for feature fusion, which can merge feature maps of different scales and solve the problem of drastic scale changes of text lines. Figure 2 It can be seen that this layer can fuse the feature maps output by each convolution layer in the feature extraction layer in sequence. Take the feature map f4 output by convolution layer 4 and the feature map f3 output by convolution layer 3 as examples, where f3 is the current feature map and f4 is the feature map of the previous stage relative to f3. The feature fusion layer first performs an upsampling operation on the current feature map f3, and then performs a series concatenation operation on the channel dimension with the feature map f4 of the previous stage. Finally, a 1×1 convolution kernel is used to reduce the number of channels and the amount of calculation, and then a 3×3 convolution kernel is used for information fusion, and finally a feature map that fuses multi-scale information is obtained.
[0064] The f in the figure i represents the features extracted by the i-th convolutional layer, that is, f1 is the feature extracted by the 1st convolutional layer; f2 is the feature extracted by the 2nd convolutional layer, f3 is the feature extracted by the 3rd convolutional layer, and f4 is the feature extracted by the 4th convolutional layer; h i represents the input of the i-th layer in the feature fusion stage, that is, h1 is the input of the first layer in the feature stage, h2 is the input of the second layer in the feature stage, h3 is the input of the third layer in the feature stage, and h4 is the input of the fourth layer in the feature stage; g i represents the output of the i-th layer in the feature fusion stage, that is, g1 is the output of the first layer in the feature fusion stage, g2 is the output of the second layer in the feature fusion stage; g3 is the output of the third layer in the feature fusion stage. The calculation formula of the feature fusion stage can be as follows:
[0065]
[0066]
[0067] It should also be noted that the shape of the pixel prediction image output at the network output stage includes two structures: rectangular or polygonal.
[0068] When the output pixel prediction image is a rectangle, the output is a 1×1×1 confidence score, a 1×1×4 rectangular coordinate offset tensor, and a 1×1×1 rectangular rotation angle tensor, where the coordinate offset tensor represents the offset from the two diagonal corners of the rectangle to the sides of the photo;
[0069] When the output pixel prediction image is a polygon, the output is a 1×1×1 confidence score and a 1×1×8 polygon coordinate offset tensor, where the polygon coordinate offset tensor represents the offset from the four corners of the polygon to the fixed point in the photo.
[0070] It can be seen that, according to the angle of the picture and the arrangement of the text in the bank card image, the shape of the bank card number information area image can be a rectangle or a polygon.
[0071] Optionally, the card number information area is located on the bank card image based on the EAST network, and a bank card number information area image with a rectangular or polygonal shape is output.
[0072] Step 103: input the bank card number information area image into an image super-resolution model based on two-dimensional discrete wavelet transform to obtain a high-resolution bank card number information area image; the image super-resolution model is configured to: process the bank card number information area image into a high-resolution bank card number information area image through a preset number of two-dimensional discrete wavelet transform convolution modules.
[0073] It should be noted that the image super-resolution model based on two-dimensional discrete wavelet transform provided in this application is obtained by integrating two-dimensional discrete wavelet transform technology into the image super-resolution model. Two-dimensional discrete wavelet transform is a signal processing technology used to analyze the frequency and spatial characteristics of images in image processing and compression. In two-dimensional discrete wavelet transform, the image is decomposed into frequency bands in multiple scales and directions, and different scales correspond to different frequency ranges.
[0074] The processing process of the image super-resolution model based on two-dimensional discrete wavelet transform provided in this application is:
[0075] The bank card number information area image is an RGB image. First, the bank card number information area image is converted into a YCbCr color space to obtain a bank card number information area image including three channels, which are a brightness channel, a blue difference chromaticity channel, and a red difference chromaticity channel;
[0076] Then, these three channels are divided into two channels. The first channel is the CbCr channel, which specifically includes a blue difference chromaticity channel and a red difference chromaticity channel; the second channel is the Y channel, that is, the brightness channel.
[0077] For the Y channel:
[0078] First, the Y channel is upsampled and input into the first convolutional layer to obtain a first feature map, which is a feature map with an increased number of feature maps.
[0079] The first feature map is input into a preset number of two-dimensional discrete wavelet transform convolution modules connected in series to obtain a high-resolution second feature map, and the dimension of the second feature map at this time is consistent with that of the first feature map. According to experiments, the processing effect of the bank card number information area image is best when the number of two-dimensional discrete wavelet transform convolution modules is 4. Of course, the number of two-dimensional discrete wavelet transform convolution modules can be 3, 5, etc., but the number of modules should not be too few or too many. Too few modules will affect the processing effect of the bank card number information area image, and too many modules will greatly increase the network calculation amount.
[0080] The second feature map is input into the second convolutional layer to obtain a third feature map with the same dimension as the brightness channel.
[0081] For CbCr channels:
[0082] The channel is upsampled to obtain a high-resolution CbCr channel, and the resolution of the upsampled CbCr channel is the required final resolution.
[0083] Finally, the high-resolution CbCr channel and the third feature map are concatenated to obtain a high-resolution concatenation result. The concatenation result is converted to RGB color space to obtain a high-resolution bank card number information area image.
[0084] Among them, the processing process of the two-dimensional discrete wavelet transform convolution module is:
[0085] The fourth feature map is input into the convolution layer to obtain the fifth feature map after the channel dimension is enlarged. Since the two-dimensional discrete wavelet transform convolution modules are connected in series, taking the number of modules as 4 as an example, for the first two-dimensional discrete wavelet transform convolution module, the fourth feature map is the first feature map mentioned above; when the two-dimensional discrete wavelet transform convolution module is not the first, the first feature map is the feature dimension map output by the previous two-dimensional discrete wavelet transform convolution module.
[0086] A preset number of wavelet filters are used to process the fifth feature map, and each feature dimension map corresponding to each wavelet filter is output. Specifically, the role of the wavelet filter is to realize multi-resolution analysis of the image. The fifth feature map is decomposed into different frequency components through low-pass filters and high-pass filters, so as to extract the details and approximate information of the image. Haar wavelet is used as the mother wavelet in the wavelet filter. The mother wavelet is the basis of wavelet transform. The wavelet filter system is obtained by discretizing and normalizing the polarity of the mother wavelet. These coefficients determine the frequency response characteristics of the filter, thereby affecting the effect of image decomposition. The mother wavelet can analyze the image at different resolutions through a series of wavelet filters of different scales to obtain feature dimension maps of different scales. It should be noted that for the number of wavelet filters, after testing, 4 are also the best.
[0087] After concatenating the feature dimension maps, they are input into the multi-layer perceptron, transposed convolution, batch normalization in sequence, and finally the output feature dimension map with the same dimension as the fourth feature map is output.
[0088] For example, see Figure 3 , the present application provides a processing flow chart of an image super-resolution model based on two-dimensional discrete wavelet transform and a processing flow chart of a two-dimensional discrete wavelet transform convolution module.
[0089] The processing flow of the image super-resolution model based on two-dimensional discrete wavelet transform is as follows:
[0090] First, input a low-resolution RGB image of the bank card number information area image.
[0091] The RGB image is converted to the YCbCr color space. The YCbCr color space divides the image into three channels: the Y channel (brightness channel), the Cb channel (blue difference chromaticity), and the Cr channel (red difference chromaticity). Since the Y channel contains most of the image detail information and is basically unaffected by color changes, the Y channel is used for parameterized learning. Among them, the Cb channel and the Cr channel can be called CbCr channels, which are channel one, and the Y channel is channel two.
[0092] Specifically, channel 2 upsamples the Y channel to high resolution, and the upsampling layer outputs , is fed into a convolutional layer where The number of feature maps increases from 1 to C, and the convolutional layer outputs feature maps , It is fed into the 2D DWT convolution module. Here, 4 2D DWT convolution modules are connected in series to generate a high-resolution feature map. Finally, the module outputs ,Will Input a convolutional layer, reduce the channel dimension from C to 1, and return a channel output .
[0093] For pass 1, the upsampled CbCr channel increases its channel resolution to the desired final resolution. This high-resolution CbCr channel is finally output with the same resolution as the Y channel. Connect them in series to get three-channel YCbCr output.
[0094] Finally, the YCbCr output is converted to RGB color space to obtain the final high-resolution output image.
[0095] It should be noted that the two-dimensional discrete wavelet transform convolution module will not reduce the spatial resolution of the feature map, and the input and output sizes of the feature map remain consistent. The module uses a two-dimensional discrete wavelet transform to reduce the space of the feature map and thus reduce the amount of network calculation. The processing of this module uses the same primer to expand the number of channels, so the process is lossless. At the same time, the two-dimensional discrete wavelet transform uses a smaller number of parameters, which makes the training process of the image super-resolution model based on the two-dimensional discrete wavelet transform simpler. It should be noted that the module uses the Haar wavelet with a simple structure and faster calculation speed as the mother wavelet, making the structural design of the entire module simpler.
[0096] Exemplarily, the input and output tensors of the two-dimensional discrete wavelet transform convolution module are: and , the downsampling operations of the four wavelet filters are respectively expressed as: , , , ; The convolution, multi-layer perceptron, transposed convolution, and batch normalization operations are represented as c, m, t, and b, respectively, and the trainable parameters of these operations can be represented as , , as well as , the concatenation along the channel dimension is expressed as , point-by-point addition is expressed as +, and the operation inside the two-dimensional discrete wavelet transform convolution can be expressed by the following formula:
[0097]
[0098]
[0099]
[0100] .
[0101] Optionally, the bank card number information area image is input into an image super-resolution model based on two-dimensional discrete wavelet transform to obtain a high-resolution bank card number information area image.
[0102] Step 104: extract the bank card number information from the high-resolution card number area image using scene text recognition.
[0103] It should be noted that scene text recognition refers to the process of extracting and identifying text content from natural scene images. These natural scene images can be real scene images collected by cameras, surveillance cameras, satellite images, etc., and the text in these images may appear under different viewing angles, lighting conditions, background noise, etc. Scene text recognition is a complex task. On the one hand, the font, size, color, etc. of the text may also vary; on the other hand, the text in natural scene images may be subject to various interferences, such as occlusion, blur, deformation, uneven lighting, etc.
[0104] Optionally, the present application may use a CNN+BLSTM+CTC network to extract bank card number information from a high-resolution card number area image.
[0105] In summary, the bank card number extraction method provided in the present application obtains the bank card image to be extracted, uses the card number positioning algorithm to determine the bank card number information area image, and then inputs the image into the image super-resolution model based on the two-dimensional discrete wavelet transform, processes the bank card number information area image into a high-resolution bank card number information area image through a preset number of two-dimensional discrete wavelet transform convolution modules, and finally uses scene text recognition to extract the bank card number information from the high-resolution card number area image. The two-dimensional discrete wavelet transform technology used in the present application can perform image super-resolution on the basis of low computing power, effectively reconstruct the bank card number information in the bank card number information area image, improve recognition accuracy, and thus improve the success rate of bank card number extraction.
[0106] The present application can effectively improve the quality of low-resolution images through a preset number of two-dimensional discrete wavelet transform convolution modules, and can identify bank card numbers in different environments and conditions. For example, it can improve the quality of images captured by mobile phone cameras with lower pixels and extract corresponding image information.
[0107] Based on the low computational complexity of two-dimensional discrete wavelet transform, the present application can achieve super-resolution reconstruction of images with nearly lossless performance, thereby enabling accurate and efficient recognition of bank card numbers.
[0108] In addition, the algorithm of the two-dimensional discrete wavelet transform is relatively small. Accordingly, the image super-resolution model based on the two-dimensional discrete wavelet transform can run on devices with less computing power, making the model more widely applicable. For example, it can be applied on cloud servers, allowing cloud servers that do not have high-performance processing capabilities to identify bank card numbers with high accuracy.
[0109] After experiments, the image super-resolution model based on two-dimensional discrete wavelet transform of the present application has a parameter amount of only 1.7M when the input size is 64×64, which is only about one-tenth of the attention mechanism-based model used in the known technology, and the computational complexity is 49.6G, which is only about one-third of the attention mechanism-based model.
[0110] In addition, the recognition accuracy of the bank card number recognition method that does not introduce the DWTNet network used in this application is only 91.29%, while the recognition accuracy of the bank card number recognition method that introduces the DWTNet network in this application and performs super-resolution reconstruction is 97.23%, which greatly improves the recognition accuracy of the bank card number.
[0111] Optional, see Figure 4 , a flow chart showing an example of a method for extracting a bank card number provided in this application.
[0112] like Figure 4 As shown, after obtaining the bank card image, the card number area is first located to obtain the card number area image, and then image super-resolution is used to reconstruct the image to obtain a high-resolution card number area image. Finally, scene text recognition is performed to extract the bank card number.
[0113] It should be noted that in this application, the image super-resolution method is used to enhance the feature expression ability of the image, reconstruct the detailed information of the image, effectively improve the accuracy of downstream visual tasks, and extract the user's bank card information from low-resolution images. The main processing objects are digital images with low pixel density such as low-resolution images.
[0114] To sum up, the image super-resolution technology used in this application can recover more details from low-quality images and achieve super-resolution reconstruction of the image using less computing power, thereby reducing the impact of differences in hardware devices, image compression algorithms, and limitations in the image process that lead to reduced image quality on recognition accuracy, and effectively extract bank card information from low-resolution images.
[0115] A method for extracting a bank card number provided in an embodiment of the present application is introduced above. A device for executing the above method for extracting a bank card number will be introduced below.
[0116] See also Figure 5 , a schematic diagram of the structure of the device for extracting bank card numbers provided in this application. Figure 5 As shown, the device comprises:
[0117] Acquisition unit 10, positioning unit 20, model processing unit 30 and extraction unit 40; wherein:
[0118] An acquisition unit 10, used to acquire a bank card image to be extracted;
[0119] A positioning unit 20, used to locate the bank card number information area on the bank card image using a card number positioning algorithm, and to crop the bank card image to obtain a bank card number information area image;
[0120] The model processing unit 30 is used to input the bank card number information area image into the image super-resolution model based on two-dimensional discrete wavelet transform to obtain a high-resolution bank card number information area image; the image super-resolution model is configured to: process the bank card number information area image into a high-resolution bank card number information area image through a preset number of two-dimensional discrete wavelet transform convolution modules;
[0121] The extraction unit 40 is used to extract the bank card number information from the high-resolution card number area image by using scene text recognition.
[0122] In one embodiment, the positioning unit 20 is specifically configured to:
[0123] The bank card image to be extracted is input into the highly accurate text detector EAST, and after feature extraction and feature fusion, a pixel prediction image is output; the pixel prediction image is an image of the bank card number information area; the pixel prediction image is a rectangular shape image or a polygonal shape image.
[0124] In one embodiment, the feature extraction process in the positioning unit 20 is completed based on the performance and accuracy PVANet network; the feature fusion process adopts a U-shape structure to perform feature fusion.
[0125] In one embodiment, the process of processing the bank card number information area image by the image super-resolution model in the model processing unit 30 includes:
[0126] Convert the bank card number information area image into a YCbCr color space to obtain a bank card number information area image including three channels; the three channels include a brightness channel, a blue difference chromaticity channel, and a red difference chromaticity channel;
[0127] After upsampling the luminance channel, it is input into the first convolutional layer to obtain the first feature map; upsampling the blue difference chroma channel and the red difference chroma channel to obtain a high-resolution blue difference chroma channel and a high-resolution red difference chroma channel;
[0128] Inputting the first feature map into a preset number of two-dimensional discrete wavelet transform convolution modules connected in series to obtain a high-resolution second feature map; the second feature map has the same dimension as the first feature map;
[0129] Input the second feature map into the second convolutional layer to obtain a third feature map consistent with the dimension of the brightness channel;
[0130] The high-resolution blue difference chromaticity channel, the high-resolution red difference chromaticity channel and the third feature map are connected in series to obtain a connection result, and the connection result is converted into an RGB color space to obtain a high-resolution bank card number information area image.
[0131] In one embodiment, the processing process of the two-dimensional discrete wavelet transform convolution module in the model processing unit 30 includes:
[0132] Input the fourth feature map into the convolution layer to obtain a fifth feature map with an enlarged channel dimension;
[0133] After processing the second input feature dimension graph using a preset number of wavelet filters, outputting each feature dimension graph corresponding to the wavelet filter one by one;
[0134] After concatenating the feature dimension maps, they are input into the multi-layer perceptron, transposed convolution, and batch normalization in sequence, and then the output feature dimension map with the same dimension as the fourth feature map is output.
[0135] In one implementation, the Haar wavelet is used as the mother wavelet in the wavelet filter of the two-dimensional discrete wavelet transform convolution module in the model processing unit 30 .
[0136] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the bank card number extraction methods provided in the embodiments of the present application.
[0137] The present application also provides a device for extracting a bank card number. Figure 6 As shown, it shows a schematic diagram of the structure of a device suitable for implementing the bank card number extraction in the embodiment of the present application. The device for extracting the bank card number in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 6 The bank card number extraction device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0138] like Figure 6As shown, the bank card number extraction device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the bank card number extraction device is powered on, various programs and data required for the bank card number extraction device to operate are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0139] Typically, the following devices may be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a memory card, a hard disk, etc.; and communication devices 609. The communication device 609 may allow the bank card number extraction device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The bank card number extraction device with various devices is shown, but it should be understood that it is not required to implement or have all the devices shown. More or fewer devices can be implemented or have alternatively.
[0140] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any bank card number extraction method provided in the embodiment of the present application.
[0141] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0142] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0143] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0144] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integration. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid-state hard disk (SSD)), etc.
Claims
1. A method for extracting a bank card number, characterized in that: include: Get the bank card image to be extracted; Using a card number positioning algorithm to locate the bank card number information area on the bank card image, and cropping the bank card image to obtain a bank card number information area image; Inputting the bank card number information area image into an image super-resolution model based on two-dimensional discrete wavelet transform to obtain a high-resolution bank card number information area image; The image super-resolution model is configured to: process the bank card number information area image into the high-resolution bank card number information area image through a preset number of two-dimensional discrete wavelet transform convolution modules; The bank card number information is extracted from the high-resolution bank card number information area image using scene text recognition.
2. The method for extracting a bank card number according to claim 1, characterized in that: The method of locating the bank card number information area on the bank card image using a card number locating algorithm includes: The bank card image to be extracted is input into a highly accurate text detector EAST, and a pixel prediction image is output after feature extraction and feature fusion; the pixel prediction image is the bank card number information area image; the pixel prediction image is a rectangular shape image or a polygonal shape image.
3. The method for extracting a bank card number according to claim 2, characterized in that: The feature extraction process is completed based on the performance and accuracy PVANet network; The feature fusion process adopts a U-shape structure to perform feature fusion.
4. The method for extracting a bank card number according to claim 1, characterized in that: The process of processing the bank card number information area image by the image super-resolution model includes: Converting the bank card number information area image into a YCbCr color space to obtain a bank card number information area image including three channels; the three channels include a brightness channel, a blue difference chromaticity channel, and a red difference chromaticity channel; Upsampling the brightness channel and inputting it into the first convolutional layer to obtain a first feature map; upsampling the blue difference chroma channel and the red difference chroma channel to obtain a high-resolution blue difference chroma channel and a high-resolution red difference chroma channel; Inputting the first feature map into the preset number of two-dimensional discrete wavelet transform convolution modules connected in series to obtain a high-resolution second feature map; the second feature map has the same dimension as the first feature map; Inputting the second feature map into a second convolutional layer to obtain a third feature map having the same dimension as the brightness channel; The high-resolution blue difference chromaticity channel, the high-resolution red difference chromaticity channel and the third feature map are connected in series to obtain a connection result, and the connection result is converted into an RGB color space to obtain the high-resolution bank card number information area image.
5. The method for extracting a bank card number according to claim 4, characterized in that: The processing process of the two-dimensional discrete wavelet transform convolution module includes: Input the fourth feature map into the convolution layer to obtain a fifth feature map with an enlarged channel dimension; After processing the fifth characteristic dimension map using a preset number of wavelet filters, outputting each characteristic dimension map corresponding to the wavelet filter one by one; After splicing the various feature dimension maps, they are sequentially input into a multilayer perceptron, transposed convolution, and batch normalization, and then a feature dimension map having the same dimension as the fourth feature map is output.
6. The method for extracting a bank card number according to claim 5, characterized in that: The wavelet filter in the two-dimensional discrete wavelet transform convolution module adopts Haar wavelet as mother wavelet.
7. A device for extracting a bank card number, characterized in that: include: An acquisition unit, a positioning unit, a model processing unit and an extraction unit; wherein: The acquisition unit is used to acquire the bank card image to be extracted; The positioning unit is used to locate the bank card number information area on the bank card image by using a card number positioning algorithm, and to crop the bank card image to obtain a bank card number information area image; The model processing unit is used to input the bank card number information area image into an image super-resolution model based on two-dimensional discrete wavelet transform to obtain a high-resolution bank card number information area image; the image super-resolution model is configured to: process the bank card number information area image into the high-resolution bank card number information area image through a preset number of two-dimensional discrete wavelet transform convolution modules; The extraction unit is used to extract the bank card number information from the high-resolution bank card number area image by using scene text recognition.
8. A computer program product, characterized in that It comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the bank card number extraction method as described in any one of claims 1 to 6.
9. A bank card number extraction device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the bank card number extraction device can implement the bank card number extraction method as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the bank card number extraction method as described in any one of claims 1 to 6.