<img src="https://img.shields.io/badge/Trainer-Ready-green"/>
<img src="https://img.shields.io/badge/Renderer-Ready-green"/>
<img src="https://img.shields.io/badge/Framework-Ready-green"/>
<img src="https://img.shields.io/badge/Documentation-Preview-purple"/>
<img src="https://img.shields.io/badge/License-MIT-orange"/>
<img src="https://raw.githubusercontent.com/InternLandMark/LandMark_Documentation/4f09c93cbec0ad50d27ac52f858e7a6c541168d6/pictures/intern_logo.svg" width="350">
<img src="https://github.com/InternLandMark/LandMark_Documentation/blob/main/pictures/logo.png?raw=true" width="650">
🌏NeRF the globe if you want
<img src="https://github.com/InternLandMark/LandMark_Documentation/blob/main/pictures/zhujiajiao.gif?raw=true" width="300">
<img src="https://github.com/InternLandMark/LandMark_Documentation/blob/main/pictures/wukang_noblackscreen.gif?raw=true" width="300">
<img src="https://github.com/InternLandMark/LandMark_Documentation/blob/main/pictures/xian.gif?raw=true" width="300">
<img src="https://github.com/InternLandMark/LandMark_Documentation/blob/main/pictures/sanjiantao.gif?raw=true" width="300">
<a href="https://landmark.intern-ai.org.cn/">
<font size="4">
🏠HomePage
</font>
</a>
|
<a href="https://internlandmark.github.io/LandMark_Documentation/">
<font size="4">
📑DocumentationSite
</font>
</a>
|
<a href="https://city-super.github.io/gridnerf/">
<font size="4">
✍️PaperPage
</font>
</a>
|
<a href="https://city-super.github.io/matrixcity/">
<font size="4">
🏬MatrixCity
</font>
</a>
This repository contains the source code for the project LandMark, the groundbreaking large-scale 3D real-world city scene modeling and rendering system. The project is built upon GridNeRF (CVPR23). Please refer to the paper and project page for more details.
Extending from GridNeRF, LandMark drastically improves training and rendering efficiency with parallelism, operators and kernels, as well as a polish over the algorithm. Including:
And now it's possible to train and render with your own LandMark models and enjoy your creativity.
Your likes and contributions to the community are exactly what we need!
The LandMark supports plenty of features at present:
Pytorch DDP both on training and rendering
MatrixCity Datasets Supports
It's highly recommended to read the DOCUMENTATION about the implementations of our parallel acceleration and dynamic fetching strategies.
You must have a NVIDIA GPU card with CUDA installed on the system. This library has been tested with single and multiple A100 GPUs.
The LandMark repository files contains configuration files to help you create a proper environment
git clone https://github.com/InternLandMark/LandMark.git
cd ./LandMark
export PYTHONPATH=$YOUR_PREFIX_PATH/LandMark/:$PYTHONPATH
We recommend using Conda to manage complicated dependencies:
cd LandMark
conda create --name landmark -y python=3.9.16
conda activate landmark
python -m pip install --upgrade pip
This library has been tested with version 3.9.16 of Python.
Install pytorch with CUDA using the commands below once and for all:
pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
This library has been tested with version 11.6 of CUDA.
We provide requirements.txt for setting the environment easily.
pip install -r requirements.txt
For confidentiality requirements, the native datasets we use as shown above will not be released. To ideal reproduce result, MatrixCity dataset is highly recommanded. More details about how to reproducing please refer to the following Chapter: MatrixCity Dataset. We have prepared tuned configuration files and dedicated dataloader for the MatrixCity dataset.
Large scale scenes captured from the real world are most suitable for our method. We recommend using dataset of a building, a well-known LandMark and even a small town. Prepare about 250 ~ 300 images of the reconstruction target. Make sure enough overlapping.
Reform your dataset as the following structure:
Folder images/ contains all the images in the training and test sets.
Camera poses in both multi-focal and single focal length formats are supported in transforms_xxx.json
### single focal example ###
{
"camera_model": "SIMPLE_PINHOLE",
"fl_x": 427,
"fl_y": 427,
"w": 547,
"h": 365,
"frames": [
{
"file_path": "./images/image_0.png",
"transform_matrix": []
}
]
}
### multi focal example ###
{
"camera_model": "SIMPLE_PINHOLE",
"frames": [
{
"fl_x": 1116,
"fl_y": 1116,
"w": 1420,
"h": 1065,
"file_path": "./images/image_0.png",
"transform_matrix": []
}
]
}
Extracting poses and sparse point-cloud model using COLMAP as other NeRF methods.
Then transfer the poses data using commands below:
python app/tools/colmap2nerf.py --recon_dir data/your_dataset/sparse/0 --output_dir data/your_dataset
A transforms_train.json and a transforms_test.json files will be generated in the your_dataset/ folder with single focal supported
Referring to the app/tools/config_parser.py and the app/tools/dataloader/city_dataset.py for help.
We provide a configuration file confs/city.txt as an example to help you initialize your experiments.
There are bunches of arguments for customization. We divide them into four types for better understanding
Some important arguments are demonstrated here. Don't forget to specify path-related arguments before proceeding.
LandMark/datasets to manage all datasets"city" as recommendedLandMark/log by defaultrender
model
For more details about arguments, refer to the LandMark/app/config_parser.py
Tune the --ub and --lb arguments to achieve ideal result in the experiments.
Now it's time to train your own LandMark model:
python app/trainer.py --config confs/city.txt
The training checkpoints and images will be saved in LandMark/log/your_expname by default.
After the training process completed, independent rendering test is available:
python app/renderer.py --config confs/city.txt --ckpt=log/your_expname/your_expname.th
The rendering results will be save in LandMark/log/your_expname/imgs_test_all by default.
The trainer and the renderer both support pytorch DDP.
To train with DDP, use commands below:
python -m torch.distributed.launch --nproc_per_node=number_of_GPUs app/trainer.py --config confs/city.txt
To render with DDP, use commands below:
python -m torch.distributed.launch --nproc_per_node=number_of_GPUs app/renderer.py --config confs/city.txt --ckpt=log/your_expname/your_expname.th
Some arguments related to the multi-GPU environment might need to be set properly. Specify number_of_GPUs according to your actual environment.
For example:
- If training a sequential gridnerf model with N GPUs, it will enables N x DDP training
- If training a gridnerf model by using branch parallel and plane_division [2,2] configuration, and the total num of GPUs used are N, it will enables N/(2x2) x DDP training.
Three types of Model Parallel strategies are currently supported for training: - Channel Parallel - Plane Parallel - Branch Parallel
It is worth pointing out that all these strategies are adapted for large-scale scene reconstruction with over 2000 images and area of several acres
To involve these parallel features in your experiments, simply use the configuration files such as confs/city_multi_branch_parallel.txt. After setting the path arguments in the configuration file, you are ready to train a plug-and-play Branch Parallel model:
python -m torch.distributed.launch --nproc_per_node=number_of_GPUs app/trainer.py --config confs/city_multi_branch_parallel.txt
There are few differences in use between training a branch parallel model and a sequential model with DDP, but the training efficiency meet great acceleration. Especially in reconstruction tasks of large scale scenes, our Parallel strategies shows stable adaption of capability in accelerating the whole training process.
To render with the Parallel model after training, using the command as the sequential one
python app/renderer.py --config confs/city_multi_branch_parallel.txt --ckpt=log/your_expname/your_expname.th
Fully supports the brilliant MatrixCity dataset. Dedicated files are given for block_1 and block_2 in confs/matrixcity.
It's recommended to download the datases from OpenXLab ,or from BaiduNetDisk (password: hqnn).
The following files are needed to be downloaded and be organized as the original directory structure:
MatrixCity/small_city/aerial/train/block_1.tar
MatrixCity/small_city/aerial/train/block_2.tar
MatrixCity/small_city/aerial/test/block_1_test.tar
MatrixCity/small_city/aerial/test/block_2_test.tar
MatrixCity/small_city/aerial/pose/block_A/
After downloaded, the tar files are needed to be unarchived by tar -xf [tar_filename]
Lastly, the dataroot, datadir, and dataset_name in the config file should be set properly as follows:
dataroot = YOUR_MATRIXCITY_FOLDER_PATH/small_city/aerial/pose
datadir = block_A
dataset_name = matrixcity
For single GPU training and rendering, simply use:
# training
python app/trainer.py --config confs/matrixcity/matrixcity_2block_multi.txt
# rendering
python app/renderer.py --config confs/matrixcity/matrixcity_2block_multi.txt --ckpt log/matrix_city_block_1+2_multi/matrix_city_block_1+2_multi.th
For multi GPU DDP training and rendering: ```
python -m torch.distributed.launch --nproc_per_node=number_of_GPUs app/trainer.py --config confs/matrixcity/matrixcity_2block_multi.txt
python app/renderer.py --config confs/matrixcity/matrixcity_2block_multi.txt --ckpt log/matrix_city_block_1+2_multi/matrix_city_block_1+2_multi.th
python -m torch.distributed.launch --nproc_per_node=number_of_GPUs app/renderer.py --config confs/matrixcity/matrixcity_2block_
$ claude mcp add LandMark \
-- python -m otcore.mcp_server <graph>