WO2021139169A1 - Method and apparatus for card recognition, device, and storage medium - Google Patents

Method and apparatus for card recognition, device, and storage medium Download PDF

Info

Publication number
WO2021139169A1
WO2021139169A1 PCT/CN2020/111203 CN2020111203W WO2021139169A1 WO 2021139169 A1 WO2021139169 A1 WO 2021139169A1 CN 2020111203 W CN2020111203 W CN 2020111203W WO 2021139169 A1 WO2021139169 A1 WO 2021139169A1
Authority
WO
WIPO (PCT)
Prior art keywords
image frame
card
target
currently processed
frame
Prior art date
Application number
PCT/CN2020/111203
Other languages
French (fr)
Chinese (zh)
Inventor
张国辉
雷晨雨
宋晨
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021139169A1 publication Critical patent/WO2021139169A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds

Definitions

  • This application relates to the field of financial technology, in particular to a card identification method, device, equipment and storage medium.
  • card identification technology has become an indispensable part as card identification A very important part of the technology, the border detection algorithm of the card is getting more and more attention.
  • the inventor realized that the existing card border detection algorithms mainly use neural networks or traditional edge detection algorithms to find all the edge information in the picture, and then set various conditions to filter out some edge information to obtain the card border. Or when the edges are blurred, misjudgments are likely to occur, leading to frame detection errors and affecting the subsequent operation of other services such as card information extraction.
  • the embodiments of the present application provide a card identification method, device, equipment, and storage medium, which can improve the efficiency of card identification and restoration.
  • an embodiment of the present application provides a card identification method, which includes:
  • each of the multi-frame image frames is an image frame in a red, green, and blue RGB format
  • an embodiment of the present application provides a card identification device, which includes:
  • the obtaining module is configured to obtain a multi-frame image frame corresponding to the target card when the card detection service is detected to be started, each of the multi-frame image frames is an image frame in red, green, and blue RGB format;
  • a determining module configured to determine card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
  • the judging module is used for judging whether the target card is a real card according to the card information of the target card.
  • an electronic device including:
  • a computer-readable storage medium storing one or more instructions, and the one or more instructions are suitable for being loaded by the processor and executing the following steps:
  • each of the multi-frame image frames is an image frame in a red, green, and blue RGB format
  • an embodiment of the present application provides a computer-readable storage medium that stores a computer program for electronic data exchange, where the computer program is used to implement the following steps when executed by a computer:
  • each of the multi-frame image frames is an image frame in a red, green, and blue RGB format
  • the multi-frame image frame corresponding to the target card is obtained.
  • Each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format.
  • the frame determines the card information of the target card.
  • the card information is used to reflect the edge conditions and key points of the target card.
  • the card information of the target card it is judged whether the target card is a real card. That is, by adopting the card detection mechanism of detection and tracking, the accuracy of card recognition is improved.
  • the process of card recognition does not require manual participation, which can improve the efficiency and accuracy of card recognition.
  • FIG. 1 is a schematic flowchart of another card identification method provided by an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of a decoder provided by an embodiment of the present application.
  • Figure 3 is a schematic structural diagram of another decoder provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a card identification device provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an electronic device provided by another embodiment of the present application.
  • Artificial intelligence technology is a comprehensive discipline, covering a wide range of fields, including both hardware-level technology and software-level technology.
  • Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, and mechatronics.
  • Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning/deep learning.
  • Computer Vision is a science that studies how to make machines "see”. Furthermore, it refers to the use of cameras and computers instead of human eyes to identify, track, and measure targets. And further graphics processing, so that computer processing becomes more suitable for human eyes to observe or send to the instrument to detect the image.
  • Computer vision studies related theories and technologies trying to establish an artificial intelligence system that can obtain information from images or multi-dimensional data.
  • Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content/behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, synchronous positioning and mapping Construction and other technologies also include common face recognition, fingerprint recognition and other biometric recognition technologies.
  • This application relates to image recognition technology in artificial intelligence.
  • the image recognition technology is used to automatically convert images into card recognition without manual participation, which can improve the efficiency and accuracy of card recognition; this application can be applied to smart government affairs, smart education and other fields , which is conducive to promoting the construction of smart cities.
  • FIG. 1 is a schematic flowchart of a card recognition method provided by an embodiment of the present application, which is executed by the electronic device of the embodiment of the present application.
  • the card recognition method includes the following steps S101 to S103.
  • each image frame in the multi-frame image frame is an image frame in a red, green, and blue RGB format
  • the target card may be an identification card, such as an ID card, a pass, a driver's license, etc., and the target card may also be a welfare card, such as a social security card, a medical insurance card, a membership card, etc., the target card It may also be a financial card, such as a memory card, a credit card, etc., and the target card may also be another type of card, which is not specifically limited.
  • an identification card such as an ID card, a pass, a driver's license, etc.
  • the target card may also be a welfare card, such as a social security card, a medical insurance card, a membership card, etc.
  • the target card It may also be a financial card, such as a memory card, a credit card, etc.
  • the target card may also be another type of card, which is not specifically limited.
  • the trigger condition for the activation of the card detection service may be that the card sensing area senses a card-like object, for example, the ID card sensing area senses that a card-like object is placed, and for example, a bank card insertion slot senses that a card-like object is inserted.
  • the trigger condition for the activation of the card detection service can also be a user's triggering operation on a preset detection service activation button, where the service activation button can be a physical button or a virtual space.
  • the current card is detected as a handheld device, and the handheld device is provided with a physical button to start the card detection service.
  • the sensing area of the handheld device may be the image acquisition range of the image acquisition device of the handheld device.
  • the image acquisition device is a camera
  • the image acquisition The range is within the lens range of the camera.
  • the image acquisition device is an infrared image sensor
  • the image acquisition range is within the infrared sensing range of the infrared image sensor; the trigger condition for starting the card detection service may also be Other trigger operations are not specifically limited.
  • the specific implementation manner for acquiring the multiple image frames corresponding to the target card may be: when the electronic device detects that the card detection service is started, recording the target The video corresponding to the card; the electronic device obtains multiple original image frames corresponding to the target card from the recorded video at a first preset time interval; the electronic device determines whether the multiple original image frames are RGB format image frames; if not, the electronic device converts the multiple original image frames into RGB format image frames.
  • the first preset time interval can be set according to user requirements and current device performance, and the value of the first time interval is not specifically limited.
  • the specific implementation manner of acquiring the multi-frame image frame corresponding to the target card may be: when the electronic device detects that the card detection service is started, the second preset Set a time interval to take pictures of the target card to obtain multiple original image frames; the electronic device determines whether the multiple original image frames are image frames in RGB format; if not, the electronic device The original image frame is converted into an image frame in RGB format.
  • the second preset time interval can be set according to user requirements and current device performance, and the value of the second time interval is not specifically limited.
  • the electronic device determines card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
  • the implementation manner for the electronic device to determine the card information of the target card according to the multiple image frames includes the following steps A11 to A15:
  • the electronic device judges whether the currently processed image frame is the first image frame among the multiple image frames
  • the electronic device obtains the information of the target card in the currently processed image frame according to the first preset algorithm Card edge information, where the card edge information is used to reflect the edge condition of the target card;
  • the electronic device acquiring the card edge information of the target card in the currently processed image frame according to the first preset algorithm includes the following steps B11 to B15:
  • the electronic device obtains a first reference image frame according to the currently processed image frame, and the size of the first reference image frame is a first preset size;
  • the first preset size may be a size whose ratio of length and width is equal to or similar to the true ratio of length and width of the target card. Different cards may have different sizes.
  • the size is not specifically limited.
  • the implementation manner in which the electronic device obtains the first reference image frame whose size is the first preset size according to the currently processed image frame may be: the electronic device obtains the real size of the target card; The electronic device determines the first preset size corresponding to the actual size according to the actual size and the corresponding relationship between the size and the first preset size, and the corresponding relationship between the size and the first preset size is stored in advance In electronic equipment.
  • the first preset size may also be a size preset in the electronic device by the user according to an application scenario, and the value of the first preset size is not specifically limited.
  • the current algorithm runs on a smart phone, and the smart phone is used to detect whether the bank card is a real card.
  • the phone is rectangular, and the captured image frame is rectangular.
  • the size of the length and width is close to two to one, that is, the above-mentioned multi-frame image frame can be obtained according to the ratio of length to width of two to one for unified processing.
  • the first preset size can be set to 128*256. In this case, the image frame can be scaled to a pixel size of 128*256. Yes, the first preset size may also be other values, and the first preset size is not specifically limited.
  • the electronic device obtains a second reference image frame according to the first reference image frame, and the pixel value of the first reference image frame is 255 times the pixel value of the second reference image frame;
  • the obtaining the second reference image frame according to the first reference image frame refers to converting the first reference image frame into a binary image.
  • the electronic device imports the second reference image frame into the target neural network model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame;
  • the target neural network model includes a semantic segmentation model and a weighted least squares model
  • the second reference image frame is imported into the target neural network model to obtain the initial image of the target card in the currently processed image frame
  • the edge line parameters and four initial reference points include: importing the second reference image frame into the semantic segmentation model to obtain the feature map of the target card in the currently processed image frame; importing the feature map To the weighted least squares model, the initial edge line parameters and four initial reference points of the target card in the currently processed image frame are obtained.
  • the target neural network model is the shufflenet_basic_128 model, which is an improved model based on the deeplab v3 model.
  • the shufflenet_basic_128 model includes an encoder Encoder, a decoder Decoder, and a least squares module Weighted_least_squares consisting of three parts.
  • the Encoder adopts the shufflenet_0.5 network
  • the Decoder adopts the simplified structure of the deepnet v3 model.
  • the structure that the decoder can adopt can be as shown in Figure 2.
  • the decoder includes the pooling layer Average Pool and the first 1x1
  • the convolution layer, the first activation function BN+RELU, the bilinear difference Resize Bilinear layer, and the fully connected Concat layer are connected in sequence, and the second 1x1Conv convolution layer, the second BN+RELU, and the Concat layer are connected in sequence.
  • the structure that the decoder can adopt can also be as shown in FIG. 3, the first 1x1 convolutional layer, the second 1x1 convolutional layer, the fitting layer Dropout, the bilinear difference layer, and the parameter layer ArgMax.
  • the electronic device obtains the initial edge line parameters of the target card and the four initial reference points in the currently processed image frame according to the second reference image frame.
  • the network model is implemented in the shufflenet_basic_128 model.
  • the second reference image frame is imported into the target neural network model for the electronic device to obtain the target card in the currently processed image frame
  • the initial edge line parameters and the realization process of the four initial reference points are introduced.
  • X_map is the feature map of the x-axis coordinate
  • y_map is the y-axis coordinate Feature map of
  • the electronic device obtains the target edge line of the target card in the currently processed image frame according to the initial edge line parameter and the four initial reference points;
  • the obtaining the target edge line of the target card in the currently processed image frame according to the initial edge line parameter and the four initial reference points includes: the electronic device according to the The four initial reference points determine four edge regions of the target card in the currently processed image frame; the electronic device determines multiple target vertices corresponding to each edge region of the four edge regions; The electronic device determines the target edge line corresponding to each edge region according to the multiple target vertices corresponding to each edge region, and obtains the target edge line of the target card in the currently processed image frame.
  • the size of the four edge regions may be the same or different, and the size of the four edge regions is not specifically limited.
  • the electronic device determining multiple target vertices corresponding to each of the four edge regions includes: the electronic device divides the currently processed region into n segments to obtain n subregions, where n is a positive value greater than or equal to 3. Integer; the electronic device obtains binarized images of the n sub-regions according to the n sub-regions; the electronic device determines n targets in the n sub-regions according to the binarized images of the n sub-regions A straight line, the target straight line is the straight line with the smallest area in the sub-region; the electronic device determines the vertices at both ends of each target straight line in the n target straight lines to obtain multiple target vertices corresponding to the currently processed region.
  • the user can set the value of n as needed, and the value of n is not specifically limited.
  • the electronic device divides the currently processed area into n segments to obtain n sub-areas.
  • the implementation manner of obtaining n sub-areas may be: the electronic device Sobel edge detection algorithm divides the currently processed area into n segments to obtain n sub-areas.
  • the implementation manner for the electronic device to obtain the binarized image of the n sub-regions according to the n sub-regions may be: the electronic device adopts the Otsu method OTSU to perform adaptive binary image on the pictures of the n sub-regions To obtain the binarized image of the n sub-regions.
  • the electronic device determines the target edge line corresponding to each edge region according to the multiple target vertices corresponding to each edge region, and obtains the implementation manner of the target edge line of the target card in the currently processed image frame It may be: a random sampling ransac algorithm is used for the two vertices corresponding to each edge region to fit the edge straight line corresponding to each edge region.
  • the electronic device determines the vertex of the target card in the currently processed image frame corresponding to the target edge straight line.
  • the electronic device determines whether the currently processed image frame exists in the previous image frame.
  • Target card
  • the electronic device acquires the card key of the target card in the currently processed image frame according to a second preset algorithm Point information, the card key point information is used to reflect the key point situation of the target card;
  • the acquiring card key point information of the target card in the currently processed image frame according to the second preset algorithm includes the following steps B21 to B24:
  • the electronic device obtains the initialization image frame of the currently processed image frame according to the card information of the target card of the previous image frame of the currently processed image frame;
  • the electronic device determines multiple key points in the initialization image frame
  • the multiple key points may be multiple feature points in the card, and the number of the key points is not specifically limited.
  • the electronic device obtains the original coordinates of the multiple key points
  • the electronic device obtains the target feature values of the multiple key points according to the original coordinates of the multiple key points.
  • the electronic device obtaining the target feature value of the multiple key points according to the original coordinates of the multiple key points includes: the electronic device determines according to the mth abscissa corresponding to the currently processed key point
  • the m-th direction gradient histogram hog feature corresponding to the m-th abscissa is used to obtain the m-th eigenvalue of the currently processed key point
  • the m-th abscissa is the m-th characteristic value of the currently processed image frame.
  • the m-th abscissa change of the key point, the m-th abscissa change is the change value from the m-th abscissa to the m+1-th abscissa
  • the m+1-th abscissa is the current
  • the number of m is not specifically limited, that is, the number of convolutions of the image frame is not specifically limited.
  • m can be 4.
  • the calculation speed and the accuracy of the calculation result meet the requirements of use.
  • the target card does not exist in the previous image frame of the currently processed image frame, acquire the card edge information of the target card in the currently processed image frame according to the first preset algorithm .
  • S103 The electronic device judges whether the target card is a real card according to the card information of the target card.
  • an svm classifier may be used to determine whether the target card is a real card according to the card information of the target card.
  • the electronic device in this application may refer to any node device in the blockchain.
  • the so-called blockchain is a computer technology such as distributed data storage, peer-to-peer transmission (P2P transmission), consensus mechanism, encryption algorithm, etc.
  • the new type of application model is essentially a decentralized database; the blockchain can be composed of multiple serial transaction records (also known as blocks) that are connected by cryptography and protect the content.
  • the connected distributed ledger allows multiple parties to effectively record the transaction, and the transaction can be checked permanently (not tampered with).
  • the consensus mechanism refers to the mathematical algorithm that realizes the establishment of trust between different nodes and the acquisition of rights and interests in the blockchain network; that is to say, the consensus mechanism is a mathematical algorithm recognized by all network nodes of the blockchain.
  • This application can use the consensus mechanism of the blockchain to realize the restoration of the target image to the target card recognition, which can improve the accuracy of the restoration of the target card recognition.
  • each node device in the blockchain performs consensus verification on the execution results of the above steps S101 to S103, and the execution results of each step are passed by the consensus verification, it can be determined that the accuracy of the generated target card recognition is relatively high; if there are steps If the execution result of is not passed by the consensus verification, it can be determined that the accuracy of the generated target card recognition is relatively low, and the node device may perform the above steps S101 to S103 again to obtain the target card recognition again.
  • each node device in the blockchain can perform consensus verification on the target card identification (that is, only the execution result of step S103).
  • the node device can perform the above steps S101 to S103 again to obtain the target card recognition again.
  • the multi-frame image frame corresponding to the target card is obtained.
  • Each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format.
  • the frame determines the card information of the target card.
  • the card information is used to reflect the edge conditions and key points of the target card.
  • the card information of the target card it is judged whether the target card is a real card. That is, by adopting the card detection mechanism of detection and tracking, the accuracy of card recognition is improved.
  • the process of card recognition does not require manual participation, which can improve the efficiency and accuracy of card recognition.
  • FIG. 4 is a schematic structural diagram of a card recognition device provided by an embodiment of the present application.
  • the card recognition device of the embodiment of the present application may be in the above-mentioned electronic equipment.
  • the card recognition device includes an acquisition module 401, a determination module 402, and a judgment module 403:
  • the obtaining module 401 is configured to obtain a multi-frame image frame corresponding to the target card when it is detected that the card detection service is started, and each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format;
  • the determining module 402 is configured to determine the card information of the target card according to the multi-frame image frame, and the card information is used to reflect the edge condition and key point condition of the target card;
  • the judging module 403 is used for judging whether the target card is a real card according to the card information of the target card.
  • the determining module 402 is specifically configured to: determine whether the currently processed image frame is the first frame of the multi-frame image frame Image frame; if the currently processed image frame is the first image frame in the multi-frame image frame, acquire the card edge information of the target card in the currently processed image frame according to the first preset algorithm , The card edge information is used to reflect the edge condition of the target card; if the currently processed image frame is not the first image frame in the multi-frame image frame, the currently processed image frame is determined Whether the target card exists in the previous image frame of the currently processed image frame; if the target card exists in the previous image frame of the currently processed image frame, the currently processed image frame is acquired according to the second preset algorithm The card key point information of the target card in the card key point information, the card key point information is used to reflect the key point situation of the target card; if the target card does not exist in the previous image frame of the currently processed image frame , The card edge information of the
  • the determining module 402 is specifically configured to: obtain the first Reference image frame, the size of the first reference image frame is a first preset size; a second reference image frame is obtained according to the first reference image frame, and the pixel value of the first reference image frame is the second 255 times the pixel value of the reference image frame; import the second reference image frame into the target neural network model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame; according to The initial edge line parameter and the four initial reference points obtain the target edge line of the target card in the currently processed image frame; determine the target edge line corresponding to the target edge line in the currently processed image frame State the apex of the target card.
  • the target neural network model includes a semantic segmentation model and a weighted least squares model
  • the second reference image frame is imported into the target neural network model to obtain the image of the target card in the currently processed image frame
  • the determining module 402 is specifically configured to: import the second reference image frame into the semantic segmentation model to obtain the target card information in the currently processed image frame Feature map; import the feature map into the weighted least squares model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame.
  • the determining module 402 is specifically configured to: The four initial reference points determine the four edge regions of the target card in the currently processed image frame; determine multiple target vertices corresponding to each edge region of the four edge regions; according to each edge The multiple target vertices corresponding to the region determine the target edge line corresponding to each edge region to obtain the target edge line of the target card in the currently processed image frame.
  • the determining module 402 is specifically configured to: divide the currently processed region into n segments to obtain n subregions, where n is A positive integer greater than or equal to 3; obtain binarized images of the n sub-regions according to the n sub-regions; determine n target straight lines in the n sub-regions according to the binarized images of the n sub-regions, so The target straight line is the straight line with the smallest area in the subregion; the two end vertices of each target straight line in the n target straight lines are determined to obtain multiple target vertices corresponding to the currently processed region.
  • the determining module 402 is specifically configured to: according to the front of the currently processed image frame Obtain the initial image frame of the currently processed image frame from the card information of the target card in one image frame; determine multiple key points in the initial image frame; obtain the original coordinates of the multiple key points; The original coordinates of the multiple key points obtain the target feature values of the multiple key points.
  • the determining module 402 is specifically configured to: according to the mth horizontal line corresponding to the currently processed key point Coordinates, determine the m-th direction gradient histogram hog feature corresponding to the m-th abscissa, and obtain the m-th eigenvalue for the currently processed key point, and the m-th abscissa is the currently processed image frame
  • the m-th abscissa change of the currently processed key point is the change value from the m-th abscissa to the m+1-th abscissa, the m+1-th abscissa Is the abscissa of the key point corresponding to the currently processed key point in the image frame obtained after the mth convolution of the currently processed image frame; according to the mth abscissa and the mth abscissa The amount of coordinate change obtains the m+1th abscissa.
  • the multi-frame image frame corresponding to the target card is obtained.
  • Each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format.
  • the frame determines the card information of the target card.
  • the card information is used to reflect the edge conditions and key points of the target card.
  • the card information of the target card it is judged whether the target card is a real card. That is, by adopting the card detection mechanism of detection and tracking, the accuracy of card recognition is improved.
  • the process of card recognition does not require manual participation, which can improve the efficiency and accuracy of card recognition.
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device in this embodiment may include: one or more processors 501; one or more input devices 502, one or more output devices 503 and storage 504.
  • the aforementioned processor 501, input device 502, output device 503, and memory 504 are connected via a bus 505.
  • the processor 501 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), application specific integrated circuits (ASICs). ), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the input device 502 can include a touch panel, a fingerprint sensor (used to collect user fingerprint information and fingerprint orientation information), a microphone, etc.
  • the output device 503 can include a display (LCD, etc.), a speaker, etc., and the output device 503 can output calibration The processed data sheet.
  • the memory 504 may include a read-only memory and a random access memory, and provides instructions and data to the processor 501. A part of the memory 504 may also include a non-volatile random access memory.
  • the memory 504 is used to store a computer program.
  • the computer program includes program instructions.
  • the processor 501 is used to execute the program instructions stored in the memory 504 to execute a program.
  • a method of card recognition which is used to perform the following operations:
  • each of the multi-frame image frames is an image frame in a red, green, and blue RGB format
  • the processor 501, input device 502, and output device 503 described in the embodiment of this application can perform the implementation described in the first embodiment of the card identification method provided in the embodiment of this application, and can also perform the implementation described in the embodiment of this application.
  • the implementation method of the electronic device of, I will not repeat it here.
  • the multi-frame image frame corresponding to the target card is obtained.
  • Each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format.
  • the frame determines the card information of the target card.
  • the card information is used to reflect the edge conditions and key points of the target card.
  • the card information of the target card it is judged whether the target card is a real card. That is, by adopting the card detection mechanism of detection and tracking, the accuracy of card recognition is improved.
  • the process of card recognition does not require manual participation, which can improve the efficiency and accuracy of card recognition.
  • An embodiment of the present application also provides a computer-readable storage medium that stores a computer program for electronic data exchange, where the computer program implements the card recognition method shown in the embodiment of FIG. 1 when the computer program is executed by a computer.
  • the computer-readable storage medium may be an internal storage unit of the electronic device described in any of the foregoing embodiments, such as a hard disk or a memory of a control device.
  • the computer-readable storage medium may also be an external storage device of the control device, such as a plug-in hard disk equipped on the control device, a smart memory card (Smart Media Card, SMC), and a secure digital (Secure Digital, SD) ) Card, Flash Card, etc.
  • the computer-readable storage medium may also include both an internal storage unit of the control device and an external storage device.
  • the computer-readable storage medium is used to store the computer program and other programs and data required by the control device.
  • the computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
  • the computer-readable storage medium may be non-volatile or volatile.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • General Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Image Analysis (AREA)

Abstract

A method and an apparatus for card recognition, a device, and a storage medium, relating to the field of financial technology. The card recognition method comprises: when it is detected that a card detection service is active, acquiring a plurality of image frames corresponding to a target card, each image frame in the plurality of image frames being an RGB format image frame (S101), then, on the basis of the plurality of image frames, determining card information of the target card (S102), the card information being used to map edges and key points of the target card, and finally, on the basis of the card information of the target card, determining whether the target card is a genuine card (S103). The invention helps to improve the efficiency and accuracy of card recognition.

Description

卡片识别方法、装置、设备及存储介质Card identification method, device, equipment and storage medium
本申请要求于2020年07月27日提交中国专利局、申请号为202010735901.0,发明名称为“卡片识别方法、装置及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the Chinese Patent Office on July 27, 2020, the application number is 202010735901.0, and the invention title is "Card Recognition Method, Apparatus and Equipment", the entire content of which is incorporated into this application by reference .
技术领域Technical field
本申请涉及金融科技领域,尤其涉及一种卡片识别方法、装置、设备及存储介质。This application relates to the field of financial technology, in particular to a card identification method, device, equipment and storage medium.
背景技术Background technique
随着身份证、社保卡和银行卡等各种卡片大量的使用,相关的卡片识别服务也随之而来,针对各种卡片识别场景,卡片识别技术成为了不可或缺的部分,作为卡片识别技术中很重要的一环,卡片的边框检测算法越来越受到重视。With the large-scale use of various cards such as ID cards, social security cards, and bank cards, related card identification services have also followed. For various card identification scenarios, card identification technology has become an indispensable part as card identification A very important part of the technology, the border detection algorithm of the card is getting more and more attention.
传统的卡片识别技术,用户需要面对复杂、冗长、繁琐的操作,如,用户需要按照逐层的操作提示信息进行操作才能识别出卡片,这容易给用户造成较差的体验,由此可见,传统的卡片识别算法还不够智能,需要很多人工干预,严重影响用户的体验,导致传统的卡片识别服务面临越来越明显的挑战。With traditional card recognition technology, users need to face complex, lengthy, and cumbersome operations. For example, users need to operate according to the operation prompt information layer by layer to recognize the card, which easily causes a poor experience for the user. It can be seen that, Traditional card recognition algorithms are not smart enough and require a lot of manual intervention, which seriously affects the user experience, causing traditional card recognition services to face more and more obvious challenges.
发明人意识到,现有的卡片边框检测算法,主要是采用神经网络或者传统的边缘检测算法找到图片中的所有边缘信息,然后设置各种条件过滤掉一些边缘信息,得到卡片边框,在复杂背景或者边缘模糊的情况下,容易出现误判,导致边框检测错误,影响后续对卡片信息的提取等其他服务的运行。The inventor realized that the existing card border detection algorithms mainly use neural networks or traditional edge detection algorithms to find all the edge information in the picture, and then set various conditions to filter out some edge information to obtain the card border. Or when the edges are blurred, misjudgments are likely to occur, leading to frame detection errors and affecting the subsequent operation of other services such as card information extraction.
发明内容Summary of the invention
本申请实施例提供一种卡片识别方法、装置、设备及存储介质,可提高对卡片识别还原的效率。The embodiments of the present application provide a card identification method, device, equipment, and storage medium, which can improve the efficiency of card identification and restoration.
第一方面,本申请实施例提供了一种卡片识别方法,该方法包括:In the first aspect, an embodiment of the present application provides a card identification method, which includes:
在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;When it is detected that the card detection service is started, acquiring a multi-frame image frame corresponding to the target card, each of the multi-frame image frames is an image frame in a red, green, and blue RGB format;
根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;Determining the card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。Determine whether the target card is a real card according to the card information of the target card.
第二方面,本申请实施例提供了一种卡片识别装置,该装置包括:In a second aspect, an embodiment of the present application provides a card identification device, which includes:
获取模块,用于在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;The obtaining module is configured to obtain a multi-frame image frame corresponding to the target card when the card detection service is detected to be started, each of the multi-frame image frames is an image frame in red, green, and blue RGB format;
确定模块,用于根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;A determining module, configured to determine card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
判断模块,用于根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。The judging module is used for judging whether the target card is a real card according to the card information of the target card.
第三方面,本申请实施例提供了一种电子设备,包括:In the third aspect, an embodiment of the present application provides an electronic device, including:
处理器,适于实现一条或一条以上指令;以及,Processor, suitable for implementing one or more instructions; and,
计算机可读存储介质,所述计算机可读存储介质存储有一条或一条以上指令,所述一条或一条以上指令适于由所述处理器加载并执行以下步骤:A computer-readable storage medium storing one or more instructions, and the one or more instructions are suitable for being loaded by the processor and executing the following steps:
在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;When it is detected that the card detection service is started, acquiring a multi-frame image frame corresponding to the target card, each of the multi-frame image frames is an image frame in a red, green, and blue RGB format;
根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;Determining the card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。Determine whether the target card is a real card according to the card information of the target card.
第四方面,本申请实施例提供了一种计算机可读存储介质,存储用于电子数据交换的计算机程序,其中,所述计算机程序被计算机执行时用于实现以下步骤:In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium that stores a computer program for electronic data exchange, where the computer program is used to implement the following steps when executed by a computer:
在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;When it is detected that the card detection service is started, acquiring a multi-frame image frame corresponding to the target card, each of the multi-frame image frames is an image frame in a red, green, and blue RGB format;
根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;Determining the card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。Determine whether the target card is a real card according to the card information of the target card.
本申请实施例中,在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧,之后,根据多帧图像帧确定目标卡片的卡片信息,卡片信息用于反映目标卡片的边缘情况和关键点情况,最后,根据目标卡片的卡片信息判断目标卡片是否为真卡。即通过采用检测加跟踪的卡片检测机制,提升卡片识别的精度,该卡片识别的过程不需要人工参与,可提高卡片识别的效率以及准确度。In the embodiment of the present application, when the card detection service is started, the multi-frame image frame corresponding to the target card is obtained. Each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format. Then, according to the multi-frame image The frame determines the card information of the target card. The card information is used to reflect the edge conditions and key points of the target card. Finally, according to the card information of the target card, it is judged whether the target card is a real card. That is, by adopting the card detection mechanism of detection and tracking, the accuracy of card recognition is improved. The process of card recognition does not require manual participation, which can improve the efficiency and accuracy of card recognition.
附图说明Description of the drawings
图1是本申请实施例提供的另一种卡片识别方法的流程示意图;FIG. 1 is a schematic flowchart of another card identification method provided by an embodiment of the present application;
图2是本申请实施例提供的一种解码器的结构示意图;FIG. 2 is a schematic structural diagram of a decoder provided by an embodiment of the present application;
图3是本申请实施例提供的另一种解码器的结构示意图;Figure 3 is a schematic structural diagram of another decoder provided by an embodiment of the present application;
图4是本申请实施例提供的一种卡片识别装置的结构示意图;FIG. 4 is a schematic structural diagram of a card identification device provided by an embodiment of the present application;
图5是本申请另一实施例提供的一种电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device provided by another embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
人工智能技术是一门综合学科,涉及领域广泛,既有硬件层面的技术也有软件层面的技术。人工智能基础技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理技术、操作/交互系统、机电一体化等技术。人工智能软件技术主要包括计算机视觉技术、语音处理技术、自然语言处理技术以及机器学习/深度学习等几大方向。Artificial intelligence technology is a comprehensive discipline, covering a wide range of fields, including both hardware-level technology and software-level technology. Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, and mechatronics. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning/deep learning.
其中,计算机视觉技术(Computer Vision,CV)是一门研究如何使机器“看”的科学, 更进一步的说,就是指用摄影机和电脑代替人眼对目标进行识别、跟踪和测量等机器视觉,并进一步做图形处理,使电脑处理成为更适合人眼观察或传送给仪器检测的图像。作为一个科学学科,计算机视觉研究相关的理论和技术,试图建立能够从图像或者多维数据中获取信息的人工智能系统。计算机视觉技术通常包括图像处理、图像识别、图像语义理解、图像检索、OCR、视频处理、视频语义理解、视频内容/行为识别、三维物体重建、3D技术、虚拟现实、增强现实、同步定位与地图构建等技术,还包括常见的人脸识别、指纹识别等生物特征识别技术。Among them, Computer Vision (CV) is a science that studies how to make machines "see". Furthermore, it refers to the use of cameras and computers instead of human eyes to identify, track, and measure targets. And further graphics processing, so that computer processing becomes more suitable for human eyes to observe or send to the instrument to detect the image. As a scientific discipline, computer vision studies related theories and technologies, trying to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content/behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, synchronous positioning and mapping Construction and other technologies also include common face recognition, fingerprint recognition and other biometric recognition technologies.
本申请涉及人工智能中的图像识别技术,利用图像识别技术将图像自动转换为卡片识别,不需要人工参与,可提高卡片识别的效率以及准确度;本申请可适用于智慧政务、智慧教育等领域,有利于推动智慧城市的建设。This application relates to image recognition technology in artificial intelligence. The image recognition technology is used to automatically convert images into card recognition without manual participation, which can improve the efficiency and accuracy of card recognition; this application can be applied to smart government affairs, smart education and other fields , Which is conducive to promoting the construction of smart cities.
请参见图1,是本申请实施例提供的一种卡片识别方法的流程示意图,由本申请实施例电子设备来执行,该卡片识别方法包括以下步骤S101~S103。Please refer to FIG. 1, which is a schematic flowchart of a card recognition method provided by an embodiment of the present application, which is executed by the electronic device of the embodiment of the present application. The card recognition method includes the following steps S101 to S103.
S101,电子设备在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;S101, when the electronic device detects that the card detection service is started, obtains a multi-frame image frame corresponding to the target card, where each image frame in the multi-frame image frame is an image frame in a red, green, and blue RGB format;
其中,所述目标卡片可以是身份证明类卡片,如身份证、通行证以及驾驶证等,所述目标卡片还可以是惠民类卡片,如社保卡、医保卡以及会员卡等,所述目标卡片还可以是金融类卡片,如存储卡、信用卡等,所述目标卡片还可以是其他类型的卡片,不作具体限定。Wherein, the target card may be an identification card, such as an ID card, a pass, a driver's license, etc., and the target card may also be a welfare card, such as a social security card, a medical insurance card, a membership card, etc., the target card It may also be a financial card, such as a memory card, a credit card, etc., and the target card may also be another type of card, which is not specifically limited.
其中,所述卡片检测服务启动的触发条件可以是卡片感应区域感应到卡状物体,如,身份证感应区域感应到有卡状物体放置,再如,银行卡插卡槽感应到卡状物体插入,等等,不作具体限定;所述卡片检测服务启动的触发条件也可以是用户针对预设的检测服务启动按钮的触发操作,其中,所述服务启动按钮可以是实体按钮也可以是虚拟空间,例如,当前卡片检测为手持设备,所述手持设备上设置有启动卡片检测服务的实体按钮,当工作人员需要确定待检测的卡片的真假时,点击该手持设备的该实体按钮,将待检测的卡片放入所述手持设备的感应区域,具体实现中,该手持设备的感应区域可以是所述手持设备的图像获取装置的图像获取范围,当该图像获取装置为摄像头时,所述图像获取范围为所述摄像头的镜头范围内,当该图像获取装置为红外线图像传感器时,所述图像获取范围为所述红外线图像传感器的红外线感应范围内;所述卡片检测服务启动的触发条件也可以是其他触发操作,不作具体限定。Wherein, the trigger condition for the activation of the card detection service may be that the card sensing area senses a card-like object, for example, the ID card sensing area senses that a card-like object is placed, and for example, a bank card insertion slot senses that a card-like object is inserted. , Etc., which are not specifically limited; the trigger condition for the activation of the card detection service can also be a user's triggering operation on a preset detection service activation button, where the service activation button can be a physical button or a virtual space. For example, the current card is detected as a handheld device, and the handheld device is provided with a physical button to start the card detection service. When the staff needs to determine the authenticity of the card to be detected, click the physical button of the handheld device to change the physical button to be detected. The card is placed in the sensing area of the handheld device. In a specific implementation, the sensing area of the handheld device may be the image acquisition range of the image acquisition device of the handheld device. When the image acquisition device is a camera, the image acquisition The range is within the lens range of the camera. When the image acquisition device is an infrared image sensor, the image acquisition range is within the infrared sensing range of the infrared image sensor; the trigger condition for starting the card detection service may also be Other trigger operations are not specifically limited.
可选的,所述电子设备在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧的具体实现方式可以是:所述电子设备在检测到卡片检测服务启动时,录制所述目标卡片对应的视频;所述电子设备按照第一预设时间间隔从录制的所述视频中获取所述目标卡片对应的多帧原始图像帧;所述电子设备判断所述多帧原始图像帧是否为RGB格式的图像帧;若否,则所述电子设备将所述多帧原始图像帧转化为RGB格式的图像帧。其中,所述第一预设时间间隔可以根据用户需求以及当前设备性能进行设置,对所述第一时间间隔的数值不作具体限定。Optionally, when the electronic device detects that the card detection service is started, the specific implementation manner for acquiring the multiple image frames corresponding to the target card may be: when the electronic device detects that the card detection service is started, recording the target The video corresponding to the card; the electronic device obtains multiple original image frames corresponding to the target card from the recorded video at a first preset time interval; the electronic device determines whether the multiple original image frames are RGB format image frames; if not, the electronic device converts the multiple original image frames into RGB format image frames. Wherein, the first preset time interval can be set according to user requirements and current device performance, and the value of the first time interval is not specifically limited.
可选的,所述电子设备在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧的具体实现方式可以是:所述电子设备在检测到卡片检测服务启动时,根据第二预设时间间隔对所述目标卡片进行拍照,得到多帧原始图像帧;所述电子设备判断所述多帧原始图像帧是否为RGB格式的图像帧;若否,则所述电子设备将所述多帧原始图像帧转化为RGB格式的图像帧。其中,所述第二预设时间间隔可以根据用户需求以及当前设备性能进行设置,对所述第二时间间隔的数值不作具体限定。Optionally, when the electronic device detects that the card detection service is started, the specific implementation manner of acquiring the multi-frame image frame corresponding to the target card may be: when the electronic device detects that the card detection service is started, the second preset Set a time interval to take pictures of the target card to obtain multiple original image frames; the electronic device determines whether the multiple original image frames are image frames in RGB format; if not, the electronic device The original image frame is converted into an image frame in RGB format. Wherein, the second preset time interval can be set according to user requirements and current device performance, and the value of the second time interval is not specifically limited.
S102,所述电子设备根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;S102: The electronic device determines card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
可选的,所述电子设备根据所述多帧图像帧确定所述目标卡片的卡片信息的实现方式包括以下步骤A11~A15:Optionally, the implementation manner for the electronic device to determine the card information of the target card according to the multiple image frames includes the following steps A11 to A15:
A11、所述电子设备判断当前处理的图像帧是否为所述多帧图像帧中的第一帧图像帧;A11. The electronic device judges whether the currently processed image frame is the first image frame among the multiple image frames;
A12、若所述当前处理的图像帧为所述多帧图像帧中的第一帧图像帧,则所述电子设备根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,所述卡片边缘信息用于反映所述目标卡片的边缘情况;A12. If the currently processed image frame is the first image frame in the multi-frame image frame, the electronic device obtains the information of the target card in the currently processed image frame according to the first preset algorithm Card edge information, where the card edge information is used to reflect the edge condition of the target card;
进一步的,所述电子设备根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,包括以下步骤B11~B15:Further, the electronic device acquiring the card edge information of the target card in the currently processed image frame according to the first preset algorithm includes the following steps B11 to B15:
B11、所述电子设备根据所述当前处理的图像帧得到第一参考图像帧,所述第一参考图像帧的尺寸为第一预设尺寸;B11. The electronic device obtains a first reference image frame according to the currently processed image frame, and the size of the first reference image frame is a first preset size;
其中,所述第一预设尺寸可以是长和宽的比例与所述目标卡片真实的长和宽的比例相等或相似的尺寸,不同的卡片,其尺寸可能不同,对所述第一预设尺寸不作具体限定。Wherein, the first preset size may be a size whose ratio of length and width is equal to or similar to the true ratio of length and width of the target card. Different cards may have different sizes. For the first preset The size is not specifically limited.
可选的,所述电子设备根据所述当前处理的图像帧得到尺寸为第一预设尺寸的第一参考图像帧的实现方式可以是:所述电子设备获取所述目标卡片的真实尺寸;所述电子设备根据所述真实尺寸和尺寸与第一预设尺寸的对应关系,确定与所述真实尺寸对应的所述第一预设尺寸,所述尺寸与第一预设尺寸的对应关系预先存储在电子设备中。Optionally, the implementation manner in which the electronic device obtains the first reference image frame whose size is the first preset size according to the currently processed image frame may be: the electronic device obtains the real size of the target card; The electronic device determines the first preset size corresponding to the actual size according to the actual size and the corresponding relationship between the size and the first preset size, and the corresponding relationship between the size and the first preset size is stored in advance In electronic equipment.
可选的,所述第一预设尺寸还可以用户根据应用场景预先设置在所述电子设备中的尺寸,对所述第一预设尺寸的数值不作具体限定。Optionally, the first preset size may also be a size preset in the electronic device by the user according to an application scenario, and the value of the first preset size is not specifically limited.
在一个可能的应用场景中,如所述当前算法运行在智能手机上,通过智能手机检测银行卡是否是真卡,正常情况下,手机是长方形的,拍摄得到的图像帧为长方形,身份证的长和宽的尺寸接近于二比一,即可以获取到上述多帧图像帧按照长和宽的比为二比一进行统一处理,需要说明的是,图像帧的尺寸越大,运算时间越长,精度越高,而为了保证时间和精度同时符合需求,则可设置第一预设尺寸为128*256,在这种情况下,可以将图像帧缩放到像素大小为128*256,需要说明的是,所述第一预设尺寸还可以是其他值,对所述第一预设尺寸不作具体限定。In a possible application scenario, as described, the current algorithm runs on a smart phone, and the smart phone is used to detect whether the bank card is a real card. Normally, the phone is rectangular, and the captured image frame is rectangular. The size of the length and width is close to two to one, that is, the above-mentioned multi-frame image frame can be obtained according to the ratio of length to width of two to one for unified processing. It should be noted that the larger the size of the image frame, the longer the calculation time. , The higher the accuracy, and in order to ensure that the time and accuracy meet the requirements at the same time, the first preset size can be set to 128*256. In this case, the image frame can be scaled to a pixel size of 128*256. Yes, the first preset size may also be other values, and the first preset size is not specifically limited.
B12、所述电子设备根据所述第一参考图像帧得到第二参考图像帧,所述第一参考图像帧的像素值为所述第二参考图像帧的像素值的255倍;B12. The electronic device obtains a second reference image frame according to the first reference image frame, and the pixel value of the first reference image frame is 255 times the pixel value of the second reference image frame;
其中,所述根据所述第一参考图像帧得到第二参考图像帧是指将所述第一参考图像帧 转化为二值图。Wherein, the obtaining the second reference image frame according to the first reference image frame refers to converting the first reference image frame into a binary image.
B13、所述电子设备将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点;B13. The electronic device imports the second reference image frame into the target neural network model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame;
其中,所述目标神经网络模型包括语意分割模型和加权最小二乘法模型,所述将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点,包括:将所述第二参考图像帧导入所述语义分割模型,得到所述当前处理的图像帧中所述目标卡片的特征图;将所述特征图导入到所述加权最小二乘法模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点。Wherein, the target neural network model includes a semantic segmentation model and a weighted least squares model, and the second reference image frame is imported into the target neural network model to obtain the initial image of the target card in the currently processed image frame The edge line parameters and four initial reference points include: importing the second reference image frame into the semantic segmentation model to obtain the feature map of the target card in the currently processed image frame; importing the feature map To the weighted least squares model, the initial edge line parameters and four initial reference points of the target card in the currently processed image frame are obtained.
其中,所述目标神经网络模型为shufflenet_basic_128模型,是基于deeplab v3模型改进而来的模型。Wherein, the target neural network model is the shufflenet_basic_128 model, which is an improved model based on the deeplab v3 model.
其中,所述shufflenet_basic_128模型包括编码器Encoder,解码器Decoder和最小二乘法模块Weighted_least_squares 3个部分组成。其中,所述Encoder采用shufflenet_0.5网络,Decoder采用deepnet v3模型的简化结构,具体的,解码器可以采用的结构,可以是如图2所示,解码器包括池化层Average Pool、第一1x1卷积层、第一激活函数BN+RELU、双线性差值Resize Bilinear层、全连接Concat层依次连接,第二1x1Conv卷积层、第二BN+RELU、Concat层依次连接。解码器可以采用的结构,还可以是如图3所示,第一1x1卷积层、第二1x1卷积层、拟合层Dropout、双线性差值层、参数层ArgMax。Wherein, the shufflenet_basic_128 model includes an encoder Encoder, a decoder Decoder, and a least squares module Weighted_least_squares consisting of three parts. Among them, the Encoder adopts the shufflenet_0.5 network, and the Decoder adopts the simplified structure of the deepnet v3 model. Specifically, the structure that the decoder can adopt can be as shown in Figure 2. The decoder includes the pooling layer Average Pool and the first 1x1 The convolution layer, the first activation function BN+RELU, the bilinear difference Resize Bilinear layer, and the fully connected Concat layer are connected in sequence, and the second 1x1Conv convolution layer, the second BN+RELU, and the Concat layer are connected in sequence. The structure that the decoder can adopt can also be as shown in FIG. 3, the first 1x1 convolutional layer, the second 1x1 convolutional layer, the fitting layer Dropout, the bilinear difference layer, and the parameter layer ArgMax.
其中,所述电子设备根据所述第二参考图像帧,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点的具体实现过程是在所述导入目标神经网络模型,即shufflenet_basic_128模型中实现的。Wherein, the electronic device obtains the initial edge line parameters of the target card and the four initial reference points in the currently processed image frame according to the second reference image frame. The network model is implemented in the shufflenet_basic_128 model.
下面,以所述第一参考图像帧的尺寸128*256为例,对所述电子设备将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点的实现过程进行介绍。In the following, taking the size of the first reference image frame of 128*256 as an example, the second reference image frame is imported into the target neural network model for the electronic device to obtain the target card in the currently processed image frame The initial edge line parameters and the realization process of the four initial reference points are introduced.
将所述尺寸为128*256的第一参考图像帧导入所述语义分割模型,得到第一参考图像帧的语义分割结果,即特征图,其尺寸为4*128*256;将所述4*128*256的特征图导入到所述加权最小二乘法模型,若,对每个128*256的特征图,设为x,则计算如下:X_map为x轴坐标的feature map;y_map为y轴坐标的feature map,计算方程组W*[y_map,1]=A*W*x_map,得到A=inv(T(WY)*WY)*(T(WY)*WX),其中,T(x)为x的转置,inv(x)为x的逆,A的尺寸为1*2,一共有4个128*256的特征图计算,可以共得到4*2个直线参数。Import the first reference image frame with the size of 128*256 into the semantic segmentation model to obtain the semantic segmentation result of the first reference image frame, that is, the feature map, the size of which is 4*128*256; The 128*256 feature map is imported into the weighted least squares model. If, for each 128*256 feature map, set as x, the calculation is as follows: X_map is the feature map of the x-axis coordinate; y_map is the y-axis coordinate Feature map of, calculate the equation set W*[y_map,1]=A*W*x_map, get A=inv(T(WY)*WY)*(T(WY)*WX), where T(x) is The transpose of x, inv(x) is the inverse of x, and the size of A is 1*2. There are a total of 4 128*256 feature map calculations, and a total of 4*2 linear parameters can be obtained.
B14、所述电子设备根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线;B14. The electronic device obtains the target edge line of the target card in the currently processed image frame according to the initial edge line parameter and the four initial reference points;
在一个可能的实例中,所述根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线,包括:所述电子设备根据所述四个初始参考点确定所述当前处理的图像帧中所述目标卡片的四个边缘区域;所述电子设备确 定所述四个边缘区域中每个边缘区域对应的多个目标顶点;所述电子设备根据所述每个边缘区域对应的多个目标顶点确定所述每个边缘区域对应的目标边缘直线,得到所述当前处理的图像帧中所述目标卡片的目标边缘直线。In a possible example, the obtaining the target edge line of the target card in the currently processed image frame according to the initial edge line parameter and the four initial reference points includes: the electronic device according to the The four initial reference points determine four edge regions of the target card in the currently processed image frame; the electronic device determines multiple target vertices corresponding to each edge region of the four edge regions; The electronic device determines the target edge line corresponding to each edge region according to the multiple target vertices corresponding to each edge region, and obtains the target edge line of the target card in the currently processed image frame.
其中,所述四个边缘区域的尺寸可以相同,也可以不同,对所述四个边缘区域的尺寸大小不作具体限定。Wherein, the size of the four edge regions may be the same or different, and the size of the four edge regions is not specifically limited.
所述电子设备确定所述四个边缘区域中每个边缘区域对应的多个目标顶点,包括:所述电子设备将当前处理的区域分成n段,得到n个子区域,n为大于等于3的正整数;所述电子设备根据所述n个子区域得到所述n个子区域的二值化图像;所述电子设备根据所述n个子区域的二值化图像确定所述n个子区域中的n条目标直线,所述目标直线为子区域中面积最小的直线;所述电子设备确定所述n条目标直线中每条目标直线的两端顶点,得到所述当前处理的区域对应的多个目标顶点。The electronic device determining multiple target vertices corresponding to each of the four edge regions includes: the electronic device divides the currently processed region into n segments to obtain n subregions, where n is a positive value greater than or equal to 3. Integer; the electronic device obtains binarized images of the n sub-regions according to the n sub-regions; the electronic device determines n targets in the n sub-regions according to the binarized images of the n sub-regions A straight line, the target straight line is the straight line with the smallest area in the sub-region; the electronic device determines the vertices at both ends of each target straight line in the n target straight lines to obtain multiple target vertices corresponding to the currently processed region.
其中,用户可以根据需要设置n的的值,对n的值不作具体限定。Among them, the user can set the value of n as needed, and the value of n is not specifically limited.
其中,所述电子设备将当前处理的区域分成n段,得到n个子区域的实现方式可以是:所述电子设备索贝尔sobel边缘检测算法将当前处理的区域分成n段,得到n个子区域。Wherein, the electronic device divides the currently processed area into n segments to obtain n sub-areas. The implementation manner of obtaining n sub-areas may be: the electronic device Sobel edge detection algorithm divides the currently processed area into n segments to obtain n sub-areas.
其中,所述电子设备根据所述n个子区域得到所述n个子区域的二值化图像的实现方式可以是:所述电子设备采用大津法OTSU对所述n个子区域的图片进行自适应二值化,得到所述n个子区域的二值化图像。Wherein, the implementation manner for the electronic device to obtain the binarized image of the n sub-regions according to the n sub-regions may be: the electronic device adopts the Otsu method OTSU to perform adaptive binary image on the pictures of the n sub-regions To obtain the binarized image of the n sub-regions.
可以理解的是,所述四个边缘区域中每个边缘区域对应的多个目标顶点都会得到2n个顶点。It can be understood that the multiple target vertices corresponding to each of the four edge regions will get 2n vertices.
所述电子设备根据所述每个边缘区域对应的多个目标顶点确定所述每个边缘区域对应的目标边缘直线,得到所述当前处理的图像帧中所述目标卡片的目标边缘直线的实现方式可以是:对所述每个边缘区域对应的两个顶点采用随机采样ransac算法,拟合出所述每个边缘区域对应的边缘直线。The electronic device determines the target edge line corresponding to each edge region according to the multiple target vertices corresponding to each edge region, and obtains the implementation manner of the target edge line of the target card in the currently processed image frame It may be: a random sampling ransac algorithm is used for the two vertices corresponding to each edge region to fit the edge straight line corresponding to each edge region.
B15、所述电子设备确定与所述目标边缘直线对应的所述当前处理的图像帧中所述目标卡片的顶点。B15. The electronic device determines the vertex of the target card in the currently processed image frame corresponding to the target edge straight line.
A13、若所述当前处理的图像帧不为所述多帧图像帧中的第一帧图像帧,则所述电子设备确定所述当前处理的图像帧的前一帧图像帧中是否存在所述目标卡片;A13. If the currently processed image frame is not the first image frame in the multi-frame image frame, the electronic device determines whether the currently processed image frame exists in the previous image frame. Target card
A14、若所述当前处理的图像帧的前一帧图像帧中存在所述目标卡片,则所述电子设备根据第二预设算法获取所述当前处理的图像帧中所述目标卡片的卡片关键点信息,所述卡片关键点信息用于反映所述目标卡片的关键点情况;A14. If the target card exists in the previous image frame of the currently processed image frame, the electronic device acquires the card key of the target card in the currently processed image frame according to a second preset algorithm Point information, the card key point information is used to reflect the key point situation of the target card;
所述根据第二预设算法获取所述当前处理的图像帧中所述目标卡片的卡片关键点信息,包括以下步骤B21~B24:The acquiring card key point information of the target card in the currently processed image frame according to the second preset algorithm includes the following steps B21 to B24:
B21、所述电子设备根据所述当前处理的图像帧的前一帧图像帧的所述目标卡片的卡片信息得到所述当前处理的图像帧的初始化图像帧;B21. The electronic device obtains the initialization image frame of the currently processed image frame according to the card information of the target card of the previous image frame of the currently processed image frame;
B22、所述电子设备确定所述初始化图像帧中的多个关键点;B22. The electronic device determines multiple key points in the initialization image frame;
所述多个关键点可以是卡片中的多个特征点,多所述关键点的数量不作具体限定。The multiple key points may be multiple feature points in the card, and the number of the key points is not specifically limited.
B23、所述电子设备获取所述多个关键点的原始坐标;B23. The electronic device obtains the original coordinates of the multiple key points;
B24、所述电子设备根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值。B24. The electronic device obtains the target feature values of the multiple key points according to the original coordinates of the multiple key points.
其中,所述电子设备根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值,包括:所述电子设备根据所述当前处理的关键点对应的第m横坐标,确定与所述第m横坐标对应的第m方向梯度直方图hog特征,得到所述针对当前处理的关键点的第m特征值,所述第m横坐标为所述当前处理的图像帧的第m次卷积的图像帧中的与所述当前处理的关键点对应的关键点的横坐标;所述电子设备根据所述第m特征值确定与所述第m特征值对应的所述当前处理的关键点的第m横坐标变化量,所述第m横坐标变化量为所述第m横坐标到第m+1横坐标之间的变化值,所述第m+1横坐标为所述当前处理的图像帧的第m次卷积之后得到的图像帧中的与所述当前处理的关键点对应的关键点的横坐标;所述电子设备根据所述第m横坐标和所述第m横坐标变化量得到所述第m+1横坐标。Wherein, the electronic device obtaining the target feature value of the multiple key points according to the original coordinates of the multiple key points includes: the electronic device determines according to the mth abscissa corresponding to the currently processed key point The m-th direction gradient histogram hog feature corresponding to the m-th abscissa is used to obtain the m-th eigenvalue of the currently processed key point, and the m-th abscissa is the m-th characteristic value of the currently processed image frame. The abscissa of the key point corresponding to the currently processed key point in the subconvolved image frame; the electronic device determines the currently processed key point corresponding to the m-th eigenvalue according to the m-th eigenvalue The m-th abscissa change of the key point, the m-th abscissa change is the change value from the m-th abscissa to the m+1-th abscissa, and the m+1-th abscissa is the current The abscissa of the key point corresponding to the currently processed key point in the image frame obtained after the m-th convolution of the processed image frame; the electronic device according to the m-th abscissa and the m-th abscissa The amount of coordinate change obtains the m+1th abscissa.
其中,所述第m横坐标变化量delta_x m、所述第m+1横坐标x m+1、所述第m横坐标x m、第m特征值F m之间的对应关系可以是:delta_x m+1=w*F m+b,x m+1=x m+delta_x m+1,其中,其中参数w和b,是采用最小二乘法提前训练得到的。 Wherein, the corresponding relationship among the m-th abscissa change delta_x m , the m+1- th abscissa x m+1 , the m- th abscissa x m , and the m- th eigenvalue F m may be: delta_x m+1 =w*F m +b, x m+1 =x m +delta_x m+1 , where the parameters w and b are obtained by training in advance using the least square method.
其中,对m的数量不作具体限定,即是,对图像帧的卷积次数不作具体限定,具体实现中,m可以4,当m为4时,计算速度和计算的结果精度符合使用需求。Among them, the number of m is not specifically limited, that is, the number of convolutions of the image frame is not specifically limited. In specific implementation, m can be 4. When m is 4, the calculation speed and the accuracy of the calculation result meet the requirements of use.
A15、若所述当前处理的图像帧的前一帧图像帧中不存在所述目标卡片,则根据所述第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息。A15. If the target card does not exist in the previous image frame of the currently processed image frame, acquire the card edge information of the target card in the currently processed image frame according to the first preset algorithm .
S103,所述电子设备根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。S103: The electronic device judges whether the target card is a real card according to the card information of the target card.
可选的,可以采用svm分类器根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。Optionally, an svm classifier may be used to determine whether the target card is a real card according to the card information of the target card.
可选的,本申请中的电子设备可以是指区块链中的任一节点设备,所谓区块链是一种分布式数据存储、点对点传输(P2P传输)、共识机制、加密算法等计算机技术的新型应用模式,其本质上是一个去中心化的数据库;区块链可由多个借由密码学串接并保护内容的串连交易记录(又称区块)构成,用区块链所串接的分布式账本能让多方有效纪录交易,且可永久查验此交易(不可篡改)。其中,共识机制是指区块链网络中实现不同节点之间建立信任、获取权益的数学算法;也就是说,共识机制是区块链各网络节点共同认可的一种数学算法。本申请可利用区块链的共识机制,来实现将目标图像还原为目标卡片识别,可提高还原目标卡片识别的准确度。Optionally, the electronic device in this application may refer to any node device in the blockchain. The so-called blockchain is a computer technology such as distributed data storage, peer-to-peer transmission (P2P transmission), consensus mechanism, encryption algorithm, etc. The new type of application model is essentially a decentralized database; the blockchain can be composed of multiple serial transaction records (also known as blocks) that are connected by cryptography and protect the content. The connected distributed ledger allows multiple parties to effectively record the transaction, and the transaction can be checked permanently (not tampered with). Among them, the consensus mechanism refers to the mathematical algorithm that realizes the establishment of trust between different nodes and the acquisition of rights and interests in the blockchain network; that is to say, the consensus mechanism is a mathematical algorithm recognized by all network nodes of the blockchain. This application can use the consensus mechanism of the blockchain to realize the restoration of the target image to the target card recognition, which can improve the accuracy of the restoration of the target card recognition.
例如,区块链中的各个节点设备对上述步骤S101~S103的执行结果进行共识验证,每个步骤的执行结果均被共识验证通过,则可以确定生成目标卡片识别准确度比较高;如果存在步骤的执行结果未被共识验证通过,则可以确定生成目标卡片识别的准确度比较低,则节点设备可以再次执行上述步骤S101~S103,重新获取目标卡片识别。或者,区块链中的各个节点设备可以对目标卡片识别(即仅对步骤S103的执行结果)进行共识验证,如果共识验证通过,则确定目标卡片识别的准确度比较高;如果共识验证未通过,则确定目标卡片识别的准确度比较低,节点设备可再次执行上述步骤S101~S103,重新获取目标卡片 识别。For example, each node device in the blockchain performs consensus verification on the execution results of the above steps S101 to S103, and the execution results of each step are passed by the consensus verification, it can be determined that the accuracy of the generated target card recognition is relatively high; if there are steps If the execution result of is not passed by the consensus verification, it can be determined that the accuracy of the generated target card recognition is relatively low, and the node device may perform the above steps S101 to S103 again to obtain the target card recognition again. Alternatively, each node device in the blockchain can perform consensus verification on the target card identification (that is, only the execution result of step S103). If the consensus verification is passed, it is determined that the accuracy of the target card identification is relatively high; if the consensus verification fails , It is determined that the accuracy of the target card recognition is relatively low, and the node device can perform the above steps S101 to S103 again to obtain the target card recognition again.
本申请实施例中,在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧,之后,根据多帧图像帧确定目标卡片的卡片信息,卡片信息用于反映目标卡片的边缘情况和关键点情况,最后,根据目标卡片的卡片信息判断目标卡片是否为真卡。即通过采用检测加跟踪的卡片检测机制,提升卡片识别的精度,该卡片识别的过程不需要人工参与,可提高卡片识别的效率以及准确度。In the embodiment of the present application, when the card detection service is started, the multi-frame image frame corresponding to the target card is obtained. Each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format. Then, according to the multi-frame image The frame determines the card information of the target card. The card information is used to reflect the edge conditions and key points of the target card. Finally, according to the card information of the target card, it is judged whether the target card is a real card. That is, by adopting the card detection mechanism of detection and tracking, the accuracy of card recognition is improved. The process of card recognition does not require manual participation, which can improve the efficiency and accuracy of card recognition.
请参见图4,是本申请实施例提供的一种卡片识别装置的结构示意图,本申请实施例的所述卡片识别装置可以在上述提及的电子设备中。本实施例中,该卡片识别装置包括获取模块401、确定模块402、判断模块403:Please refer to FIG. 4, which is a schematic structural diagram of a card recognition device provided by an embodiment of the present application. The card recognition device of the embodiment of the present application may be in the above-mentioned electronic equipment. In this embodiment, the card recognition device includes an acquisition module 401, a determination module 402, and a judgment module 403:
获取模块401,用于在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;The obtaining module 401 is configured to obtain a multi-frame image frame corresponding to the target card when it is detected that the card detection service is started, and each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format;
确定模块402,用于根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;The determining module 402 is configured to determine the card information of the target card according to the multi-frame image frame, and the card information is used to reflect the edge condition and key point condition of the target card;
判断模块403,用于根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。The judging module 403 is used for judging whether the target card is a real card according to the card information of the target card.
其中,在所述根据所述多帧图像帧确定所述目标卡片的卡片信息方面,所述确定模块402具体用于:判断当前处理的图像帧是否为所述多帧图像帧中的第一帧图像帧;若所述当前处理的图像帧为所述多帧图像帧中的第一帧图像帧,则根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,所述卡片边缘信息用于反映所述目标卡片的边缘情况;若所述当前处理的图像帧不为所述多帧图像帧中的第一帧图像帧,则确定所述当前处理的图像帧的前一帧图像帧中是否存在所述目标卡片;若所述当前处理的图像帧的前一帧图像帧中存在所述目标卡片,则根据第二预设算法获取所述当前处理的图像帧中所述目标卡片的卡片关键点信息,所述卡片关键点信息用于反映所述目标卡片的关键点情况;若所述当前处理的图像帧的前一帧图像帧中不存在所述目标卡片,则根据所述第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息。Wherein, in terms of determining the card information of the target card according to the multi-frame image frame, the determining module 402 is specifically configured to: determine whether the currently processed image frame is the first frame of the multi-frame image frame Image frame; if the currently processed image frame is the first image frame in the multi-frame image frame, acquire the card edge information of the target card in the currently processed image frame according to the first preset algorithm , The card edge information is used to reflect the edge condition of the target card; if the currently processed image frame is not the first image frame in the multi-frame image frame, the currently processed image frame is determined Whether the target card exists in the previous image frame of the currently processed image frame; if the target card exists in the previous image frame of the currently processed image frame, the currently processed image frame is acquired according to the second preset algorithm The card key point information of the target card in the card key point information, the card key point information is used to reflect the key point situation of the target card; if the target card does not exist in the previous image frame of the currently processed image frame , The card edge information of the target card in the currently processed image frame is acquired according to the first preset algorithm.
其中,在所述根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息方面,所述确定模块402具体用于:根据所述当前处理的图像帧得到第一参考图像帧,所述第一参考图像帧的尺寸为第一预设尺寸;根据所述第一参考图像帧得到第二参考图像帧,所述第一参考图像帧的像素值为所述第二参考图像帧的像素值的255倍;将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点;根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线;确定与所述目标边缘直线对应的所述当前处理的图像帧中所述目标卡片的顶点。Wherein, in terms of obtaining the card edge information of the target card in the currently processed image frame according to the first preset algorithm, the determining module 402 is specifically configured to: obtain the first Reference image frame, the size of the first reference image frame is a first preset size; a second reference image frame is obtained according to the first reference image frame, and the pixel value of the first reference image frame is the second 255 times the pixel value of the reference image frame; import the second reference image frame into the target neural network model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame; according to The initial edge line parameter and the four initial reference points obtain the target edge line of the target card in the currently processed image frame; determine the target edge line corresponding to the target edge line in the currently processed image frame State the apex of the target card.
其中,在所述目标神经网络模型包括语意分割模型和加权最小二乘法模型,所述将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点方面,所述确定模块402具体用于:将所述第二参考图像帧导入所述语义分割模型,得到所述当前处理的图像帧中所述目标卡片的特征图;将 所述特征图导入到所述加权最小二乘法模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点。Wherein, the target neural network model includes a semantic segmentation model and a weighted least squares model, and the second reference image frame is imported into the target neural network model to obtain the image of the target card in the currently processed image frame In terms of initial edge line parameters and four initial reference points, the determining module 402 is specifically configured to: import the second reference image frame into the semantic segmentation model to obtain the target card information in the currently processed image frame Feature map; import the feature map into the weighted least squares model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame.
其中,在所述根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线方面,所述确定模块402具体用于:根据所述四个初始参考点确定所述当前处理的图像帧中所述目标卡片的四个边缘区域;确定所述四个边缘区域中每个边缘区域对应的多个目标顶点;根据所述每个边缘区域对应的多个目标顶点确定所述每个边缘区域对应的目标边缘直线,得到所述当前处理的图像帧中所述目标卡片的目标边缘直线。Wherein, in terms of obtaining the target edge line of the target card in the currently processed image frame according to the initial edge line parameter and the four initial reference points, the determining module 402 is specifically configured to: The four initial reference points determine the four edge regions of the target card in the currently processed image frame; determine multiple target vertices corresponding to each edge region of the four edge regions; according to each edge The multiple target vertices corresponding to the region determine the target edge line corresponding to each edge region to obtain the target edge line of the target card in the currently processed image frame.
其中,在所述确定所述四个边缘区域中每个边缘区域对应的多个目标顶点方面,所述确定模块402具体用于:将当前处理的区域分成n段,得到n个子区域,n为大于等于3的正整数;根据所述n个子区域得到所述n个子区域的二值化图像;根据所述n个子区域的二值化图像确定所述n个子区域中的n条目标直线,所述目标直线为子区域中面积最小的直线;确定所述n条目标直线中每条目标直线的两端顶点,得到所述当前处理的区域对应的多个目标顶点。Wherein, in the aspect of determining multiple target vertices corresponding to each of the four edge regions, the determining module 402 is specifically configured to: divide the currently processed region into n segments to obtain n subregions, where n is A positive integer greater than or equal to 3; obtain binarized images of the n sub-regions according to the n sub-regions; determine n target straight lines in the n sub-regions according to the binarized images of the n sub-regions, so The target straight line is the straight line with the smallest area in the subregion; the two end vertices of each target straight line in the n target straight lines are determined to obtain multiple target vertices corresponding to the currently processed region.
其中,在所述根据第二预设算法获取所述当前处理的图像帧中所述目标卡片的卡片关键点信息方面,所述确定模块402具体用于:根据所述当前处理的图像帧的前一帧图像帧的所述目标卡片的卡片信息得到所述当前处理的图像帧的初始化图像帧;确定所述初始化图像帧中的多个关键点;获取所述多个关键点的原始坐标;根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值。Wherein, in the aspect of acquiring the card key point information of the target card in the currently processed image frame according to the second preset algorithm, the determining module 402 is specifically configured to: according to the front of the currently processed image frame Obtain the initial image frame of the currently processed image frame from the card information of the target card in one image frame; determine multiple key points in the initial image frame; obtain the original coordinates of the multiple key points; The original coordinates of the multiple key points obtain the target feature values of the multiple key points.
其中,在所述根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值方面,所述确定模块402具体用于:根据所述当前处理的关键点对应的第m横坐标,确定与所述第m横坐标对应的第m方向梯度直方图hog特征,得到所述针对当前处理的关键点的第m特征值,所述第m横坐标为所述当前处理的图像帧的第m次卷积的图像帧中的与所述当前处理的关键点对应的关键点的横坐标,m为正整数;根据所述第m特征值确定与所述第m特征值对应的所述当前处理的关键点的第m横坐标变化量,所述第m横坐标变化量为所述第m横坐标到第m+1横坐标之间的变化值,所述第m+1横坐标为所述当前处理的图像帧的第m次卷积之后得到的图像帧中的与所述当前处理的关键点对应的关键点的横坐标;根据所述第m横坐标和所述第m横坐标变化量得到所述第m+1横坐标。Wherein, in terms of obtaining the target feature values of the plurality of key points according to the original coordinates of the plurality of key points, the determining module 402 is specifically configured to: according to the mth horizontal line corresponding to the currently processed key point Coordinates, determine the m-th direction gradient histogram hog feature corresponding to the m-th abscissa, and obtain the m-th eigenvalue for the currently processed key point, and the m-th abscissa is the currently processed image frame The abscissa of the key point corresponding to the currently processed key point in the m-th convolutional image frame, m is a positive integer; the m-th eigenvalue is determined according to the m-th eigenvalue. The m-th abscissa change of the currently processed key point, the m-th abscissa change is the change value from the m-th abscissa to the m+1-th abscissa, the m+1-th abscissa Is the abscissa of the key point corresponding to the currently processed key point in the image frame obtained after the mth convolution of the currently processed image frame; according to the mth abscissa and the mth abscissa The amount of coordinate change obtains the m+1th abscissa.
本申请实施例中,在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧,之后,根据多帧图像帧确定目标卡片的卡片信息,卡片信息用于反映目标卡片的边缘情况和关键点情况,最后,根据目标卡片的卡片信息判断目标卡片是否为真卡。即通过采用检测加跟踪的卡片检测机制,提升卡片识别的精度,该卡片识别的过程不需要人工参与,可提高卡片识别的效率以及准确度。In the embodiment of the present application, when the card detection service is started, the multi-frame image frame corresponding to the target card is obtained. Each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format. Then, according to the multi-frame image The frame determines the card information of the target card. The card information is used to reflect the edge conditions and key points of the target card. Finally, according to the card information of the target card, it is judged whether the target card is a real card. That is, by adopting the card detection mechanism of detection and tracking, the accuracy of card recognition is improved. The process of card recognition does not require manual participation, which can improve the efficiency and accuracy of card recognition.
请参见图5,是本申请实施例提供的一种电子设备的结构示意图,如图5所示的本实施例中的电子设备可以包括:一个或多个处理器501;一个或多个输入装置502,一个或多个输出装置503和存储器504。上述处理器501、输入装置502、输出装置503和存储器504 通过总线505连接。Please refer to FIG. 5, which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As shown in FIG. 5, the electronic device in this embodiment may include: one or more processors 501; one or more input devices 502, one or more output devices 503 and storage 504. The aforementioned processor 501, input device 502, output device 503, and memory 504 are connected via a bus 505.
所处理器501可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 501 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), application specific integrated circuits (ASICs). ), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
输入装置502可以包括触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风等,输出装置503可以包括显示器(LCD等)、扬声器等,输出装置503可以输出校正处理后的数据表。The input device 502 can include a touch panel, a fingerprint sensor (used to collect user fingerprint information and fingerprint orientation information), a microphone, etc., the output device 503 can include a display (LCD, etc.), a speaker, etc., and the output device 503 can output calibration The processed data sheet.
该存储器504可以包括只读存储器和随机存取存储器,并向处理器501提供指令和数据。存储器504的一部分还可以包括非易失性随机存取存储器,存储器504用于存储计算机程序,所述计算机程序包括程序指令,处理器501用于执行存储器504存储的程序指令,以用于执行一种卡片识别方法,即用于执行以下操作:The memory 504 may include a read-only memory and a random access memory, and provides instructions and data to the processor 501. A part of the memory 504 may also include a non-volatile random access memory. The memory 504 is used to store a computer program. The computer program includes program instructions. The processor 501 is used to execute the program instructions stored in the memory 504 to execute a program. A method of card recognition, which is used to perform the following operations:
在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;When it is detected that the card detection service is started, acquiring a multi-frame image frame corresponding to the target card, each of the multi-frame image frames is an image frame in a red, green, and blue RGB format;
根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;Determining the card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。Determine whether the target card is a real card according to the card information of the target card.
本申请实施例中所描述的处理器501、输入装置502、输出装置503可执行本申请实施例提供的卡片识别方法的第一实施例所描述的实现方式,也可执行本申请实施例所描述的电子设备的实现方式,在此不再赘述。The processor 501, input device 502, and output device 503 described in the embodiment of this application can perform the implementation described in the first embodiment of the card identification method provided in the embodiment of this application, and can also perform the implementation described in the embodiment of this application. The implementation method of the electronic device of, I will not repeat it here.
本申请实施例中,在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧,之后,根据多帧图像帧确定目标卡片的卡片信息,卡片信息用于反映目标卡片的边缘情况和关键点情况,最后,根据目标卡片的卡片信息判断目标卡片是否为真卡。即通过采用检测加跟踪的卡片检测机制,提升卡片识别的精度,该卡片识别的过程不需要人工参与,可提高卡片识别的效率以及准确度。In the embodiment of the present application, when the card detection service is started, the multi-frame image frame corresponding to the target card is obtained. Each image frame in the multi-frame image frame is an image frame in red, green, and blue RGB format. Then, according to the multi-frame image The frame determines the card information of the target card. The card information is used to reflect the edge conditions and key points of the target card. Finally, according to the card information of the target card, it is judged whether the target card is a real card. That is, by adopting the card detection mechanism of detection and tracking, the accuracy of card recognition is improved. The process of card recognition does not require manual participation, which can improve the efficiency and accuracy of card recognition.
本申请实施例中还提供一种计算机可读存储介质,存储用于电子数据交换的计算机程序,其中,所述计算机程序被计算机执行时实现如图1实施例中所示的卡片识别方法。An embodiment of the present application also provides a computer-readable storage medium that stores a computer program for electronic data exchange, where the computer program implements the card recognition method shown in the embodiment of FIG. 1 when the computer program is executed by a computer.
所述计算机可读存储介质可以是前述任一实施例所述的电子设备的内部存储单元,例如控制设备的硬盘或内存。所述计算机可读存储介质也可以是所述控制设备的外部存储设备,例如所述控制设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述计算机可读存储介质还可以既包括所述控制设备的内部存储单元也包括外部存储设备。所述计算机可读存储介质用于存储所述计算机程序以及所述控制设备所需的其他程序和数据。所述计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。其中,所述计算 机可读存储介质可以是非易失性,也可以是易失性的。The computer-readable storage medium may be an internal storage unit of the electronic device described in any of the foregoing embodiments, such as a hard disk or a memory of a control device. The computer-readable storage medium may also be an external storage device of the control device, such as a plug-in hard disk equipped on the control device, a smart memory card (Smart Media Card, SMC), and a secure digital (Secure Digital, SD) ) Card, Flash Card, etc. Further, the computer-readable storage medium may also include both an internal storage unit of the control device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the control device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output. Wherein, the computer-readable storage medium may be non-volatile or volatile.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Should be covered within the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (20)

  1. 一种卡片识别方法,其中,包括:A card identification method, which includes:
    在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;When it is detected that the card detection service is started, acquiring a multi-frame image frame corresponding to the target card, each of the multi-frame image frames is an image frame in a red, green, and blue RGB format;
    根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;Determining the card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
    根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。Determine whether the target card is a real card according to the card information of the target card.
  2. 根据权利要求1所述的方法,其中,所述根据所述多帧图像帧确定所述目标卡片的卡片信息,包括:The method according to claim 1, wherein the determining the card information of the target card according to the multi-frame image frame comprises:
    判断当前处理的图像帧是否为所述多帧图像帧中的第一帧图像帧;Judging whether the currently processed image frame is the first image frame among the multiple image frames;
    若所述当前处理的图像帧为所述多帧图像帧中的第一帧图像帧,则根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,所述卡片边缘信息用于反映所述目标卡片的边缘情况;If the currently processed image frame is the first image frame in the multi-frame image frame, acquiring the card edge information of the target card in the currently processed image frame according to a first preset algorithm, and Card edge information is used to reflect the edge situation of the target card;
    若所述当前处理的图像帧不为所述多帧图像帧中的第一帧图像帧,则确定所述当前处理的图像帧的前一帧图像帧中是否存在所述目标卡片;If the currently processed image frame is not the first image frame in the multi-frame image frame, determining whether the target card exists in the previous image frame of the currently processed image frame;
    若所述当前处理的图像帧的前一帧图像帧中存在所述目标卡片,则根据所述当前处理的图像帧的前一帧图像帧的所述目标卡片的卡片信息得到所述当前处理的图像帧的初始化图像帧;If the target card exists in the previous frame of the currently processed image frame, the currently processed image frame is obtained according to the card information of the target card in the previous frame of the currently processed image frame The initial image frame of the image frame;
    确定所述初始化图像帧中的多个关键点;Determining multiple key points in the initialization image frame;
    获取所述多个关键点的原始坐标;Acquiring the original coordinates of the multiple key points;
    根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值;Obtaining target feature values of the multiple key points according to the original coordinates of the multiple key points;
    若所述当前处理的图像帧的前一帧图像帧中不存在所述目标卡片,则根据所述第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息。If the target card does not exist in the previous image frame of the currently processed image frame, acquiring the card edge information of the target card in the currently processed image frame according to the first preset algorithm.
  3. 根据权利要求2所述的方法,其中,所述根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,包括:The method according to claim 2, wherein said acquiring card edge information of said target card in said currently processed image frame according to a first preset algorithm comprises:
    根据所述当前处理的图像帧得到第一参考图像帧,所述第一参考图像帧的尺寸为第一预设尺寸;Obtaining a first reference image frame according to the currently processed image frame, and the size of the first reference image frame is a first preset size;
    根据所述第一参考图像帧得到第二参考图像帧,所述第一参考图像帧的像素值为所述第二参考图像帧的像素值的255倍;Obtaining a second reference image frame according to the first reference image frame, where the pixel value of the first reference image frame is 255 times the pixel value of the second reference image frame;
    将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点;Importing the second reference image frame into the target neural network model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame;
    根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线;Obtaining, according to the initial edge line parameter and the four initial reference points, the target edge line of the target card in the currently processed image frame;
    确定与所述目标边缘直线对应的所述当前处理的图像帧中所述目标卡片的顶点。Determine the vertex of the target card in the currently processed image frame corresponding to the target edge straight line.
  4. 根据权利要求3所述的方法,其中,所述目标神经网络模型包括语意分割模型和加 权最小二乘法模型,所述将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点,包括:The method according to claim 3, wherein the target neural network model includes a semantic segmentation model and a weighted least squares model, and the second reference image frame is imported into the target neural network model to obtain the currently processed The initial edge line parameters and four initial reference points of the target card in the image frame include:
    将所述第二参考图像帧导入所述语义分割模型,得到所述当前处理的图像帧中所述目标卡片的特征图;Importing the second reference image frame into the semantic segmentation model to obtain a feature map of the target card in the currently processed image frame;
    将所述特征图导入到所述加权最小二乘法模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点。The feature map is imported into the weighted least squares model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame.
  5. 根据权利要求3或4所述的方法,其中,所述根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线,包括:The method according to claim 3 or 4, wherein the obtaining the target edge line of the target card in the currently processed image frame according to the initial edge line parameter and the four initial reference points comprises:
    根据所述四个初始参考点确定所述当前处理的图像帧中所述目标卡片的四个边缘区域;Determining four edge regions of the target card in the currently processed image frame according to the four initial reference points;
    确定所述四个边缘区域中每个边缘区域对应的多个目标顶点;Determining multiple target vertices corresponding to each of the four edge regions;
    根据所述每个边缘区域对应的多个目标顶点确定所述每个边缘区域对应的目标边缘直线,得到所述当前处理的图像帧中所述目标卡片的目标边缘直线。The target edge line corresponding to each edge area is determined according to the multiple target vertices corresponding to each edge area to obtain the target edge line of the target card in the currently processed image frame.
  6. 根据权利要求5所述的方法,其中,所述确定所述四个边缘区域中每个边缘区域对应的多个目标顶点,包括:The method according to claim 5, wherein the determining multiple target vertices corresponding to each of the four edge regions comprises:
    将当前处理的区域分成n段,得到n个子区域,n为大于等于3的正整数;Divide the currently processed area into n segments to obtain n sub-areas, where n is a positive integer greater than or equal to 3;
    根据所述n个子区域得到所述n个子区域的二值化图像;Obtaining the binarized image of the n sub-regions according to the n sub-regions;
    根据所述n个子区域的二值化图像确定所述n个子区域中的n条目标直线,所述目标直线为子区域中面积最小的直线;Determining n target straight lines in the n sub-regions according to the binarized images of the n sub-regions, where the target straight lines are the straight lines with the smallest area in the sub-regions;
    确定所述n条目标直线中每条目标直线的两端顶点,得到所述当前处理的区域对应的多个目标顶点。The two end vertices of each target straight line in the n target straight lines are determined, and multiple target vertices corresponding to the currently processed region are obtained.
  7. 根据权利要求2所述的方法,其中,所述根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值,包括:The method according to claim 2, wherein the obtaining the target feature value of the plurality of key points according to the original coordinates of the plurality of key points comprises:
    根据所述当前处理的关键点对应的第m横坐标,确定与所述第m横坐标对应的第m方向梯度直方图hog特征,得到所述针对当前处理的关键点的第m特征值,所述第m横坐标为所述当前处理的图像帧的第m次卷积的图像帧中的与所述当前处理的关键点对应的关键点的横坐标,m为正整数;According to the m-th abscissa corresponding to the currently processed key point, determine the m-th direction gradient histogram hog feature corresponding to the m-th abscissa to obtain the m-th eigenvalue for the currently processed key point, so The m-th abscissa is the abscissa of the key point corresponding to the currently processed key point in the m-th convolutional image frame of the currently processed image frame, and m is a positive integer;
    根据所述第m特征值确定与所述第m特征值对应的所述当前处理的关键点的第m横坐标变化量,所述第m横坐标变化量为所述第m横坐标到第m+1横坐标之间的变化值,所述第m+1横坐标为所述当前处理的图像帧的第m次卷积之后得到的图像帧中的与所述当前处理的关键点对应的关键点的横坐标;Determine the m-th abscissa change amount of the currently processed key point corresponding to the m-th eigenvalue according to the m-th characteristic value, where the m-th abscissa change amount is the m-th abscissa to the m-th The change value between +1 abscissa, the m+1th abscissa is the key corresponding to the currently processed key point in the image frame obtained after the mth convolution of the currently processed image frame The abscissa of the point;
    根据所述第m横坐标和所述第m横坐标变化量得到所述第m+1横坐标。The m+1th abscissa is obtained according to the amount of change of the mth abscissa and the mth abscissa.
  8. 一种卡片识别装置,其中,包括:A card recognition device, which includes:
    第一获取模块,用于在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;The first acquisition module is configured to acquire a multi-frame image frame corresponding to the target card when it is detected that the card detection service is started, and each of the multi-frame image frames is an image frame in a red, green, and blue RGB format;
    第一确定模块,用于根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;The first determining module is configured to determine the card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
    判断模块,用于根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。The judging module is used for judging whether the target card is a real card according to the card information of the target card.
  9. 一种电子设备,其中,所述电子设备包括存储器和处理器,所述存储器和所述处理器相互连接,所述存储器用于存储计算机程序,所述计算机程序并被配置为由所述处理器执行,所述计算机程序配置用于执行一种卡片识别方法:An electronic device, wherein the electronic device includes a memory and a processor, the memory and the processor are connected to each other, the memory is used to store a computer program, and the computer program is configured to be used by the processor Execution, the computer program is configured to execute a card recognition method:
    其中,所述卡片识别方法包括:Wherein, the card identification method includes:
    在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中每帧图像帧为红绿蓝RGB格式的图像帧;When it is detected that the card detection service is started, acquiring a multi-frame image frame corresponding to the target card, each of the multi-frame image frames is an image frame in a red, green, and blue RGB format;
    根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;Determining the card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
    根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。Determine whether the target card is a real card according to the card information of the target card.
  10. 根据权利要求9所述的电子设备,其中,所述根据所述多帧图像帧确定所述目标卡片的卡片信息,包括:9. The electronic device according to claim 9, wherein the determining the card information of the target card according to the multi-frame image frame comprises:
    判断当前处理的图像帧是否为所述多帧图像帧中的第一帧图像帧;Judging whether the currently processed image frame is the first image frame among the multiple image frames;
    若所述当前处理的图像帧为所述多帧图像帧中的第一帧图像帧,则根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,所述卡片边缘信息用于反映所述目标卡片的边缘情况;If the currently processed image frame is the first image frame in the multi-frame image frame, acquiring the card edge information of the target card in the currently processed image frame according to a first preset algorithm, and Card edge information is used to reflect the edge situation of the target card;
    若所述当前处理的图像帧不为所述多帧图像帧中的第一帧图像帧,则确定所述当前处理的图像帧的前一帧图像帧中是否存在所述目标卡片;If the currently processed image frame is not the first image frame in the multi-frame image frame, determining whether the target card exists in the previous image frame of the currently processed image frame;
    若所述当前处理的图像帧的前一帧图像帧中存在所述目标卡片,则根据所述当前处理的图像帧的前一帧图像帧的所述目标卡片的卡片信息得到所述当前处理的图像帧的初始化图像帧;If the target card exists in the previous frame of the currently processed image frame, the currently processed image frame is obtained according to the card information of the target card in the previous frame of the currently processed image frame The initial image frame of the image frame;
    确定所述初始化图像帧中的多个关键点;Determining multiple key points in the initialization image frame;
    获取所述多个关键点的原始坐标;Acquiring the original coordinates of the multiple key points;
    根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值;Obtaining target feature values of the multiple key points according to the original coordinates of the multiple key points;
    若所述当前处理的图像帧的前一帧图像帧中不存在所述目标卡片,则根据所述第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息。If the target card does not exist in the previous image frame of the currently processed image frame, acquiring the card edge information of the target card in the currently processed image frame according to the first preset algorithm.
  11. 根据权利要求10所述的电子设备,其中,所述根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,包括:The electronic device according to claim 10, wherein said acquiring card edge information of said target card in said currently processed image frame according to a first preset algorithm comprises:
    根据所述当前处理的图像帧得到第一参考图像帧,所述第一参考图像帧的尺寸为第一预设尺寸;Obtaining a first reference image frame according to the currently processed image frame, and the size of the first reference image frame is a first preset size;
    根据所述第一参考图像帧得到第二参考图像帧,所述第一参考图像帧的像素值为所述第二参考图像帧的像素值的255倍;Obtaining a second reference image frame according to the first reference image frame, where the pixel value of the first reference image frame is 255 times the pixel value of the second reference image frame;
    将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点;Importing the second reference image frame into the target neural network model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame;
    根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线;Obtaining, according to the initial edge line parameter and the four initial reference points, the target edge line of the target card in the currently processed image frame;
    确定与所述目标边缘直线对应的所述当前处理的图像帧中所述目标卡片的顶点。Determine the vertex of the target card in the currently processed image frame corresponding to the target edge straight line.
  12. 根据权利要求11所述的电子设备,其中,所述目标神经网络模型包括语意分割模型和加权最小二乘法模型,所述将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点,包括:The electronic device according to claim 11, wherein the target neural network model includes a semantic segmentation model and a weighted least squares model, and the second reference image frame is imported into the target neural network model to obtain the current processing The initial edge line parameters and four initial reference points of the target card in the image frame include:
    将所述第二参考图像帧导入所述语义分割模型,得到所述当前处理的图像帧中所述目标卡片的特征图;Importing the second reference image frame into the semantic segmentation model to obtain a feature map of the target card in the currently processed image frame;
    将所述特征图导入到所述加权最小二乘法模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点。The feature map is imported into the weighted least squares model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame.
  13. 根据权利要求11或12所述的电子设备,其中,所述根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线,包括:The electronic device according to claim 11 or 12, wherein the obtaining the target edge line of the target card in the currently processed image frame according to the initial edge line parameter and the four initial reference points comprises :
    根据所述四个初始参考点确定所述当前处理的图像帧中所述目标卡片的四个边缘区域;Determining four edge regions of the target card in the currently processed image frame according to the four initial reference points;
    确定所述四个边缘区域中每个边缘区域对应的多个目标顶点;Determining multiple target vertices corresponding to each of the four edge regions;
    根据所述每个边缘区域对应的多个目标顶点确定所述每个边缘区域对应的目标边缘直线,得到所述当前处理的图像帧中所述目标卡片的目标边缘直线。The target edge line corresponding to each edge area is determined according to the multiple target vertices corresponding to each edge area to obtain the target edge line of the target card in the currently processed image frame.
  14. 根据权利要求13所述的电子设备,其中,所述确定所述四个边缘区域中每个边缘区域对应的多个目标顶点,包括:The electronic device according to claim 13, wherein said determining a plurality of target vertices corresponding to each of the four edge regions comprises:
    将当前处理的区域分成n段,得到n个子区域,n为大于等于3的正整数;Divide the currently processed area into n segments to obtain n sub-areas, where n is a positive integer greater than or equal to 3;
    根据所述n个子区域得到所述n个子区域的二值化图像;Obtaining the binarized image of the n sub-regions according to the n sub-regions;
    根据所述n个子区域的二值化图像确定所述n个子区域中的n条目标直线,所述目标直线为子区域中面积最小的直线;Determining n target straight lines in the n sub-regions according to the binarized images of the n sub-regions, where the target straight lines are the straight lines with the smallest area in the sub-regions;
    确定所述n条目标直线中每条目标直线的两端顶点,得到所述当前处理的区域对应的多个目标顶点。The two end vertices of each target straight line in the n target straight lines are determined, and multiple target vertices corresponding to the currently processed region are obtained.
  15. 根据权利要求10所述的电子设备,其中,所述根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值,包括:11. The electronic device according to claim 10, wherein the obtaining the target feature value of the plurality of key points according to the original coordinates of the plurality of key points comprises:
    根据所述当前处理的关键点对应的第m横坐标,确定与所述第m横坐标对应的第m方向梯度直方图hog特征,得到所述针对当前处理的关键点的第m特征值,所述第m横坐标为所述当前处理的图像帧的第m次卷积的图像帧中的与所述当前处理的关键点对应的关键点的横坐标,m为正整数;According to the m-th abscissa corresponding to the currently processed key point, determine the m-th direction gradient histogram hog feature corresponding to the m-th abscissa to obtain the m-th eigenvalue for the currently processed key point, so The m-th abscissa is the abscissa of the key point corresponding to the currently processed key point in the m-th convolutional image frame of the currently processed image frame, and m is a positive integer;
    根据所述第m特征值确定与所述第m特征值对应的所述当前处理的关键点的第m横坐标变化量,所述第m横坐标变化量为所述第m横坐标到第m+1横坐标之间的变化值,所述第m+1横坐标为所述当前处理的图像帧的第m次卷积之后得到的图像帧中的与所述当前处理的关键点对应的关键点的横坐标;Determine the m-th abscissa change amount of the currently processed key point corresponding to the m-th eigenvalue according to the m-th characteristic value, where the m-th abscissa change amount is the m-th abscissa to the m-th The change value between +1 abscissa, the m+1th abscissa is the key corresponding to the currently processed key point in the image frame obtained after the mth convolution of the currently processed image frame The abscissa of the point;
    根据所述第m横坐标和所述第m横坐标变化量得到所述第m+1横坐标。The m+1th abscissa is obtained according to the amount of change of the mth abscissa and the mth abscissa.
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现卡片识别,其中,所述卡片识别包括以下步骤:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program that realizes card recognition when the computer program is executed by a processor, wherein the card recognition includes the following steps:
    在检测到卡片检测服务启动时,获取目标卡片对应的多帧图像帧,所述多帧图像帧中 每帧图像帧为红绿蓝RGB格式的图像帧;When it is detected that the card detection service is started, obtain a multi-frame image frame corresponding to the target card, and each of the multi-frame image frames is an image frame in a red, green, and blue RGB format;
    根据所述多帧图像帧确定所述目标卡片的卡片信息,所述卡片信息用于反映所述目标卡片的边缘情况和关键点情况;Determining the card information of the target card according to the multi-frame image frame, where the card information is used to reflect the edge condition and key point condition of the target card;
    根据所述目标卡片的卡片信息判断所述目标卡片是否为真卡。Determine whether the target card is a real card according to the card information of the target card.
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述根据所述多帧图像帧确定所述目标卡片的卡片信息,包括:The computer-readable storage medium according to claim 16, wherein the determining the card information of the target card according to the multi-frame image frame comprises:
    判断当前处理的图像帧是否为所述多帧图像帧中的第一帧图像帧;Judging whether the currently processed image frame is the first image frame among the multiple image frames;
    若所述当前处理的图像帧为所述多帧图像帧中的第一帧图像帧,则根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,所述卡片边缘信息用于反映所述目标卡片的边缘情况;If the currently processed image frame is the first image frame in the multi-frame image frame, acquiring the card edge information of the target card in the currently processed image frame according to a first preset algorithm, and Card edge information is used to reflect the edge situation of the target card;
    若所述当前处理的图像帧不为所述多帧图像帧中的第一帧图像帧,则确定所述当前处理的图像帧的前一帧图像帧中是否存在所述目标卡片;If the currently processed image frame is not the first image frame in the multi-frame image frame, determining whether the target card exists in the previous image frame of the currently processed image frame;
    若所述当前处理的图像帧的前一帧图像帧中存在所述目标卡片,则根据所述当前处理的图像帧的前一帧图像帧的所述目标卡片的卡片信息得到所述当前处理的图像帧的初始化图像帧;If the target card exists in the previous frame of the currently processed image frame, the currently processed image frame is obtained according to the card information of the target card in the previous frame of the currently processed image frame The initial image frame of the image frame;
    确定所述初始化图像帧中的多个关键点;Determining multiple key points in the initialization image frame;
    获取所述多个关键点的原始坐标;Acquiring the original coordinates of the multiple key points;
    根据所述多个关键点的原始坐标得到所述多个关键点的目标特征值;Obtaining target feature values of the multiple key points according to the original coordinates of the multiple key points;
    若所述当前处理的图像帧的前一帧图像帧中不存在所述目标卡片,则根据所述第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息。If the target card does not exist in the previous image frame of the currently processed image frame, acquiring the card edge information of the target card in the currently processed image frame according to the first preset algorithm.
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述根据第一预设算法获取所述当前处理的图像帧中所述目标卡片的卡片边缘信息,包括:18. The computer-readable storage medium according to claim 17, wherein the acquiring card edge information of the target card in the currently processed image frame according to a first preset algorithm comprises:
    根据所述当前处理的图像帧得到第一参考图像帧,所述第一参考图像帧的尺寸为第一预设尺寸;Obtaining a first reference image frame according to the currently processed image frame, and the size of the first reference image frame is a first preset size;
    根据所述第一参考图像帧得到第二参考图像帧,所述第一参考图像帧的像素值为所述第二参考图像帧的像素值的255倍;Obtaining a second reference image frame according to the first reference image frame, where the pixel value of the first reference image frame is 255 times the pixel value of the second reference image frame;
    将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点;Importing the second reference image frame into the target neural network model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame;
    根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线;Obtaining, according to the initial edge line parameter and the four initial reference points, the target edge line of the target card in the currently processed image frame;
    确定与所述目标边缘直线对应的所述当前处理的图像帧中所述目标卡片的顶点。Determine the vertex of the target card in the currently processed image frame corresponding to the target edge straight line.
  19. 根据权利要求18所述的计算机可读存储介质,其中,所述目标神经网络模型包括语意分割模型和加权最小二乘法模型,所述将所述第二参考图像帧导入目标神经网络模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点,包括:The computer-readable storage medium according to claim 18, wherein the target neural network model includes a semantic segmentation model and a weighted least squares model, and the second reference image frame is imported into the target neural network model to obtain the The initial edge line parameters and four initial reference points of the target card in the currently processed image frame include:
    将所述第二参考图像帧导入所述语义分割模型,得到所述当前处理的图像帧中所述目标卡片的特征图;Importing the second reference image frame into the semantic segmentation model to obtain a feature map of the target card in the currently processed image frame;
    将所述特征图导入到所述加权最小二乘法模型,得到所述当前处理的图像帧中所述目标卡片的初始边缘直线参数和四个初始参考点。The feature map is imported into the weighted least squares model to obtain the initial edge line parameters and four initial reference points of the target card in the currently processed image frame.
  20. 根据权利要求18或19所述的计算机可读存储介质,其中,所述根据所述初始边缘直线参数和所述四个初始参考点得到所述当前处理的图像帧中所述目标卡片的目标边缘直线,包括:The computer-readable storage medium according to claim 18 or 19, wherein the target edge of the target card in the currently processed image frame is obtained according to the initial edge straight line parameter and the four initial reference points Straight line, including:
    根据所述四个初始参考点确定所述当前处理的图像帧中所述目标卡片的四个边缘区域;Determining four edge regions of the target card in the currently processed image frame according to the four initial reference points;
    确定所述四个边缘区域中每个边缘区域对应的多个目标顶点;Determining multiple target vertices corresponding to each of the four edge regions;
    根据所述每个边缘区域对应的多个目标顶点确定所述每个边缘区域对应的目标边缘直线,得到所述当前处理的图像帧中所述目标卡片的目标边缘直线。The target edge line corresponding to each edge area is determined according to the multiple target vertices corresponding to each edge area to obtain the target edge line of the target card in the currently processed image frame.
PCT/CN2020/111203 2020-07-27 2020-08-26 Method and apparatus for card recognition, device, and storage medium WO2021139169A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010735901.0A CN111860486B (en) 2020-07-27 2020-07-27 Card identification method, device and equipment
CN202010735901.0 2020-07-27

Publications (1)

Publication Number Publication Date
WO2021139169A1 true WO2021139169A1 (en) 2021-07-15

Family

ID=72948882

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/111203 WO2021139169A1 (en) 2020-07-27 2020-08-26 Method and apparatus for card recognition, device, and storage medium

Country Status (2)

Country Link
CN (1) CN111860486B (en)
WO (1) WO2021139169A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112837285B (en) * 2021-01-29 2022-07-26 山东建筑大学 Edge detection method and device for panel image

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120087537A1 (en) * 2010-10-12 2012-04-12 Lisong Liu System and methods for reading and managing business card information
CN106408533A (en) * 2016-09-12 2017-02-15 大连海事大学 Card image extraction method and card image extraction system
CN108563990A (en) * 2018-03-08 2018-09-21 南京华科和鼎信息科技有限公司 A kind of license false distinguishing method and system based on CIS image capturing systems
CN109359502A (en) * 2018-08-13 2019-02-19 北京市商汤科技开发有限公司 False-proof detection method and device, electronic equipment, storage medium
CN110598710A (en) * 2019-08-21 2019-12-20 阿里巴巴集团控股有限公司 Certificate identification method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111612834B (en) * 2017-07-19 2023-06-30 创新先进技术有限公司 Method, device and equipment for generating target image
CN110570209A (en) * 2019-07-30 2019-12-13 平安科技(深圳)有限公司 Certificate authenticity verification method and device, computer equipment and storage medium
CN110570460B (en) * 2019-09-06 2024-02-13 腾讯云计算(北京)有限责任公司 Target tracking method, device, computer equipment and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120087537A1 (en) * 2010-10-12 2012-04-12 Lisong Liu System and methods for reading and managing business card information
CN106408533A (en) * 2016-09-12 2017-02-15 大连海事大学 Card image extraction method and card image extraction system
CN108563990A (en) * 2018-03-08 2018-09-21 南京华科和鼎信息科技有限公司 A kind of license false distinguishing method and system based on CIS image capturing systems
CN109359502A (en) * 2018-08-13 2019-02-19 北京市商汤科技开发有限公司 False-proof detection method and device, electronic equipment, storage medium
CN110598710A (en) * 2019-08-21 2019-12-20 阿里巴巴集团控股有限公司 Certificate identification method and device

Also Published As

Publication number Publication date
CN111860486A (en) 2020-10-30
CN111860486B (en) 2023-10-31

Similar Documents

Publication Publication Date Title
US20200160040A1 (en) Three-dimensional living-body face detection method, face authentication recognition method, and apparatuses
US10896518B2 (en) Image processing method, image processing apparatus and computer readable storage medium
Walia et al. Digital image forgery detection: a systematic scrutiny
US10699103B2 (en) Living body detecting method and apparatus, device and storage medium
US10360465B2 (en) Liveness testing methods and apparatuses and image processing methods and apparatuses
Xiao et al. Combined blur, translation, scale and rotation invariant image recognition by Radon and pseudo-Fourier–Mellin transforms
CN107944420B (en) Illumination processing method and device for face image
TWI669664B (en) Eye state detection system and method for operating an eye state detection system
WO2021184847A1 (en) Method and device for shielded license plate character recognition, storage medium, and smart device
CN110852311A (en) Three-dimensional human hand key point positioning method and device
CN108961183B (en) Image processing method, terminal device and computer-readable storage medium
CN110263805B (en) Certificate verification and identity verification method, device and equipment
CN111310724A (en) In-vivo detection method and device based on deep learning, storage medium and equipment
WO2021151317A1 (en) Living-body detection method, apparatus, electronic device, and storage medium
Joshi OpenCV with Python by example
CN111325107A (en) Detection model training method and device, electronic equipment and readable storage medium
JP2022133378A (en) Face biological detection method, device, electronic apparatus, and storage medium
CN111950554A (en) Identification card identification method, device, equipment and storage medium
WO2021139169A1 (en) Method and apparatus for card recognition, device, and storage medium
WO2024022301A1 (en) Visual angle path acquisition method and apparatus, and electronic device and medium
US20230306791A1 (en) Method and apparatus with liveness detection
WO2020244076A1 (en) Face recognition method and apparatus, and electronic device and storage medium
Golubev et al. Validation of Real Estate Ads based on the Identification of Identical Images
CN112348069B (en) Data enhancement method, device, computer readable storage medium and terminal equipment
WO2021114824A1 (en) Presentation generation method, apparatus, and device, and medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20913008

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20913008

Country of ref document: EP

Kind code of ref document: A1