mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-04-22 22:46:36 +00:00
fix issues
This commit is contained in:
@@ -27,11 +27,25 @@ class IFaissIndexManager(ABC):
|
||||
@abstractmethod
|
||||
def load_index(self, path: str) -> FaissIndex:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def is_gpu_available(self) -> bool:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def set_device(self, device: str) -> bool:
|
||||
"""Set device: 'gpu' or 'cpu'."""
|
||||
pass
|
||||
```
|
||||
|
||||
## Component Description
|
||||
|
||||
Manages Faiss indices for AnyLoc retrieval (IVF, HNSW options).
|
||||
Manages Faiss indices for DINOv2 descriptor similarity search. H04 builds indexes from UAV image descriptors for:
|
||||
1. **Loop closure detection**: Find when UAV revisits previously seen areas within the same flight
|
||||
2. **Chunk-to-chunk matching**: Match disconnected chunks to each other
|
||||
3. **Flight-to-flight matching**: Match current flight to previous flights in same area
|
||||
|
||||
**Index Source**: Descriptors are computed from UAV images using F08's DINOv2 encoder, NOT from satellite images. The index enables finding similar UAV viewpoints.
|
||||
|
||||
## API Methods
|
||||
|
||||
@@ -76,9 +90,18 @@ Manages Faiss indices for AnyLoc retrieval (IVF, HNSW options).
|
||||
|
||||
**External**: faiss-gpu or faiss-cpu
|
||||
|
||||
## GPU/CPU Fallback
|
||||
|
||||
H04 supports automatic fallback from GPU to CPU:
|
||||
- `is_gpu_available()`: Returns True if faiss-gpu is available and CUDA works
|
||||
- `set_device("gpu")`: Use GPU acceleration (faster for large indexes)
|
||||
- `set_device("cpu")`: Use CPU (fallback when GPU unavailable)
|
||||
|
||||
## Test Cases
|
||||
|
||||
1. Build index with 10,000 descriptors → succeeds
|
||||
2. Search query → returns top-k matches
|
||||
1. Build index with 10,000 UAV image descriptors → succeeds
|
||||
2. Search query UAV descriptor → returns top-k similar UAV frames
|
||||
3. Save/load index → index restored correctly
|
||||
4. GPU unavailable → automatically falls back to CPU
|
||||
5. Add descriptors incrementally → index grows correctly
|
||||
|
||||
|
||||
Reference in New Issue
Block a user