File size: 4,245 Bytes
3c83d6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# 🏒 Indoor Localization and Navigation System

![Project Status](https://img.shields.io/badge/status-active-brightgreen)
![Python Version](https://img.shields.io/badge/python-3.10-blue)
![TensorFlow](https://img.shields.io/badge/tensorflow-2.13-orange)

> A deep learning-based indoor positioning system with real-time A\* navigation, achieving **0–3 meter accuracy** β€” a significant improvement over existing methods.

---

## πŸ“Œ Overview

Indoor localization is a challenging problem due to the lack of GPS signals inside buildings and complex environments with walls, obstacles, and interference. Many existing systems rely on signal strength, Wi-Fi fingerprints, or other heuristics, but these approaches often have limited accuracy, with errors ranging from **0 to 5 meters**.

This project builds upon the methodology proposed in the **WiDeep paper** with two key improvements:

1. βœ… Replaced the weighted-sum approach with a **trainable softmax-based layer** for position approximation.
2. βœ… Implemented a **grid-based mapping system** with the **A\* algorithm** for path planning and real-time navigation.

---

## 🧠 Approach

### Position Approximation

The core of the localization method is a custom Keras layer called **`PositionAproxmator`**:

- Takes a predefined list of possible positions in the environment (`PlacesPosition`).
- Learns a small **trainable offset weight** `W` for each position, allowing the model to refine predicted locations.
- Computes the final position via matrix multiplication of probabilities with `(PlacesPosition + W)`.

```python
import tensorflow as tf
from tensorflow import keras

class PositionAproxmator(keras.layers.Layer):
    def __init__(self, PlacesPosition, name="PositionAproxmator"):
        super(PositionAproxmator, self).__init__()
        self.PlacesPosition = tf.constant(PlacesPosition, dtype=tf.float32, name="PlacesPositions")

    def build(self, inputs_shape):
        self.W = self.add_weight(
            shape=(inputs_shape[1], 2),
            trainable=True,
            dtype=tf.float32,
            name="PlacesWeight"
        )

    def call(self, Probilites):
        return Probilites @ (self.PlacesPosition + self.W)

    def get_config(self):
        config = super().get_config()
        config.update({"PlacesPosition": self.PlacesPosition})
        return config
```

---

### πŸ—ΊοΈ Mapping & Navigation

Once the position is estimated, the system uses a **grid-based map** of the environment and applies the **A\* algorithm** to plan the optimal path from the current location to a target β€” enabling real-time indoor navigation.

---

## πŸ”„ System Workflow

```
Input Probabilities
       β”‚
       β–Ό
Softmax Layer          ← Normalizes probabilities
       β”‚
       β–Ό
PositionAproxmator     ← PlacesPosition + learned W offsets
       β”‚
       β–Ό
Predicted (x, y) Position
       β”‚
       β–Ό
Grid Map Representation
       β”‚
       β–Ό
A* Path Planning
       β”‚
       β–Ό
Navigation Instructions / Path
```

---

## πŸ“Š Results

| System         | Error Range  |
|----------------|-------------|
| **My System**  | **0 – 3 m** |
| WiDeep Paper   | 0 – 5 m     |

By integrating mapping and A\* navigation, the system also generates accurate indoor routes, making it practical for real-world applications.

---

## πŸ› οΈ Tech Stack

| Category             | Tools / Libraries                        |
|----------------------|------------------------------------------|
| Language             | Python 3.10                              |
| Deep Learning        | TensorFlow / Keras                       |
| Data Processing      | NumPy, Pandas                            |
| Visualization        | Matplotlib, Seaborn                      |
| Navigation           | Custom Grid Map + A\* Algorithm          |

---

## πŸš€ Future Work

- [ ] Real-time deployment on mobile devices
- [ ] Multi-floor building support
- [ ] Sensor fusion: Bluetooth, UWB, IMU
- [ ] Dynamic obstacle avoidance

---

## πŸ“¬ Contact

Feel free to reach out for collaborations, discussions, or contributions!