High-precision visible light positioning system and method based on WKNN and genetic algorithm optimization
By adopting the dynamic optimization method of weighted K nearest neighbor algorithm and genetic algorithm in the visible indoor positioning system, the problems of insufficient indoor positioning accuracy and poor algorithm adaptability are solved, and high-precision and stable positioning in complex environments are achieved.
Patent Information
- Application Number
- CN202411813957.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-25
AI Technical Summary
The existing indoor positioning technology based on visible light is insufficient in complex environments and poor algorithm adaptability, making it difficult to maintain high-precision positioning under the conditions of multipath interference and signal fluctuations.
A high-precision visible indoor positioning system based on weighted K nearest neighbor algorithm (WKNN) is adopted, and the K value of each point to be measured is dynamically optimized in combination with a genetic algorithm to improve positioning accuracy and adaptability.
By dynamically optimizing the K value, the system's positioning accuracy and stability in complex indoor environments are improved, and the needs of high-precision applications are met. It is suitable for intelligent navigation, drone indoor navigation and other scenarios.
Smart Images

Figure CN119689381A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of indoor positioning, and in particular to a high-precision visible light indoor positioning system based on a weighted K nearest neighbor algorithm (WKNN) and an optimization method thereof. Background Art
[0002] With the development of technologies such as the Internet of Things (IoT), smart homes, industrial automation, and virtual reality, the demand for high-precision indoor positioning has become more urgent. Although existing indoor positioning technologies such as WiFi, Bluetooth, and ultra-wideband (UWB) can provide good positioning results, their accuracy and anti-interference capabilities in complex environments are still insufficient. In addition, these technologies mostly rely on radio frequency signals, which are susceptible to electromagnetic interference, and the hardware cost of some solutions is relatively high. In contrast, positioning technology based on visible light communication (VLC) uses light to achieve data transmission. It not only has the advantage of anti-electromagnetic interference, but also can take into account both lighting and positioning functions, and has broad application prospects.
[0003] However, in the process of achieving high-precision visible light positioning, environmental complexity and signal fluctuations pose great challenges to positioning accuracy. As a classic machine learning method, WKNN can effectively improve positioning accuracy by obtaining position estimates through weighted neighboring points. However, the optimal K value is different at different test points, and the traditional fixed K value method may lead to positioning errors. Based on this, the present invention proposes an optimization method combined with a genetic algorithm, which dynamically optimizes the K value of each test point to enhance the positioning accuracy and stability of the WKNN algorithm in different scenarios to meet the needs of high-precision applications. Summary of the invention
[0004] The present invention aims to solve the problems of insufficient positioning accuracy and poor algorithm adaptability in the existing indoor positioning technology based on visible light, and proposes a high-precision indoor visible light positioning system and method based on WKNN algorithm and genetic algorithm optimization. The present invention improves the positioning accuracy and adaptability of the system by dynamically optimizing the K value of each point to be measured using a genetic algorithm, and can achieve more accurate positioning in a complex indoor environment.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is:
[0006] One of the purposes of the present invention is to propose a high-precision visible light positioning method based on WKNN and genetic algorithm optimization, comprising the following steps:
[0007] Step 1: Use multiple LED lamps to emit visible light signals with specific codes;
[0008] Step 2: The receiving module receives the optical signal and transmits the light intensity information to the positioning processing module;
[0009] Step 3: The positioning processing module uses the weighted K nearest neighbor WKNN algorithm to process the received signal and make a preliminary position estimate;
[0010] Step 4: The optimization module optimizes the K value of the test point through a genetic algorithm and gradually adjusts it to reduce the positioning error;
[0011] Wherein, the WKNN algorithm described in step 3 matches the received optical signal intensity with the pre-established signal-position mapping relationship according to the received optical intensity information to perform a preliminary position estimation;
[0012] Step 4 dynamically adjusts the K value of each point to be measured through a genetic algorithm, that is, optimizes the number of neighbors of each point to be measured. The genetic algorithm iteratively selects, crosses and mutates the K value until the K value that minimizes the positioning error is found, thereby improving the positioning accuracy.
[0013] Furthermore, the layout design of the LED signal transmission module in step 1 of the present invention is based on the size, layout and lighting conditions of the indoor scene to ensure that the signal can cover the entire positioning area and provide a reliable positioning signal.
[0014] Furthermore, in step 4 of the present invention, the genetic algorithm first randomly generates multiple K values, which constitute an initial population. For each K value combination, the system evaluates its fitness through actual measured data, where the fitness value is measured by calculating the positioning error; the genetic algorithm selects excellent individual K values according to the fitness value, and then generates a new K value combination through crossover and mutation operations; the crossover operation exchanges the K values of two individuals, and the mutation operation makes slight adjustments to certain K values; after multiple generations of selection, crossover and mutation, the genetic algorithm gradually optimizes the K value to minimize the positioning error; after each iteration, the position of the target device is recalculated according to the optimized K value, and its estimated accuracy is adjusted. When the genetic algorithm reaches a predetermined number of iterations or the positioning error stabilizes at a certain minimum value, the optimization process ends, and the optimal K value setting is finally obtained.
[0015] The actual measured data is the error between the actual position of the target device and the preliminary estimated position.
[0016] The second object of the present invention is to propose a high-precision visible light positioning system based on WKNN and genetic algorithm optimization to implement the above method of the present invention, the system includes at least one signal transmitting module, a receiving module, a positioning processing module and an optimization module, wherein:
[0017] The signal transmitting module is composed of a plurality of LED lamps and is configured to transmit a specific coded visible light signal;
[0018] The receiving module is used to receive the optical signal emitted by the signal emitting module and transmit the light intensity information to the positioning processing module;
[0019] The positioning processing module performs preliminary position estimation through the WKNN algorithm;
[0020] The optimization module adjusts the K value of the measured point through a genetic algorithm to optimize the positioning accuracy and ensure that the positioning error is minimized. The high-precision indoor positioning system based on WKNN and genetic algorithm of the present invention not only adapts to complex indoor environments, but also has low hardware requirements and can be deployed using existing LED lamps and common photoelectric receiving equipment. By dynamically optimizing the K value, the present invention can effectively cope with challenges such as multipath interference and signal fluctuations while improving positioning accuracy. It has broad application prospects and is suitable for various scenarios such as intelligent navigation, indoor navigation of drones, and smart homes.
[0021] Furthermore, the optimization module of the present invention utilizes the selection, crossover and mutation operations of the genetic algorithm to optimize the K value combination through multiple generations of iterations, thereby gradually reducing the positioning error.
[0022] Furthermore, the receiving module of the present invention includes a photodetector or a camera configured to receive and convert the optical signal into a digital signal so as to transmit it to the positioning processing module for processing.
[0023] Furthermore, the fitness function of the genetic algorithm of the present invention gradually optimizes the K value parameter by calculating the difference between the positioning error and the target error of each iteration.
[0024] Furthermore, the positioning processing module of the present invention uses a WKNN algorithm to perform preliminary positioning by matching the received optical signal strength with a pre-established mapping relationship between signal strength and position.
[0025] Furthermore, the system of the present invention can update and optimize the positioning accuracy of multiple targets in real time in a dynamic environment, and is suitable for indoor environments such as smart homes, office buildings, and shopping malls.
[0026] The advantages and beneficial effects of the present invention are:
[0027] The high-precision indoor positioning system based on WKNN and genetic algorithm not only adapts to complex indoor environments, but also has low hardware requirements and can be deployed using existing LED lamps and common photoelectric receiving equipment. By dynamically optimizing the K value, the present invention can effectively cope with challenges such as multipath interference and signal fluctuations while improving positioning accuracy. It has a wide range of application prospects and is suitable for a variety of scenarios such as intelligent navigation, indoor navigation of drones, and smart homes. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 Flowchart of the visible light positioning system optimized based on genetic algorithm. DETAILED DESCRIPTION
[0029] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0030] Based on the description in the background technology, existing indoor visible light positioning methods usually use a K-nearest neighbor algorithm with fixed parameters for position estimation. However, in multipath interference and dynamic environments, the fixed K value is often difficult to meet the positioning accuracy requirements.
[0031] To this end, the present invention proposes a high-precision visible light positioning system and method based on WKNN and genetic algorithm optimization. The K value of different measuring points is optimized by genetic algorithm, so that the system can adapt to complex environmental changes and improve the prediction accuracy of WKNN.
[0032] In order to understand the technical concept of the present invention in more detail, the technical solution of the present invention includes the following key technical points:
[0033] 1) System architecture: The WKNN and genetic algorithm optimized visible light positioning system proposed in the present invention includes an LED transmitting module, a receiving module, a positioning processing module and an optimization calculation module. The transmitting module transmits the positioning signal through the LED, the receiving module captures the signal strength information through the photoelectric detector, the positioning processing module completes the preliminary positioning in combination with the WKNN algorithm, and the optimization calculation module uses the genetic algorithm to optimize the K value of different points.
[0034] 2) Positioning algorithm design: The present invention adopts the WKNN algorithm combined with signal strength (RSS) for weighted positioning, and dynamically adjusts the K value through the genetic algorithm, so that the system can achieve adaptive optimal positioning effect in different areas. The genetic algorithm continuously iterates and optimizes, selects the K value combination that minimizes the positioning error, and improves the overall positioning accuracy.
[0035] 3) Optimization processing method: The genetic algorithm of the present invention takes minimizing the positioning error as the objective function, and continuously adjusts the K value by using crossover, mutation and selection operations to adapt to changes in the indoor environment. The optimization process can automatically adjust the positioning parameters according to the signal characteristics and environmental interference of each measuring point, and realize high-precision and personalized positioning calculation.
[0036] 4) Hardware cost optimization: The positioning system of the present invention has a simple hardware structure and is suitable for existing LED lighting systems and common photoelectric sensors as receiving modules, which greatly reduces the system deployment cost. In addition, the system effectively improves the positioning accuracy at a low cost by optimizing the K value instead of relying on additional hardware.
[0037] Through the above technical conception, the present invention further introduces the WKNN algorithm, combined with the optimization method of the genetic algorithm, to improve the positioning accuracy and adaptability of the system, and can achieve more accurate positioning in complex indoor environments.
[0038] Example:
[0039] A high-precision visible light positioning system based on genetic algorithm to optimize K value, such as Figure 1 As shown in the figure, the system mainly consists of a visible light signal transmitting module, a receiving module, a positioning processing module and an optimization module. The LED lamps in the transmitting module are used to emit visible light signals with different codes, which carry specific location information. The receiving module is equipped with a photodetector or camera to receive signals from different LED lamps, and after pre-processing the signals through filtering and amplification circuits, they are transmitted to the positioning processing module.
[0040] In the positioning process, the WKNN algorithm is used to process the received signal to preliminarily obtain the estimated position of the target to be measured. In order to improve the positioning accuracy, the present invention further introduces an optimization module to dynamically adjust the K value of each point to be measured through a genetic algorithm, that is, to optimize the number of neighbors of each point to be measured. Specifically, the genetic algorithm will iteratively select, crossover and mutate the K value until the K value that minimizes the positioning error is found, thereby improving the positioning accuracy.
[0041] The system works in the following steps:
[0042] 1) Install LED signal transmission module: Use multiple (at least three) LED lamps, each of which emits visible light signals at a high frequency. The layout design of the LED signal transmission module is based on factors such as the size, layout and lighting conditions of the indoor scene to ensure that the signal can cover the entire positioning area and provide reliable positioning signals.
[0043] 2) The receiving module obtains the light signal: The target device is equipped with a receiving module, which receives the visible light signal from the LED lamp. The receiving module captures the intensity of the light signal through a sensor (such as a photodetector or camera), and pre-processes the signal through hardware such as filters and amplifiers to eliminate noise and interference. The received signal strength information will be transmitted to the positioning processing module for further processing. The design of the receiving module must ensure that it can work stably in a variety of lighting environments and can accurately extract the signal strength from different LED transmitting modules.
[0044] 3) The positioning processing module calculates the preliminary position: In the positioning processing module, the system first calculates the preliminary position of the target device through the WKNN algorithm. The WKNN algorithm estimates the position of the target device based on the intensity information of the received multiple LED signals and a predefined positioning database (including the position of the LED lamps and their corresponding signal strengths, etc.). Specifically, the WKNN algorithm calculates the relative distance from the test point to multiple LED lamps based on the received light intensity information by comparing it with the LED signal intensity at known positions in the database. The signal strength is weighted according to the distance. The signal weight of the closer LED lamp is greater, and the signal weight of the farther LED lamp is smaller. Through weighted calculation, the preliminary estimated position of the target device is obtained.
[0045] 4) Genetic algorithm optimizes K value and adjusts positioning accuracy: In order to further improve positioning accuracy, the present invention introduces a genetic algorithm to optimize the K value in the WKNN algorithm. WKNN introduces a weight factor w, which is used as a basis to consider the contribution of the K nearest neighbor fingerprint data in the positioning estimation. Generally speaking, the larger the distance d, the farther the fingerprint point at the location is from the positioning point, so its contribution to the positioning result should be smaller accordingly. Assume that i reference points are randomly selected in an indoor positioning environment, and the position coordinates of each reference point are (x i ,y i ), the fingerprint information in the offline fingerprint database is:
[0046] F data =[RSS 1,i ,RSS 2,i ,RSS 3,i ,RSS 4,i ,x i ,y i ] (1)
[0047] Among them, RSS n,i , n=1,2,3,4 are the RSS data of 4 LED light sources received by the i-th reference point.
[0048] During the positioning process, the WKNN algorithm calculates the similarity between the real-time RSS value of the point to be tested and the RSS value of the reference point in the fingerprint library. K reference points with the greatest similarity are selected to complete the matching and positioning. The real-time fingerprint data collected at the test point is:
[0049] rss i =[rss 1,i ,rss 2,i ,rss 3,i ,rss 4,i ] (2)
[0050] The similarity is related to the distance between the RSS values. The closer the distance between the reference point and the test point, the higher the weight factor corresponding to the reference point. Taking the Euclidean distance as an example, the calculation formula is:
[0051]
[0052] The weight factor of each reference point is proportional to the inverse of the distance of the RSS value. The calculation formula for the position coordinates of the point to be measured is:
[0053]
[0054] Although the WKNN algorithm can perform position estimation, the selection of K value has an important impact on positioning accuracy. Therefore, the present invention optimizes the selection of K value by introducing a genetic algorithm (GA). Genetic algorithm is an optimization technique based on natural selection and genetic principles, which is used to solve complex optimization problems. It simulates the evolutionary process in nature, including selection, crossover and mutation, to continuously improve the quality of the solution. The core idea is to find the best solution by simulating biological evolution.
[0055] The genetic algorithm initially creates a population where each individual represents a value of K. These individuals are randomly generated integers ranging from 2 to 20. Each individual in the population is then evaluated using a fitness function to assess how well each value of K solves the problem. The fitness function chosen is the mean squared error (MSE) of the predictions. The calculation formula is as follows:
[0056] Fitness(k i )=MSE(k i ) (5)
[0057] The formula for calculating MSE is:
[0058]
[0059] Here, M is the total number of test samples, y j true is the true value, y i (k i ) is to use k i The predicted value of .
[0060] Next, the selection operation involves choosing the K value with the smaller prediction error to advance to the next generation. Subsequently, the crossover operation combines the characteristics of the parent individuals to generate new offspring. The characteristics of the two parent individuals are randomly exchanged to create new individuals:
[0061] k child = Cross(k parent1 ,k parent2) (7)
[0062] Next, the mutation operation introduces random changes to increase the diversity of the population. Mutation is achieved by making small random adjustments to the K values of individuals:
[0063] k mutated =k individual +Δk (8)
[0064] where Δk is a small random variation.
[0065] The new generation is created through selection, crossover and mutation, combining the best features of the current population to improve the overall fitness. The genetic algorithm iterates, refining the individuals until a predetermined number of generations is reached. The final solution is the individual with the highest fitness, whose K value minimizes the prediction error of the WKNN algorithm.
[0066] 5) Positioning result output and application: The optimized K value will be applied to the final positioning calculation. The positioning processing module will perform more accurate calculations based on the optimized K value and the received signal, and finally output the accurate position of the target device. This position result will be transmitted to related application modules, such as indoor navigation, virtual reality system, etc., to achieve accurate real-time positioning. Through the dynamic optimization of the K value by genetic algorithm, the system can adapt to changes and maintain high-precision positioning performance in complex indoor environments.
[0067] The specific operation method of the present invention is as follows:
[0068] First, multiple LED lamps are arranged in the experimental environment as signal transmission modules. The LED lamps are configured to emit visible light signals with different codes to ensure uniform and stable signal coverage in the indoor area. Photoelectric detectors or cameras are installed in the target device as receiving modules to receive the light signals emitted by the LED lamps and record the corresponding light intensity data. The received light intensity information will be transmitted to the positioning processing module, which first uses the WKNN algorithm to perform preliminary processing on the received signals and make preliminary positioning estimates. In order to further optimize the positioning accuracy, the experiment introduces a genetic algorithm to adjust the K value of the test point. In the specific operation process, the genetic algorithm calculates the positioning error for different K value combinations through multiple generations of selection and crossover operations, and gradually optimizes the positioning accuracy by evaluating the fitness of each combination. The genetic algorithm continuously adjusts the K value and finally finds an optimal parameter setting to minimize the positioning error, thereby greatly improving the positioning accuracy of the system. The entire process is completed under low-cost hardware conditions, ensuring the efficiency and practicality of the system.
[0069] Based on the above implementations, the present invention supports multi-target positioning and can simultaneously locate multiple targets, which is suitable for complex indoor environments. In the scenario where multiple targets move simultaneously, the system can update the target position in real time and ensure the high accuracy of the positioning result. In addition, the system of the present invention can also be widely used in multiple fields such as virtual reality, augmented reality, intelligent navigation, and autonomous driving.
[0070] It should be further explained that the above embodiments of the present invention are only used to understand the technical scheme of the present invention, and are not used to limit the scope of protection of the present invention. Any obvious adjustments and modifications made to the technical scheme of the present invention that belong to the technical concept of the present invention should also fall within the scope of protection of the present invention.
Claims
1. A high-precision visible light positioning method based on WKNN and genetic algorithm optimization, characterized in that: The following steps are involved: Step 1: Use multiple LED lamps to emit visible light signals with specific codes; Step 2: The receiving module receives the optical signal and transmits the light intensity information to the positioning processing module; Step 3: The positioning processing module uses the weighted K nearest neighbor WKNN algorithm to process the received signal and make a preliminary position estimate; Step 4: The optimization module optimizes the K value of the test point through a genetic algorithm and gradually adjusts it to reduce the positioning error; Wherein, the WKNN algorithm described in step 3 matches the received optical signal intensity with the pre-established signal-position mapping relationship according to the received optical intensity information to perform a preliminary position estimation; Step 4 dynamically adjusts the K value of each point to be measured through a genetic algorithm, that is, optimizes the number of neighbors of each point to be measured. The genetic algorithm iteratively selects, crosses and mutates the K value until the K value that minimizes the positioning error is found, thereby improving the positioning accuracy.
2. The high-precision visible light positioning method based on WKNN and genetic algorithm optimization as claimed in claim 1, characterized in that: The layout design of the LED signal transmission module in step 1 is based on the size, layout and lighting conditions of the indoor scene to ensure that the signal can cover the entire positioning area and provide reliable positioning signals.
3. The high-precision visible light positioning method based on WKNN and genetic algorithm optimization as claimed in claim 1, characterized in that: In step 4, 1) The genetic algorithm initially creates a population, each individual represents a K value, and then uses the fitness function to evaluate each person in the population to evaluate the ability of each K value to solve the problem. The selected fitness function is the mean square error MSE of the prediction, which is calculated as follows: Fitness(k i )=MSE(k i ) (5) The formula for calculating MSE is: M is the total number of test samples, y j true is the true value, y i (k i ) is to use k i The predicted value of 2) The selection operation involves selecting the K value with a smaller prediction error to advance to the next generation. Subsequently, the crossover operation combines the characteristics of the parent individuals to generate new offspring, randomly exchanging the characteristics of the two parent individuals to create new individuals. The formula is as follows: k child =Cross(k parent1 ,k parent2 ) (7) 3) The mutation operation introduces random changes to increase the diversity of the population. Mutation is achieved by making small random adjustments to the K value of the individual. The formula is as follows: k mutated =k individual +Δk (8) where Δk is a small random variation; After each iteration, the position of the target device is recalculated according to the optimized K value, and its estimation accuracy is adjusted. When the genetic algorithm reaches a predetermined number of iterations or the positioning error stabilizes at a certain minimum value, the optimization process ends and the best K value setting is finally obtained.
4. The high-precision visible light positioning method based on WKNN and genetic algorithm optimization as claimed in claim 3 is characterized in that The measured data is the error between the actual position of the target device and the initial estimated position.
5. A high-precision visible light positioning system based on WKNN and genetic algorithm optimization to implement any one of the methods of claims 1-4, characterized in that: The system includes at least one signal transmitting module, a receiving module, a positioning processing module and an optimization module, wherein: The signal transmitting module is composed of a plurality of LED lamps and is configured to transmit a specific coded visible light signal; The receiving module is used to receive the optical signal emitted by the signal emitting module and transmit the light intensity information to the positioning processing module; The positioning processing module performs preliminary position estimation through the WKNN algorithm; The optimization module adjusts the K value of the measured point through a genetic algorithm to optimize the positioning accuracy and ensure that the positioning error is minimized.
6. The positioning system according to claim 5, wherein: The optimization module utilizes the selection, crossover and mutation operations of the genetic algorithm to optimize the K value combination through multiple generations of iterations, thereby gradually reducing the positioning error.
7. The positioning system according to claim 5, wherein: The receiving module includes a photodetector or a camera, which is configured to receive and convert the optical signal into a digital signal so as to transmit it to the positioning processing module for processing.
8. The positioning system according to claim 5, wherein: The fitness function of the genetic algorithm gradually optimizes the K value parameter by calculating the difference between the positioning error and the target error of each iteration.
9. The positioning system according to claim 5, wherein: The positioning processing module uses the WKNN algorithm to perform preliminary positioning by matching the received optical signal strength with a pre-established mapping relationship between signal strength and position.
10. The positioning system according to claim 5, wherein: The system can update and optimize the positioning accuracy of multiple targets in real time in a dynamic environment, and is suitable for indoor environments such as smart homes, office buildings, and shopping malls.