Image selection method, computer device and storage medium
By detecting and evaluating the text object recognition results in the image and determining the target image, the problem of low image selection accuracy is solved and the image usage effect is improved.
Patent Information
- Application Number
- CN202411079836.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-08-07
AI Technical Summary
The prior art results in the low accuracy of the selected images during the image selection process, which affects the subsequent use effect.
By detecting the text targets contained in each frame image in the candidate image set, the text recognition results are obtained, and the target image is determined based on the evaluation value, thereby improving the accuracy of image selection.
Improve the accuracy of image selection and improve the subsequent use of images.
Smart Images

Figure CN118606508B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image selection method, a computer device and a storage medium. Background Art
[0002] With the development of image processing technology, it is necessary to optimize a number of images. At present, one or more images are usually selected as the preferred images from multiple images based on their image quality. However, due to the influence of the image selection method, the accuracy of the selected images is low, and the subsequent use of the images is poor. Summary of the invention
[0003] The main technical problem solved by the present application is to provide an image selection method, a computer device and a storage medium, which can improve the accuracy of image selection.
[0004] In order to solve the above problems, the first aspect of the present application provides an image selection method, which includes: detecting the text targets contained in each frame image in the candidate image set, and obtaining the text recognition results of the text targets contained in each frame image; determining the evaluation value of the text recognition result of each text target; and determining the target image of each text target from the candidate image set based on the evaluation value.
[0005] In order to solve the above problem, the second aspect of the present application provides a computer device, which includes a memory and a processor coupled to each other, the memory stores program data, and the processor is used to execute the program data to implement any step of the above image selection method.
[0006] In order to solve the above problem, the third aspect of the present application provides a computer-readable storage medium, which stores program data that can be executed by a processor, and the program data is used to implement any step of the above image selection method.
[0007] The above scheme detects the text targets contained in each frame image in the candidate image set and obtains the text recognition results of the text targets contained in each frame image to determine the evaluation value of the text recognition results of each text target. The evaluation value can indirectly represent the accuracy of the text recognition result. Therefore, according to the evaluation value of the text recognition result, the target image of each text target is determined from the candidate image set, that is, the target image can be determined according to the text recognition result, so that a target image with clearer text targets and better quality can be selected, which can improve the accuracy of image selection and thus improve the subsequent use effect of the image.
[0008] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in this application, the following briefly introduces the drawings required in the description of the embodiments. Obviously, the drawings described below are only some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0010] Figure 1 It is a flowchart of the first embodiment of the image selection method of the present application;
[0011] Figure 2 is a flowchart of the second embodiment of the image selection method of the present application;
[0012] Figure 3 is a flowchart of a third embodiment of the image selection method of the present application;
[0013] Figure 4 is a flowchart of a fourth embodiment of the image selection method of the present application;
[0014] Figure 5 It is a structural schematic diagram of an embodiment of the image selection system of the present application;
[0015] Figure 6 It is a structural schematic diagram of an embodiment of the image selection device of the present application;
[0016] Figure 7 It is a structural schematic diagram of an embodiment of a computer device of the present application;
[0017] Figure 8 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0019] The terms "first" and "second" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" can explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0020] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0021] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated before and after are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.
[0022] The present application provides the following embodiments, and each embodiment is described in detail below.
[0023] It is understandable that the image selection method in the present application can be executed by a computer device, and the computer device can be any device with processing capabilities, such as a mobile phone, a computer, a server, etc., and the present application does not limit this. In some possible implementations, it can also be implemented by a processor calling program data stored in a memory.
[0024] See also Figure 1 , Figure 1 1 is a flow chart of the first embodiment of the image selection method of the present application. The method may include the following steps:
[0025] S11: Detecting text objects contained in each frame image in the candidate image set, and obtaining text recognition results of the text objects contained in each frame image.
[0026] A candidate image set is obtained, wherein the candidate image set may include a plurality of images, and the plurality of images may be obtained by acquiring the target area using an image acquisition device. For example, the plurality of images may be an image sequence, and each frame of the video may be used as an image sequence by performing video acquisition on the target area. The present application does not limit the method for acquiring the candidate image set. Exemplarily, the target area may include a conveying device, and a plurality of target objects may be placed on the conveying device, and the candidate image set may be obtained by acquiring images of the target objects in the conveying state.
[0027] In some embodiments, an image acquisition may be performed on a target object in a target area to obtain a candidate image set, and the outer surface of the target object contains text information. The target object is in a moving state in the target area, that is, the target object is in a non-stationary state. The target object may be an article or a target object, etc. For example, the text information contained on the outer surface of the target object is characters, text, etc. The characters may be characters such as numbers and letters, and the text may be Chinese characters, etc. Exemplarily, taking the target object as an article as an example, the text information may represent the model information, ingredient list information, production information, label information, etc. of the article, and the present application does not limit the target object and text information.
[0028] In some embodiments, each frame image includes text information. Each frame image may include the same text information. For example, at least two frames of images may include at least partially the same text information. In the image sequence in the candidate image set, the text information may be presented in a dynamic manner.
[0029] In some embodiments, after obtaining the candidate image set, each frame image of the candidate image set is marked with a unique frame serial number index. For example, the candidate image set is an image sequence of a video. Each frame image after decoding the video can be stored, and each frame image is marked with a unique frame serial number index.
[0030] Perform text detection on each frame image in the candidate image set to obtain the text target contained in each frame image. Specifically, a text detection algorithm can be used to detect the text target contained in each frame image, wherein the text detection algorithm is used to find the text position in the image, that is, the area where the text information is located, and use this as the text target. The text target can be a single character position or the entire text line position. This application takes the text line position as an example for explanation. Among them, the text detection algorithm may include, for example: Textbox algorithm, CTPN (Connectionist Text Proposal Network), Spatial-Temporal text detector, Two-Stage algorithm, etc. The text detection algorithm can be determined according to the target object or text information in the specific application scenario. This application does not limit the file detection algorithm.
[0031] By performing text recognition on the text target contained in each frame image, a text recognition result of the text target can be obtained. For example, the area where the text target is located can be extracted or intercepted, and text recognition can be performed on the area to obtain a text recognition result. For example, a text recognition algorithm can be used to perform text recognition on the area where the text target is located to obtain a text recognition result. Exemplarily, text recognition algorithms include: OCR (Optical Character Recognition) algorithm, CTC (Conectionist Temporal Classification) algorithm, SVTR (SceneText Recognition with a Single Visual Model) algorithm, etc. This application does not limit the text recognition algorithm.
[0032] In some implementations, after obtaining the text target, text tracking can be performed on the text target contained in each frame image. For example, text tracking is performed using the position of the text target, the detection frame of the text target, the semantic information of the text recognition result, etc., to obtain each tracked target text, and mark the ID (Identity Document, unique identifier) of each text target.
[0033] In some implementations, each frame image of the candidate image set may be input in sequence to sequentially perform text detection and tracking on each frame image to obtain a text target of each frame image and a tracked text target.
[0034] Exemplarily, a text tracking algorithm can be used to process each frame of the image to detect and track each text target and determine the ID of the text target in each frame of the image. If they belong to the same ID, it can be said that they belong to the same text target. For example, text tracking algorithms include: SVTD algorithm (Semantic-Aware Video Text Detection), HOG algorithm (Histogram of Oriented Gradients), SIFT algorithm (Scale-Invariant Feature Transform), CCA algorithm (Connected Component Analysis), etc. The text tracking algorithm can be determined according to the specific application scenario, and this application does not limit the text tracking algorithm.
[0035] In some implementations, after obtaining each text target and the corresponding text recognition result, the ID of each text target and the text recognition result Value may be cached.
[0036] S12: Determine an evaluation value of the text recognition result of each text target.
[0037] After obtaining the text recognition results of the text targets contained in each frame image, the evaluation value of the text recognition results of each text target is determined. Among them, the text recognition results belonging to the same text target can be determined, and then the text recognition results belonging to the same text target are evaluated to obtain the evaluation value of the text recognition result of the text target. If the same text target contains multiple text recognition results, the evaluation values of the multiple text recognition results corresponding to the text target can be obtained. In this way, the evaluation value of the text recognition result corresponding to each text target can be obtained.
[0038] By tracking the text targets in each frame image, the ID of each text target can be obtained, and the text targets with the same ID can be determined as the same text target. Since the same text target may appear in multiple frames of the candidate image set, that is, the regions where the same text target is located in multiple frames can be identified to obtain multiple text recognition results. Therefore, multiple text recognition results of the text target with the same ID can be evaluated to obtain the evaluation value of the text recognition result of the text target with the ID.
[0039] The images in the candidate image set are continuously increased. Each time an image is added, the candidate image set after the added image can be used as the current candidate image set. Then, the text recognition results of each text target in the current candidate image set are evaluated to obtain the evaluation value of the text recognition result of the current text target.
[0040] In some embodiments, the text recognition result can represent the number of the same text recognition results. The text recognition results of the text target in the current candidate image set can be counted to obtain the statistical number of the text recognition results of the text target. Specifically, multiple text recognition results of the same text target can be counted. Due to the clarity of the text information in the image, the image shooting angle, etc., the corresponding text recognition results in different frame images may be different. The statistical number of the same text recognition result can be counted. During the statistical process, if the text recognition results are the same, the corresponding statistical number is increased by one. Thus, the statistical number of multiple text recognition results of the text target is obtained.
[0041] The evaluation value of each text recognition result of the text target can be determined based on the statistical number of each text recognition result of the text target. For example, the statistical number of the same text recognition result can be determined as the evaluation value of the text recognition result. That is, the evaluation value can represent the number of frames or times in which the same text recognition result is recognized for the text target in the current candidate image set. The higher the evaluation value, the more accurate the recognition of the same text recognition result may be.
[0042] S13: Determine a target image for each text target from the candidate image set according to the evaluation value.
[0043] For each text target, each text recognition result can be sorted according to the evaluation value of the text recognition result, so that the target image of each text target can be determined from the candidate image set according to the evaluation value and / or the sorting of various text recognition results.
[0044] In some embodiments, the step of determining the target image of the text target includes: selecting a text recognition result whose evaluation value satisfies a preset selection condition from various text recognition results of the text target as the target text recognition result of the text target. The preset selection condition includes that the numerical value of the evaluation value is the maximum or equal to the evaluation value that satisfies the preset selection condition last time. The evaluation value that satisfies the preset selection condition last time indicates the evaluation value of the target text recognition result corresponding to the target image when the target image was acquired last time before the current time.
[0045] This application is explained by taking the preset selection condition including the maximum numerical value of the evaluation value as an example. For example, the text recognition result with the largest evaluation value among multiple text recognition results of the text target with the same ID can be used as the target text recognition result. Among them, the target text recognition result can represent a more accurate text recognition result among the multiple text recognition results of the text target. Since the target text recognition result can represent a relatively accurate text recognition result. The text information of the text target in at least one frame of image corresponding to the target text recognition result may also be clearer.
[0046] The target image of the text target can be selected from at least one frame of image corresponding to the target text recognition result of the text target, and the selected target image may also have clearer text information for the text target. Exemplarily, the target text recognition result may correspond to multiple frames of images, and the most recently updated image can be selected as the target image of the text target. Alternatively, image evaluation can be performed on multiple frames of images to comprehensively select the target image of the text target. In some application scenarios, the number of selected target images is single or multiple. This application takes the selection of a single target image for a text target as an example for explanation.
[0047] The above scheme detects the text targets contained in each frame image in the candidate image set and obtains the text recognition results of the text targets contained in each frame image to determine the evaluation value of the text recognition results of each text target. The evaluation value can indirectly represent the accuracy of the text recognition result. Therefore, according to the evaluation value of the text recognition result, the target image of each text target is determined from the candidate image set, that is, the target image can be determined according to the text recognition result, so that a target image with clearer text targets and better quality can be selected, which can improve the accuracy of image selection and thus improve the subsequent use effect of the image.
[0048] In some embodiments, steps S11 to S13 of the above embodiment can be further expanded. When the images in the candidate image set continue to increase, it is necessary to perform text detection and text tracking for each added image, obtain each text target of the added image and its corresponding text recognition result, obtain the evaluation value of various text recognition results of each text target, and then select the target image for each text target. For details, please refer to the description of the following embodiment.
[0049] See also Figure 2 , Figure 2 1 is a flow chart of the second embodiment of the image selection method of the present application. The method may include the following steps:
[0050] S21: In response to adding a new image to the candidate image set, determining the newly added image as the current frame image, detecting a text target contained in the current frame image as a first text target, and obtaining a text recognition result of the first text target in the current frame image.
[0051] In the case where the images in the candidate image set are continuously increasing, in response to the addition of new images to the candidate image set, the newly added images can be determined as the current frame image. By performing text detection and text tracking on the current frame image, the text target contained in the current frame image and the ID to which the text target belongs can be obtained. The text target contained in the current frame image can be used as the first text target, and text recognition is performed on the area where the first text target is located to obtain the text recognition result of the first text target in the current frame image. Among them, the specific implementation methods of text detection, text tracking and obtaining text recognition results can refer to the specific implementation process of step S11 of the first embodiment above, and this application will not repeat them here.
[0052] S22: Determine an evaluation value of the text recognition result of each first text object.
[0053] The current frame image may contain a single or multiple first text targets, and the evaluation value of the text recognition result of each first text target can be determined. Since the first text target may be a text target that has appeared in the historical frame image (for example, the first text target and the text target can be set to have the same ID) or a new text target that has not appeared (for example, a new ID can be set for the first text target), it is necessary to obtain the evaluation value of the text recognition result of each first text target.
[0054] In some embodiments, for each first text target in the current frame image, the text recognition results of the first text target in the current frame image and the text recognition results in the historical frame images can be counted, and the number of the same text recognition results can be counted to obtain the statistical number of various text recognition results of the first text target, wherein the historical frame image is an image in the candidate image set other than the current frame image. For example, the historical frame image may include each frame image before the current frame image.
[0055] After detecting the current frame image, if the first text target is a new text target, a new text recognition result can be obtained. Since there is no text recognition result of the new text target in the historical frame image, the number of text recognition results of the new text target of the current frame image can be counted to obtain the statistical number of text recognition results of the first text target.
[0056] The specific implementation method of determining the evaluation value of the text recognition result of each first text target can refer to the specific implementation process of step S12 of the first embodiment above, and the present application will not repeat it here.
[0057] S23: Determine a target image of each first text object based on the evaluation value of the text recognition result of each first text object.
[0058] Since the text recognition result of the current frame image is re-evaluated, the evaluation value of the text recognition result of the first text target may change, and a target image may be determined for each first text target based on the evaluation value of the text recognition result of each first text target in the current frame image, wherein the target image may be the original target image or a new target image.
[0059] In some embodiments, if the first text target is a new text target and does not appear in any historical frame image other than the current frame in the subsequent image set, that is, its text recognition results all correspond to the current frame image, and the text recognition result that meets the preset selection condition is selected, that is, the target text recognition result is the text recognition result of the current frame image. Therefore, in response to the first text target not appearing in any historical frame image other than the current frame image in the candidate image set, the current frame image can be used as the target image of the first text target.
[0060] In some embodiments, if the first text target is the original text target and has appeared in a historical frame image, the evaluation value of the text recognition result of the first text target may change, and the target image may be re-determined. Specifically, in response to the first text target having appeared in a historical frame image, and the text recognition result of the first text target in the current frame image is the target text recognition result, the target image of the first text target may be updated to the current frame image, and the target text recognition result is a text recognition result whose evaluation value meets the preset selection condition. Alternatively, if the text recognition result of the first text target in the historical frame image is the target text recognition result, the target image of the first text target may be updated to the historical frame image, wherein, when the historical frame image is the original target image of the first text target, the target image of the first text target does not need to be updated.
[0061] Exemplarily, before adding the current frame image, two text recognition results (value_1 and value_2) have been cached for the text target ID_0 in the candidate image set, among which the evaluation value of the text recognition result value_1 is the largest, the target text recognition result is the text recognition result value_1, and its corresponding target image is the frame number index_0, that is, the frame image corresponding to the text recognition result value_1. After adding the current frame image, the current image frame is detected to have text target ID_0, and its text recognition result value is obtained, wherein the text recognition result value of the current frame image may be the same as any one of the text recognition results value_1 and value_2 of the historical frame image, or both are different. Statistics are performed based on the text recognition result value of the current frame image and the text recognition results (value_1 and value_2) of the historical frame image to obtain the evaluation value of each text recognition result after adding the current frame image. If the text recognition result value_2 after adding the current frame image is greater than or equal to value_1, that is, the evaluation value of the current text recognition result value_2 is the largest, then the current image frame can be used as the new image frame of the text target ID_0. If the evaluation value of the text recognition result value_1 is still the maximum value after adding the current frame image, there is no need to update the target image, that is, the frame number of the target image is index_0, and the current frame image can be used as other images.
[0062] The specific implementation method of determining the target image of each first text target may refer to the specific implementation process of step S13 of the first embodiment above, and the present application will not elaborate on it here.
[0063] The above scheme can add new images to the candidate image set, that is, when new images are continuously added, the newly added images can be determined as current frame images in turn, the text targets contained in the current frame images can be detected, and the target images can be continuously determined for each text target based on the new evaluation values. In this way, the accuracy of determining the target image for each text target can be improved.
[0064] In some embodiments, after the above steps determine the target image of each text target, at least one of the following steps may be performed: caching the target image, setting flag information, releasing the image, etc. For details, please refer to the description of the following embodiments.
[0065] See also Figure 3 , Figure 3 : is a flowchart of the third embodiment of the image selection method of the present application. The method may include the following steps:
[0066] S31: Cache the target image of each text target.
[0067] After determining the target image of each text target, cache the target image of each text target. In order to reduce the memory usage of the candidate image set that continues to increase the image, only one target image can be cached for the text target with the same ID. In the subsequent process of caching the target image, only when the target image is no longer used as a target image can it be released as another image.
[0068] In some implementations, flag information may also be set for each frame image of the candidate image set or for the cached target image. The following takes setting flag information for the cached target image as an example for explanation. For details, refer to the following steps:
[0069] S32: Setting the value of the flag information of the cached target image, wherein the flag information includes at least one of the following: a selection flag, a release flag, and a times flag.
[0070] When caching the target image of each text target, the value of the flag information of the cached target image can be set, and the flag information can be cached. The flag information can include at least one of the following: a selection flag related_flag, a release flag release_flag, and a number flag cnt. Among them, the selection flag is used to mark whether it is currently used as a target image, the release flag is used to mark whether it is currently used as another image, and the number flag is used to mark the number of times it is currently used as a target image. Different values can be set for the flag information to represent different marks.
[0071] The selection flag related_flag takes the first value (for example, 1) to mark the current image as the target image, and the release flag release_flag takes the first value (for example, 1, the initial value is 0) to mark the current image as other images, that is, images that need to be released.
[0072] In some implementations, the images in the candidate image set are continuously added. Whenever a new image is added to the candidate image set, the newly added image is determined as the current frame image, and the target image of the text target contained in the current frame image is re-determined.
[0073] In the case where the target image of at least one second text target in the current image frame is updated to the current frame image, the current frame image can be cached as the updated target image of the second text target. If the second text target has an original target image, or the second text target has appeared in a historical frame image, etc., after the current frame image is updated as the updated target image, the original target image of the second text target can be released. In addition, historical frame images (i.e., other images) that are not used as target images in the current candidate image set except the current frame image can also be released.
[0074] In some implementations, the value of the flag information of the updated target image of the second text target may be cached, and the value of the flag information of the original target image of the second text target may be updated.
[0075] Specifically, the value of the flag information of the cached current frame image can be set to represent the current frame image as the target image after the second text target is updated, and the value of the flag information of the original target image of the second text target can be updated to represent that the original target image is no longer the target image of the second text target, that is, it can be used as other images that need to be released.
[0076] In some implementations, setting the value of the flag information of the cached current frame image includes at least one of the following:
[0077] Set the value of the selection flag bit related_flag of the current frame image to the first value (such as 1).
[0078] Set the release flag release_flag of the current frame image to the second value (eg, 0).
[0079] Set the value of the times flag cnt of the current frame image to the preset default value plus one (for example, the preset default value is 0).
[0080] In some implementations, updating the value of the flag information of the original target image of the second text target includes at least one of the following:
[0081] Update the value of the selection flag related_flag of the original target image from the first value to the second value (such as updating 1 to 0), update the value of the release flag release_flag of the original target image from the second value to the first value (such as updating 0 to 1), and set the value of the number flag cnt of the original target image to be reduced by one.
[0082] In some implementations, when the current frame image is cached as the updated target image, the value of the times flag cnt of the current frame image may not be set, or the value of the times flag cnt of the current frame image may be set to a preset default value (such as the preset default value is 0). In this case, in response to the target image (such as the current frame image as the updated target image) meeting the preset output condition, the value of the times flag cnt of the target image may be set to be increased by one (such as the preset default value increased by one).
[0083] In some embodiments, after caching the target image of each text target, or after determining the target image of each text target, or after setting the flag information, other images may be released. For details, refer to the following steps:
[0084] S33: releasing other images in the candidate image set, where the other images include images in the candidate image set except the target image.
[0085] The images other than the target image in the subsequent image set are released so that only the target image of each text target is cached, the cache amount of the candidate image set is reduced, and the memory occupied by the continuously increasing images in the candidate image set can also be reduced.
[0086] Exemplarily, if the original target image frame number of the text target id_0 is id_0. After adding a new image, the target image of the text target id_0 in the current frame image can be determined again according to the evaluation value. If the current frame image (frame number is id_1) is updated to the updated target image, the current frame image (frame number id_1) is cached, and the original target image (frame number id_0) can be released. If the current frame image is not the target image of the text target id_0, or the original target image is still the target image of the text target id_0, there is no need to update the target image, and the current frame image (frame number id_1) can be released.
[0087] The above scheme caches the target image of each text target and releases other images in the candidate image set, which can reduce the memory required for continuously adding new images to the candidate image set. In addition, the selection and release of the target image can be controlled by setting the flag information of the target image, thereby improving the accuracy of determining and releasing the target image.
[0088] In some embodiments, after the above steps of caching the target images of the respective texts or setting the flag information, at least one of the following steps may be performed: outputting the image or outputting the text recognition result, releasing the image, etc. For details, please refer to the description of the following embodiments.
[0089] See also Figure 4 , Figure 4 1 is a flow chart of the fourth embodiment of the image selection method of the present application. The method may include the following steps:
[0090] S41: In response to the target image satisfying a preset output condition, outputting at least one of the following: the target image, and a target text recognition result of a text target in the target image.
[0091] It can be determined whether the cached target image satisfies a preset output condition. If so, the target image and at least one of the target text recognition results of the text target in the target image can be output in response to the target image satisfying the preset output condition.
[0092] The preset output condition may be determined according to the target text recognition result, the preset period, etc. For example, the preset output condition may include that the target text recognition result corresponding to the text target satisfies the constraint condition, such as satisfying the preset character length, satisfying the preset character type, etc. For example, the preset output condition may also include that the duration period of the target text recognition result corresponding to the text target satisfies the preset duration condition, etc. This application does not limit the preset output condition.
[0093] In some implementations, in response to the target image satisfying a preset output condition, the value of the number flag cnt of the target image may be set to be incremented by one (eg, incremented by one to a preset default value).
[0094] In some embodiments, corresponding to the newly added current frame image, if the current frame image is not used as the target image, it is determined that the current frame image meets the preset release condition to release the current frame image. In addition, after caching the target image of each text target, it is also possible to determine whether the target image meets the preset release condition to release the target image according to the determination.
[0095] The preset release condition includes that the target image is no longer used as the target image. For example, whether the target image meets the preset release condition can be determined based on the flag information of the target image. The target image meets the preset release condition, which can be represented by the selection flag related_flag taking the second value (such as 0), the release flag release_flag taking the first value (such as 1), and the number flag cnt taking the value 0.
[0096] If the target image meets the preset release condition, that is, the target image is no longer used as the target image, but can be used as other images, then the step of releasing the target image is executed, and specifically, the step of releasing other images in the candidate image set can be executed, and the other images include images in the candidate image set except the target image.
[0097] In some embodiments, the target image determined by at least two text targets in the same frame image may be the same frame image, that is, there are at least two text targets that may determine the same target image. For example, in this case, the following steps may be referred to determine whether the target image meets the preset release condition.
[0098] S42: When the target image was the same target image corresponding to at least two text targets in the same frame image, and the target images of the at least two text targets are subsequently updated to new target images, it is determined that the target image meets a preset release condition.
[0099] In the case where at least two text targets may be determined to be the same target image, for example, when the target image was the same target image corresponding to at least two text targets in the same frame image, it can be judged whether the target image meets the preset release condition based on the subsequent determination of the target images of the at least two text targets.
[0100] Wherein, when the target images of at least two text targets are subsequently updated to new target images, it is determined that the target image satisfies the preset release condition.
[0101] For example, if two text objects a and b in a frame image determine the same target image (whose frame number is index_n), the text object a meets the preset output condition, and the flags set for the target image index_n include: the value of the selection flag related_flag is 1, the value of the release flag release_flag is 0, and the value of the number flag cnt is 1.
[0102] If the target image index_n of any of the text targets a or b is subsequently updated to a new target image (whose frame number is index_n+1), the flag information set for the original target image index_n includes: the value of the selection flag related_flag is 1, the value of the release flag release_flag is 1, and the value of the number flag cnt is 0. At this time, the original target image index_n does not meet the preset release condition.
[0103] If the target images index_n of text targets a and b are subsequently updated to new target images. For example, the target images of text targets a and b are updated to new target images index_n+1, or the target image of text target a is updated to new target image index_n+1, and the target image of text target b is updated to new target image index_n+2, then the flag information set for the original target image index_n includes: the value of the selection flag related_flag is 0, the value of the release flag release_flag is 1, and the value of the number flag cnt is 0. At this time, the original target image index_n meets the preset release condition.
[0104] In some implementations, when the target images of at least two text targets are subsequently updated to new target images, the target image may be released after it is determined that the target image meets a preset release condition.
[0105] In some implementations, after determining that the target image meets the preset output condition and the preset release condition, the target image may be released. The following steps may be referred to:
[0106] S43: In response to the target image satisfying a preset output condition and a preset release condition, determining that the target image is no longer a target image of a text target, and releasing the target image.
[0107] When the target image of the cached text target meets the preset output condition and the preset release condition, it can be indicated that the target image is no longer the target image of the text target and can be released. In some application scenarios, the target image and its target text recognition result can also be output.
[0108] The above scheme can output more accurate content by outputting the target image that meets the preset output condition, and can reduce the memory occupied by continuously adding new images by releasing the target image that meets the preset release condition. In addition, the release of the target image can be controlled by setting the flag information of the target image, so as to improve the accuracy of the target image release.
[0109] For the above-mentioned embodiment, an asynchronous processing method can be used to implement the image selection method. Specifically, the first processing step and the second processing step can be respectively performed in an asynchronous processing method, and the first processing step includes at least one of the following steps: detecting the text target contained in each frame image in the candidate image set, and obtaining the text recognition result of the text target contained in each frame image; determining the evaluation value of the text recognition result of each text target; and determining the target image of each text target from the candidate image set according to the evaluation value. And, the step of caching the target image of each text target. The second processing step includes: the step of releasing other images in the candidate image set.
[0110] The asynchronous processing method used to execute the first processing step and the second processing step respectively can indicate that the second processing step can be processed without waiting for the first processing step to be completed. In some application scenarios, the asynchronous processing method can be used to submit the first processing step and the second processing step to different threads or thread pools for processing. Therefore, when waiting for the processing result, different threads will not be blocked and can continue to process other tasks.
[0111] In some embodiments, the images of the candidate image set are continuously increased, and each time a new image is added to the candidate image set, the newly added image is determined as the current frame image. The first processing step can be executed to process the current frame image, and the second processing step can be executed to process the historical frame image. The historical frame image is the image before the current frame image. For example, the first processing step can be executed to process the first image, and at the same time, the second processing step can be executed to process the second image, wherein the second image can be the image before the first image. That is, the second processing step of the previous frame image has not been processed, and the first processing step of the current frame image has begun. The second processing step of the current frame image has not been processed, and the first processing step of the next frame image has begun, or the second processing step of the current frame image has been processed, and the first processing step of the previous frame image is still being processed, etc. This application does not limit the asynchronous processing method.
[0112] The above scheme can improve the effectiveness of acquiring the target image by respectively executing the first processing step and the second processing step in an asynchronous processing manner to continuously process each frame image in the candidate image set.
[0113] See also Figure 5 , Figure 5 It is a structural diagram of an embodiment of the image selection system of the present application.
[0114] Exemplarily, the image selection method of the present application may be performed by using an image selection system. The image selection system may include a storage unit, a processing unit, a selection unit, and an output unit in sequence.
[0115] A storage unit is used to store each frame image of the input candidate image set.
[0116] The processing unit can be used to execute the above steps S11 to S12 to detect the text targets contained in each frame image in the candidate image set, and obtain the text recognition results of the text targets contained in each frame image; and determine the evaluation value of the text recognition results of each text target.
[0117] The above step S13 is performed by using the selection unit to determine the target image of each text target from the candidate image set according to the evaluation value.
[0118] In some implementations, at least one of the above steps S31 to S32 can also be performed using a selection unit. The target image of each text target is cached, and the flag information of the cached target image is set, wherein the flag information includes at least one of the following: a selection flag, a release flag, and a times flag.
[0119] The selection unit is used to send the target image and / or its flag information that meets the preset output conditions to the output unit.
[0120] The output unit is used to execute the above step S33 to release other images in the candidate image set, where the other images include images other than the target image in the candidate image set.
[0121] In some embodiments, the output unit may be used to perform step S41 to output the target image that meets the preset output condition. That is, in response to the target image meeting the preset output condition, at least one of the following may be output: the target image and the target text recognition result of the text target in the target image.
[0122] In some embodiments, the output unit may be used to execute step S42 above, and when the target image was the same target image corresponding to at least two text targets in the same frame image, and the target images of at least two text targets are subsequently updated to new target images, it is determined that the target image meets the preset release condition.
[0123] In some implementations, the output unit may be used to execute step S43 above, where the output unit determines that the target image is no longer a target image of a text target and releases the target image in response to the target image satisfying a preset output condition and a preset release condition.
[0124] In some implementations, the processing unit, the selection unit, and the output unit may be executed in an asynchronous processing manner. For example, the processing unit and the selection unit may be used to execute the first processing step, and the output unit may be used to execute the second processing step.
[0125] The specific implementation of this embodiment can refer to the specific implementation process of each step of the above embodiment, and this application will not go into details here.
[0126] It is understandable that in the above method of the specific implementation mode, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0127] For the above embodiment, the present application also provides an image selection device for implementing the above image selection method.
[0128] See also Figure 6 , Figure 6 It is a structural diagram of an embodiment of an image selection device of the present application.
[0129] The image selection device 50 includes a detection module 51 , an evaluation module 52 and a determination module 53 .
[0130] The detection module 51 is used to detect the text target contained in each frame image in the candidate image set, and obtain the text recognition result of the text target contained in each frame image.
[0131] The evaluation module 52 is used to determine the evaluation value of the text recognition result of each text target.
[0132] The determination module 53 is used to determine the target image of each text target from the candidate image set according to the evaluation value.
[0133] It should be noted that the image selection device provided in the above embodiment and the image selection method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here. In practical applications, the image selection device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this application does not limit this.
[0134] For the above embodiment, the present application provides a computer device, see Figure 7 , Figure 7 1 is a schematic diagram of the structure of an embodiment of a computer device of the present application. The computer device 60 includes a memory 61 and a processor 62, wherein the memory 61 and the processor 62 are coupled to each other, the memory 61 stores program data, and the processor 62 is used to execute the program data to implement the steps of any embodiment of the above-mentioned image selection method.
[0135] In this embodiment, the processor 62 may also be referred to as a CPU (Central Processing Unit). The processor 62 may be an integrated circuit chip having the ability to process signals. The processor 62 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or the processor 62 may also be any conventional processor, etc.
[0136] The method of the above embodiment can be implemented in the form of a computer program, so the present application proposes a computer readable storage medium, see Figure 8 , Figure 8The computer-readable storage medium 70 stores program data 71 that can be run by a processor, and the program data 71 can be executed by the processor to implement the steps of any embodiment of the above-mentioned image selection method.
[0137] The computer-readable storage medium 70 of this embodiment may be a medium that can store the program data 71, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or may be a server storing the program data 71. The server may send the stored program data 71 to other devices for execution, or may execute the stored program data 71 by itself.
[0138] In some embodiments, the functions or modules included in the device provided in the above embodiments of the present application can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and the present application will not repeat them here.
[0139] The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar points can be referenced to each other, and the present application will not repeat them here.
[0140] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0141] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0142] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0143] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium, which is a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application.
[0144] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a computer-readable storage medium and executed by a computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present application is not limited to any specific combination of hardware and software.
[0145] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An image selection method, characterized in that: include: Detecting text objects contained in each frame image in the candidate image set, and obtaining text recognition results of the text objects contained in each frame image; Determining an evaluation value of a text recognition result for each text target; Determining a target image for each of the text objects from the candidate image set according to the evaluation value; The images in the candidate image set are continuously increased; the detecting the text target contained in each frame image in the candidate image set and obtaining the text recognition result of the text target contained in each frame image includes: in response to the addition of a new image to the candidate image set, determining the newly added image as the current frame image, detecting the text target contained in the current frame image as the first text target respectively, and obtaining the text recognition result of the first text target in the current frame image; Determining the evaluation value of the text recognition result of each text target includes: determining the evaluation value of the text recognition result of each first text target; wherein the evaluation value is a statistical quantity of each text recognition result, and the evaluation value is used to represent the number of frames or times in which the same text recognition result is recognized for the first text target in the candidate image set; Determining the target image of each of the text targets from the candidate image set according to the evaluation value includes: in response to the first text target having appeared in a historical frame image, and the text recognition result of the first text target in the current frame image is a target text recognition result, updating the target image of the first text target to the current frame image, wherein the target text recognition result is a text recognition result in which the evaluation value satisfies a preset selection condition, and the preset selection condition includes that the numerical value of the evaluation value is the maximum or equal to the evaluation value that last satisfied the preset selection condition; caching a target image of each of the text targets, and releasing other images in the candidate image set, wherein the other images include images in the candidate image set except the target image; The value of the flag information of the cached target image is set, and the selection and release of the target image are controlled by setting the flag information of the target image; wherein the flag information includes at least one of the following: a selection flag, a release flag, and a number flag; wherein the selection flag is used to mark whether it is currently used as a target image, the release flag is used to mark whether it is currently used as another image, and the number flag is used to mark the number of times it is currently used as a target image.
2. The method according to claim 1, characterized in that The step of determining the evaluation value of the text recognition result of the text target comprises: Counting each text recognition result of the text target in the current candidate image set to obtain a statistical number of each text recognition result of the text target; Determining evaluation values of the text recognition results of the text targets based on the statistical quantities of the text recognition results of the text targets; And / or, the step of determining the target image of the text target comprises: From the text recognition results of the text target, select the text recognition result whose evaluation value meets the preset selection condition as the target text recognition result of the text target; A target image of the text target is selected from at least one frame of image corresponding to the target text recognition result of the text target.
3. The method according to claim 1, characterized in that The step of determining an evaluation value of a text recognition result of each of the first text targets includes: For each of the first text targets, statistics are performed on the text recognition results of the first text target in the current frame image and the text recognition results of the historical frame images to obtain the statistical number of each text recognition result of the first text target, wherein the historical frame images are images in the candidate image set except the current frame image; Based on the statistical quantity of each text recognition result of the first text target, an evaluation value of each text recognition result of the first text target is determined.
4. The method according to claim 1, characterized in that: The step of determining a target image of each of the text objects from the candidate image set according to the evaluation value further includes: In response to the first text target not appearing in any historical frame image other than the current frame image in the candidate image set, the current frame image is used as a target image of the first text target.
5. The method according to claim 1, characterized in that: The images of the candidate image set are continuously increased. Whenever a new image is added to the candidate image set, the newly added image is determined as the current frame image, and the target image of the text target contained in the current frame image is re-determined; when there is at least one target image of a second text target, the target image is updated to the current frame image. The caching of target images of the text targets includes: caching the current frame image as an updated target image of the second text target; The releasing other images in the candidate image set comprises: releasing the original target image of the second text target; And / or, the value of the flag information of the target image to be cached is set, including: The value of the flag information of the cached current frame image is set to represent the current frame image as the updated target image of the second text target, and the value of the flag information of the original target image of the second text target is updated to represent that the original target image is no longer the target image of the second text target.
6. The method according to claim 5, characterized in that The value of the flag information of the current frame image to be cached includes at least one of the following: Setting the value of the selection flag of the current frame image to a first value; Setting the value of the release flag bit of the current frame image to a second value; The updating of the value of the flag information of the original target image of the second text target includes at least one of the following: The value of the selection flag of the original target image is updated from the first value to the second value, the value of the release flag of the original target image is updated from the second value to the first value, and the value of the number flag of the original target image is set to be reduced by one; The value of the selection flag is the first value used to mark the current image as the target image, and the value of the release flag is the first value used to mark the current image as another image.
7. The method according to claim 1, characterized in that After caching the target images of the text targets, the method includes: In response to the target image satisfying a preset output condition, outputting at least one of the following: the target image, and a target text recognition result of a text target in the target image; And / or, the value of the flag information of the target image to be cached is set, including: In response to the target image satisfying a preset output condition, the value of the number flag of the target image is set to be increased by one.
8. The method according to claim 1, characterized in that After caching the target images of the text targets, the method includes: When the target image was once the same target image corresponding to at least two text targets in the same frame image, and subsequently the target images of the at least two text targets are updated to new target images, determining that the target image meets a preset release condition; The releasing other images in the candidate image set comprises: In response to the target image satisfying a preset output condition and satisfying the preset release condition, it is determined that the target image is no longer a target image of the text target, and the target image is released.
9. The method according to claim 1, characterized in that: The method further comprises: The first processing step and the second processing step are respectively executed in an asynchronous processing manner, wherein the first processing step includes at least one of the following steps: detecting the text target contained in each frame image in the candidate image set, and obtaining the text recognition result of the text target contained in each frame image; determining the evaluation value of the text recognition result of each text target; determining the target image of each text target from the candidate image set according to the evaluation value; and caching the target image of each text target; the second processing step includes: releasing other images in the candidate image set.
10. A computer device, characterized in that: The invention comprises a memory and a processor coupled to each other, wherein the memory stores program data, and the processor is used to execute the program data to implement the steps of the method according to any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that: Program data that can be executed by a processor are stored, and the program data is used to implement the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
License plate image quality evaluation method and device and computer equipment
CN111611863A
License plate recognition method, device and system and computer equipment
CN111862617A
