How gg-dema/df-visualodometry works
Project Type and Purpose
• DFVO is a research‐grade visual odometry system implemented in Python.
• It combines classical geometry‐based tracking (E-tracker and PnP tracker) with neural‐network modules (depth estimation and optical flow) to compute camera motion from monocular video.
File Structure to Locate Major Components
• Top‐level orchestrator:
• main.py – command-line interface to run experiments and select dataset, tracker, output options.
• utils.py, camera_module.py, read_bag.py – auxiliary I/O and data loading utilities.
• Neural-network modules (pretrained PyTorch models):
• depth_net/ – depth estimation interface (depth_net.py) + borrowed model definitions and weights.
• flow_net/ – optical‐flow interface (flow_net_ui.py) + correlation and utility scripts + pretrained weights.
• Classical tracking module:
• tracker/tracker_v4.py – implements E-tracker (epipolar fitting) and PnP tracker, plus GRIC‐based model selection.
• Evaluation & output:
• visual_odometry.py – may contain visualization or trajectory plotting routines.
• main.py orchestrates saving the trajectory to disk.
Extract Additional Insights from the README
• Two alternative trackers coexist; the system chooses per‐frame via the GRIC metric.
• All neural networks are pretrained on the KITTI dataset; depth_net and flow_net are merely wrapped.
• Target datasets: KITTI (driving) and a top-view drone dataset for evaluation.
1. Input Source
• Live camera (camera_module.py) or ROS bag reader (read_bag.py)
2. Preprocessing
• Frame undistortion, timestamping (utils.py)
3. Depth Estimation Service
• depth_net.depth_net.py → resnet_encoder, depth_decoder
• Pretrained weights (depth.pth)
4. Flow Estimation Service
• flow_net.flow_net_ui.py → correlation.py, flow_utils.py
• Pretrained weights (network-kitti.pytorch)
5. Feature Selection / Matching
• Extract keypoints and descriptors, combine flow + depth cues
6. Dual Tracker Module
• E-tracker (epipolar geometry)
• PnP Tracker (Perspective-n-Point)
7. Model Selection (GRIC computation)
• Computes GRIC score to choose better pose estimate each frame
8. Pose Estimation Output
• Relative pose (R, t) per frame
9. Trajectory Assembly & Visualization
• Writes trajectory file, optional plotting (visual_odometry.py)
10. Experiment Controller / CLI
• main.py – ties everything together, parses args, selects dataset & trackers
• Input Source → Preprocessing
• Preprocessing → {Depth Estimation, Flow Estimation, Feature Selection}
• Depth & Flow services → Feature Selection
• Feature Selection → Dual Tracker Module
• Dual Tracker Module → Model Selection
• Model Selection → Pose Estimation Output
• Pose Estimation → Trajectory Assembly
• CLI / main.py → orchestrates all flows, reads config, invokes each service
c. Architectural Patterns & Design Principles:
• Pipeline architecture: data flows through a sequence of stages.
• Separation of concerns: neural‐network inference is encapsulated in dedicated modules.
• Plug-and-play trackers: two interchangeable classical trackers with runtime selection.
• Modular I/O: camera/ros-bag readers separated from core algorithm.
d. Key Technologies & Frameworks:
• Python 3.x as primary language
• PyTorch for depth_net and flow_net
• NumPy / OpenCV for feature processing and epipolar geometry
• Command-line parser (argparse) in main.py
• ROS bag support via read_bag.py (if needed)
Capturing Essential Details
• External dependencies next to modules (e.g., “PyTorch,” “KITTI weights”).
• That main.py triggers each stage, passes parameters, and writes results.