Skip to main content

A unified framework for indoor localization

Project description

Open Source Indoor Localization Toolbox

Build License Python Stars

Issues Last Commit PRs Welcome

English | 中文


Introduction

IndoorLoc is a unified framework for indoor localization, inspired by MMPretrain. It provides a one-stop solution from datasets to algorithms, enabling automatic adaptation across different localization methods.

Who is this for?

  • Beginners: Get started with indoor localization quickly without worrying about implementation details
  • Researchers: Reproduce and compare state-of-the-art algorithms with consistent interfaces
  • Developers: Build and deploy indoor positioning systems with production-ready code

Why IndoorLoc?

  • Zero Boilerplate: Load datasets, train models, and evaluate results in just a few lines of code
  • Fair Comparison: All algorithms use the same data pipeline and evaluation metrics
  • Easy Reproduction: Built-in configs for reproducing published results
  • Rapid Prototyping: Focus on your novel ideas, not engineering details

Features

  • Multi-Algorithm Support: k-NN, SVM, Random Forest, Deep Learning (CNN, LSTM, Transformer)
  • Multi-Modal: WiFi, BLE, IMU, Visual, UWB signal support
  • Multi-Dataset: UJIndoorLoc, Tampere, Microsoft Indoor, and more
  • Unified Interface: Consistent API across all algorithms
  • Easy Configuration: YAML-based configuration with inheritance
  • Extensible: Registry-based plugin architecture
  • PyPI Ready: Easy installation via pip

Installation

# Basic installation
pip install indoorloc

# With vision support
pip install indoorloc[vision]

# Full installation (all features)
pip install indoorloc[full]

# Development installation
git clone https://github.com/qdtiger/indoorloc.git
cd indoorloc
pip install -e ".[dev]"

Quick Start

import indoorloc as iloc
import numpy as np

# Create a k-NN localizer
model = iloc.create_model('KNNLocalizer', k=5)

# Prepare training data
train_signals = [
    iloc.WiFiSignal(rssi_values=np.random.randn(520).astype(np.float32))
    for _ in range(100)
]
train_locations = [
    iloc.Location.from_coordinates(
        x=np.random.uniform(0, 100),
        y=np.random.uniform(0, 100),
        floor=np.random.randint(0, 3)
    )
    for _ in range(100)
]

# Train the model
model.fit(train_signals, train_locations)

# Make predictions
test_signal = iloc.WiFiSignal(rssi_values=np.random.randn(520).astype(np.float32))
result = model.predict(test_signal)

print(f"Predicted position: ({result.x:.2f}, {result.y:.2f})")
print(f"Predicted floor: {result.floor}")

Using Configuration Files

# configs/wifi/knn_ujindoorloc.yaml
model:
  type: KNNLocalizer
  k: 5
  weights: distance
  metric: euclidean
  predict_floor: true
  predict_building: true
import indoorloc as iloc

# Load from config
model = iloc.create_model(config='configs/wifi/knn_ujindoorloc.yaml')

Custom Model Registration

from indoorloc.registry import LOCALIZERS
from indoorloc.localizers.base import BaseLocalizer

@LOCALIZERS.register_module()
class MyCustomLocalizer(BaseLocalizer):
    def __init__(self, custom_param=1.0, **kwargs):
        super().__init__(**kwargs)
        self.custom_param = custom_param

    @property
    def localizer_type(self) -> str:
        return 'my_custom'

    def fit(self, signals, locations, **kwargs):
        # Training logic
        self._is_trained = True
        return self

    def predict(self, signal):
        # Prediction logic
        pass

# Use the custom model
model = iloc.create_model('MyCustomLocalizer', custom_param=2.0)

Project Structure

indoorloc/
├── indoorloc/
│   ├── signals/          # Signal abstractions (WiFi, BLE, IMU, etc.)
│   ├── locations/        # Location and coordinate classes
│   ├── datasets/         # Dataset implementations
│   ├── localizers/       # Localization algorithms
│   │   ├── fingerprint/  # Traditional ML (k-NN, SVM, RF)
│   │   ├── deep/         # Deep learning (CNN, LSTM, Transformer)
│   │   └── pdr/          # Inertial navigation
│   ├── fusion/           # Multi-sensor fusion
│   ├── evaluation/       # Metrics and evaluation
│   ├── engine/           # Training utilities
│   ├── visualization/    # Plotting tools
│   ├── configs/          # Built-in configurations
│   └── utils/            # Utility functions
├── tools/                # CLI tools
├── examples/             # Usage examples
├── tests/                # Unit tests
└── docs/                 # Documentation

Supported Algorithms

Fingerprint-based

  • k-NN (k-Nearest Neighbors)
  • Weighted k-NN
  • SVM (Support Vector Machine)
  • Random Forest
  • Gaussian Process

Deep Learning

  • MLP (Multi-Layer Perceptron)
  • CNN (Convolutional Neural Network)
  • LSTM (Long Short-Term Memory)
  • Transformer

Fusion

  • Kalman Filter
  • Extended Kalman Filter
  • Particle Filter

Supported Datasets

  • UJIndoorLoc
  • Tampere
  • Microsoft Indoor Localization
  • Custom datasets

Evaluation Metrics

Metric Description
Mean Position Error Average localization error (meters)
Median Position Error Median localization error (meters)
75th/95th Percentile 75%/95% percentile error
Floor Accuracy Floor classification accuracy
Building Accuracy Building classification accuracy
CDF Analysis Cumulative distribution function analysis

License

Apache License 2.0

Citation

@software{indoorloc,
  title = {IndoorLoc: A Unified Framework for Indoor Localization},
  year = {2024},
  url = {https://github.com/qdtiger/indoorloc}
}

Acknowledgements

Contributing

We welcome issues and pull requests!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

indoorloc-0.1.0.tar.gz (43.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

indoorloc-0.1.0-py3-none-any.whl (47.7 kB view details)

Uploaded Python 3

File details

Details for the file indoorloc-0.1.0.tar.gz.

File metadata

  • Download URL: indoorloc-0.1.0.tar.gz
  • Upload date:
  • Size: 43.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for indoorloc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f84b84fee6f417589db2317085dd6efd39177e8020ca856e335a2ba7f6ab6d11
MD5 b232d4d0eb5baa8ae207cc4264bf14fc
BLAKE2b-256 d2483745303bca6593b8dd9a20a704df152a9b8780f05dd518da80ffecffe976

See more details on using hashes here.

File details

Details for the file indoorloc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: indoorloc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 47.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for indoorloc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cf08a996ef204cdeb38b284315f905ad77642b378ec2e793d725606235ca4b1
MD5 223d9e0faec5f422c444e07032a60447
BLAKE2b-256 6dc4bd2228200d3b2d284ec344a82f43a492f55cdcab677849bb8842e38f130e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page