Method, system and storage medium for obtaining wifi portrait
By employing character segmentation and a trained text-cnn model with a pinyin library, the method accurately categorizes Wi-Fi networks with non-Chinese character names, enhancing recognition accuracy.
Patent Information
- Application Number
- CN202210880479.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-25
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2042-07-25
AI Technical Summary
Existing methods struggle to accurately identify the category of Wi-Fi networks with names containing only non-Chinese characters due to arbitrary naming conventions, leading to reduced recognition accuracy.
A method involving character segmentation and a preset pinyin library to identify Chinese pinyin in Wi-Fi names, followed by inputting the Wi-Fi names into a trained text-cnn classification model to obtain category portraits, using a training sample set with Chinese characters to enhance accuracy.
Improves the accuracy of Wi-Fi recognition by effectively identifying and categorizing Wi-Fi networks with non-Chinese character names through a robust classification model, ensuring high recognition rates.
Smart Images

Figure CN115243277B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and specifically to a method, system and storage medium for obtaining a wifi image. Background Art
[0002] Due to its own convenience, wifi is becoming more and more important in people's daily work and life. Since the location of wifi itself is usually relatively fixed, therefore, depicting the wifi portrait helps to further help build the portrait of the user connected to the wifi, among which, obtaining the wifi portrait through wifi naming (SSID name) is a common method. However, in the prior art, the naming of wifi is quite arbitrary. A category portrait of a type of wifi can be obtained according to its Chinese name. For example, a shopping mall wifi may be named as a certain shopping mall. However, there are still a considerable number of wifi names that do not include any Chinese characters. For example, a wifi that contains both Chinese pinyin and other non-Chinese characters is difficult to identify its category attribute based on its naming. Therefore, how to obtain the portrait of a wifi that does not contain Chinese characters in its naming is a technical problem that needs to be solved at present. Summary of the invention
[0003] In response to the above technical problems, the technical solution adopted in the present application is: a method for obtaining a wifi portrait, comprising the following steps: S100, obtaining the SSID name of the wifi; S200, if the SSID name does not contain Chinese characters, and the ratio of the number of characters P contained in the Chinese pinyin that conforms to the preset pinyin library in the SSID name to the total number of characters T contained in the SSID name is ≥ a preset proportion threshold, executing step S300, wherein the preset pinyin library contains multiple preset pinyins; S300, obtaining a category portrait of the wifi based on the SSID name and a preset wifi classification model.
[0004] A system for acquiring a wifi portrait, the system comprising a processor and a non-transitory computer-readable storage medium, the storage medium being used to store at least one instruction or at least one program, the processor loading and executing the at least one instruction or at least one program to implement the above method.
[0005] A computer-readable storage medium stores a program or instruction, wherein the program or instruction enables a computer to execute the steps of the above method.
[0006] It can be seen from the above content that the present application first judges the acquired wifi name. When the wifi name does not contain Chinese characters, and the ratio of the number of Chinese pinyin characters that conform to the preset pinyin library to the total number of characters in the wifi name is ≥ the preset percentage threshold, the wifi name is input into the preset wifi classification model to obtain the category portrait of the wifi, wherein the preset wifi classification model is trained based on a training wifi sample set containing Chinese characters. By setting a preset pinyin library and a preset percentage threshold, the pinyin part contained in the wifi and the valid wifi can be effectively identified. Further, by using the training samples containing Chinese characters to obtain the classification model (Chinese characters need to be converted into corresponding pinyin parts before training), the accuracy of the classification model itself is ensured, thereby improving the accuracy of the wifi recognition rate that may be reduced due to errors in the pinyin recognition part. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0008] Figure 1 A flowchart of a method for obtaining a wifi portrait provided in an embodiment of the present application;
[0009] Figure 2 Provided in the embodiments of this application Figure 1 Flow chart of the steps included in step S200. DETAILED DESCRIPTION
[0010] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0011] The present application embodiment provides a method for obtaining a wifi image, such as Figure 1 As shown, the following steps are included:
[0012] S100, obtaining the SSID name of the wifi. Those skilled in the art may know that the SSID is the wireless network name of the wifi, and the user may change the SSID name as needed.
[0013] S200, if the SSID name does not contain Chinese characters, and the ratio of the number of characters P contained in the Chinese pinyin of the SSID name that conforms to the preset pinyin library to the total number of characters T contained in the SSID name is ≥ the preset proportion threshold, execute step S300.
[0014] In this step, the preset pinyin library contains multiple preset pinyins. In one embodiment, the multiple preset pinyins are all Chinese pinyins; in a preferred embodiment, the multiple preset pinyins are all other Chinese pinyins excluding the three single vowel pinyins of a, o, and e. By removing the three single vowel pinyins of a, o, and e, the influence of invalid characters in wifi naming on the accuracy of the entire wifi classification can be effectively reduced. In addition, in the present application, the specific form of the preset pinyin library is not limited, and it can use any method in the prior art to save the multiple preset pinyins, such as a table. Further, in the present application, the characters at least include all characters that may be used in the naming process of the SSID name, such as all Arabic numerals, uppercase and lowercase letters of the 26 English letters, operation symbols, Chinese, etc. In the present application, the value range of the preset proportion threshold is [0.3, 1], preferably 0.4. By setting the preset proportion threshold, invalid wifis that are named arbitrarily can be screened out.
[0015] S300, obtaining the category portrait of the wifi based on the SSID name and the preset wifi classification model. In the present application, the preset wifi classification model can adopt any classification technology in the prior art, such as SVM, etc. In a preferred embodiment of the present application, the preset wifi classification model is a text-cnn model.
[0016] From the above content, it can be seen that the present application first judges the acquired wifi name. When the wifi name does not contain Chinese characters, and the ratio of the number of Chinese pinyin characters that conform to the preset pinyin library to the total number of characters in the wifi name is ≥ the preset proportion threshold, the wifi name is input into the preset wifi classification model to obtain the category portrait of the wifi. Among them, setting the preset pinyin library and the preset proportion threshold can, on the one hand, identify the pinyin part contained in the wifi, and on the other hand, exclude invalid wifi with the default original wifi name or invalid name, thereby improving the accuracy of wifi portrait acquisition at the source.
[0017] In a preferred embodiment of the present application, step S200 includes: Figure 2 As shown:
[0018] S201, when the SSID name does not contain Chinese characters, obtain the total number of characters T contained in the SSID name and all the longest Chinese pinyins in the SSID name that conform to the preset pinyin library, wherein the corresponding contents of all the longest Chinese pinyins in the SSID name do not intersect with each other. For example, if the SSID name of a wifi is dazhongshudian-5G, then according to the above content, the total number of characters T contained in the SSID name of the wifi is 17.
[0019] Further, in one embodiment of the present application, character segmentation is performed from front to back based on the SSID name to obtain all the longest Chinese pinyin contained in the SSID name. In a preferred embodiment of the present application, character segmentation is performed from back to front based on the SSID name to obtain all the longest Chinese pinyin contained in the SSID name. Specifically, taking the SSID name dazhongshudian-5G in the above example, first take the last character G as the starting point, and check whether there are 6 character strings of length 1, 2, 3, 4, 5, and 6 in total, including G, 5G, -5G, n-5G, an-5G, and ian-5G, respectively, which are 1, 2, 3, 4, 5, and 6, that match the Chinese pinyin in the preset pinyin library. If not, take the second to last character as the starting point, that is, take 5 as the starting point, and check whether 5, -5, n-5, an-5, ian-5, and dian-5 match the Chinese pinyin in the preset pinyin library. , if it does not exist, the starting point is set to -, and then check whether there is a string of Chinese Pinyin in the preset Pinyin library in the 6-length string before the character, and so on. When it is carried out to n as the starting point, check whether n, an, ian, dian, udian, and hudian have a string of Chinese Pinyin in the preset Pinyin library. At this time, if an and dian both meet the preset Pinyin in the preset Pinyin library, since the character length of dian is 4> the character length of an is 2, dian is recognized as a Pinyin, and then the character u is used as the starting point to continue the check. It can be seen that after the recognition is performed according to the above method, all the longest Chinese Pinyins recognized include: dian, shu, zhong, and da. That is, if a character itself and a continuous string of multiple lengths containing it do not meet the preset Pinyin library, the previous character of the character is used as the starting point for checking. Otherwise, the Chinese Pinyin with the maximum length is found, and then the previous character of the Chinese Pinyin with the maximum length is used as the starting point for checking until the entire SSID name is checked.
[0020] S202, according to all the longest Chinese Pinyin, obtain the character number P. According to the example in step S201, the character number P of all the longest Chinese Pinyins dian, shu, zhong, da is 14.
[0021] S203, if P / T≥preset proportion threshold, execute step S300.
[0022] According to the above content, by adopting the back-to-front method to segment the characters of the wifi SSID name to obtain the longest Chinese pinyin contained in the SSID name, the SSID name can be better identified, thereby improving the accuracy of obtaining the wifi portrait.
[0023] In a preferred embodiment of the present application, the acquisition of the preset Wi-Fi classification model includes the following steps:
[0024] S1, obtain the SSID name set S corresponding to the training wifi set = {SSID 1 , SSID 2 , ..., SSID n} and its corresponding category attribute set L = {L 1 , L 2 , ..., L n}, where the SSID name corresponding to the i-th training wifi is SSID i Contains Chinese characters, and the category attribute corresponding to the i-th training wifi is L i , L i is one of the M preset categories, 1≤i≤n. In the present application, the M preset categories can be customized, for example, transportation, surrounding tours, hotels, etc., and the above content is only an exemplary example and is not a specific limitation on the scope of protection of the present application. It is known to those skilled in the art that in order to improve the robustness of the classification model, the samples of each category in the M preset categories in the training wifi set are as many as possible to traverse all possible situations.
[0025] S2, based on the SSID name set S, obtain the pinyin name set SP = {SSIDP 1 ,SSIDP 2 , ..., SSIDP n},SSIDP i By setting the SSID i The Chinese characters in the code are converted into Chinese pinyin. In this step, each SSID is first identified. i Then convert each Chinese character into the corresponding Chinese pinyin to get SSIDP i Since Chinese character annotation is relatively simpler than pinyin annotation, the difficulty of obtaining the training sample set can be reduced while ensuring the accuracy of the training sample set. At the same time, it also avoids the reduction of classification accuracy of the classification model caused by directly using training samples that only contain Chinese pinyin but not Chinese characters after pinyin segmentation.
[0026] S3, using the pinyinized name set SP and the category attribute set L as input data of a text-cnn model to train the text-cnn model to obtain the preset wifi classification model.
[0027] In this application, in order to obtain the preset wifi classification model, first, in SSIDP 1 ,SSIDP 2 , ..., SSIDP n Based on the digital vector method, the SSIDP 1 ,SSIDP 2 , ..., SSIDP n The corresponding digitized vector matrices D1, D2, ..., Dn are respectively, where the j-th row vector of the digitized vector matrix Di is SSIDP i The digitized vector of the jth element in, specifically, SSIDP i Any Chinese pinyin and any non-Chinese character in the name is called an element, and 1≤j≤SSIDP i The digital vectorization method can be any element encoding method used in the prior art, such as one-hot encoding, word2vec encoding, etc. Specifically, the total number of all Chinese pinyin and other non-Chinese characters that can be used to name the SSID name is obtained, and based on the total number, the SSIDP i All the elements contained are encoded separately to obtain SSIDP i The corresponding digitized vector matrix Di. Afterwards, the digitized vector matrices D1, D2, ..., Dn are padded in length, for example, by using a 0-padded operation, so that D1, D2, ..., Dn have the same number of matrix rows. Finally, D1, D2, ..., Dn with the same number of matrix rows are input into the text-cnn model for training to obtain a preset wifi classification model.
[0028] Furthermore, in this application, in order to obtain the best wifi category portrait, the convolution kernel size of the text-cnn model is set to a value range of [three, six], preferably five, each with 128. Preferably, the convolution kernels are convolution kernels of sizes 1, 3, 5, 7, and 9, respectively. Using the above five convolution kernels of different sizes, the effective features in the SSID name of each wifi can be comprehensively and effectively obtained, thereby improving the classification accuracy. Table 1 is some wifi recognition accuracy data for different wifi category portraits in this application.
[0029] Table 1
[0030] Category portrait Classification accuracy personal 0.9 Entertainment 1 Company 0.7 Tours 0.4 College 1 Home building materials 0.8 gourmet food 0.7 Shopping 0.6 ...... ......
[0031] It can be seen from the contents of Table 1 that the present application can effectively identify the wifi categories containing Chinese pinyin, the wifi classification model is highly robust, and the obtained wifi category portrait is highly accurate.
[0032] An embodiment of the present application also provides a system for obtaining a wifi portrait, the system comprising a processor and a non-transitory computer-readable storage medium, the storage medium being used to store at least one instruction or at least one program, the processor loading and executing the at least one instruction or at least one program to implement the method provided in the above embodiment.
[0033] A computer-readable storage medium stores a program or instruction, wherein the program or instruction enables a computer to execute the method provided in the above embodiment.
[0034] An embodiment of the present application also provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program related to implementing a method in a method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiment.
[0035] An embodiment of the present application also provides an electronic device, comprising a processor and the aforementioned non-transitory computer-readable storage medium.
[0036] An embodiment of the present application also provides a computer program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the method according to various exemplary embodiments of the present application described above in this specification.
[0037] Although some specific embodiments of the present application have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are only for illustration and not for limiting the scope of the present application. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present application. The scope of the present application is defined by the appended claims.
Claims
1. A method for obtaining a wifi image, characterized in that: The following steps are involved: S100, obtaining the SSID name of the wifi; S200, if the SSID name does not contain Chinese characters, and the ratio of the number of characters P contained in the Chinese pinyin that conforms to the preset pinyin library in the SSID name to the total number of characters T contained in the SSID name is ≥ the preset proportion threshold, executing step S300, wherein the preset pinyin library contains multiple preset pinyins; S300, obtaining a category portrait of the wifi based on the SSID name and a preset wifi classification model; Wherein, step S200 includes: S201, when the SSID name does not contain Chinese characters, obtain the total number of characters T contained in the SSID name and all the longest Chinese pinyins in the SSID name that conform to the preset pinyin library, wherein the corresponding contents of all the longest Chinese pinyins in the SSID name are not intersecting with each other; S202, obtaining the number of characters P according to all the longest Chinese pinyins; S203, if P / T ≥ preset proportion threshold, execute step S300; The preset wifi classification model is a text-cnn model; The acquisition of the preset wifi classification model includes the following steps: S1, obtain the SSID name set S = {SSID1, SSID2, ..., SSID n } and its corresponding category attribute set L = {L1, L2, ..., L n }, where the SSID name corresponding to the i-th training wifi is SSID i Contains Chinese characters, and the category attribute corresponding to the i-th training wifi is L i , L i is one of M preset categories, 1≤i≤n; S2, based on the SSID name set S, obtain a pinyin name set SP = {SSIDP1, SSIDP2, ..., SSIDP n },SSIDP i By setting the SSID i The Chinese characters in are converted into Chinese pinyin; S3, using the pinyinized name set SP and the category attribute set L as input data of a text-cnn model to train the text-cnn model to obtain the preset wifi classification model.
2. The method according to claim 1, characterized in that The value range of the preset proportion threshold is [0.3, 1].
3. The method according to claim 1 or 2, characterized in that: The plurality of preset pinyins do not include the Chinese pinyins a, o, and e.
4. The method according to claim 3, characterized in that There are five convolution kernel sizes corresponding to the text-cnn model, each with 128 kernels.
5. The method according to claim 4, characterized in that The convolution kernels are convolution kernels of sizes 1, 3, 5, 7, and 9 respectively.
6. A system for acquiring a wifi image, the system comprising a processor and a non-transitory computer-readable storage medium, the storage medium being used to store at least one instruction or at least one program, characterized in that: The processor loads and executes the at least one instruction or at least one program to implement the method according to any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Wireless network identification method and device, storage medium and computer device
CN109951846A
Neural network-based Chinese named entity recognition method, device, equipment and storage medium
CN110717331A
Text recognition method and device based on deep learning, equipment and storage medium
CN113569608A
Font recognition by dynamically weighting multiple deep learning neural networks
US20190147304A1
Text classification method and apparatus, and electronic device and storage medium
WO2021081945A1