Image acquisition method, device, equipment and computer readable storage medium
By using the object detection model in the card image acquisition system to detect the confidence of card borders and feature borders, the problem of collecting incorrect card images in the prior art is solved, and the efficiency of image recognition is improved.
Patent Information
- Application Number
- CN202010618086.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2040-06-30
AI Technical Summary
The existing card image acquisition methods lack an audit mechanism, which is prone to card images problems of collecting wrong types of cards, resulting in an increase in the calculation amount and calculation time of subsequent image recognition and a decrease in efficiency.
The card border confidence and feature border confidence in the detection result are obtained by acquiring the target image and inputting it into the pre-trained object detection model. If the confidence level exceeds the preset threshold, an image acquisition operation is performed to avoid acquisition of incorrect card images.
The review of card images is realized to ensure that the collected images are of the correct type, reduce the calculation amount and duration of subsequent image recognition, and improve the efficiency of image recognition.
Smart Images

Figure CN111783775B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an image acquisition method, device, equipment and computer-readable storage medium. Background Art
[0002] Card image recognition is involved in many application scenarios in order to obtain information in the card image, for example: identifying the library card number in a library card image, and identifying the bank card account number in a bank card image.
[0003] Card image acquisition is the first step in card image recognition, and the quality of card image acquisition has a great impact on the results of card image recognition.
[0004] Currently, card image acquisition is performed on the front end, and card image recognition is performed on the back end.
[0005] In the card image collection stage, the card is usually photographed to complete the card image collection. However, the existing collection method lacks an audit mechanism, which easily leads to the problem of collecting the wrong type of card image. For example, in some scenarios, it is necessary to collect the user's library card image, but in order to protect personal privacy, the user uses other cards of the same size as the library card to complete the image collection.
[0006] Although it can be identified that the card type is wrong during the image recognition stage, the number of images that need to be recognized in the background is huge. These unreviewed images increase the amount of image recognition calculations and the calculation time, reducing the efficiency of image recognition. Summary of the invention
[0007] The main purpose of the present invention is to provide an image acquisition method, device, equipment and computer-readable storage medium to solve the problem that the existing card image acquisition method lacks an audit mechanism.
[0008] In view of the above technical problems, the embodiments of the present invention are solved by the following technical solutions:
[0009] An embodiment of the present invention provides an image acquisition method, comprising: acquiring a target image; inputting the target image into a pre-trained target detection model, and acquiring a detection result output by the target detection model; the detection result comprising: a card border confidence and a feature border confidence of a card image detected in the target image by the target detection model; and performing an image acquisition operation on the target image when the card border confidence is greater than a first confidence threshold and the feature border confidence is greater than a second confidence threshold.
[0010] Among them, the detection result also includes: the coordinates of the top corners of the card frame of the card image; the execution of the image acquisition operation for the target image includes: determining whether the card image is within the preset area range of the target image based on the coordinates of the top corners of the card frame of the card image; if the card image is within the preset area range of the target image, then acquiring the target image; otherwise, discarding the target image and obtaining the next target image in the video stream to which the target image belongs, so as to input the next target image into the target detection model.
[0011] The method further includes: when the video stream to which the target image belongs is a real-time captured video stream, if the card image is not within a preset area of the target image, then before obtaining the next target image in the video stream to which the target image belongs, a preset card position prompt information is displayed to prompt the position of the moving card so that the card image in the next target image is within the preset area of the next target image.
[0012] The method further includes: when the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, discarding the target image and obtaining the next target image in the video stream to which the target image belongs, so as to input the next target image into the target detection model.
[0013] The method further includes: when the video stream to which the target image belongs is a real-time captured video stream, if the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, then before acquiring the next target image in the video stream to which the target image belongs, displaying preset card correction prompt information to prompt the replacement of the card type, so that the card border confidence of the card image in the next target image is greater than the first confidence threshold, and the feature border confidence is greater than the second confidence threshold.
[0014] The method further includes: when the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, determining the image acquisition duration from the moment the first target image is acquired from the video stream to the current moment; when the image acquisition duration is greater than a preset duration threshold, updating the first confidence threshold and the second confidence threshold; wherein the updated first confidence threshold is less than the first confidence threshold before the update, and the updated second confidence threshold is less than the second confidence threshold before the update.
[0015] Wherein, the acquiring of the target image includes: if before acquiring the target image, a first confidence threshold that a card border confidence of the card image in the target image is greater than is an updated first confidence threshold, and a second confidence threshold that a feature border confidence of the card image in the target image is greater than is an updated second confidence threshold, then when acquiring the target image, a corresponding confidence threshold degradation flag is set for the target image.
[0016] Among them, the number of parameters of the target detection model is less than a preset parameter number threshold; and / or the number of floating-point operations FLOPs performed by the target detection model is less than a preset floating-point operation threshold; and / or the frame rate of the target detection model is greater than a preset frame rate threshold.
[0017] An embodiment of the present invention also provides an image acquisition device, comprising: an acquisition module, used to acquire a target image; a detection module, used to input the target image into a pre-trained target detection model and acquire a detection result output by the target detection model; the detection result comprises: a card border confidence and a feature border confidence of the card image detected in the target image by the target detection model; an execution module, used to execute an image acquisition operation for the target image when the card border confidence is greater than a first confidence threshold and the feature border confidence is greater than a second confidence threshold.
[0018] An embodiment of the present invention further provides an image acquisition device, which includes a processor and a memory; the processor is used to execute an image acquisition program stored in the memory to implement any of the above-mentioned image acquisition methods.
[0019] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement any of the above-mentioned image acquisition methods.
[0020] The beneficial effects of the embodiments of the present invention are as follows:
[0021] The embodiment of the present invention can review the card image in the target image, determine the card border confidence and the feature border confidence of the card image, and determine whether to perform the image acquisition operation according to the card border confidence and the feature border confidence. If the card border confidence is greater than the first confidence threshold and the feature border confidence is greater than the second confidence threshold, the image acquisition operation is performed to avoid the problem of acquiring the card image of the wrong type of card, reduce the amount of calculation and calculation time of subsequent image recognition, and improve the efficiency of image recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0023] Figure 1 is a flow chart of an image acquisition method according to an embodiment of the present invention;
[0024] Figure 2 is a schematic diagram of sample annotation according to an embodiment of the present invention;
[0025] Figure 3 is a flowchart of steps of an image acquisition operation according to an embodiment of the present invention;
[0026] Figure 4 is a structural diagram of an image acquisition device according to an embodiment of the present invention;
[0027] Figure 5 is a structural diagram of an image acquisition device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0029] According to an embodiment of the present invention, an image acquisition method is provided. Figure 1 FIG. 1 is a flow chart of an image acquisition method according to an embodiment of the present invention.
[0030] Step S110, acquiring a target image.
[0031] The target image is a target image to be reviewed. Further, the target image may include a card image of a target card.
[0032] Specifically, in the received video stream, one frame of video image is obtained and the video image is used as the target image. The video stream is a video stream shot in real time or a video stream shot in advance.
[0033] For example, you can call a camera to shoot a video stream in real time, receive the video stream sent back by the camera, and obtain the first frame of the video stream as the target image.
[0034] Step S120, inputting the target image into a pre-trained target detection model, and obtaining a detection result output by the target detection model; the detection result includes: a card border confidence and a feature border confidence of the card image detected by the target detection model in the target image.
[0035] The target detection model is used to detect whether the target image contains a card image of a suspected target type card. If the target image contains a card image of a suspected target type card, the card border and feature border of the suspected target type image are extracted, and the card border confidence corresponding to the card border and the feature border confidence corresponding to the feature border are determined.
[0036] Target card type refers to the card type that needs to be reviewed, such as library cards, bank cards, etc.
[0037] The card border confidence refers to the degree of confidence that the image area surrounded by the card border is a card of the target type.
[0038] The confidence of the feature border refers to the degree of confidence that the image area surrounded by the feature border is the target type. The feature border refers to the border of the area where the feature information in the target type card is located.
[0039] The number of feature information in the target type card can be one or more. For example, the feature information in a library card includes the library card number and the library card photo. Another example is that the feature information in a bank card includes the bank card number. The target detection model can be used to detect the feature border confidence corresponding to the border of the area where each feature information is located.
[0040] Step S130, when the card border confidence is greater than a first confidence threshold, and the feature border confidence is greater than a second confidence threshold, performing an image acquisition operation for the target image.
[0041] The first confidence threshold is used to measure whether the card border of the card image is the card border of the target type of card. If the card border confidence of the card image is greater than the first confidence threshold, it means that the card border of the card image is the card border of the target type of card; otherwise, it means that the card border of the card image is not the card border of the target type of card.
[0042] The second confidence threshold is used to measure whether the feature border of the card image is the feature border of the target type of card. If the confidence of the feature border of the card image is greater than the second confidence threshold, it means that the feature border of the card image is the feature border of the target type of card; otherwise, it means that the feature border of the card image is not the feature border of the target type of card.
[0043] In this embodiment, since the card frame is relatively easy to extract, while the feature frame is more difficult to extract, the first confidence threshold is greater than the second confidence threshold. For example: the first confidence threshold is set to 0.8, and the second confidence threshold is set to 0.6; the card frame confidence is 0.9 (0.9>0.8), the feature frame confidence is 0.7 (0.7>0.6), and the image acquisition operation is performed; the card frame confidence is 0.85 (0.85>0.8), the feature frame confidence is 0.5 (0.5<0.6), and the image acquisition operation is not performed.
[0044] When performing the image acquisition operation for the target image, the target image may be acquired directly, or when the target image meets a preset image acquisition condition, the target image may be acquired. The image acquisition condition is, for example, that the card image in the target image is in the center area of the target image.
[0045] After the target image is captured, the target image is sent to the back end so that the back end performs image recognition processing on the target image.
[0046] Through this embodiment, the card image in the target image can be reviewed to determine the card border confidence and feature border confidence of the card image, and whether to perform the image acquisition operation is determined based on the card border confidence and feature border confidence. If the card border confidence is greater than the first confidence threshold and the feature border confidence is greater than the second confidence threshold, the image acquisition operation is performed to avoid the problem of acquiring card images of the wrong type of cards, reduce the amount of calculation and calculation time of subsequent image recognition, and improve the efficiency of image recognition.
[0047] The training process of the target detection model is described below.
[0048] In this embodiment, the target detection model is a lightweight model, so that the image acquisition method of this embodiment can be integrated into the front end and occupy a small storage space, so that the front end can run smoothly.
[0049] Furthermore, the number of parameters of the target detection model is less than a preset parameter number threshold; and / or the number of floating-point operations (FLOPs) performed by the target detection model is less than a preset floating-point operation number threshold; and / or the frame rate of the target detection model is greater than a preset frame rate threshold. The parameter number threshold, floating-point operation number threshold and frame rate threshold are all empirical values.
[0050] Furthermore, the target detection model can be constructed using an SSD (Single Shot MultiBox Detector) algorithm or a YOLO (You Only Look Once) algorithm. The SSD algorithm is, for example, a Mobilenet-SSD algorithm.
[0051] When labeling samples, the card border of the target type card can be labeled as card, and the feature border of the target type card can be labeled as number. When labeling the card border, it is necessary to ensure that the card border can contain the entire target type card area, and when labeling the feature border, it is necessary to ensure that the feature border can contain the entire feature information area. For example: Figure 2 : is a schematic diagram of sample annotation according to an embodiment of the present invention, where bank card is the target type of card, card is the card border of the bank card, and number is the border of the area where the bank card number is located.
[0052] The target detection model is trained using multiple labeled samples until the target detection model converges.
[0053] The trained target detection model is used to detect the card border and feature border of the card image of the target type card with high accuracy and strong generalization ability. Even if the card surface pattern of the target type card is designed to be more complex in order to enhance the design sense of the card, when shooting the target type card, the target type card is placed in an environment with a complex background. The target detection model can accurately detect the card border and feature border of the card image, and determine the card border confidence and feature border confidence.
[0054] Furthermore, since the samples used in training the target detection model are images of real target card types, the target detection model has the ability to distinguish the authenticity of target card types. For example, in some scenarios, it is necessary to collect images of user's bank cards, and illegal users use copies of other people's bank cards to collect bank card images for profit. However, the photocopy cannot be significantly different from the real bank card image in color, brightness, or texture, and it is easier for the target detection model to detect the difference between the photocopy and the real bank card image. As a result, the card border confidence and feature border confidence output by the target detection model are both small, so the image collection operation is not performed on the photocopy.
[0055] Another scenario of the embodiment of the present invention is described below.
[0056] If there is only one target image, then when the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, the image acquisition process of this embodiment can be terminated and an image acquisition failure prompt message can be displayed.
[0057] If the target image is a video image obtained from a video stream, then when the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, the target image is discarded, and the next target image is obtained in the video stream to which the target image belongs, so as to input the next target image into the target detection model. In other words, the next video image is obtained from the video stream, and the newly obtained video image is used as the new target image. If no target image on which the image acquisition operation can be performed appears, the image acquisition process of the embodiment of the present invention can be cyclically executed for multiple video images in the video stream, so as to dynamically find a target image that meets the confidence requirements in the video stream.
[0058] Furthermore, in the case where the video stream to which the target image belongs is a real-time video stream, if the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, then before acquiring the next target image in the video stream to which the target image belongs, a preset card correction prompt is displayed to prompt the user to change the type of card, so that the card border confidence of the card image in the next target image is greater than the first confidence threshold, and the feature border confidence is greater than the second confidence threshold. If both the card border confidence and the feature border confidence of the card image are lower than the corresponding thresholds, it is possible that the type of card photographed is wrong. For example, if a library card image needs to be captured, and the user photographs a membership card image, the card border size is different, and the border (feature border) of the area where the library card number is located cannot be extracted from the membership card image.
[0059] In one embodiment, in order to avoid the problem of long-term unsuccessful acquisition, the first confidence threshold and the second confidence threshold can be set to multiple gradients. Each gradient corresponds to a set of first confidence threshold and second confidence threshold, the first confidence threshold between multiple gradients is set to different values and the second confidence threshold between multiple gradients is set to different values, and the change trend of the first confidence threshold and the second confidence threshold between multiple gradients is the same, from the 1st gradient to the Nth gradient, the first confidence threshold is sorted from large to small, and the second confidence threshold is also sorted from large to small. Among them, in order to acquire a clearer target image, the initial value of the first confidence threshold and the second confidence threshold can be set to the maximum value of multiple gradients. In order to avoid the problem that the target image of the target type card cannot be normally acquired, the first confidence threshold and the second confidence threshold can be downgraded.
[0060] Specifically, when the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, determine the image acquisition duration from the moment the first target image is acquired from the video stream to the current moment; when the image acquisition duration is greater than a preset duration threshold, update the first confidence threshold and the second confidence threshold; wherein the updated first confidence threshold is less than the first confidence threshold before the update, and the updated second confidence threshold is less than the second confidence threshold before the update.
[0061] The image acquisition time can be an empirical value or a value obtained through experiments. Furthermore, multiple time thresholds can be set. When the image acquisition time is greater than the minimum time threshold, the first confidence threshold and the second confidence threshold are updated to the first confidence threshold and the second confidence threshold in the second gradient in descending order; when the image acquisition time is greater than the second minimum time threshold, the first confidence threshold and the second confidence threshold are updated to the first confidence threshold and the second confidence threshold in the third gradient in descending order; and so on. If the target image is still not acquired after the first confidence threshold and the second confidence threshold in all gradients are used up, the image acquisition process of the embodiment of the present invention is terminated, and a prompt message of image acquisition failure is displayed.
[0062] If the updated first confidence threshold and the second confidence threshold are used to compare with the card border confidence and the feature border confidence respectively, a corresponding confidence threshold degradation flag needs to be set for the target image, so as to indicate that the confidence threshold used by the target image is not the maximum confidence threshold through the confidence threshold degradation flag. In other words, if before acquiring the target image, the first confidence threshold that the card border confidence of the card image in the target image is greater than is the updated first confidence threshold, and the second confidence threshold that the feature border confidence of the card image in the target image is greater than is the updated second confidence threshold, then when acquiring the target image, a corresponding confidence threshold degradation flag is set for the target image.
[0063] In another embodiment, in order to further improve the efficiency of image recognition, the integrity of the card can also be determined. The integrity of the card can be determined by determining the area where the card image is located in the target image.
[0064] Furthermore, the target detection model is also used to determine the coordinates of the card border corners of the card image. In this way, the detection result of the target detection model also includes: the coordinates of the card border corners of the card image. The coordinates of the card border corners include the vertex coordinates of the two diagonal corners of the card image. For example: the vertex coordinates of the upper left corner and the vertex coordinates of the lower right corner of the card image.
[0065] like Figure 3 FIG. 1 is a flowchart of the steps of an image acquisition operation according to an embodiment of the present invention.
[0066] Step S310, determining whether the card image is within a preset area range of the target image based on the coordinates of the top corners of the card frame of the card image; if yes, executing step S320; if not, executing step S330.
[0067] The preset area range may be a central area of the target image, and the central area has no overlap with an edge of the target image.
[0068] For example: the vertex coordinates of the upper left corner of the card image (x1, y1) and the vertex coordinates of the lower right corner (x2, y2). The width w and height h of the target image. The boundary threshold t is the shortest distance from the edge of the card image to the edge of the target image. This boundary distance can divide the center area of the target image.
[0069] When the vertex coordinates (x1, y1) of the upper left corner and the vertex coordinates (x2, y2) of the lower right corner of the card image meet the following conditions, it means that the card image is in the center area of the target image, the card image is complete, and can be collected:
[0070]
[0071] The upper left corner of the target image is used as the origin of the coordinate system, the direction of the vertical axis is downward along the edge of the target image passing through the origin, and the direction of the horizontal axis is rightward along the edge of the target image passing through the origin.
[0072] Step S320: If the card image is within the preset area of the target image, the target image is captured.
[0073] Step S330, if the card image is not within the preset area range of the target image, the target image is discarded, and the next target image is obtained in the video stream to which the target image belongs, so as to input the next target image into the target detection model.
[0074] In the case that the video stream to which the target image belongs is a real-time video stream, if the card image is not within the preset area of the target image, then before obtaining the next target image in the video stream to which the target image belongs, preset card position prompt information is displayed to prompt the position of moving the card so that the card image in the next target image is within the preset area of the next target image.
[0075] If the card image is not within the preset area of the target image, the card image may be incomplete. In this case, the card position prompt information is used to allow the user to adjust the position of the card so that the card is within the preset area when it appears in the target image again.
[0076] The embodiment of the present invention also provides an image acquisition device. Figure 4 FIG. 4 is a structural diagram of an image acquisition device according to an embodiment of the present invention.
[0077] The image acquisition device includes: an acquisition module 410 , a detection module 420 and an execution module 430 .
[0078] The acquisition module 410 is used to acquire a target image.
[0079] The detection module 420 is used to input the target image into a pre-trained target detection model and obtain the detection result output by the target detection model; the detection result includes: the card border confidence and feature border confidence of the card image detected by the target detection model in the target image.
[0080] The execution module 430 is used to perform an image acquisition operation on the target image when the card frame confidence is greater than a first confidence threshold and the feature frame confidence is greater than a second confidence threshold.
[0081] The functions of the device described in the embodiment of the present invention have been described in the above method embodiment, so for the details not fully described in this embodiment, please refer to the relevant description in the above embodiment, and no further description will be given here.
[0082] This embodiment also provides an image acquisition device. Figure 5 FIG. 4 is a structural diagram of an image acquisition device according to an embodiment of the present invention.
[0083] In this embodiment, the image acquisition device includes, but is not limited to: a processor 510 and a memory 520 .
[0084] The processor 510 is used to execute the image acquisition program stored in the memory 520 to implement the above-mentioned image acquisition method.
[0085] Specifically, the processor 510 is used to execute the image acquisition program stored in the memory 520 to implement the following steps: acquiring a target image; inputting the target image into a pre-trained target detection model, and acquiring a detection result output by the target detection model; the detection result includes: a card border confidence and a feature border confidence of the card image detected by the target detection model in the target image; when the card border confidence is greater than a first confidence threshold and the feature border confidence is greater than a second confidence threshold, performing an image acquisition operation for the target image.
[0086] Among them, the detection result also includes: the coordinates of the top corners of the card frame of the card image; the execution of the image acquisition operation for the target image includes: determining whether the card image is within the preset area range of the target image based on the coordinates of the top corners of the card frame of the card image; if the card image is within the preset area range of the target image, then acquiring the target image; otherwise, discarding the target image and obtaining the next target image in the video stream to which the target image belongs, so as to input the next target image into the target detection model.
[0087] The method further includes: when the video stream to which the target image belongs is a real-time captured video stream, if the card image is not within a preset area of the target image, then before obtaining the next target image in the video stream to which the target image belongs, a preset card position prompt information is displayed to prompt the position of the moving card so that the card image in the next target image is within the preset area of the next target image.
[0088] The method further includes: when the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, discarding the target image and obtaining the next target image in the video stream to which the target image belongs, so as to input the next target image into the target detection model.
[0089] The method further includes: when the video stream to which the target image belongs is a real-time captured video stream, if the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, then before acquiring the next target image in the video stream to which the target image belongs, displaying preset card correction prompt information to prompt the replacement of the card type, so that the card border confidence of the card image in the next target image is greater than the first confidence threshold, and the feature border confidence is greater than the second confidence threshold.
[0090] The method further includes: when the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, determining the image acquisition duration from the moment the first target image is acquired from the video stream to the current moment; when the image acquisition duration is greater than a preset duration threshold, updating the first confidence threshold and the second confidence threshold; wherein the updated first confidence threshold is less than the first confidence threshold before the update, and the updated second confidence threshold is less than the second confidence threshold before the update.
[0091] Wherein, the acquiring of the target image includes: if before acquiring the target image, a first confidence threshold that a card border confidence of the card image in the target image is greater than is an updated first confidence threshold, and a second confidence threshold that a feature border confidence of the card image in the target image is greater than is an updated second confidence threshold, then when acquiring the target image, a corresponding confidence threshold degradation flag is set for the target image.
[0092] Among them, the number of parameters of the target detection model is less than a preset parameter number threshold; and / or the number of floating-point operations FLOPs performed by the target detection model is less than a preset floating-point operation threshold; and / or the frame rate of the target detection model is greater than a preset frame rate threshold.
[0093] The embodiment of the present invention also provides a computer-readable storage medium. The computer-readable storage medium here stores one or more programs. The computer-readable storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.
[0094] When one or more programs in the computer-readable storage medium can be executed by one or more processors, the above-mentioned image acquisition method can be implemented. Since the image acquisition method has been described in detail above, it will not be described here in detail.
[0095] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of the claims of the present invention.
Claims
1. An image acquisition method, characterized in that: include: Acquiring a target image includes: receiving a video stream captured by an image acquisition device, and determining any frame of video image in the video stream as the target image; The target image is input into a pre-trained target detection model, and a detection result output by the target detection model is obtained; the detection result includes: a card border confidence and a feature border confidence of the card image detected by the target detection model in the target image; the feature border confidence is used to characterize the credibility of the image area surrounded by the feature border as the target type, and the feature border refers to the border of the area where one or more feature information in the target type card is located; When the card border confidence is greater than a first confidence threshold, and the feature border confidence is greater than a second confidence threshold, performing an image acquisition operation for the target image; When the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, discard the target image, and obtain the next target image in the video stream to which the target image belongs, so as to input the next target image into the target detection model; Determine the image acquisition duration from the moment when the first target image is acquired from the video stream to the current moment; When the image acquisition duration is greater than a preset duration threshold, the first confidence threshold and the second confidence threshold are updated; wherein the updated first confidence threshold is smaller than the first confidence threshold before the update, and the updated second confidence threshold is smaller than the second confidence threshold before the update.
2. The method according to claim 1, characterized in that The detection result also includes: coordinates of the top corners of the card frame of the card image; The performing of the image acquisition operation for the target image comprises: Determining whether the card image is within a preset area range of the target image according to the coordinates of the top corners of the card frame of the card image; If the card image is within the preset area range of the target image, the target image is captured; otherwise, the target image is discarded and the next target image is obtained in the video stream to which the target image belongs, so that the next target image can be input into the target detection model.
3. The method according to claim 2, characterized in that The method further comprises: In the case that the video stream to which the target image belongs is a real-time video stream, if the card image is not within the preset area of the target image, then before obtaining the next target image in the video stream to which the target image belongs, preset card position prompt information is displayed to prompt the position of moving the card so that the card image in the next target image is within the preset area of the next target image.
4. The method according to claim 1, characterized in that: The method further comprises: In the case that the video stream to which the target image belongs is a real-time video stream, if the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, then before obtaining the next target image in the video stream to which the target image belongs, a preset card correction prompt message is displayed to prompt the replacement of the card type, so that the card border confidence of the card image in the next target image is greater than the first confidence threshold, and the feature border confidence is greater than the second confidence threshold.
5. The method according to claim 1, characterized in that The acquiring of the target image comprises: If, before acquiring the target image, the first confidence threshold that the card border confidence of the card image in the target image is greater than is the updated first confidence threshold, and the second confidence threshold that the feature border confidence of the card image in the target image is greater than is the updated second confidence threshold, then when acquiring the target image, a corresponding confidence threshold degradation flag is set for the target image.
6. The method according to any one of claims 1 to 5, characterized in that: The number of parameters of the target detection model is less than a preset parameter number threshold; and / or, The number of floating-point operations FLOPs performed by the target detection model is less than a preset floating-point operation threshold; and / or, The frame rate of the target detection model is greater than a preset frame rate threshold.
7. An image acquisition device, characterized in that: include: The acquisition module is used to acquire the target image, including: receiving the video stream captured by the image acquisition device, and determining any frame of the video image as the target image; A detection module, used for inputting the target image into a pre-trained target detection model and obtaining a detection result output by the target detection model; the detection result includes: a card border confidence and a feature border confidence of the card image detected by the target detection model in the target image; the feature border confidence is used to characterize the credibility of the image area surrounded by the feature border as the target type, and the feature border refers to the border of the area where one or more feature information in the target type card is located; An execution module, configured to execute an image acquisition operation for the target image when the card frame confidence is greater than a first confidence threshold and the feature frame confidence is greater than a second confidence threshold; When the card border confidence is less than or equal to the first confidence threshold, and / or the feature border confidence is less than or equal to the second confidence threshold, discard the target image, and obtain the next target image in the video stream to which the target image belongs, so as to input the next target image into the target detection model; Determine the image acquisition duration from the moment when the first target image is acquired from the video stream to the current moment; When the image acquisition duration is greater than a preset duration threshold, the first confidence threshold and the second confidence threshold are updated; wherein the updated first confidence threshold is smaller than the first confidence threshold before the update, and the updated second confidence threshold is smaller than the second confidence threshold before the update.
8. An image acquisition device, characterized in that: The image acquisition device comprises a processor and a memory; the processor is used to execute the image acquisition program stored in the memory to implement the image acquisition method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the image acquisition method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Bank card information identification method and device, computer equipment and storage medium
CN111027450A
Character recognition method, reading auxiliary equipment, circuit and medium
CN111126394A
Bank card recognition model training method, bank card recognition method and device
CN111199240A