The invention relates to an indoor positioning method based on WiFi, which comprises the following steps of: in an offline stage, acquiring
fingerprint vectors of N reference point positions in an indoor positioning area, and storing the
fingerprint information of the N reference points into a
fingerprint database DB; roughly positioning at an online stage, namely determining a target floor; utilizing the K-means
algorithm to carry out clustering analysis on the sub-fingerprint libraries DBjk of the corresponding floors, and further dividing positioning sub-regions; in the real-time positioning stage, firstly, carrying out AP selection, and then using a KNN classification
algorithm for determining a sub-region where a target is located; and finally, finding out K nearest neighbors, and estimating the position (x, y) of the target in a weighted average mode. According to the method, for a large-range indoor positioning scene, the intensity information of all APs is reserved; for indoorfloor positioning, an
SVM classifier is used, an
encoder is added to a classifier model, the
data dimension is reduced through introduction of the
encoder, redundant information and
noise interferenceare effectively reduced, and the classification precision is improved.