An identity card retrieval method, system, device and medium based on embedded vector coding
Patent Information
- Application Number
- CN202211369481.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-03
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2042-11-03
AI Technical Summary
通过身份证读卡器读取身份证信息可以快速地识别个人,然而有些场合并不具备身份证读卡器,使得个人身份信息不能立刻进行校验,会存在登记的身份证号码信息错误的情况,在某些情况需要对相关错误的身份证号码信息进行紧急核对,然而现有缺乏对错误身份证号码信息进行检索的技术
[0034]This technical solution converts ID card numbers into vector form for retrieval. It quickly and roughly filters a set of approximate ID card numbers from a massive ID card number vector index. Then, it compares each digit of the approximate ID card number obtained from the rough screening with the ID card number to be checked, resulting in a more refined screening result with higher similarity. For some erroneous or ambiguous ID card numbers, it provides similar ID card number detection results, thereby correcting errors or providing guidance.
Smart Images

Figure CN115577015B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data search technology, specifically to an ID card retrieval method, system, device, and medium based on embedded vector coding. Background Technology
[0002] A resident identity card is a legal document used to prove the identity of its holder, usually issued to citizens by the governments of various countries or regions. As an important identity verification tool for every individual and citizen, the identity card displays the citizen's name, date of birth, address, ethnicity, ID number, and photograph. While ID card readers can quickly identify individuals, some places lack such readers, preventing immediate verification of personal information and potentially leading to incorrect ID card numbers. In certain situations, urgent verification of erroneous ID card numbers is necessary, but current technology lacks the capability to retrieve such information. Summary of the Invention
[0003] To solve the above problems, the technical solution provided by the present invention is as follows:
[0004] An ID card retrieval method based on embedded vector coding includes:
[0005] Obtain the ID card number to be inspected, and based on the ID card number to be inspected... Location information and stated Location information On Value information The ID card number to be inspected is vector-encoded to obtain the ID card number to be inspected. Detection vector ;
[0006] The vector retrieval engine is invoked to retrieve data from the vector index library that matches the stated... Detection vector Similar ID card numbers; determine the set of similar ID card numbers.
[0007] The ID card number to be checked is compared with the ID card numbers in the set of similar ID card numbers in an advanced similarity comparison. Based on the similarity, the ID card numbers in the set of similar ID card numbers are sorted and extracted to obtain similarity retrieval results.
[0008] The present invention is further configured to perform vector encoding on the ID card number to be inspected, including:
[0009] Position index symbol The Position index symbol This refers to the positional sequence number of the ID card number;
[0010] Value symbol The Value symbol The range of values for the position number in the ID card number;
[0011] The Position index symbol and stated Value symbol Combine them to construct a multi-dimensional... Zero vector The above-mentioned Zero vector The dimension is the number of combination methods; based on the ID card number to be inspected... Location information and stated Value information Regarding the Zero vector The vector position is assigned a value, which is a.
[0012] The present invention is further configured to be based on odd-even pairs. Position index symbol The first 18 digits of the ID number are compressed into 9 categories, represented by serial numbers 0 to 8.
[0013] According to parity pairs Value symbol Compress the normal... Value symbol Compress values 0-9 into 1-5, and the compressed value is calculated as (int(int(value before compression) / 2) + 1). Value symbol The value of odd numbers is assigned as -a, and the value of even numbers before compression is assigned as a; for the 18th digit of the ID number, which is X, it is defined as '17-x'.
[0014] The present invention is further configured to group all symbols in the ID card number that exceed 18 digits into the same symbol and define it as '18-unk';
[0015] Regarding the abnormality stated Value symbol The value can be unk;
[0016] The resulting set of combined symbols is: ['0-1', '1-1', '2-1', '3-1', '4-1', '5-1', '6-1', '7-1', '8-1', '0-2', '1-2', '2-2', '3-2', '4-2', '5-2', '6-2', '7-2', '8-2', '0-3', '1-3', '2-3', '3-3', '4-3', '5-3', '6-3', '7-3', '8-3', '0-4', '1-4', '2-4', '3-4', '4-4', '5-4', '6-4', '7-4', '8-4', '0-5', '1-5', '2-5', '3-5', '4-5', '5-5', '6-5', '7-5', '8-5', '0-unk', '1-unk', '2-unk', '3-unk', '4-unk','5-unk', '6-unk', '7-unk', '8-unk', '17-x', '18-unk'].
[0017] The present invention is further configured to add weights to the first six digits of the ID card number before compression:
[0018] The weight of the first and second digits of the original ID number is x;
[0019] The weights of the third and fourth digits of the original ID number are y;
[0020] The weights of the fifth and sixth digits of the original ID number are z; where x > y > z.
[0021] The present invention is further configured to invoke the hnswlib vector retrieval engine to retrieve data from the vector index library that is related to the above. treat Detection vector Return a set of similar ID card numbers whose cosine similarity is close to the given value; and compare them with the previously mentioned set of similar ID card numbers. Detection vector Similar ID numbers are obtained by setting a cosine similarity threshold or by sorting by cosine similarity.
[0022] The present invention is further configured to perform an advanced similarity comparison between the ID card number to be inspected and the ID card numbers in the set of similar ID card numbers, including:
[0023] The string length of the ID card number to be inspected is determined as the first string length; the string length of the ID card numbers in the set of similar ID card numbers is determined as the second string length;
[0024] The shorter of the lengths of the first and second strings is used as the index length;
[0025] Initialize the number of identical symbols. Within the index length range, iterate and compare whether the characters at the same index position of the ID card number to be checked are the same as those of the ID card numbers in the set of similar ID card numbers. If they are the same, increment the value of the number of identical symbols by one. The advanced similarity is 2 × the number of identical symbols / (length of the first string + length of the second string).
[0026] After the traversal calculation is completed, the similarity between each ID card number in the set of similar ID card numbers and the ID card number to be checked is calculated and sorted to obtain the similarity retrieval results.
[0027] An ID card retrieval system based on embedded vector coding, employing the aforementioned ID card retrieval method based on embedded vector coding, includes:
[0028] The encoding module performs vector encoding on the ID card number to be inspected to obtain the ID card number to be inspected. pending inspection vector ;
[0029] The first extraction module calls the vector retrieval engine to retrieve data from the vector index library that matches the given information. Detection vector Similar ID card numbers; determine the set of similar ID card numbers.
[0030] The second extraction module performs an advanced similarity comparison between the ID card number to be checked and the ID card numbers in the set of similar ID card numbers, and sorts and extracts the ID card numbers in the set of similar ID card numbers according to the similarity to obtain similarity retrieval results.
[0031] An electronic device includes a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the aforementioned ID card retrieval method based on embedded vector coding.
[0032] A storage medium storing computer program instructions, which, when executed by a processor, implement the aforementioned ID card retrieval method based on embedded vector coding.
[0033] Compared with the prior art, the technical solution provided by this invention has the following advantages:
[0034] This technical solution converts ID card numbers into vector form for retrieval. It quickly and roughly filters a set of approximate ID card numbers from a massive ID card number vector index. Then, it compares each digit of the approximate ID card number obtained from the rough screening with the ID card number to be checked, resulting in a more refined screening result with higher similarity. For some erroneous or ambiguous ID card numbers, it provides similar ID card number detection results, thereby correcting errors or providing guidance. Attached Figure Description
[0035] Figure 1 This is a flowchart of an embodiment of the ID card retrieval method based on embedded vector coding according to the present invention.
[0036] Figure 2 This is a schematic diagram of an ID card retrieval system based on embedded vector coding, according to an embodiment of the present invention.
[0037] Figure 3 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0038] To further understand the content of this invention, a detailed description of the invention will be provided in conjunction with the accompanying drawings and embodiments.
[0039] In the description of this invention, it should be noted that the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0040] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than those described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.
[0041] Example 1
[0042] Combined with appendix Figure 1 The present invention provides a method for ID card retrieval based on embedded vector coding, comprising:
[0043] Obtain the ID card number to be inspected, and based on the ID card number to be inspected... Location information and stated Location information On Value informationThe ID card number to be inspected is vector-encoded to obtain the ID card number to be inspected. Detection vector ;
[0044] The vector retrieval engine is invoked to retrieve data from the vector index library that matches the stated... Detection vector Similar ID card numbers; determine the set of similar ID card numbers.
[0045] The ID card number to be checked is compared with the ID card numbers in the set of similar ID card numbers in an advanced similarity comparison. Based on the similarity, the ID card numbers in the set of similar ID card numbers are sorted and extracted to obtain similarity retrieval results.
[0046] In the above embodiments, the vector index library contains a massive number of ID card numbers that have been converted into vectors according to the above encoding rules.
[0047] In this embodiment, vector encoding of the ID card number to be inspected includes:
[0048] Position index symbol The Position index symbol This refers to the positional sequence number of the ID card number;
[0049] Value symbol The Value symbol The range of values for the position number in the ID card number;
[0050] The Position index symbol and stated Value symbol Combine them to construct a multi-dimensional... Zero vector The above-mentioned Zero vector The dimension is the number of combination methods; based on the ID card number to be inspected... Location information and stated Value information Regarding the Zero vector The vector position is assigned a value of 1.
[0051] In the above embodiment, the value of assignment a is set to 1 for ease of calculation.
[0052] In the above embodiments, the ID card number in my country's ID card system is 18 digits, and its encoding rule is: DDDDDD YYYYMMDD XXX Y, the specific meaning of which is shown in Table 1.
[0053] Table 1
[0054]
[0055] In this embodiment, for abnormal / normal ID card numbers, 18 symbols are required for the first 18th digits, and any digits exceeding 18 are grouped into one symbol, for a total of 19 symbols. The values for each symbol are shown in Table 2.
[0056] Table 2
[0057]
[0058] In the above embodiment, the value range of the 1st to 17th bits is [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], and the value range of the 18th bit is [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, X]. 'unk' is used to represent abnormal values, and symbols exceeding the 18th bit are also represented by 'unk'.
[0059] In this embodiment, in order to compress the dimension of the vector, the parity is calculated. Position index symbol The first 18 digits of the ID card number are compressed into 9 categories, as shown in Table 3. For example, the first category represents the first and second digits of the ID card number, and the second category represents the third and fourth digits of the ID card number. These are represented by serial numbers 0 to 8 in the vector encoding (in computers, serial numbers start from 0).
[0060] Table 3
[0061]
[0062] In this embodiment, to further compress the dimension of the vector, the vector is arranged according to parity. Value symbol Compress the normal... Value symbol Compress values 0-9 into 1-5, and the compressed value is calculated as (int(int(value before compression) / 2) + 1). Value symbol The value of odd numbers is -1, and the value of even numbers before compression is 1, as shown in Table 4; for the 18th digit of the ID number, which is X, it is defined as '17-x'.
[0063] Table 4
[0064]
[0065] Before compression Value symbol The range is [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; after compression Value symbol The range is [1, 2, 3, 4, 5]; positive and negative values are used to distinguish them based on whether the original value is odd or even.
[0066] In this embodiment, as shown in Tables 1 and 2 above, symbols for ID card numbers exceeding 18 digits are grouped into the same symbol and defined as '18-unk';
[0067] Regarding the abnormality stated Value symbol The value can be unk;
[0068] The resulting set of combined symbols is: ['0-1', '1-1', '2-1', '3-1', '4-1', '5-1', '6-1', '7-1', '8-1', '0-2', '1-2', '2-2', '3-2', '4-2', '5-2', '6-2', '7-2', '8-2', '0-3', '1-3', '2-3', '3-3', '4-3', '5-3', '6-3', '7-3', '8-3', '0-4', '1-4', '2-4', '3-4', '4-4', '5-4', '6-4', '7-4', '8-4', '0-5', '1-5', '2-5', '3-5', '4-5', '5-5', '6-5', '7-5', '8-5', '0-unk', '1-unk', '2-unk', '3-unk', '4-unk', '5-unk', '6-unk', '7-unk', '8-unk', '17-x', '18-unk'];Construct the set of combined symbols into a 56-dimensional array. Zero vector .
[0069] In the above embodiment, the code for constructing the set of combined symbols is as follows:
[0070] def GetSubStrKeysList():
[0071] a = [1, 2, 3, 4, 5, 'unk']
[0072] SubStrKeysList = list()
[0073] for numstr in a:
[0074] for i in range(0, 9):
[0075] SubStrKeysList.append(str(i) + '-' + str(numstr))
[0076] SubStrKeysList.append('17-' + "x")
[0077] SubStrKeysList.append("unk")
[0078] return SubStrKeysList
[0079] The meaning of the code above for constructing a set of combinatorial symbols is as follows:
[0080] ① Definition Value symbol ValueSymbol, with a range of [1, 2, 3, 4, 5, 'unk'];
[0081] ② Definition Position index symbol IndexSymbol1, with a range of [0, 1, 2, 3, 4, 5, 6, 7, 8];
[0082] ③ Definition Position index symbol IndexSymbol2, with a range of ['17-x', '18-unk'];
[0083] ④ Define the CompositeSymbol rule: IndexSymbol-ValueSymbol;
[0084] ⑤ Based on the combination rules, iterate through IndexSymbol1 and ValueSymbol to obtain the composite symbol collection CompositeSymbolList;
[0085] ⑥ Concatenate '17-x' and 'unk' into the composite symbol set CompositeSymbolList, where the composite symbol set is ['0-1', '1-1', '2-1', '3-1', '4-1', '5-1', '6-1', '7-1', '8-1', '0-2', '1-2', '2-2', '3-2', '4-2', '5-2', '6-2', '7-2', '8-2', '0-3', '1-3', '2-3', '3-3', '4-3', '5-3', '6-3', '7-3', '8-3', '0-4', '1-4', '2-4', '3-4', '4-4','5-4', '6-4', '7-4', '8-4', '0-5', '1-5', '2-5', '3-5', '4-5', '5-5', '6-5','7-5', '8-5', '0-unk', '1-unk', '2-unk', '3-unk', '4-unk', '5-unk', '6-unk', '7-unk', '8-unk', '17-x', '18-unk'].
[0086] In this embodiment, the first six digits of the ID card number before compression are weighted:
[0087] The weight of the first and second digits of the original ID number is x;
[0088] The weights of the third and fourth digits of the original ID number are y;
[0089] The weights of the fifth and sixth digits of the original ID number are z; where x > y > z.
[0090] In the above embodiment, x is set to 1.5, y to 1.4, and z to 1.2; according to the ID card number to be inspected... Location information and stated Value information Regarding the Zero vector The vector positions are assigned values, and the specific conversion code is as follows:
[0091] def Sfzh2Vec(sfzh, SubStrKeysList):
[0092] veclist = [0] * len(SubStrKeysList)
[0093] index = 0
[0094] for char in sfzh:
[0095] w = 1
[0096] # """
[0097] if index in [0, 1]:
[0098] w = 1.5
[0099] elif index in [2, 3]:
[0100] w = 1.4
[0101] elif index in [4, 5]:
[0102] w = 1.3
[0103] elif index == 16:
[0104] w = 1.2
[0105] # """
[0106] if str(char) in ['0', '1', '2', '3', '4', '5', '6', '7', '8','9', 'x', 'X']:
[0107] if str(char) != 'X' and str(char) != 'x':
[0108] if index <= 17:
[0109] if int(char) % 2 == 0:
[0110] veclist[SubStrKeysList.index(str(int(index / 2))+'-'+str(int(int(char) / 2) + 1))] += w
[0111] else:
[0112] veclist[SubStrKeysList.index(str(int(index / 2))+'-'+str(int(int(char) / 2) + 1))] += -1 * w
[0113] else:
[0114] veclist[SubStrKeysList.index('unk')] += w
[0115] else:
[0116] if index == 17:
[0117] veclist[SubStrKeysList.index(str(index) + '-x')]+= w
[0118] elif index < 17:
[0119] veclist[SubStrKeysList.index(str(int(index / 2)) +'-unk')] += w
[0120] else:
[0121] veclist[SubStrKeysList.index('unk')] += w
[0122] else:
[0123] if index <= 17:
[0124] veclist[SubStrKeysList.index(str(int(index / 2)) + '-unk')] += w
[0125] else:
[0126] veclist[SubStrKeysList.index('unk')] += w
[0127] index += 1
[0128] return veclist
[0129] The meaning of the code for transforming the vector to be tested is as follows:
[0130] ⑦ Initialize the traversal index: index = 0;
[0131] ⑧ Initialize a zero-value vector veclist of the same dimension based on the composite symbol set CompositeSymbolList, which is: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
[0132] 9. Loop through the characters in the ID number.
[0133] 1) Assign an initial weight w=1.0. In particular, the weight can be appropriately increased for the first 6 digits of the regional code. The weight of the first two digits (index=0 and index=1) is 1.5, the weight of the third and fourth digits (index=2 and index=3) is 1.4, and the weight of the last two digits (index=4 and index=5) is 1.2.
[0134] 2) If char is in the range ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
[0135] If index <= 17, retrieve the current combination number CurCompositeSymbol, calculated as str(int(index / 2)) + '-' + str(int(int(char) / 2) + 1)).
[0136] If index > 17, retrieve the current combination number CurCompositeSymbol, which is directly 'unk'.
[0137] It returns the index of CurCompositeSymbol in CompositeSymbolList and updates veclist. If the index is even, the update method is veclist[CompositeSymbolList] += w; otherwise, the update method is veclist[CompositeSymbolList] += -1 * w.
[0138] 3) If char is in the range ['x', 'X']
[0139] If index=17, retrieve the current combination number CurCompositeSymbol, which is directly '17-x';
[0140] If index < 17, retrieve the current combination number CurCompositeSymbol, calculated as str(int(index / 2)) + '-unk').
[0141] If index > 17, retrieve the current combination number CurCompositeSymbol, which is directly 'unk';
[0142] It returns the index of CurCompositeSymbol in CompositeSymbolList via CurCompositeSymbol and updates veclist by veclist[CompositeSymbolList] += w;
[0143] 4) If char is not in the range ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'x', 'X']
[0144] If index <= 17, retrieve the current combination number CurCompositeSymbol, calculated as str(int(index / 2)) + '-unk').
[0145] If index > 17, retrieve the current combination number CurCompositeSymbol, which is directly 'unk';
[0146] It returns the index of CurCompositeSymbol in CompositeSymbolList via CurCompositeSymbol and updates veclist by veclist[CompositeSymbolList] += w;
[0147] 5) Calculate the current traversal index: index = index + 1;
[0148] ⑩ Obtain the vector after converting the current ID number, which is the updated veclist.
[0149] In this embodiment, the hnswlib vector retrieval engine is invoked to retrieve data from the vector index library that matches the... Detection vector Return a set of similar ID card numbers whose cosine similarity is close to the given value; and compare them with the previously mentioned set of similar ID card numbers. Detection vector Similar ID numbers are obtained by setting a cosine similarity threshold or by sorting by cosine similarity.
[0150] In the above embodiments, HNSW is a typical and widely used graph algorithm. Graph-based vector retrieval algorithms have excellent performance in vector retrieval evaluations and can be applied to online queries with high concurrency and large data volumes.
[0151] In the above embodiment, cosine similarity is used to retrieve ID card numbers with similarity. Cosine similarity is the cosine of the angle between two n-dimensional vectors in n-dimensional space. It is equal to the dot product (vector product) of the two vectors divided by the product of the lengths (or sizes) of the two vectors, and its value ranges from [-1, 1], where -1 is completely dissimilar and 1 is completely similar.
[0152] In the above embodiments, cosine similarity can be used to find all similar ID cards within a certain threshold; alternatively, a fixed number of ID cards with high similarity can be selected by sorting them according to cosine similarity.
[0153] In this embodiment, performing an advanced similarity comparison between the ID card number to be inspected and the ID card numbers in the set of similar ID card numbers includes:
[0154] The string length of the ID card number to be inspected is determined as the first string length; the string length of the ID card numbers in the set of similar ID card numbers is determined as the second string length;
[0155] The shorter of the lengths of the first and second strings is used as the index length;
[0156] Initialize the number of identical symbols. Within the index length range, iterate and compare whether the characters at the same index position of the ID card number to be checked are the same as those of the ID card numbers in the set of similar ID card numbers. If they are the same, increment the value of the number of identical symbols by one. The advanced similarity is 2 × the number of identical symbols / (length of the first string + length of the second string).
[0157] After the traversal calculation is completed, the similarity between each ID card number in the set of similar ID card numbers and the ID card number to be checked is calculated and sorted to obtain the similarity retrieval results.
[0158] In the above embodiment, the code for further similarity filtering is as follows:
[0159] def SfzhSim(s0, s1):
[0160] if s0 is None:
[0161] return 0.0
[0162] if s1 is None:
[0163] return 0.0
[0164] if s0 == s1:
[0165] return 1.0
[0166] s0_len, s1_len = len(s0), len(s1)
[0167] minlen = min(s0_len, s1_len)
[0168] length = 0
[0169] for i in range(0, minlen):
[0170] if s0[i] == s1[i]:
[0171] length += 1
[0172] return round(2 * length / (s0_len + s1_len), 3)
[0173] The meaning of the code above for further similarity filtering is as follows:
[0174] ① Given two strings, s0 and s1, if either s0 or s1 is None, return a similarity score of 0.0.
[0175] ②If s0 and s1 are the same, return a similarity score of 1.0 directly;
[0176] ③ Calculate the length of s0, s0_len, calculate the length of s1, s1_len, and obtain the minimum length minlen = min(s0_len, s1_len);
[0177] ④ Initialize length=0, index list=range(0, minlen), that is, take positive integers between 0 and minlen;
[0178] ⑤ Iterate through indexlist. If the s0 character at the same index is the same as the s0 character, update length. The update formula is length = length + 1.
[0179] ⑥ Calculate the similarity SfzhSim, the formula is SfzhSim = 2 * length / (s0_len + s1_len).
[0180] For example: The hnswlib vector retrieval engine is invoked to retrieve data from the vector index library related to the above. Detection vector The cosine similarity of ID card numbers is close, and the coarse screening yields a set of 50 similar ID card numbers. Further fine screening is performed to determine the three most similar ID card numbers based on the magnitude of the advanced similarity.
[0181] This invention converts ID card numbers into vector form for retrieval, quickly and roughly filtering a set of approximate ID card numbers from a massive ID card number vector index database. Then, it compares each digit of the approximate ID card numbers obtained from the rough screening with the ID card number to be checked, yielding a more refined screening result with higher similarity. For some erroneous or ambiguous ID card numbers, it provides similar ID card number detection results, thereby correcting errors or providing guidance.
[0182] Example 2
[0183] Combined with appendix Figure 2 The technical solution of this invention is an ID card retrieval system based on embedded vector coding, employing the ID card retrieval method based on embedded vector coding described in Example 1, including:
[0184] Encoding module 10 performs vector encoding on the ID card number to be inspected to obtain the ID card number to be inspected. treat Detection vector ;
[0185] The first extraction module 20 calls the vector retrieval engine to retrieve data from the vector index library that matches the given information. Detection vector Similar ID card numbers; determine the set of similar ID card numbers.
[0186] The second extraction module 30 performs an advanced similarity comparison between the ID card number to be inspected and the ID card numbers in the set of similar ID card numbers, and sorts and extracts the ID card numbers in the set of similar ID card numbers according to the similarity to obtain similarity retrieval results.
[0187] Example 3
[0188] Combined with appendix Figure 3 An electronic device includes a memory 200 and a processor 100. The memory 200 stores a computer program, which, when executed by the processor 100, causes the processor 100 to perform the ID card retrieval method based on embedded vector coding as described in Embodiment 1.
[0189] Example 4
[0190] A storage medium storing computer program instructions, which, when executed by a processor, implement the ID card retrieval method based on embedded vector coding as described in Embodiment 1.
[0191] The present invention and its embodiments have been described above illustratively. This description is not restrictive, and the figures shown are only one embodiment of the present invention; the actual structure is not limited thereto. Therefore, if those skilled in the art are inspired by this description and design similar structures and embodiments without departing from the spirit of the present invention, such designs should fall within the protection scope of the present invention.
Claims
1. A method for retrieving ID cards based on embedded vector coding, characterized in that, include: Obtain the ID card number to be inspected, and perform vector encoding on the ID card number to be inspected based on the location information and the value information on the location information to obtain the inspection vector of the ID card number to be inspected; The vector retrieval engine is invoked to retrieve ID card numbers similar to the vector to be detected from the vector index library, thereby determining a set of similar ID card numbers; The ID card number to be checked is compared with the ID card numbers in the set of similar ID card numbers. The ID card numbers in the set of similar ID card numbers are sorted and extracted according to the similarity to obtain the similarity retrieval results. Vector encoding of the ID card number to be inspected includes: Location index symbol, wherein the location index symbol is the location sequence number of the ID card number; The value symbol is the range of values for the position number of the ID card number; The position index symbol and the value symbol are combined to construct a multi-dimensional zero vector; the dimension of the zero vector is the number of combination methods; the vector position of the zero vector is assigned a value a based on the position information and value information of the ID card number to be checked. i ; The position index symbols are compressed according to parity, and the first 18 digits of the ID card number are compressed into 9 categories, represented by serial numbers 0 to 8 respectively; The value symbols are compressed according to parity, and the normal value symbols 0-9 are compressed into 1-5. The compressed value is = (int(int(value before compression) / 2) + 1); the value symbol that was odd before compression is assigned the value -a, and the value symbol that was even before compression is assigned the value a; for the 18th digit of the ID number that is X, it is defined as '17-x'. Add weights to the first six digits of the original ID number before compression: The weight of the first and second digits of the original ID number is x; The weights of the third and fourth digits of the original ID number are y; The weights of the fifth and sixth digits of the original ID number are z; where x > y > z.
2. The ID card retrieval method based on embedded vector coding according to claim 1, characterized in that, All symbols in an ID number exceeding 18 digits are grouped into a single symbol and defined as '18-unk'. For abnormal values in the first 18 digits of an ID card number, the symbol for the value is unk; The resulting set of combined symbols is: ['0-1', '1-1', '2-1', '3-1', '4-1', '5-1', '6-1', '7-1', '8-1', '0-2', '1-2', '2-2', '3-2', '4-2', '5-2', '6-2', '7-2', '8-2', '0-3', '1-3', '2-3', '3-3', '4-3', '5-3', '6-3', '7-3', '8-3', '0-4', '1-4', '2-4', '3-4', '4-4', '5-4', '6-4', '7-4', '8-4', '0-5', '1-5', '2-5', '3-5', '4-5','5-5', '6-5', '7-5', '8-5', '0-unk', '1-unk', '2-unk', '3-unk', '4-unk', '5-unk', '6-unk', '7-unk', '8-unk', '17-x', '18-unk'].
3. The ID card retrieval method based on embedded vector coding according to claim 1 or 2, characterized in that, The hnswlib vector retrieval engine is invoked to retrieve ID card numbers that are close to the cosine similarity of the vector to be detected from the vector index library, and a set of similar ID card numbers is returned. The ID card numbers that are similar to the vector to be detected are obtained by setting a cosine similarity threshold or by sorting by cosine similarity.
4. The ID card retrieval method based on embedded vector coding according to claim 1 or 2, characterized in that, The advanced similarity comparison between the ID card number to be inspected and the ID card numbers in the set of similar ID card numbers includes: The string length of the ID card number to be inspected is determined as the first string length; the string length of the ID card numbers in the set of similar ID card numbers is determined as the second string length; The shorter of the lengths of the first and second strings is used as the index length; Initialize the number of identical symbols. Within the index length range, iterate and compare whether the characters at the same index position of the ID card number to be checked are the same as those of the ID card numbers in the set of similar ID card numbers. If they are the same, increment the value of the number of identical symbols by one. The advanced similarity is 2 × the number of identical symbols / (length of the first string + length of the second string). After the traversal calculation is completed, the similarity between each ID card number in the set of similar ID card numbers and the ID card number to be checked is calculated and sorted to obtain the similarity retrieval results.
5. An ID card retrieval system based on embedded vector coding, characterized in that, The ID card retrieval method based on embedded vector coding as described in any one of claims 1 to 4 includes: The encoding module performs vector encoding on the ID card number to be inspected to obtain the inspection vector of the ID card number to be inspected; The first extraction module calls the vector retrieval engine to retrieve ID card numbers similar to the vector to be detected from the vector index library, and determines the set of similar ID card numbers; The second extraction module performs an advanced similarity comparison between the ID card number to be checked and the ID card numbers in the set of similar ID card numbers, and sorts and extracts the ID card numbers in the set of similar ID card numbers according to the similarity to obtain similarity retrieval results.
6. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the ID card retrieval method based on embedded vector coding as described in any one of claims 1 to 4.
7. A storage medium, characterized in that, The storage medium stores computer program instructions, which, when executed by a processor, implement the ID card retrieval method based on embedded vector coding as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Address book retrieval method, server and storage medium
CN110489515A
Data retrieval method and device, equipment and storage medium
CN115169489A