Image data entry method, device, electronic device and storage medium
By adopting a parallel asynchronous thread mechanism in the image data entry system to handle image data entry and feature value extraction respectively, the problem of low entry efficiency in the existing technology is solved and more efficient image data processing is achieved.
Patent Information
- Application Number
- CN201911419619.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-31
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2039-12-31
AI Technical Summary
The existing image data entry system is inefficient and cannot meet the demand for entry of image data such as faces, human bodies, vehicles, etc. after adding cameras and subdivisions.
Using a parallel asynchronous thread mechanism, one thread is responsible for inputting image data, and the other thread is responsible for extracting short feature values within a preset time period, and establishing an index relationship between short feature values and image data to improve input efficiency.
Through asynchronous parallel processing, the input of image data does not need to wait for feature extraction, which significantly improves the input efficiency and can handle higher data volumes and faster input speeds.
Smart Images

Figure CN113127659B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to an image data entry method, device, electronic equipment and storage medium. Background Art
[0002] In the era of information digitization, more and more data is acquired, and more and more data needs to be entered, such as image data. The image data entry system uses a camera to collect images, converts the collected images into digital information, extracts feature data, and then enters them into the database together. Assuming that one piece of data is 3KB, the efficiency of entering the database per second is 1000 / s-1500 / s. However, with the increase in cameras, the segmentation of specific business scenarios, and the increase in segmented fields, it is also necessary to simultaneously enter image data such as faces, bodies, or vehicles collected by cameras. The existing entry efficiency obviously cannot meet the requirements for image data entry. It can be seen that the current image data entry system has the problem of low entry efficiency. Summary of the invention
[0003] The embodiments of the present invention provide an image data entry method, device, electronic device and storage medium, which can improve the image data entry efficiency.
[0004] In a first aspect, an embodiment of the present invention provides an image data entry method, comprising:
[0005] Executing a first thread to enter the acquired image data into a first image database;
[0006] Executing a second thread to extract short feature values of image data within a preset time period in the first image database, wherein the first thread and the second thread are parallel asynchronous threads, and the data length of the short feature values is smaller than the data length of the image data;
[0007] The short feature value is entered into a second image database, and an index relationship between the short feature value and the image data is established.
[0008] Optionally, executing the first thread to enter the acquired image data into a first image database includes:
[0009] When it is detected that the message queue meets the preset packaging conditions, the image data in the message queue is packaged;
[0010] Grouping the packaged image data according to the attribute values of the image data to obtain grouped image data;
[0011] The grouped image data are respectively entered into the first image database.
[0012] Optionally, the image data includes a data ID, and before grouping the packaged image data according to the attribute values of the image data to obtain the grouped image data, the method further includes:
[0013] The packaged image data is deduplicated according to the data ID.
[0014] Optionally, executing the second thread to extract feature values of image data in the first image database includes:
[0015] Detecting whether there is image data in the first image database for which short feature values have not been extracted within a preset time;
[0016] If there is image data from which short eigenvalues have not been extracted, short eigenvalue extraction is performed on the image data from which short eigenvalues have not been extracted according to a preset extraction rule to obtain corresponding short eigenvalues.
[0017] Optionally, the extraction rule includes a sorting rule, and the extracting feature values from the image data from which the feature values have not been extracted according to the preset extraction rule includes:
[0018] The image data from which the feature values have not been extracted are sorted according to a set sorting rule, and the feature values are extracted according to the sorting.
[0019] Optionally, the extraction rule includes an extraction quantity, and the step of extracting feature values from the image data from which feature values have not been extracted according to the preset extraction rule includes:
[0020] Counting the number of image data from which short eigenvalues have not been extracted;
[0021] Dividing the image data from which short eigenvalues are not extracted into batches according to the extraction quantity;
[0022] Perform short feature value extraction on the batched image data.
[0023] Optionally, the image data includes a data ID, and the step of storing the short feature value in the second image database and establishing an index relationship between the short feature value and the image data includes:
[0024] storing the short feature value in the second image database;
[0025] The ID corresponding to the short feature value is stored in the memory, and an index relationship between the short feature value and the corresponding ID is established, so that the short feature value and the image data have an index relationship.
[0026] In a second aspect, an embodiment of the present invention provides an image data entry device, comprising:
[0027] An input module, used to execute the first thread and input the acquired image data into the first image database;
[0028] an extraction module, configured to execute a second thread to extract feature values of image data in the first image database, wherein the first thread and the second thread are parallel asynchronous threads;
[0029] A storage module is used to store the short feature value in a second image database and establish an index relationship between the short feature value and the image data.
[0030] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the image data entry method provided in the embodiment of the present invention when executing the computer program.
[0031] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image data entry method provided in the embodiment of the invention are implemented.
[0032] In an embodiment of the present invention, a first thread is executed to enter the acquired image data into a first image database; a second thread is executed to extract short feature values of image data within a preset time period in the first image database, the first thread and the second thread are parallel asynchronous threads, and the data length of the short feature value is less than the data length of the image data; the short feature value is entered into the second image database, and an index relationship between the short feature value and the image data is established. The image data is entered and feature extracted respectively by two threads. Since the two threads are asynchronous and parallel, the image data can be entered without waiting for feature extraction, thereby improving the efficiency of image data entry. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 is a flow chart of an image data input method provided by an embodiment of the present invention;
[0035] Figure 2 is a flowchart of a first thread provided by an embodiment of the present invention;
[0036] Figure 3 is a schematic diagram of the structure of a data table provided by an embodiment of the present invention;
[0037] Figure 4 is a flowchart of another first thread provided by an embodiment of the present invention;
[0038] Figure 5 is a flowchart of a second thread provided by an embodiment of the present invention;
[0039] Figure 6 is a flowchart of another second thread provided by an embodiment of the present invention;
[0040] Figure 7 is a flowchart of another second thread provided by an embodiment of the present invention;
[0041] Figure 8 is a flow chart of another method for inputting image data provided by an embodiment of the present invention;
[0042] Fig. 9 is a schematic diagram of the structure of another data table provided by an embodiment of the present invention;
[0043] Fig.10 is a structural schematic diagram of an image data entry device provided by an embodiment of the present invention;
[0044] Fig.11 is a structural diagram of an input module provided by an embodiment of the present invention;
[0045] Fig.12 is a schematic diagram of the structure of another input module provided by an embodiment of the present invention;
[0046] Fig.13 is a structural schematic diagram of an extraction module provided by an embodiment of the present invention;
[0047] Fig.14 is a schematic diagram of the structure of another extraction module provided by an embodiment of the present invention;
[0048] Fig.15 is a schematic diagram of the structure of another storage module provided by an embodiment of the present invention;
[0049] Fig.16 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] See also Figure 1 , Figure 1 is a flow chart of an image data input method provided by an embodiment of the present invention, such as Figure 1 As shown, the following steps are included:
[0052] 101. Execute a first thread to input acquired image data into a first image database.
[0053] The above-mentioned image data may be image data collected by an image acquisition device, and the above-mentioned image acquisition device may be a camera deployed in various application scenarios, such as a traffic camera, a community camera, a public security camera, a customs camera, etc. The above-mentioned image data may be digital data generated by the collected image, and the above-mentioned image data may be represented by a one-dimensional matrix vector, such as a matrix vector generated by an image. The above-mentioned matrix vector may be understood as the color value corresponding to the pixel point of the image, for example: the row of the matrix corresponds to the pixel height of the image, the column of the matrix corresponds to the pixel width of the image, and the matrix unit corresponds to the pixel point of the image. Specifically, for example, the pixel of a picture is 640*480, which means that the picture has 640 pixels horizontally and 480 pixels vertically, with a total of 640*480=307,200 pixels. The corresponding matrix has 640 columns, 480 rows, and a total of 307,200 matrix units, and the pixel value of each pixel corresponds to the value of each matrix unit. The above-mentioned image data may be image data of a face, a human body, a vehicle, etc., and the above-mentioned image data also includes attribute information such as data ID, dimension, type, and version. The above data ID is used to identify the image data to distinguish it from other different image data; the above dimension is used to illustrate the length of the image data. The higher the dimension, the longer the length of the image data; the above type may include: household permanent population, authentication collection, police personnel, key personnel and other types; the above version may be an algorithm version, such as an algorithm version for capturing faces, an algorithm version for capturing bodies, etc. The above first thread may include execution functions such as data monitoring and data storage, and may also include at least one of the functions of data packaging, data deduplication and data grouping. The above data monitoring may be monitoring whether the image data is obtained; the above data storage may be entering the obtained image data into the image database; the above data packaging may be obtaining batch image data and entering the batch image data into the database; the above data deduplication may be deleting duplicate image data and retaining only one; the above data grouping may be grouping the image data according to the classification rules, and the above classification rules are preset by the user. The above image database is used to store the obtained image data and provide image data search.
[0054] It should be noted that, in the embodiment of the present invention, the above-mentioned image data may also be referred to as original image data, original image eigenvalues, image eigenvalues, image matrices, etc., and the above-mentioned first thread may also be referred to as a consumption thread or an input thread.
[0055] 102. Execute a second thread to extract short feature values of image data within a preset time period in a first image database.
[0056] Among them, the first thread in step 101 and the second thread in step 102 are parallel asynchronous threads. The parallelism of the first thread and the second thread can be understood as that while executing the image data entry of the first thread, the short eigenvalue extraction of the image data of the second thread is also executed; the asynchronousness of the first thread and the second thread means that the first thread and the second thread do not process the same batch of image data. For example, while the first thread is entering the Nth batch of image data, the second thread extracts the eigenvalues of the N-ath batch of image data to obtain short eigenvalues, where a is a positive integer greater than or equal to 1. The short eigenvalues can be understood as the eigenvalues after feature extraction of the image data. In terms of data length, the eigenvalues are much lower than the corresponding image data. In an understandable way, the short eigenvalues can also be called the eigenvalues of the image eigenvalues, that is, the eigenvalues of an image are obtained after the eigenvalues are extracted, and the eigenvalues obtained by feature extraction of the image eigenvalues are obtained. The short eigenvalues can be represented by matrix vectors. For example: the image feature value is (1, 3, 2, 7, 4, 55, 13, 255, 17, 91), and the feature extraction of the feature value is performed to obtain the feature (1, 7, 13, 91). The data length is greatly reduced. It should be noted that the feature value of the above-mentioned image data is used to accelerate the search, and the speed of searching the image data can be improved by the feature value of the image data. Taking the facial feature value as an example, the facial feature value in the database is (1, 3, 2, 7, 4, 55, 13, 255, 17, 91) and the feature value of the corresponding facial feature value is (1, 7, 13, 91). When searching for the target face, the target facial feature value is (1, 3, 2, 7, 4, 55, 13, 254, 17, 91), and the feature value of the extracted target facial feature value is (1, 7, 13, 91). When comparing, it is only necessary to compare the target face in the database. The feature value (1, 7, 13, 91) of the target face feature value and the feature value of the face feature value in the database are sufficient, and the feature value (1, 7, 13, 91) of the face feature value in the database is compared to the feature value (1, 7, 13, 91) of the face feature value in the database, which is 100% similarity. There is no need to compare the target face feature value (1, 3, 2, 7, 4, 55, 13, 254, 17, 91) with the face feature value (1, 3, 2, 7, 4, 55, 13, 255, 17, 91) in the database. In this way, the amount of data compared in the database is much smaller. The above-mentioned preset time can be the day before the current day. For example, if the current day is May 2, 2015, the preset time period is May 1, 2015, that is, while the first thread enters the image data of May 2, 2015, the second thread extracts the feature value of the image data entered into the image database by the first thread on May 1, 2015. The above-mentioned preset time may also be the previous time period of the current time period. For example, if the current time period is 13:00-14:00, then the preset time period is 12:00-13:00.
[0057] It should be noted that, in the embodiment of the present invention, the short eigenvalues of the image data may also be referred to as accelerated search eigenvalues, accelerated search matrix vectors, search eigenvalues, comparison eigenvalues, etc. The second thread may also be referred to as an extraction thread.
[0058] 103. Enter the short feature value into the second image database, and establish an index relationship between the short feature value and the image data.
[0059] Among them, the short feature value is the feature value of the image data extracted in step 102, and the second image database can be the same image database as the first image database, or the second image database and the first image database can be independent image databases. The image database can be a local database or a database on a cloud server. When the second image database and the first image database are the same database, the second image database and the first image database refer to different image data storage areas in the database. The index relationship is used to index the corresponding image data according to the short feature value when searching for an image, which can be a direct index or an indirect index. The direct index can be understood as directly associating the short feature with the corresponding image data. The indirect index can be understood as indexing a unique identifier associated with the image data through the short feature value, and indexing the image data through the unique identifier. For example, since the image data has a unique data ID, the short feature value can be associated with the data ID to establish an index relationship between the short feature value and the image data. After the target short feature value is obtained by comparison, the data ID associated with the target short feature value can also be obtained, and the corresponding image data is obtained from the first image database according to the data ID.
[0060] In some possible embodiments, before receiving image data and extracting features from the image data, the threads are initialized. When the program initialization succeeds, the first thread and the second thread start to execute the required functions at the same time. The program initialization can be understood as configuring the resources required by the first thread and the second thread to the memory. In this way, the first thread and the second thread can start working at the same time, avoiding data backlog in the first thread.
[0061] It should be noted that the image data entry method provided in the embodiment of the present invention can be applied to computers, servers and other devices for image data entry.
[0062] In an embodiment of the present invention, the first thread is executed to enter the acquired image data into the first image database; the second thread is executed to extract the short feature value of the image data within a preset time period in the first image database, the first thread and the second thread are parallel asynchronous threads, and the data length of the short feature value is less than the data length of the image data; the short feature value is entered into the second image database, and an index relationship between the short feature value and the image data is established. In this way, the image data is entered and the feature is extracted respectively by two threads. Since the two threads are asynchronous and parallel, the image data can be entered without waiting for the feature extraction, thereby improving the efficiency of image data entry.
[0063] Optional, see Figure 2 , Figure 2 is a flowchart of a first thread provided in an embodiment of the present invention, such as Figure 2 As shown, the following steps are included:
[0064] 201. When it is detected that the message queue meets a preset packaging condition, the image data in the message queue is packaged.
[0065] Among them, the above-mentioned message queue is used to temporarily store the image data collected by the camera, and the above-mentioned message queue can be a first-in-first-out queue, that is, the image data stored first will be taken out first. The above-mentioned pre-set packaging condition can be a time condition or a quantity condition. The above-mentioned time condition, for example, is 1 second, and the image data in the message queue is packaged every 1 second. The above-mentioned quantity condition, for example, is 10,000 pieces of image data, and when it is detected that the image data in the message queue reaches 10,000, the image data in the message queue is packaged. It should be noted that the above-mentioned 1 second time and 10,000 pieces of image data are exemplary conditions, and should not be regarded as limitations in the embodiments of the present invention. The specific time condition or quantity condition can be set by the user. The above-mentioned packaging of image data refers to packaging the original independent image data in the message queue into batch data for subsequent processing.
[0066] In some possible embodiments, when the preset packaging condition is not met, the image data will be added to the message queue for waiting.
[0067] 202. Group the packaged image data according to attribute values of the image data to obtain grouped image data.
[0068] The above-mentioned image data includes attribute information such as data ID, dimension, type, version, time, etc. Figure 3As shown in the data table, the above attribute values include values corresponding to attribute information such as data ID, dimension, type, version, time, etc. The attribute value of the above data ID is configured when the image data is generated, such as configuring the attribute value of the data ID according to the device number of the image collected, the timestamp of the image, whether the image is a face, a human body, or a vehicle; the attribute value of the above dimension can be the value after encoding the dimension of the image data, such as encoding the image data of 128 dimensions as 1, encoding the image data of 256 dimensions as 2, and encoding the image data of 512 dimensions as 3, etc.; the attribute value of the above type can be the encoding of the image data type, such as encoding the types of household registration permanent population, authentication collection, police comprehensive personnel, key personnel, etc. as attribute values 1, 2, 3, 4, etc. The above grouping of the packaged image data can be grouping of a single attribute value according to dimension, type, version, etc., such as grouping only the dimension, or only the type, or only the version, etc. It can also be grouping by combining multiple attribute values, such as grouping image data with the same dimension, type, and version into the same group.
[0069] 203. Enter the grouped image data into the first image database respectively.
[0070] The above-mentioned grouped image data is obtained in step 202, and the above-mentioned first image database is pre-set with a data table corresponding to each group attribute value, such as Figure 3 The entry of the grouped image data may be to enter each grouped image data into a data table of corresponding attribute values according to the attribute values of the grouped image data. The entry of the grouped image data may be performed according to routing rules.
[0071] In some possible implementations, if the entry fails, step 201 will be re-executed.
[0072] In the above steps, by packaging the image data that meets the packaging conditions, the image data can be batch-entered into the image database, further improving the efficiency of image data entry. In addition, the image data can be grouped and entered according to the attribute value, which is convenient for querying the image data in the database and can improve the query efficiency.
[0073] Optional, see Figure 4 , Figure 4 is a flowchart of another first thread provided in an embodiment of the present invention, such as Figure 4 As shown, the following steps are included:
[0074] 301. When it is detected that the message queue meets a preset packaging condition, the image data in the message queue is packaged.
[0075] The image data includes a data ID.
[0076] 302. De-duplicate the packaged image data according to the data ID.
[0077] During the image data acquisition process, the camera transmits data to the message queue, and then the image data is packaged through the message queue. Duplicate image data may appear during the transmission and packaging process. Duplicate image data will reduce the efficiency of image data entry and affect the efficiency of feature extraction from image data. In addition, duplicate data will occupy additional storage resources and I / O resources of the image database. When querying image data, the amount of query calculation will also increase. In an embodiment of the present invention, different image data have different data IDs. The data IDs in the packaged image data can be traversed and the image data with the same data ID can be discarded to ensure that there is no duplicate image data in the packaged image data.
[0078] 303. Group the packaged image data according to the attribute values of the image data to obtain grouped image data.
[0079] 304. Enter the grouped image data into the first image database respectively.
[0080] In the above steps, duplicate data entry is avoided by deduplicating the packaged image data, thereby improving the efficiency of data entry and avoiding the waste of storage resources and I / O resources of the image database.
[0081] Optional, see Figure 5 , Figure 5 is a flowchart of a second thread provided in an embodiment of the present invention, such as Figure 5 As shown, the following steps are included:
[0082] 401. Detect whether there is image data in a first image database from which short feature values have not been extracted within a preset time.
[0083] For the image data entered into the first image database, there are corresponding short feature value extraction states in the corresponding data table, such as Figure 3 As shown, the short feature value status of the image data from which the short feature value has not been extracted is null. It is only necessary to detect whether the value of the short feature value extraction status in the data table is null to determine whether the image data is image data from which the feature value has not been extracted. The above-mentioned preset time can be the day before the current day, or the previous time period of the current time period. The above-mentioned detection can be a cyclic monitoring of the image data in the first image database, for example, monitoring once every 1 second.
[0084] In some possible embodiments, when image data are batch-entered into the same data table, if it is detected that the value of one image data in the data table is empty, it can be considered that the values of all image data in the data table are also empty.
[0085] 402. If there is image data from which short eigenvalues have not been extracted, extract short eigenvalues from the image data from which short eigenvalues have not been extracted according to a preset extraction rule to obtain corresponding short eigenvalues.
[0086] When it is detected that the short eigenvalue status of the image data in the data table is empty (Null), it means that there are image data whose eigenvalues have not been extracted. The above-mentioned pre-set extraction rules can be extracted according to the sorting rules, or can be extracted according to the pre-set extraction quantity, that is, extracting a certain amount of image data as batch data. The above-mentioned sorting rules can be time sorting or attribute value sorting. Specifically, the short eigenvalue extraction of image data can be: read out the image data whose short eigenvalues have not been extracted from the first image data according to the pre-set extraction rules, and input these image data whose short eigenvalues have not been extracted into the short eigenvalue extraction engine for short eigenvalue extraction.
[0087] In the above steps, by extracting short feature values from image data whose short feature values have not been extracted within a preset time, short feature extraction can be performed asynchronously on the image data, which is less affected by the image input speed of the first thread.
[0088] Optional, see Figure 6 , Figure 6 is a flowchart of another second thread provided in an embodiment of the present invention, such as Figure 6 As shown, the following steps are included:
[0089] 501. Detect whether there is image data in a first image database from which short feature values have not been extracted within a preset time.
[0090] 502. If there is image data from which short feature values have not been extracted, sort the image data from which feature values have not been extracted according to a preset sorting rule, and extract feature values according to the sorting.
[0091] The above-mentioned sorting rule can be time sorting or attribute value sorting. The above-mentioned time sorting can be sorting a class of image data according to the order of entry time among all image data whose short feature values have not been extracted within a preset time. For example, assuming that there are 5 groups of image data whose short features have not been extracted, and within the preset time, they are A1, A2, B1, B2, and C1, respectively, where A1 and A2 are a class of data (that is, they have the same attribute value and are entered in different data tables), B1 and B2 are a class of data, and C1 is a class of data. The entry time is A1, B1, A2, C1, and B2 from first to last, then A1 is ranked first. Since A2 and A1 are a class of data, A1 and A2 are selected for extraction, and B1 is ranked after A1 and A2. Since B2 and B1 are a class of data, B1 and B2 are extracted after A1 and A2, and C1 is extracted last. The above-mentioned attribute value sorting can be to sort by the attribute values corresponding to the image data in all image data whose short feature values have not been extracted within a preset time. The above-mentioned attribute values include dimension, type, version and other attribute values. For example, sorting is performed by the high and low dimension attribute values, first extracting the short feature values of the image data with low dimension, and then extracting the short feature values of the image data with high dimension; sorting is performed by the importance of the type, first extracting the short feature values of the image data corresponding to the type with high importance, and then extracting the short feature values of the image data corresponding to the type with low importance, and the importance can be positively correlated with the frequency of use; sorting is performed by the version usage rate, first extracting the short feature values of the image data corresponding to the version with high winning rate, and then extracting the short feature values of the image data corresponding to the version with low winning rate.
[0092] In some possible embodiments, feature values of the same algorithm are preferentially extracted. The above algorithm may be a recognition algorithm, a detection algorithm, a tracking algorithm, a clustering algorithm, and the like.
[0093] In the above steps, the image data is sorted so that the extraction of short eigenvalues of the image data is orderly, further improving the extraction efficiency of short eigenvalues.
[0094] Optional, see Figure 7 , Figure 7 is a flowchart of another second thread provided in an embodiment of the present invention, such as Figure 7 As shown, the following steps are included:
[0095] 601. Detect whether there is image data in a first image database from which short feature values have not been extracted within a preset time.
[0096] 602. If there is image data from which short eigenvalues are not extracted, count the number of image data from which short eigenvalues are not extracted.
[0097] The above number refers to the total number of image data from which short feature values are not extracted within a preset time. The above preset time may be the day before the current time or the time period before the current time period.
[0098] 603. Divide the image data from which short feature values have not been extracted into batches according to a preset extraction quantity.
[0099] The above-mentioned pre-set extraction quantity can be set by the user. For example, if the extraction quantity is 5000, 5000 pieces of image data meeting the conditions will be extracted from the first image database at one time for extraction of short feature values. When the number of image data without short feature values extracted from the first image database is 10000, the image data without short feature values extracted will be divided into two batches according to the extraction quantity and extracted from the first image database, and then the short feature values of each batch of image data will be extracted respectively.
[0100] 604. Perform short feature value extraction on the batched image data.
[0101] The batched image data can be read out and input into the short feature value extraction engine in sequence. The batched image data can also be processed simultaneously by multiple short feature value extraction engines. For example, multiple short feature value extraction engines can be constructed by adding a GPU graphics processor for processing. In this way, the concurrent performance of short feature value extraction can be improved, thereby improving the extraction efficiency of short feature values, and further improving the input efficiency of image data.
[0102] In the above steps, the image data can be distributed in batches, and the short eigenvalues of the image data can be extracted in batches, so as to further improve the extraction efficiency of the short eigenvalues and thus improve the efficiency of data entry.
[0103] Optional, see Figure 8 , Figure 8 is a flow chart of another method for inputting image data provided in an embodiment of the present invention. Figure 8 As shown, the following steps are included:
[0104] 701. Execute a first thread to input acquired image data into a first image database.
[0105] 702. Execute a second thread to extract short feature values of image data within a preset time period in a first image database.
[0106] 703. Store the short feature value in the second image database.
[0107] The second image database mentioned above may be the same image database as the first image database. In one possible implementation, the second image database is the same image database as the first image database, and the extracted short feature values are stored in a data table corresponding to the corresponding image database, such as Fig. 9 As shown, the extracted short feature value is entered into the corresponding pq_code, and the null value (Null) is changed to the short feature value. In another possible implementation, the second image database and the first image database are different image databases, that is, the image data and the short feature value are stored in the two image databases respectively. At this time, the image data in the first image database and the short feature value in the second image database have the same data ID, and the state of the short feature value in the image database in the first image database is changed from the null value (Null) to other values, such as changing the null value (Null) to 1, indicating that the short feature value of the image data has been extracted and entered into the second image database.
[0108] 704. Store the ID corresponding to the short feature value in the memory, and establish an index relationship between the short feature value and the corresponding ID, so that the short feature value and the image data have an index relationship.
[0109] The above-mentioned memory is a storage space directly addressed by the CPU, and a data ID is configured for the short feature value, which is the data ID corresponding to the image data from which the short feature value is extracted, that is, the short feature value and the corresponding image data have the same ID, thereby establishing an index relationship between the short feature value and the corresponding data ID. Through the data ID, an index relationship between the feature value and the corresponding image data can be established. For example, when searching for an image, the short feature value of the image to be searched is extracted, the short feature value in the second image database is read into the memory, and the short feature value of the image to be searched is compared with all the short feature values read into the memory to obtain a target short feature value whose similarity meets the conditions, and the corresponding target data ID is indexed in the memory through the target short feature value, and the corresponding data ID in the first image database is found through the target data ID in the memory, and the image data corresponding to the data ID is read out, which is the target image data corresponding to the image data to be searched.
[0110] In the above steps, by establishing an index relationship between the short feature value and the data ID, the corresponding image data can be indexed by the short feature value during the search.
[0111] See also Fig.10 , Fig.10 is a schematic diagram of the structure of an image data input device provided by an embodiment of the present invention, such as Fig.10 As shown, including:
[0112] An input module 1001 is used to execute a first thread to input the acquired image data into a first image database;
[0113] An extraction module 1002 is used to execute a second thread to extract feature values of image data in the first image database, wherein the first thread and the second thread are parallel asynchronous threads;
[0114] The storage module 1003 is used to store the short feature value in the second image database and establish an index relationship between the short feature value and the image data.
[0115] Optional, such as Fig.11 As shown, the input module 1001 includes:
[0116] The detection unit 10011 is used to package the image data in the message queue when detecting that the message queue meets the preset packaging condition;
[0117] A grouping unit 10012 is used to group the packaged image data according to the attribute values of the image data to obtain grouped image data;
[0118] The input unit 10013 is used to input the grouped image data into the first image database respectively.
[0119] Optional, such as Fig.12 As shown, the image data includes a data ID, and the input module 1001 also includes:
[0120] The deduplication unit 10014 is used to deduplicate the packaged image data according to the data ID.
[0121] Optional, such as Fig.13 As shown, the extraction module 1002 includes:
[0122] A detection unit 10021 is used to detect whether there is image data in the first image database for which a short feature value has not been extracted within a preset time;
[0123] The first extraction unit 10022 is used to extract short feature values from the image data without short feature value extraction according to a preset extraction rule to obtain corresponding short feature values if there is image data without short feature value extraction.
[0124] Optionally, the extraction rule includes a sorting rule, and the first extraction unit 10022 is further used to sort the image data from which the feature values are not extracted according to the set sorting rule, and extract the feature values according to the sorting.
[0125] Optional, such as Fig.14As shown, the extraction rule includes the extraction quantity, and the extraction module 1002 includes:
[0126] A counting unit 10023, used for counting the number of image data from which short feature values have not been extracted;
[0127] A batching unit 10024 is used to batch the image data from which the short eigenvalues are not extracted according to the extraction quantity;
[0128] The second extraction unit 10025 is used to extract short feature values from the batched image data.
[0129] Optional, such as Fig.15 As shown, the image data includes a data ID, and the storage module 1003 includes:
[0130] A storage unit 10031, used to store the short feature value in the second image database;
[0131] The association unit 10032 is used to store the ID corresponding to the short feature value in the memory, and establish an index relationship between the short feature value and the corresponding ID, so that the short feature value and the image data have an index relationship.
[0132] It should be noted that the image data entry device provided in the embodiment of the present invention can be applied to computers, servers and other equipment for image data entry.
[0133] The image data entry device provided in the embodiment of the present invention can implement each process implemented by the image data entry method in the above method embodiment, and will not be described here to avoid repetition, and can achieve the same beneficial effects.
[0134] See also Fig.16 , Fig.16 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.16 As shown, it includes: a memory 1602, a processor 1601, and a computer program stored in the memory 1602 and executable on the processor 1601, wherein:
[0135] The processor 1601 is used to call the computer program stored in the memory 1602 and execute the following steps:
[0136] Executing a first thread to enter the acquired image data into a first image database;
[0137] Executing a second thread to extract short feature values of image data within a preset time period in the first image database, wherein the first thread and the second thread are parallel asynchronous threads, and the data length of the short feature values is smaller than the data length of the image data;
[0138] The short feature value is entered into a second image database, and an index relationship between the short feature value and the image data is established.
[0139] Optionally, the step of executing the first thread executed by the processor 1601 to enter the acquired image data into the first image database includes:
[0140] When it is detected that the message queue meets the preset packaging conditions, the image data in the message queue is packaged;
[0141] Grouping the packaged image data according to the attribute values of the image data to obtain grouped image data;
[0142] The grouped image data are respectively entered into the first image database.
[0143] Optionally, the image data includes a data ID, and before the processor 1601 performs the grouping of the packaged image data according to the attribute value of the image data to obtain the grouped image data, the method further includes:
[0144] The packaged image data is deduplicated according to the data ID.
[0145] Optionally, the executing the second thread executed by the processor 1601 to extract feature values of image data in the first image database includes:
[0146] Detecting whether there is image data in the first image database for which short feature values have not been extracted within a preset time;
[0147] If there is image data from which short eigenvalues have not been extracted, short eigenvalue extraction is performed on the image data from which short eigenvalues have not been extracted according to a preset extraction rule to obtain corresponding short eigenvalues.
[0148] Optionally, the extraction rule includes a sorting rule, and the step of extracting feature values from the image data from which feature values have not been extracted according to the preset extraction rule, performed by the processor 1601, includes:
[0149] The image data from which the feature values have not been extracted are sorted according to a set sorting rule, and the feature values are extracted according to the sorting.
[0150] Optionally, the extraction rule includes an extraction quantity, and the step of extracting feature values from the image data from which feature values have not been extracted according to the preset extraction rule executed by the processor 1601 includes:
[0151] Counting the number of image data from which short eigenvalues have not been extracted;
[0152] Dividing the image data from which short eigenvalues are not extracted into batches according to the extraction quantity;
[0153] Perform short feature value extraction on the batched image data.
[0154] Optionally, the image data includes a data ID, and the step of storing the short feature value in the second image database and establishing an index relationship between the short feature value and the image data performed by the processor 1601 includes:
[0155] storing the short feature value in the second image database;
[0156] The data ID of the image data corresponding to the short feature value is stored in the memory, and an index relationship between the short feature value and the corresponding data ID is established so that the short feature value and the image data have an index relationship.
[0157] It should be noted that the above-mentioned electronic device may be a computer, server or other device that can be used for image data entry.
[0158] The electronic device provided by the embodiment of the present invention can implement each process implemented by the image data entry method in the above method embodiment, and will not be described here to avoid repetition, and can achieve the same beneficial effects.
[0159] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the image data entry method provided by the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0160] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0161] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A method for inputting image data, characterized in that: The following steps are involved: Executing a first thread to enter the acquired image data into a first image database; the image data includes a data ID, and the data ID is used to identify the image data to distinguish it from other different image data; The executing the first thread to enter the acquired image data into the first image database includes: When it is detected that the message queue meets the preset packaging conditions, the image data in the message queue is packaged; Deduplication of the packaged image data according to the data ID; Grouping the packaged image data according to the attribute values of the image data to obtain grouped image data; The grouped image data are respectively entered into the first image database; the first image database is pre-set with a data table corresponding to each group attribute value, and each grouped image data is entered into the data table corresponding to the group attribute value according to the group attribute value to which it belongs; Execute the second thread to detect whether there is image data in the first image database from which short feature values have not been extracted within a preset time; if there is image data from which short feature values have not been extracted, extract short feature values from the image data from which short feature values have not been extracted according to a preset extraction rule to obtain corresponding short feature values; for the image data entered into the first image database, there are corresponding short feature value extraction states in the data table of the corresponding grouping attribute values, and the short feature value extraction states of the image data from which short feature values have not been extracted are empty; when the image data are entered into the same data table in batches, when it is detected that the short feature value extraction state of one image data in the data table is empty, it is considered that the short feature value extraction states of all the image data in the data table are also empty; the first thread and the second thread are parallel asynchronous threads, and the data length of the short feature value is less than the data length of the image data; The short feature value is entered into a second image database, and an index relationship between the short feature value and the image data is established.
2. The method according to claim 1, characterized in that The extraction rule includes a sorting rule, and the feature value extraction of the image data from which the feature value has not been extracted according to the preset extraction rule includes: The image data from which the feature values have not been extracted are sorted according to a set sorting rule, and the feature values are extracted according to the sorting.
3. The method according to claim 1, characterized in that The extraction rule includes an extraction quantity, and the step of extracting short feature values from the image data from which short feature values have not been extracted according to the preset extraction rule includes: Counting the number of image data from which short eigenvalues have not been extracted; Dividing the image data from which short eigenvalues are not extracted into batches according to the extraction quantity; Perform short feature value extraction on the batched image data.
4. The method according to any one of claims 1 to 3, characterized in that The step of storing the short feature value in the second image database and establishing an index relationship between the short feature value and the image data comprises: storing the short feature value in the second image database; The ID corresponding to the short feature value is stored in the memory, and an index relationship between the short feature value and the corresponding ID is established, so that the short feature value and the image data have an index relationship.
5. An image data input device, characterized in that: The device comprises: An input module is used to execute a first thread and input the acquired image data into a first image database; the image data includes a data ID, and the data ID is used to identify the image data to distinguish it from other different image data; the execution of the first thread and inputting the acquired image data into the first image database includes: when it is detected that the message queue meets the preset packing condition, packing the image data in the message queue; deduplicating the packed image data according to the data ID; grouping the packed image data according to the attribute value of the image data to obtain grouped image data; and respectively inputting the grouped image data into the first image database; a data table corresponding to each group attribute value is pre-set in the first image database, and each grouped image data is input into the data table corresponding to the group attribute value according to the group attribute value to which it belongs; The extraction module is used to execute the second thread, detect whether there is image data in the first image database whose short feature value has not been extracted within a preset time; if there is image data whose short feature value has not been extracted, extract the short feature value of the image data whose short feature value has not been extracted according to the preset extraction rules to obtain the corresponding short feature value; for the image data entered into the first image database, there is a corresponding short feature value extraction status in the data table of the corresponding grouping attribute value, and the short feature value extraction status of the image data whose short feature value has not been extracted is empty; when the image data are batch entered into the same data table, when it is detected that the short feature value extraction status of one image data in the data table is empty, it is considered that the short feature value extraction status of all the image data in the data table is also empty; the first thread and the second thread are parallel asynchronous threads, and the data length of the short feature value is less than the data length of the image data; A storage module is used to store the short feature value in a second image database and establish an index relationship between the short feature value and the image data.
6. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the image data entry method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the image data entry method according to any one of claims 1 to 4 are implemented.
