add chunking

This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-11-27 03:43:19 +02:00
parent 4f8c18a066
commit 2037870f67
43 changed files with 7041 additions and 4135 deletions
@@ -0,0 +1,170 @@
# Acceptance Test: Multi-Chunk Simultaneous Processing
## Summary
Validate system's ability to process multiple chunks simultaneously, matching and merging them asynchronously.
## Linked Acceptance Criteria
**AC-4**: Robust to sharp turns (<5% overlap)
**AC-5**: Connect route chunks (multiple chunks)
## Preconditions
1. F10 Factor Graph Optimizer with native multi-chunk support
2. F12 Route Chunk Manager functional
3. F11 Failure Recovery Coordinator with chunk orchestration
4. Test dataset: Flight with 3 disconnected segments
## Test Description
Test system's ability to handle multiple disconnected route segments simultaneously. The system should create chunks proactively, process them independently, and match/merge them asynchronously without blocking frame processing.
## Test Steps
### Step 1: Create Multi-Segment Flight
- **Action**: Create flight with 3 disconnected segments:
- Segment 1: AD000001-010 (10 frames, sequential)
- Segment 2: AD000025-030 (6 frames, no overlap with Segment 1)
- Segment 3: AD000050-055 (6 frames, no overlap with Segments 1 or 2)
- **Expected Result**: Flight created with all 22 images
### Step 2: Process Segment 1
- **Action**: Process AD000001-010
- **Expected Result**:
- Chunk_1 created (frames 1-10)
- Sequential VO provides relative factors
- Factors added to chunk_1's subgraph
- Chunk_1 optimized independently
- GPS anchors from LiteSAM matching
- Chunk_1 anchored and merged to main trajectory
### Step 3: Detect Discontinuity (Segment 1 → 2)
- **Action**: Process AD000025 after AD000010
- **Expected Result**:
- Tracking lost detected (large displacement ~2km)
- **Chunk_2 created proactively** (immediate, not reactive)
- Processing continues immediately in chunk_2
- Chunk_1 remains in factor graph (not deleted)
### Step 4: Process Segment 2 Independently
- **Action**: Process AD000025-030
- **Expected Result**:
- Frames processed in chunk_2 context
- Relative factors added to chunk_2's subgraph
- Chunk_2 optimized independently
- Chunk_1 and chunk_2 exist simultaneously
- Chunk_2 matching attempted asynchronously (background)
### Step 5: Detect Discontinuity (Segment 2 → 3)
- **Action**: Process AD000050 after AD000030
- **Expected Result**:
- Tracking lost detected again
- **Chunk_3 created proactively**
- Processing continues in chunk_3
- Chunk_1, chunk_2, chunk_3 all exist simultaneously
### Step 6: Process Segment 3 Independently
- **Action**: Process AD000050-055
- **Expected Result**:
- Frames processed in chunk_3 context
- Chunk_3 optimized independently
- All 3 chunks exist simultaneously
- Each chunk processed independently
### Step 7: Asynchronous Chunk Matching
- **Action**: Background task attempts matching for unanchored chunks
- **Expected Result**:
- Chunk_2 semantic matching attempted
- Chunk_2 LiteSAM matching attempted
- Chunk_2 anchored when match found
- Chunk_3 semantic matching attempted
- Chunk_3 LiteSAM matching attempted
- Chunk_3 anchored when match found
- Matching happens asynchronously (doesn't block frame processing)
### Step 8: Chunk Merging
- **Action**: Merge chunks as they become anchored
- **Expected Result**:
- Chunk_2 merged to chunk_1 when anchored
- Chunk_3 merged to merged trajectory when anchored
- Sim(3) transforms applied correctly
- Global optimization performed
- All chunks merged into single trajectory
### Step 9: Verify Final Trajectory
- **Action**: Verify all 22 frames have GPS coordinates
- **Expected Result**:
- All frames have GPS coordinates
- Trajectory globally consistent
- No systematic bias between segments
- Accuracy: 20/22 < 50m (90.9%)
## Success Criteria
**Primary Criterion**:
- Multiple chunks created simultaneously
- Chunks processed independently
- Chunks matched and merged asynchronously
- Final trajectory globally consistent
**Supporting Criteria**:
- Chunk creation is proactive (immediate)
- Frame processing continues during chunk matching
- Chunk matching doesn't block processing
- Sim(3) transforms computed correctly
## Expected Results
```
Multi-Chunk Simultaneous Processing:
- Chunk_1: frames 1-10, anchored, merged
- Chunk_2: frames 25-30, anchored asynchronously, merged
- Chunk_3: frames 50-55, anchored asynchronously, merged
- Simultaneous existence: All 3 chunks exist at same time
- Independent processing: Each chunk optimized independently
- Asynchronous matching: Matching doesn't block frame processing
- Final trajectory: Globally consistent
- Accuracy: 20/22 < 50m (90.9%)
```
## Pass/Fail Criteria
**TEST PASSES IF**:
- Multiple chunks created simultaneously
- Chunks processed independently
- Chunks matched and merged asynchronously
- Final trajectory globally consistent
- Accuracy acceptable (≥ 80% < 50m)
**TEST FAILS IF**:
- Chunks not created simultaneously
- Chunk processing blocks frame processing
- Chunk matching blocks processing
- Merging produces inconsistent trajectory
- Final accuracy below threshold
## Architecture Elements
**Multi-Chunk Support**:
- F10 Factor Graph Optimizer supports multiple chunks simultaneously
- Each chunk has own subgraph
- Chunks optimized independently
**Proactive Chunk Creation**:
- Chunks created immediately on tracking loss
- Not reactive (doesn't wait for matching to fail)
- Processing continues in new chunk
**Asynchronous Matching**:
- Background task processes unanchored chunks
- Matching doesn't block frame processing
- Chunks matched and merged asynchronously
**Chunk Merging**:
- Sim(3) transform for merging
- Accounts for translation, rotation, scale
- Global optimization after merging
## Notes
- Multiple chunks can exist simultaneously
- Chunk processing is independent and non-blocking
- Asynchronous matching reduces user input requests
- Sim(3) transform critical for scale ambiguity resolution