How gpcv-liujin/rednet-pytorch works
Project type and purpose
• This is a research‑oriented, open‑source deep learning tool (PyTorch implementation of REDNet) for large-scale multi‑view stereo reconstruction.
• Its primary function is to read a preprocessed aerial dataset, train the REDNet network, and generate depth maps and associated outputs.
File structure
• Top‑level scripts:
• train.py — orchestrates training and testing
• predict_whu.py — wrapper for inference (if any)
• Directories:
• datasets/ — data I/O, preprocessing, and evaluation routines for the WHU MVS dataset
• models/ — model definitions: base module, MVSNet, REDNet, RMVSNet
• checkpoints/ — saved model weights
• Utilities:
• utils.py — shared helpers (logging, metrics, I/O, etc.)
Extract insights from the README
• Environment: Python 3.7, PyTorch 1.1.0, CUDA GPU
• Workflow:
• Download & unzip WHU_MVS_dataset
• Configure paths in train.py
• Run Python scripts for train or test
• Output: depth maps, probability maps, images, camera parameters
a. Main components
1. External Dataset (WHU_MVS_dataset)
2. Data Preparation & Loader (datasets/)
3. Preprocessing Module (datasets/preprocess.py)
4. Model Zoo (models/)
– Module (base classes)
– mvsnet, rednet, rmvsnet implementations
5. Training Controller (train.py)
6. Checkpoint Store (checkpoints/)
7. Inference Engine (train.py in test mode or predict_whu.py)
8. Evaluation & Output Writer (datasets/whu_eval.py + utils.py)
9. GPU Compute (NVIDIA TITAN RTX)
10. Python & PyTorch Runtime
b. Relationships & data flow
• Data Batches → Model (forward pass) → Loss Computation → Backprop
• Training Controller ↔️ GPU Compute
• Model ↔ Checkpoints (save & load)
• Inference Engine uses trained Checkpoints + Data Loader → Model → Output Writer
• Output files written back to Dataset folder structure
c. Architectural patterns & design principles
• Modular design:
• Clear separation of data I/O, model definitions, training logic, and utilities
• Reusability:
• Base Module class for multiple networks
• Extensibility:
• New architectures can plug into models/ and be selected in train.py
• Single‑process GPU pipeline controlled by Python script
d. Key technologies and libraries
• Python 3.7, Anaconda environment
• PyTorch 1.1.0 (torch, torch.nn, torch.optim)
• NumPy, OpenCV (for image I/O)
• CUDA/cuDNN on NVIDIA TITAN RTX 2080Ti