Memory device and data search method thereof
By performing vectorization and logical operations on the data in the memory device and utilizing compression mode and Hamming distance calculation, the problems of high computational complexity and insufficient reliability in the prior art are solved, and fast and accurate data search is achieved.
Patent Information
- Application Number
- CN202210714306.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-06-16
- Filing Date
- 2022-06-22
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2042-06-22
AI Technical Summary
When performing similarity analysis, existing memory devices have high computational complexity and insufficient reliability of the analysis results, making it difficult to provide a reliable data search method while maintaining computational simplicity.
By vectorizing the search data, the data is converted into a low-resolution vector form using a compression mode, and logical operations are performed in the memory device to determine the data matching, combined with Hamming distance calculation to perform fast and accurate similarity analysis.
This simplifies calculations while improving the accuracy and efficiency of data searches and reducing system storage requirements and database reading time.
Smart Images

Figure CN117290535B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to a memory device and a data search method thereof. BACKGROUND
[0002] Currently, we have entered the information age, and there is a very wide demand for similarity analysis. For example, text mining, data mining, plagiarism detection, recommendation systems, face recognition, voiceprint recognition, fingerprint recognition, etc.
[0003] Similarity analysis is often carried out by vector analysis. Common vector similarity measures include, but are not limited to, Euclidean distance, Cosine similarity, Hamming distance, etc.
[0004] In order to perform the above analysis, the features of the object are first extracted and vectorized. For example, in a large database, artificial intelligence (AI) training is performed. After training, the model can vectorize the input face information. A good model can output different photos of the same person as high similarity vectors. Then, the object to be searched is vectorized and compared with the vectors in the database to search for similar data in the database.
[0005] Therefore, there is a need for a memory device and a data search method that can achieve simple calculation but high reliability of analysis results. SUMMARY
[0006] According to an embodiment of the present disclosure, a data search method of a memory device is provided, comprising: vectorizing a to-be-searched data to obtain a to-be-searched data vector according to a recorded compression mode, wherein the to-be-searched data and a plurality of objects of a database are compressed by the compression mode; setting a search condition; searching the objects of the database with the to-be-searched data vector to determine whether the to-be-searched data matches the objects in the database; and recording and outputting at least one matched object in the database that matches the to-be-searched data.
[0007] According to another embodiment of the present disclosure, a memory device is provided, comprising: a plurality of word lines; a plurality of bit lines; and a plurality of storage units located at a plurality of intersections of the word lines and the bit lines; wherein a first feature vector of a first object is stored in the storage units of a first word line of the word lines, a feature vector of a data to be searched is inputted to the storage units of the first word line along the bit lines, and a logical operation is performed between the feature vector of the data to be searched and the first feature vector of the first object to obtain a plurality of first logical operation results, so as to determine whether the data to be searched matches the first object.
[0008] According to another embodiment of the present disclosure, a memory device is provided, comprising: a memory array, and a controller coupled to the memory array, wherein the controller is configured to: vectorize a data to be searched according to a recorded compression mode to obtain a data to be searched vector, and compress the data to be searched and a plurality of objects of a database according to the compression mode, the objects of the database being stored in the memory array; set a search condition; search the objects of the database stored in the memory array with the data to be searched vector to determine whether the data to be searched matches the objects in the database; and record and output at least one matched object in the database that matches the data to be searched.
[0009] In order to have a better understanding of the above and other aspects of the present disclosure, the following embodiments are described in detail below with reference to the accompanying drawings: BRIEF DESCRIPTION OF DRAWINGS
[0010] Figure 1A A flow chart for vectorizing a database according to a first embodiment of the present disclosure.
[0011] Figure 1B A flow chart for a data searching method of a memory device according to a first embodiment of the present disclosure.
[0012] Figure 2 An example of vector numerical analysis of a database according to a first embodiment of the present disclosure is shown.
[0013] Figure 3 A vector compression schematic diagram according to a first embodiment of the present disclosure is shown.
[0014] Figure 4A And Figure 4B A vector compression schematic diagram according to an embodiment of the present disclosure is shown, wherein the partitioning is performed in dimensions.
[0015] Figure 5 A data compression result of dimension equivalent partitioning according to a first embodiment of the present disclosure is shown.
[0016] Figure 6 A data compression result according to a first embodiment of the present disclosure is shown.
[0017] Figure 7A A flowchart for an architecture vector database according to a second embodiment of the present disclosure.
[0018] Figure 7B A flowchart for a data search method of a memory device according to a second embodiment of the present disclosure.
[0019] Figure 8A A flowchart for an architecture vector database according to a third embodiment of the present disclosure.
[0020] Figure 8B A flowchart for a data search method of a memory device according to a third embodiment of the present disclosure.
[0021] Figure 9A A schematic diagram showing a memory device implementing the above-mentioned data search method according to a fourth embodiment of the present disclosure.
[0022] Figure 9B A schematic diagram showing a memory device according to a fourth embodiment of the present disclosure.
[0023] Figure 10 A schematic diagram showing another memory device implementing the above-mentioned data search method according to a fourth embodiment of the present disclosure.
[0024] Figure 11 A schematic diagram showing yet another memory device implementing the above-mentioned data search method according to a fourth embodiment of the present disclosure.
[0025] Figure 12 A schematic diagram showing a memory device combining multiple single-order storage units with multiple single-order bit lines to perform multi-order operations according to an embodiment of the present disclosure.
[0026] Figure 13 A functional block diagram of a memory device according to an embodiment of the present disclosure.
[0027] Explanation of Reference Numerals
[0028] 105-170: Steps
[0029] 705-770: Steps
[0030] 805-870: Steps
[0031] WL0-WL11: Word lines
[0032] BL0, BL1: Bit lines
[0033] C0, C1: Storage units
[0034] 900: memory device
[0035] 900A: memory array 900B: page buffer
[0036] 900C: counter
[0037] 1000: memory device 1100: memory device
[0038] C1-1, C1-2, C2-1, C2-2: storage unit
[0039] BL1, BL2: bit line
[0040] WL1, WL2: word line
[0041] 1300: memory device
[0042] 1310: memory array
[0043] 1320: controller DETAILED DESCRIPTION
[0044] The technical terms in the present specification refer to the conventional terms in the technical field, and the explanations of the terms are subject to the descriptions or definitions in the present specification. Each of the embodiments of the present disclosure has one or more technical features. A person skilled in the art can selectively implement part or all of the technical features in any of the embodiments, or selectively combine part or all of the technical features in the embodiments, under the premise of possibility.
[0045] First embodiment
[0046] Figure 1A Flowchart for an architecture vector database according to the first embodiment of the present disclosure. Figure 1B Flowchart for a data search method of a memory device according to the first embodiment of the present disclosure.
[0047] Please refer to Figure 1A In step 105, the model M is trained. Here, the details of training the model M can not be particularly limited.
[0048] In step 110, it is determined whether the dimension of the data is greater than or equal to a dimension threshold value. For example, but not limited to, the dimension threshold value is 64. Generally speaking, the greater the dimension of the data, the more beneficial to the calculation precision; and the smaller the dimension of the data, the more beneficial to reduce the operation resources. Therefore, the selection of the dimension threshold value is to balance between "calculation precision" and "reducing operation resources".
[0049] In step 115, the trained model M is used to vectorize a plurality of objects (data) in a database (for convenience, the database is referred to as database B below) to obtain individual vector values of the objects (data). The database stores a plurality of objects. For example but not limited to, one of the objects A is vectorized by the trained model M to obtain the vector value A = (A1, A2,... An) of A, where n is a positive integer representing the dimension. When performing face recognition, voiceprint recognition, fingerprint recognition, etc., the information of face data, voiceprint data, and fingerprint data needs to be vectorized. Generally, when the dimension n is a large value, it is beneficial for fine calculation; when the dimension n is a small value, it is beneficial for reducing operation resources. Therefore, the setting of the dimension n is usually balanced with the above needs. n ), where n is a positive integer representing the dimension. When performing face recognition, voiceprint recognition, fingerprint recognition, etc., the information of face data, voiceprint data, and fingerprint data needs to be vectorized. Generally, when the dimension n is a large value, it is beneficial for fine calculation; when the dimension n is a small value, it is beneficial for reducing operation resources. Therefore, the setting of the dimension n is usually balanced with the above needs.
[0050] The object A can be, for example but not limited to, a face image (for face recognition), or a person's voiceprint (for voiceprint recognition), or a person's fingerprint (for fingerprint recognition), etc.
[0051] In step 120, it is determined whether the resolution is equal to or less than a resolution threshold value. For example but not limited to, the resolution threshold value is 3 bits. When step 120 is no, the vector values of the objects of the database are compressed (step 125). When step 120 is yes, the obtained vector values of the objects are stored (step 135). In the embodiment, the resolution equal to or less than 3 bits (8 states) can obtain a more ideal operation result.
[0052] In a possible embodiment of the present disclosure, the data compression in step 125 is, for example but not limited to, data equal slicing or dimension equal slicing, the details of which will be described below.
[0053] In step 130, the compression mode (data equal slicing or dimension equal slicing) is recorded.
[0054] In addition, in an embodiment of the present disclosure, when a new object is added to the database, if the data amount of the original object is much larger than that of the new object, the new object can be compressed according to the existing compression mode. If the data amount of the original object is much smaller than that of the new object, the new object can still be compressed according to the existing compression mode, but if it is detected that the new object causes considerable change in the overall data distribution, which means that the current database contains information inconsistent with the original object, the database will be re-compressed. In re-compressing the database, data equal slicing or dimension equal slicing can be continued, however, the slicing point will be moved.
[0055] Please refer to Figure 1BThe present disclosure provides a method for searching a database. The method comprises the following steps: (1) obtaining a plurality of objects in the database, wherein each object is associated with a plurality of dimensions; (2) obtaining a search data; (3) vectorizing the search data according to a training model; (4) compressing the vectorized search data according to a compression mode; (5) searching the database according to the compressed vectorized search data; and (6) determining whether the search data matches the objects in the database.
[0056] In step 140, the search data is vectorized according to the training model M, and the vectorized search data is compressed according to the compression mode recorded in step 130 (data equivalent cutting or dimension equivalent cutting). That is, in the embodiments of the present disclosure, for example but not limited to, when the resolution is 3 bits, the dimension vectors of the objects in the database and the dimension vectors of the search data are compressed within 3 bits or 8 states after compression.
[0057] In step 145, the search conditions (for example but not limited to, the number or proportion of matching dimensions, etc.) are set.
[0058] In step 150, the compressed vectorized search data is used to search all the objects in the database to determine whether the search data matches the objects in the database. For example but not limited to, when the matching dimensions between the search data and the matching objects in the database meet the search conditions, it is determined that the search data is similar to the matching objects in the database, and vice versa.
[0059] For example but not limited to, the dimensions of the object data are 512, and the matching dimensions between the search data and a database object are higher than the search conditions (for example but not limited to, 300 dimensions), then the search data is considered to match the database object.
[0060] When the determination in step 150 is yes, the database object matching the search data is recorded (step 155); and when the determination in step 150 is no, it is determined whether the last piece of data has been searched (step 160).
[0061] In step 155, the recorded object information can include, for example but not limited to, object number, name, matching value, etc.
[0062] When the determination in step 160 is no, the next object in the database is searched with the compressed vectorized search data (step 165). When the determination in step 160 is yes, the matching object meeting the search conditions is output (step 170).
[0063] In step 170, the outputted matching object information can be, for example but not limited to, raw data of the object, sorted data of the object, data of a number of objects with higher matching degree, or data of the object with the strongest signal strength (highest matching degree), etc.
[0064] The details of the architecture vector database and the data searching method of the first embodiment of the present disclosure will be described in detail. If the Hamming distance is used for similarity calculation, there is the advantage of fast calculation. Therefore, the Hamming distance can be applied to the case of high dimension and low resolution. High dimension helps to reduce the accuracy problem caused by low resolution, and low resolution has the advantages of fast calculation, low data storage, fast database reading, etc. The following will explain that the Hamming distance can achieve fast and accurate calculation. However, it is known that the present disclosure is not limited thereto.
[0065] Table 1 below shows an example of a database. Here, database B is taken as an example of a face image database, but it is known that the present disclosure is not limited thereto. The face image database stores face photos of multiple people, and each person has multiple face photos. In addition, here, 512 dimensions are taken as an example for illustration, but it is known that the present disclosure is not limited thereto.
[0066] Table 1
[0067] Code Ba1 Ba2 ... Bb1 Bb2 ... Human a a ... b b ... Photo 1 2 ... 1 2 ... D1 (vector 1)
[00111] Bao Ba21 ... Bb11 Bb21 ... D2 (vector 2) Ba12 Ba 22 ... Bb12 Bb22 ... D3 (vector 3) Ba13 Ba23 ... Bb13 Bb23 ... ... ... ... ... ... ... ... D510 (vector 510) Ba1 510 ]] Ba2 510 ]] ... Bb1 510 ]] Bb2 510 ]] ... D511 (vector 511) Ba1 511 ]] Ba2 511 ]]> ... Bb1 511 ]] Bb2 511 ]] D512 (vector 512) Ba1 512 ]]> Ba2 512 ]]> ... Bb1 512 ]] Bb2 512 ]]> ...
[0068] In Table 1 above, "a" and "b" represent different people, and "1" and "2" represent different photos, so Ba1 is the first photo of person a, Ba2 is the second photo of person a, Bb2 is the second photo of person b, and the rest can be inferred accordingly.
[0069] After the first photo Ba1 of person a is vectorized by the trained AI model, the vector (Ba11, Ba12, Ba13,..., Ba1 510 , Ba1 511 , Ba1 512 ) can be obtained. The vector "Ba11" represents the first dimension vector of the first photo Ba1 of person a, and the rest can be inferred accordingly.
[0070] Table 2 below shows an example of Table 1 above.
[0071] Table 2
[0072]
[0073]
[0074] In Table 2 above, the vectors are normalized, so the values of the normalized vectors are between +0.16 and -0.16. However, the present disclosure is not limited thereto.
[0075] Figure 2 An example of vector numerical analysis of a database according to the first embodiment of the present disclosure is shown, but the present disclosure is not limited thereto. In Figure 2 In FIG. 6, the horizontal axis represents vector values, and the vertical axis represents the density of the vector values in the database. It is assumed that there are 19955 photos in the database, and these 19955 photos belong to different people, each of whom has several photos. Each photo is vectorized by the model into 512 values. The data has 512 dimensions, so the data vector has 32 states. For example, the density of the vector value 0.05 is 1.9%, which means that the vector with the value 0.05 accounts for 1.9% of the entire data among all vectors.
[0076] Now, data search according to the first embodiment of the present disclosure will be described. A face image recognition example is described, but the present disclosure is not limited thereto. In the face image database, as described above, after being vectorized by the model, the vector of the first face photo Ba1 of person a can be represented as: (Ba11, Ba12, Ba13,..., Ba1 510 , Ba1 511 , Ba1 512 ). For the face photo of person x captured by the camera, after being vectorized by the model, the vector of the face photo Bx of person x can be represented as: (Bx11, Bx12, Bx13,..., Bx1 510 , Bx1 511 , Bx1 512 ). In step 150, the vector (Bx11, Bx12, Bx13,..., Bx1 510 , Bx1 511 , Bx1 512 ) of the data to be searched is used to search / compare the vector of the first face photo Ba1 of person a in the face image database: (Ba11, Ba12, Ba13,..., Ba1 510 , Ba1 511 , Ba1 512). When Bx11 matches Ba11, it is called 1st dimension match; and when Bx11 does not match Ba11, it is called 1st dimension mismatch. After comparing all the dimension vectors, the number of matched dimensions can be obtained. When the number of matched dimensions between the vector of the face photo Bx of person x and the vector of the 1st face photo Ba1 of person a is higher than the search condition (for example, but not limited to, 300 dimensions), person x is considered to match person a, that is, after face recognition, person x and person a are considered to be the same person. Conversely, the same is true.
[0077] The details of the compression (digitization) of the vector according to the present disclosure will be described. In the first embodiment of the present disclosure, reducing the resolution has a considerable advantage for the calculation of the Hamming distance, so the data is compressed to reduce the resolution.
[0078] For example, the resolution is 1 bit and 0 is the cutting point. When Bn (vector value) is less than or equal to 0, Bn is set to 0; and when Bn (vector value) is greater than 0, Bn is set to 1.
[0079] Alternatively, in another possible example, the resolution is 1 bit and the middle value middle (Bn) is the cutting point. The middle value middle (Bn) represents the middle value of all vector values. When Bn (vector value) is less than or equal to middle (Bn), Bn is set to 0; and when Bn (vector value) is greater than middle (Bn), Bn is set to 1.
[0080] Alternatively, in another possible example, the resolution is 1 bit and the average value avg (Bn) is the cutting point. The average value avg (Bn) represents the average value of all vector values. When Bn (vector value) is less than or equal to avg (Bn), Bn is set to 0; and when Bn (vector value) is greater than avg (Bn), Bn is set to 1.
[0081] Figure 3 The vector compression schematic diagram according to the first embodiment of the present disclosure is shown. In Figure 3 For example, the resolution is 1 bit and 0 is the cutting point, but the present disclosure is not limited thereto.
[0082] After compression, if the model is not normalized due to reasons such as the distribution of the vector values of the database presents an asymmetric distribution, cutting with the middle value middle (B) can obtain better results. In the present disclosure, data cutting and data compression have similar meanings.
[0083] Figure 4A With Figure 4B The vector compression schematic diagram according to an embodiment of the present disclosure is shown, in which the dimensions are divided. Figure 4AData distribution of the database in dimension 15 (D15) (total dimension is 512); and Figure 4B Data distribution of the database in dimension 109 (D109) (total dimension is 512). By Figure 4A With Figure 4B It can be seen that the compression results are obviously different when 0 is the cut point and middle (Bn) is the cut point.
[0084] Figure 5 Data compression results of dimension-equivalent cut according to the first embodiment of the present disclosure are shown. As shown in Figure 5 , the data can be cut into m equal parts (m can be any positive integer such as 2, 3, 4, 5, etc.) according to the dimension. When m = 2, the compression result is 2 states (0 or 1), and it is 1-bit resolution. When m = 3, the compression result is 3 states (0 or 1 or 2). When m = 4, the compression result is 4 states (0 or 1 or 2 or 3), and it is 2-bit resolution. The rest can be analogously deduced. Figure 5 Data vectors are cut into 3 states (0 or 1 or 2) according to the dimension, and the cut points are -0.05 and +0.05, respectively. That is, when the vector is less than -0.05, the vector is compressed to 0; when the vector is between -0.05 and +0.05, the vector is compressed to 1; and when the vector is greater than +0.05, the vector is compressed to 2.
[0085] Figure 6 Data compression results of data-equivalent cut according to the first embodiment of the present disclosure are shown. As shown in Figure 6 , the data can be cut into m equal parts (m can be any positive integer such as 2, 3, 4, 5, etc.) according to the data. Figure 6 Data vectors are cut into 3 states (0 or 1 or 2) according to the data. After data-equivalent cut, about 1 / 3 of the vectors are compressed to 0, about 1 / 3 of the vectors are compressed to 1, and about 1 / 3 of the vectors are compressed to 2. The cut points are determined according to the data distribution. Figure 6 The data distribution is more uniform.
[0086] As described above, in the first embodiment of the present disclosure, data-equivalent cut can make the data distribution more uniform.
[0087] In the first embodiment of the present disclosure, the dimension method uses Hamming distance calculation, which is suitable for databases with low resolution. Generally speaking, the dimension method has better results (8 states or lower states) when the resolution is below 3 bits. In the first embodiment of the present disclosure, the system storage requirement is greatly reduced, and the calculation speed is improved.
[0088] In the first embodiment of the present disclosure, the resolution is reduced by data partitioning. As mentioned above, the data partitioning can be data equal-cutting or dimension equal-cutting or other cutting methods (e.g. cutting with exponential distance). When data partitioning is performed, the data vector can be partitioned into m states, m is less than or equal to 8 (3-bit resolution).
[0089] In the first embodiment of the present disclosure, data equal-cutting can achieve greater applicability and stability, and better results.
[0090] Second embodiment
[0091] Figure 7A Flowchart of the architecture vector database according to the second embodiment of the present disclosure. Figure 7B Flowchart of the data search method of the memory device according to the second embodiment of the present disclosure.
[0092] Figure 7A Steps 705-735 of the method are substantially the same or similar to steps 105-135 of the method Figure 1A of the method, and details thereof are omitted here.
[0093] In step 736, the individual feature vector (also referred to as representative vector) of each object is found, the details of which are as follows.
[0094] In the second embodiment of the present disclosure, the dimension method is used, and the face image database is taken as an example for illustration, but it is understood that the present disclosure is not limited thereto. In the face image database, each person can have multiple photos. The trained model is used to vectorize each photo of the same person to obtain a multi-dimensional vector. Among the multi-dimensional vectors of these photos belonging to the same person, the most common value (MODE) in each dimension is found as the feature vector of the person.
[0095] For example, taking the person a in database B as an example, the feature vector of the person a can be represented as: (Ba1, Ba2, …, Ba n ), wherein Ba i = MODE(Ba1 i , Ba2 i , Ba3 i …), i = 1 ~ n. The function MODE represents the most common value among these values. When there are multiple values in a dimension that have the most counts, one of them can be taken as the feature vector; in other possible cases, the smaller value can be taken as the feature vector. The feature vector of the search data can be generated in the same or similar manner.
[0096] For ease of understanding, Table 3 below illustrates how to find the feature vector, but it is understood that the present disclosure is not limited thereto. For ease of understanding, Table 3 below illustrates how to find the feature vector, but it is understood that the present disclosure is not limited thereto.
[0097] Table 3
[0098] Code Ba1 Ba2 Ba3 Ba4 Ba5 Mode (Ba) Human a a a a a a Photo 1 2 3 4 5 - D1 (vector 1) 0 0 0 1 0 0 D2 (vector 2) 2 2 2 3 2 2 D3 (vector 3) 1 2 3 2 3 2 or 3 … … … … … … … D510 (vector 510) 2 3 1 1 1 1 D511 (vector 511) 3 0 2 1 2 2 D512 (vector 512) 0 3 3 3 3 3
[0099] For example, in Table 3, the five photos of person a are vectorized by the model. The vector of the first photo is (0, 2, 1, ..., 2, 3, 0), and the rest can be deduced similarly.
[0100] The vectors 1 (D1) of the five photos of person a are: 0, 0, 0, 1, and 0. The value "0" has the most counts, so the first element (first-dimensional feature vector) Ba1 of person a's feature vector is 0. Similarly, the second element (second-dimensional feature vector) Ba2 of person a's feature vector is 2; the third element (third-dimensional feature vector) Ba3 of person a's feature vector is 2 or 3; the 510th element (510th-dimensional feature vector) Ba 510 =1; the 511th element of the eigenvector of person a (the 511th dimension eigenvector) Ba 511 =2; the 512th element of the eigenvector of character a (the 512th dimension eigenvector) Ba 512 is 3.
[0101] Therefore, we can get the feature vector of person a (object a): (Ba1, Ba2, ...Ba n )=(0, 2, (2 or 3),…, 1, 2, 3).
[0102] In step 737 , the individual feature vectors of each object found in step 736 are stored, and the database is named BM to distinguish it from the original database B.
[0103] Figure 7B Steps 740-770 are in principle the same or similar to Figure 1B The details of steps 140-170 are omitted here. The difference lies in that in step 740, the search data is vectorized based on the training model M, and the vectorized data of the search data is compressed according to the recorded compression mode (data equalization or dimension equalization). The feature vector of the search data is then found in the above-mentioned manner. In the subsequent steps, the feature vector of the search data is used to search the database BM.
[0104] The data search of the second embodiment of the present disclosure will now be described. The facial image recognition is used as an example for illustration, but it should be understood that the present disclosure is not limited thereto. In the facial image database, as described above, after the model is vectorized and the feature vector is obtained, the feature vector of person a is (Ba1, Ba2, ...Ba n). For the face photo of person x captured by the camera, after model vectorization and feature vector finding, the feature vector of person x can be represented as: (Bx1, Bx2, … Bx n ) In step 750, the feature vector of person x (Bx1, Bx2, … Bx n ) is used to search / compare the feature vector of person a (Ba1, Ba2, … Ba n ) in the face image database. When Bx1 matches Ba1, it is called 1st dimension match; and when Bx1 does not match Ba1, it is called 1st dimension mismatch. After comparing all the dimension vectors, the number of matching dimensions can be obtained. When the matching dimensions between the feature vector of person x and the feature vector of person a are higher than the search condition (for example, but not limited to, 300 dimensions), it is considered that person x matches person a, that is, after face recognition, person x and person a are considered to be the same person. Conversely, the same is true.
[0105] In an embodiment of the present disclosure, each dimension of the feature vector of the data to be searched has a multi-vector state, and the number of the multi-vector state is equal to or lower than 3 bits or 8 states; and each dimension of the feature vector of the database object has a multi-vector state, and the number of the multi-vector state is equal to or lower than 3 bits or 8 states.
[0106] Third embodiment
[0107] Figure 8A Flowchart of the architecture vector database of the memory device according to the third embodiment of the present disclosure. Figure 8B Flowchart of the data search method of the memory device according to the third embodiment of the present disclosure.
[0108] Figure 8A Steps 805-836 of the third embodiment are basically the same or similar to steps 705-736 of the second embodiment, and thus the details are omitted here. Figure 7A Steps 805-836 of the third embodiment are basically the same or similar to steps 705-736 of the second embodiment, and thus the details are omitted here.
[0109] In step 838, the mask ratio is set. In the third embodiment of the present disclosure, the elements of the feature vector are given a mask according to the mask ratio to improve the matching confidence.
[0110] For more details of step 838, the following is described.
[0111] For example, the database has 19 pieces of data of object a (for example, 19 face photos of person a), and after vectorization, the 19 vector dimensions of the object a are as shown in Table 4.
[0112] Table 4
[0113]
[0114]
[0115] Table 4 above provides an illustration. In the third embodiment of the present disclosure, the feature vector of character a is (1, 0, 1, 1, 1, 0, 1, 0, 1, 0). The 10 elements of this feature vector have respective occurrence counts of 12, 17, 18, 10, 15, 15, 11, 11, 14, and 18. In other words, the first element (first-dimensional feature vector) Ba1 of character a's feature vector is 1, and its occurrence count in these 19 first-dimensional vectors (D1) is 12. The same applies to the remaining elements.
[0116] If the masking ratio is set to 40%, 40% of all elements in the feature vector will be masked. In Table 4 above, the feature vector includes 10 elements, 10*40%=4. In other words, the four elements with the "lowest occurrence" in the top four of all elements in the feature vector must be found and masked. In Table 4 above, the four elements with the lowest occurrence are D1 (12 times), D4 (10 times), D7 (11 times), and D8 (11 times). Therefore, the mask bits of these dimensions (D1, D4, D7, and D8) are set to 0, and the mask bits of the remaining dimensions are set to 1. Therefore, the mask vector for object a is: (0, 1, 1, 0, 1, 1, 0, 0, 1, 1). If a vector is masked, it will not be used in subsequent matching.
[0117] That is, in the third embodiment of the present disclosure, vectors with low occurrence times and low confidence levels are masked out.
[0118] In step 839A, the masking vector of each object is obtained according to the masking ratio and the number of occurrences of each vector in the feature vector.
[0119] In step 839B, the mask vector and feature vector of each object are stored in the database BM to form the database BMM.
[0120] Figure 8B Steps 840-870 are in principle the same or similar to Figure 7B The details of steps 740-770 are omitted here. The difference is that in step 840, the search data is vectorized based on the training model M, the vectorized data is compressed according to the recorded compression pattern, and the feature vector of the search data is found. In the subsequent steps, the feature vector of the search data is used to search the database BMM.
[0121] The data search of the third embodiment of the present disclosure will now be explained. The face image recognition is taken as an example for explanation, but it is understood that the present disclosure is not limited thereto. In the face image database, as mentioned above, after the model vectorization and the feature vector and the shield vector are found, the feature vector of person a is (Ba1, Ba2, …Ba n ), and the shield vector of person a is (Ba 1M , Ba 2M , …Ba nM ). For the face photo of person x taken by the camera, after the model vectorization and the feature vector and the shield vector are found, the feature vector of person x can be represented as: (Bx1, Bx2, …Bx n ). In step 850, the feature vector of person x (Bx1, Bx2, …Bx n ) is used to search / compare the feature vector of person a (Ba1, Ba2, …Ba n ) in the face image database, and the shield vector of person a needs to be considered. When Bx1 matches Ba1 and this vector Ba1 is not shielded, it is called the 1st dimension match; when Bx1 does not match Ba1 (whether this vector Ba1 is shielded or not), it is called the 1st dimension mismatch; and when this vector Ba1 is shielded (whether Bx1 matches Ba1 or not), it is called the 1st dimension mismatch. After all the dimension vectors are compared one by one, the number of matching dimensions can be obtained. After considering the shield vector, when the matching dimensions between the feature vector of person x and the feature vector of person a are higher than the search condition (for example, but not limited to, 300 dimensions), person x is considered to match person a, that is, after face recognition, person x and person a are considered to be the same person. Conversely, the same is true.
[0122] In the third embodiment of the present disclosure, by shielding the vector of confidence, the confidence can be improved, and the search speed can be accelerated and the required storage space can be reduced.
[0123] Fourth Embodiment
[0124] The memory device according to the fourth embodiment of the present disclosure will now be explained how to implement the above-mentioned data search method.
[0125] In the fourth embodiment of the present disclosure, the vector data (feature vector) is stored in the storage unit.
[0126] Figure 9A A schematic diagram showing the memory device according to the fourth embodiment of the present disclosure implementing the above-mentioned data search method is shown. Figure 9B A schematic diagram showing the memory device according to the fourth embodiment of the present disclosure is shown.
[0127] As Figure 9A And Figure 9BAs shown, 512 dimensions are used as an example for illustration, but the present disclosure is not limited thereto. Character a's feature vector has 512 dimensions, so character a's feature vector can be stored in 512 storage cells (C0, C1, ...) along wordline WL0. Subsequently, the feature vector of the next character, b, also has 512 dimensions, so character b's feature vector can be stored in the subsequent 512 storage cells (not shown) along wordline WL0. The rest can be deduced in a similar manner.
[0128] For example, when the character's feature vector is logic 0, the related storage cell is programmed to a high threshold voltage (Vt); and when the character's feature vector is logic 1, the related storage cell is programmed to a low threshold voltage (Vt).
[0129] exist Figure 9A In the example, memory device 900 includes multiple blocks, each of which includes multiple word lines (WL0, ...) and multiple bit lines (BL0, ...). Therefore, if each word line has 128k storage cells, each word line can store 128k / 512 = 256 individual feature vectors. If each block has 128 word lines, the block can store 32k individual feature vectors. These storage cells are located at the intersections of the word lines and bit lines.
[0130] like Figure 9B As shown, memory device 900 includes a memory array 900A, a page buffer 900B, and a counter 900C. Counter 900C is coupled to memory array 900A and page buffer 900B. Page buffer 900B is coupled to the bit lines of memory array 900A. For example, but not limited to, counter 900C is coupled to the bit lines of memory array 900A to count the logical operation results returned by the bit lines. Page buffer 900B includes a plurality of operation units for performing logical operations.
[0131] A plurality of vectors are stored in the memory device 900. How the fourth embodiment performs comparison / identification will now be described.
[0132] For example, when one wants to compare / identify person x captured by the camera with multiple persons (objects) in the memory device 900, the vector (or feature vector) of person x is input into the memory device 900 via these bit lines. Afterwards, when comparing person x with person a stored in the memory device 900, a logical operation can be performed on the vector (or feature vector) of person x and the vector (or feature vector) of person a, such as, but not limited to, an XNOR logical operation. 512 dimensions are used as an example for illustration, but the present disclosure is not limited to this. Since it is 512 dimensions, the vector (or feature vector) of person a is stored in 512 storage units. The result of the logical operation can be sent to the counter 900C via the 512 bit lines, that is, the counter 900C counts the result of the XNOR logical operation of the vector (or feature vector) of person x and the vector (or feature vector) of person a. If the number of counts exceeds the threshold, the number of the corresponding person (object) in the memory device is output, indicating that this person matches person x. In other possible examples, the memory device can output the calculation results of each person (object) to the outside for external processing to find the matching person (object).
[0133] Figure 10 A schematic diagram showing another memory device implementing the above-mentioned data search method according to a fourth embodiment of the present disclosure is shown.
[0134] Different from Figure 9A ,exist Figure 10 In the embodiment, the first group of word lines (for example, but not limited to, even word lines) can be used to store the vector (feature vector) of the object (hereinafter referred to as B1), and the second group of word lines (for example, but not limited to, odd word lines) can be used to store the mask vector of the object (hereinafter referred to as B2).
[0135] For example, when comparing / identifying person x captured by a camera with multiple people (objects) stored in memory device 1000, the vector (or feature vector) of person x is input into memory device 1000 via these bit lines. Subsequently, when comparing person x with person a stored in memory device 1000, a logical operation can be performed on the vector (or feature vector) of person x, the vector (or feature vector) of person a (B1), and the mask vector (B2), such as, but not limited to, an XNOR logical operation ((B1 XNOR X) AND B2).
[0136] In this example, the dimension is 512, but the present disclosure is not limited thereto. Since the dimension is 512, the vector (or feature vector) of the person x is stored in 512 storage units. The result of the logical operation can be sent to the counter by 512 bit lines, that is, the counter counts the result of the XNOR logical operation of the vector (or feature vector) of the person x and the vector (or feature vector) of the person a and the mask vector. If the count exceeds a threshold value, the corresponding person (object) number in the memory device is output, representing that the person matches the person x. In other possible cases, the memory device can output the operation result of each person (object) to the outside, and the matching person (object) is found by the outside.
[0137] Figure 11 Fig. 4 shows a schematic diagram of another memory device implementing the above-described data search method according to a fourth embodiment of the present disclosure.
[0138] In Figure 11 In the figure, the vector (feature vector) of the same object (hereinafter referred to as B1) and the mask vector (hereinafter referred to as B2) can be stored in the same word line. For example, the vector (feature vector) of the object b (B1) is stored in the first 512 storage units of the word line WLO, and the mask vector (B2) of the object b can be stored in the next 512 storage units of the word line WLO. The rest can be similarly deduced.
[0139] In addition, for the convenience of design, a reference vector C is introduced, wherein each element of the reference vector is 1, C=(1, 1, 1, 1, …1). The reference vector C is connected after the vector (or feature vector) of the person x.
[0140] For example, when the person x captured by the camera is compared / identified with the plurality of persons (objects) stored in the memory device 1100, the vector (or feature vector) X of the person x and the reference vector C are input to the memory device 1100 through the bit lines. Then, when the person x is compared with the person a stored in the memory device 1100, the vector (or feature vector) X of the person x and the vector (or feature vector) (B1) of the person a and the mask vector (B2), and the reference vector C are logically operated, for example, but not limited to, XNOR logical operation ((B1 XNOR X) AND (B2 XNOR C)).
[0141] In this embodiment, the dimension is 512, but the present disclosure is not limited thereto. Since the dimension is 512, the vector (or feature vector) of the person is stored in 512 storage units. The logical operation result can be sent to the counter by 512 bit lines, that is, the counter counts the XNOR logical operation result of the vector (or feature vector) X of the person x, the vector (or feature vector) of the person a, and the XNOR logical operation result of the mask vector and the reference vector C. If the count exceeds the threshold value, the corresponding person (object) number in the storage device is output, representing that the person matches the person x; or the count of each person (object) in the storage device can be output to the outside for processing to find the matching person (object). In this embodiment, B2 XNOR C = B2, and thus (B1 XNOR X) AND (B2 XNOR C) = (B1 XNOR X) AND B2.
[0142] In this way, the number of counters required can be further reduced. Figure 11
[0143] In the above embodiments of the present disclosure, the plurality of object data in the database are vectorized by the model to obtain object vectors (or feature vectors), and the object vectors (or feature vectors) conform to high-dimensional low-resolution to simplify the calculation and reduce the required storage space. In addition, the object vectors can also be cut (i.e., compressed), for example but not limited to, dimension equivalent cutting.
[0144] In the above embodiments of the present disclosure, by introducing the mask vector, the vector element with lower confidence can be shielded to improve the matching confidence.
[0145] In the above embodiments of the present disclosure, the storage unit for storing the vector (feature vector) can be a multilevel cell for recording more information for comparison / recognition; and the data of each bit line is also multilevel (i.e., the dimension vector (or feature vector) of the data to be searched is also multilevel), that is, the bit lines are multilevel bit lines. This embodiment can also be referred to as multilevel operation.
[0146] In other embodiments, each storage unit is a single-level cell (SLC), and the data of each bit line is also single-level (i.e., the dimension vector (or feature vector) of the data to be searched is also single-level), that is, the bit lines are single-level bit lines, and this embodiment can be referred to as single-level operation. However, in other possible embodiments of the present disclosure, MLC operation can be performed by combining a plurality of storage units and a plurality of bit lines.
[0147] Figure 12 A schematic diagram of combining a plurality of single-level storage units and a plurality of single-level bit lines to perform MLC operation according to an embodiment of the present disclosure is shown. As shown in FIG. 4, the storage unit is a single-level cell (SLC), and the bit line is also a single-level bit line.Figure 12 As shown in the figure, storage cells C1-1, C1-2, C2-1 and C2-2 are all single-level cells, and the data on bit lines BL1 and BL2 are also single-level. Among them, WL1 and WL2 are word lines.
[0148] exist Figure 12 In the figure, two single-order bit lines can be used to transmit information of the same dimension of the data to be searched. For example, if one dimension has four states, the combination of BL1 and BL2 can be used to transmit the four states of the first dimension of the feature vector of the data to be searched, and the same applies to the remaining dimensions.
[0149] Likewise, in Figure 12 In the figure, two single-level storage units can be used to store information about the same dimension of a database object. For example, if one dimension has four states, the combination of storage units C1-1 and C1-2 can be used to store the four states of the first dimension of the database object's feature vector (or mask vector), and the same applies to the remaining dimensions.
[0150] The logic operation principle is as follows. For example, the XNOR logic operation (B1 XNOR X) in the above embodiment becomes (C1-1 XNOR BL1) AND (C1-2 XNOR BL2). The rest can be deduced similarly.
[0151] The matching status can be as follows:
[0152]
[0153]
[0154] Figure 13 A functional block diagram of a memory device according to an embodiment of the present disclosure is shown. The memory device 1300 includes: a memory array 1310; and a controller 1320 coupled to the memory array 1310. The controller 1320 is configured to: vectorize a to-be-searched data according to a recorded compression pattern to obtain a to-be-searched data vector, wherein the to-be-searched data and a plurality of objects in a database are compressed by the compression pattern, and the plurality of objects in the database are stored in the memory array 1310; set a search condition; use the to-be-searched data vector to search the objects in the database stored in the memory array 1310 to determine whether the to-be-searched data matches the objects in the database; and record and output at least one matching object in the database that matches the to-be-searched data.
[0155] In the above embodiments of the present disclosure, the memory device may be a non-volatile memory, or a volatile NAND flash memory.
[0156] The memory device and the data search / compare method thereof of the above-mentioned embodiments of the present disclosure can be applied to an edge device.
[0157] Therefore, the memory device and the data search method thereof of the above-mentioned embodiments of the present disclosure can achieve simple calculation but high analysis confidence.
[0158] In summary, although the present disclosure has been disclosed as above with embodiments, it is not intended to limit the present disclosure. Those skilled in the art to which the present disclosure pertains can make various modifications and improvements without departing from the spirit and scope of the present disclosure. Therefore, the scope of protection of the present disclosure is defined by the scope of the claims attached herewith.
Claims
1. A method for searching data in a memory device, comprising: vectorizing a data to be searched according to a compression mode recorded to obtain a data to be searched vector, and compressing the data to be searched and objects in a database according to the compression mode; setting a search condition; searching the objects in the database with the data to be searched vector to determine whether the data to be searched matches the objects in the database; recording and outputting at least one matched object in the database matching the data to be searched; generating and storing individual feature vectors of the objects in the database; generating a feature vector of the data to be searched, and comparing the feature vector of the data to be searched with the individual feature vectors of the objects in the database to determine whether the data to be searched matches the objects in the database; generating and storing individual mask vectors of the objects in the database according to a mask ratio; and comparing the feature vector of the data to be searched with the individual feature vectors of the objects in the database according to the mask vectors of the objects in the database to determine whether the data to be searched matches the objects in the database. The compression mode comprises a data equivalent cutting mode or a dimension equivalent cutting mode, and the search condition comprises a matched dimension number or a matched dimension ratio.
2. The data search method of claim 1, wherein, The feature vectors of the objects are stored in storage units of the memory device along word lines, and the method further comprises:
3. The data search method of claim 1, wherein, when the feature vector of an object is logical 0, the relevant storage unit is programmed as a high threshold voltage; when the feature vector of an object is logical 1, the relevant storage unit is programmed as a low threshold voltage.
4. A memory device, comprising: a plurality of word lines; a plurality of bit lines; and a plurality of storage units at intersections of the word lines and the bit lines; wherein a first feature vector of a first object is stored in the storage units of a first word line of the word lines, a feature vector of a data to be searched is input to the storage units of the first word line of the memory device along the bit lines, and logical operations are performed on the feature vector of the data to be searched and the first feature vector of the first object to obtain a plurality of first logical operation results to determine whether the data to be searched matches the first object. a first mask vector of the first object is stored in the storage units of the first word line of the word lines, a reference vector is input to the memory device along the bit lines, and logical operations are performed on the feature vector of the data to be searched, the first feature vector of the first object, the first mask vector of the first object, and the reference vector to obtain the first logical operation results to determine whether the data to be searched matches the first object.
5. The memory device of claim 4, further comprising a counter coupled to the bit lines to count the first logical operation results returned by the bit lines to obtain a first count number, output a first number of the first object; or output the first count number of the first object. wherein, 6. The memory device of claim 4, wherein, a first group of the word lines are used to store a plurality of feature vectors of a plurality of objects, and, a second group of the word lines are used to store a plurality of mask vectors of the objects.
7. The memory device of claim 4, further comprising a page buffer coupled to the bit lines, the page buffer comprising a plurality of operation units for performing logical operations.
8. A memory device, comprising: a memory array, and a controller coupled to the memory array, wherein the controller is configured to: vectorize a data to be searched to obtain a data to be searched vector according to a compression mode recorded, and compress the data to be searched and a plurality of objects of a database according to the compression mode, the objects of the database being stored in the memory array; set a search condition; search the objects of the database stored in the memory array with the data to be searched vector to determine whether the data to be searched matches the objects in the database; record and output at least one matched object in the database that matches the data to be searched; a first mask vector of a first object is stored in the storage units of a first word line of the word lines, a reference vector is inputted to the first word line of the memory device along the bit lines, and a feature vector of the data to be searched, a first feature vector of the first object, the first mask vector of the first object and the reference vector are logically operated to obtain the first logical operation results to determine whether the data to be searched matches the first object.
Citation Information
Patent Citations
Picture searching method and device, storage medium and electronic equipment
CN111382287A
Efficient similarity search
CN113407809A
Cited By
An interview resource scheduling method and system based on markov decision
CN122489240A